Package com.twilio.sdk.resource.factory

Examples of com.twilio.sdk.resource.factory.CallFactory


    // You can also get just the first page of data
    accountList = client.getAccounts();
    List<Account> accounts = accountList.getPageData();

    // Make a call
    CallFactory callFactory = mainAccount.getCallFactory();
    Map<String, String> callParams = new HashMap<String, String>();
    callParams.put("To", "5105551212"); // Replace with a valid phone number
    callParams.put("From", "(510) 555-1212"); // Replace with a valid phone
    // number in your account
    callParams.put("Url", "http://demo.twilio.com/welcome/voice/");
    Call call = callFactory.create(callParams);
    System.out.println(call.getSid());

    // Send an sms (using the new messages endpoint)
    MessageFactory messageFactory = mainAccount.getMessageFactory();
    List<NameValuePair> messageParams = new ArrayList<NameValuePair>();
View Full Code Here


    }

    public boolean makeCall(String phoneNumber, String code, String lang) {
        if (canRun()) {
            final Account account = TWILIO_CLIENT.getAccount(); // Make a call
            CallFactory callFactory = account.getCallFactory();
            Map<String, String> callParams = new HashMap<String, String>();
            callParams.put("To", phoneNumber);
            callParams.put("From", TWILIO_FROM_NUMBER);
            callParams.put("Url", HOST + "/external/partyContactValidation.do?method=validatePhone&code=" + code + "&lang="
                    + lang);
            try {
                callFactory.create(callParams);
                return true;
            } catch (TwilioRestException e) {
                logger.error("Error makeCall: " + e.getMessage(), e);
                return false;
            }
View Full Code Here

TOP

Related Classes of com.twilio.sdk.resource.factory.CallFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.