Search in sources :

Example 1 with CallUpdater

use of com.twilio.rest.api.v2010.account.CallUpdater in project twilio-java by twilio.

the class CallUpdaterExample method main.

@SuppressWarnings("checkstyle:javadocmethod")
public static void main(final String[] args) {
    Twilio.init("AC123", "AUTH TOKEN");
    try {
        CallCreator creator = Call.creator("AC123", new PhoneNumber("+14156085895"), new PhoneNumber("+14154888928"), new URI("http://twimlbin.com/cc413d9d"));
        Call call = creator.create();
        System.out.println(call.getSid());
        System.out.println(call.getStatus());
        System.out.println("press enter once call is accepted");
        try {
            System.in.read();
        } catch (final IOException e) {
            System.out.println("whoops");
        }
        CallUpdater updater = Call.updater("AC123", call.getSid()).setUrl(new URI("http://twimlbin.com/4397e62f"));
        Call updated = updater.update();
        System.out.println(updated.getSid());
        System.out.println(updated.getStatus());
    } catch (URISyntaxException | ApiException e) {
        System.err.println("womp womp");
        System.exit(1);
    }
}
Also used : CallUpdater(com.twilio.rest.api.v2010.account.CallUpdater) Call(com.twilio.rest.api.v2010.account.Call) PhoneNumber(com.twilio.type.PhoneNumber) IOException(java.io.IOException) URISyntaxException(java.net.URISyntaxException) CallCreator(com.twilio.rest.api.v2010.account.CallCreator) URI(java.net.URI) ApiException(com.twilio.exception.ApiException)

Aggregations

ApiException (com.twilio.exception.ApiException)1 Call (com.twilio.rest.api.v2010.account.Call)1 CallCreator (com.twilio.rest.api.v2010.account.CallCreator)1 CallUpdater (com.twilio.rest.api.v2010.account.CallUpdater)1 PhoneNumber (com.twilio.type.PhoneNumber)1 IOException (java.io.IOException)1 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1