Skip to content
Albert G. Nairn edited this page May 1, 2018 · 1 revision

// Install the Java helper library from twilio.com/docs/libraries/java import java.net.URI; import java.net.URISyntaxException;

import com.twilio.Twilio; import com.twilio.rest.api.v2010.account.Call; import com.twilio.type.PhoneNumber;

public class MakePhoneCall { // Find your Account Sid and Token at twilio.com/console public static final String ACCOUNT_SID = "AC004c91b6faa63aa549faddc2dfe6bc35"; public static final String AUTH_TOKEN = "your_auth_token";

public static void main(String[] args) throws URISyntaxException {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    String from = "+15017122661";
    String to = "+14155551212";

    Call call = Call.creator(new PhoneNumber(to), new PhoneNumber(from),
            new URI("http://demo.twilio.com/docs/voice.xml")).create();

    System.out.println(call.getSid());
}

}

Clone this wiki locally