Skip to main content

v8 -> v9

Client Initialization

ApiClient defaultClient = Configuration.getDefaultApiClient();
HttpBasicAuth Basic = (HttpBasicAuth) defaultClient.getAuthentication("Basic");
Basic.setUsername("YOUR USERNAME");
Basic.setPassword("YOUR PASSWORD");

Messaging

Create Message

String accountId = "9900000";
String applicationId = "1234-qwer";
MessagesApi apiInstance = new MessagesApi(defaultClient);
messageRequest.applicationId(applicationId);
messageRequest.addToItem("+19195551234");
messageRequest.from("+19195554321");
messageRequest.text("Sample Text");
messageRequest.addMediaItem(URI.create("https://media.jpg"));
messageRequest.tag("Hello from Java");
messageRequest.priority(PriorityEnum.DEFAULT);

try {
Message result = apiInstance.createMessage(accountId, messageRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessagesApi#createMessage");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

List Messages

String accountId = "9900000";
String messageId = "9e0df4ca-b18d-40d7-a59f-82fcdf5ae8e6";
String sourceTn = "%2B15554443333";
String destinationTn = "%2B15554443333";
MessageStatusEnum messageStatus = MessageStatusEnum.fromValue("RECEIVED");
ListMessageDirectionEnum messageDirection = ListMessageDirectionEnum.fromValue("INBOUND");
String carrierName = "Verizon";
MessageTypeEnum messageType = MessageTypeEnum.fromValue("sms");
Integer errorCode = 9902;
String fromDateTime = "2022-09-14T18:20:16.000Z";
String toDateTime = "2022-09-14T18:20:16.000Z";
String sort = "sourceTn:desc";
String pageToken = "gdEewhcJLQRB5";
Integer limit = 50;

try {
MessagesList result = apiInstance.listMessages(accountId, messageId, sourceTn, destinationTn, messageStatus, messageDirection, carrierName, messageType, errorCode, fromDateTime, toDateTime, sort, pageToken, limit);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MessagesApi#listMessages");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Media

List Media

MediaApi apiInstance = new MediaApi(defaultClient);
String accountId = "9900000";
String continuationToken = "1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39";

try {
List<Media> result = apiInstance.listMedia(accountId, continuationToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MediaApi#listMedia");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Get Media

MediaApi apiInstance = new MediaApi(defaultClient);
String accountId = "9900000";
String mediaId = "14762070468292kw2fuqty55yp2b2/0/bw.png";

try {
File result = apiInstance.getMedia(accountId, mediaId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MediaApi#getMedia");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Upload Media

MediaApi apiInstance = new MediaApi(defaultClient);
String accountId = "9900000";
String mediaId = "14762070468292kw2fuqty55yp2b2/0/bw.png";
File body = new File("/path/to/file");
String contentType = "audio/wav";
String cacheControl = "no-cache";

try {
apiInstance.uploadMedia(accountId, mediaId, body, contentType, cacheControl);
} catch (ApiException e) {
System.err.println("Exception when calling MediaApi#uploadMedia");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Delete Media

MediaApi apiInstance = new MediaApi(defaultClient);
String accountId = "9900000";
String mediaId = "14762070468292kw2fuqty55yp2b2/0/bw.png";

try {
apiInstance.deleteMedia(accountId, mediaId);
} catch (ApiException e) {
System.err.println("Exception when calling MediaApi#deleteMedia");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

BXML

Imports

import org.openapitools.client.model.bxml.Bxml;
import org.openapitools.client.model.bxml.Forward;
import org.openapitools.client.model.bxml.Tag;

Bridge

Bridge bridge = new Bridge().builder()
.targetCallId("+19198675309")
.bridgeCompleteUrl("https://example.com")
.tag("test")
.build();

Conference

Conference conference = new Conference().builder()
.name("conf1")
.mute(true)
.hold(false)
.callIdsToCoach("example-call-id")
.conferenceEventUrl("example.com/eventurl")
.conferenceEventMethod("POST")
.conferenceEventFallbackUrl("backupexample.com/eventurl")
.conferenceEventFallbackMethod("POST")
.username("user")
.password("pass")
.fallbackUsername("user")
.fallbackPassword("pass")
.tag("tag")
.callbackTimeout(5d)
.build();

Forward

Forward forward = new Forward().builder()
.to("+19195554321")
.from("19195554322")
.callTimeout(15d)
.diversionTreatment(DiversionTreatment.PROPAGATE)
.diversionReason(DiversionReason.AWAY)
.uui("93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt")
.build();

Gather

Gather gather = new Gather().builder()
.gatherUrl("test.com")
.gatherMethod("POST")
.gatherFallbackUrl("fallback-test.com")
.gatherFallbackMethod("GET")
.username("user")
.password("pass")
.fallbackUsername("user")
.fallbackPassword("pass")
.tag("tag")
.terminatingDigits("2")
.maxDigits(5)
.interDigitTimeout(1d)
.firstDigitTimeout(3d)
.repeatCount(2)
.children(List.of(playAudio, speakSentence))
.build();

Hangup

Hangup hangup = new Hangup();

Pause

Pause pause = new Pause(2d);

Pause Recording

PauseRecording pauseRecording = new PauseRecording();

Play Audio

PlayAudio playAudio = new PlayAudio().builder()
.audioUri("test.com")
.username("user")
.password("pass")
.build();

Record

Record record = new Record().builder()
.maxDuration(10)
.build();

Redirect

Redirect redirect = new Redirect().builder()
.redirectUrl("https://example.com/redirect")
.redirectFallbackUrl("fallback-url.com")
.redirectMethod("POST")
.build();

Resume Recording

ResumeRecording resumeRecording = new ResumeRecording();

Ring

Ring ring = new Ring(30d, false);

Send DTMF

SendDtmf sendDtmf = new SendDtmf("12w34", 3,5);

Speak Sentence

SpeakSentence speakSentence = new SpeakSentence().builder()
.innerTags(List.of(sentence))
.locale(TtsLocale.EN_UK)
.gender(TtsGender.FEMALE)
.build();

Start Gather

StartGather startGather = new StartGather().builder()
.dtmfUrl("https://example.com/startgather")
.dtmfMethod("POST")
.username("user")
.password("pass")
.tag("tag")
.build();

Start Recording

StartRecording startRecording = new StartRecording().builder()
.recordingAvailableUrl("https://example.com")
.recordingAvailableMethod("POST")
.transcribe(true)
.transcriptionAvailableUrl("transcription-example.com")
.recordingAvailableMethod("POST")
.username("user")
.password("pass")
.tag("tag")
.fileFormat("wav")
.multiChannel(true)
.build();

Start Stream

StreamParam streamParam1 = new StreamParam().builder()
.name("name1")
.value("value1")
.build();

StreamParam streamParam2 = new StreamParam().builder()
.name("name2")
.value("value2")
.build();

StartStream startStream = new StartStream().builder()
.name("stream1")
.tracks(CallDirectionEnum.INBOUND)
.destination("testurl.com")
.streamEventUrl("eventurl.com")
.streamEventMethod("POST")
.username("user")
.password("pass")
.streamParams(List.of(streamParam1, streamParam2))
.build();

Stop Gather

StopGather stopGather = new StopGather();

Stop Recording

StopRecording stopRecording = new StopRecording();

Stop Stream

StopStream stopStream = new StopStream("live_audience");

Tag

Tag tag1 = new Tag("audio playing");

Transfer

PhoneNumber phoneNumber = new PhoneNumber().builder()
.number("+19195551234")
.transferAnswerUrl("https://example.com/webhooks/transfer_answer")
.tag("test")
.transferAnswerMethod("POST")
.build();

Transfer transfer = new Transfer().builder()
.callTimeout(15d)
.destinations(List.of(phoneNumber))
.transferCallerId("+19195554321")
.tag("test")
.build();

Calls

Create Call

CallsApi apiInstance = new CallsApi(defaultClient);
String accountId = "9900000";
CreateCall createCall = new CreateCall();

try {
CreateCallResponse result = apiInstance.createCall(accountId, createCall);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CallsApi#createCall");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Get Call Information

CallsApi apiInstance = new CallsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
CallState result = apiInstance.getCallState(accountId, callId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling CallsApi#getCallState");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Update Call

CallsApi apiInstance = new CallsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
UpdateCall updateCall = new UpdateCall();

try {
apiInstance.updateCall(accountId, callId, updateCall);
} catch (ApiException e) {
System.err.println("Exception when calling CallsApi#updateCall");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Replace Call BXML

SpeakSentence speakSentence = new SpeakSentence().builder()
.innerTags("Test sentence.")
.locale(TtsLocale.EN_UK)
.gender(TtsGender.FEMALE)
.build();

CallsApi apiInstance = new CallsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
String body = new Bxml().with(speakSentence).toBxml(jaxbContext);

try {
apiInstance.updateCallBxml(accountId, callId, body);
} catch (ApiException e) {
System.err.println("Exception when calling CallsApi#updateCallBxml");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Conferences

List Conferences

ConferencesApi apiInstance = new ConferencesApi(defaultClient);
String accountId = "9900000";
String name = "my-custom-name";
String minCreatedTime = "2022-06-21T19:13:21Z";
String maxCreatedTime = "2022-06-21T19:13:21Z";
Integer pageSize = 1000;
String pageToken = "pageToken_example";

try {
List<Conference> result = apiInstance.listConferences(accountId, name, minCreatedTime, maxCreatedTime, pageSize, pageToken);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ConferencesApi#listConferences");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Get Conference Information

ConferencesApi apiInstance = new ConferencesApi(defaultClient);
String accountId = "9900000";
String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9";

try {
Conference result = apiInstance.getConference(accountId, conferenceId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ConferencesApi#getConference");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Update Conference

ConferencesApi apiInstance = new ConferencesApi(defaultClient);
String accountId = "9900000";
String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9";
UpdateConference updateConference = new UpdateConference();

try {
apiInstance.updateConference(accountId, conferenceId, updateConference);
} catch (ApiException e) {
System.err.println("Exception when calling ConferencesApi#updateConference");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Update Conference BXML


SpeakSentence speakSentence = new SpeakSentence().builder()
.innerTags("Test sentence.")
.locale(TtsLocale.EN_UK)
.gender(TtsGender.FEMALE)
.build();

ConferencesApi apiInstance = new ConferencesApi(defaultClient);
String accountId = "9900000";
String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9";
String body = new Bxml().with(speakSentence).toBxml(jaxbContext);

try {
apiInstance.updateConferenceBxml(accountId, conferenceId, body);
} catch (ApiException e) {
System.err.println("Exception when calling ConferencesApi#updateConferenceBxml");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Get Conference Member

ConferencesApi apiInstance = new ConferencesApi(defaultClient);
String accountId = "9900000";
String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9";
String memberId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
ConferenceMember result = apiInstance.getConferenceMember(accountId, conferenceId, memberId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ConferencesApi#getConferenceMember");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Update Conference Member

ConferencesApi apiInstance = new ConferencesApi(defaultClient);
String accountId = "9900000";
String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9";
String memberId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
UpdateConferenceMember updateConferenceMember = new UpdateConferenceMember();

try {
apiInstance.updateConferenceMember(accountId, conferenceId, memberId, updateConferenceMember);
} catch (ApiException e) {
System.err.println("Exception when calling ConferencesApi#updateConferenceMember");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

List Conference Recordings

ConferencesApi apiInstance = new ConferencesApi(defaultClient);
String accountId = "9900000";
String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9";

try {
List<ConferenceRecordingMetadata> result = apiInstance.listConferenceRecordings(accountId, conferenceId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ConferencesApi#listConferenceRecordings");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Get Conference Recording Information

ConferencesApi apiInstance = new ConferencesApi(defaultClient);
String accountId = "9900000";
String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9";
String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
ConferenceRecordingMetadata result = apiInstance.getConferenceRecording(accountId, conferenceId, recordingId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ConferencesApi#getConferenceRecording");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Download Conference Recording

ConferencesApi apiInstance = new ConferencesApi(defaultClient);
String accountId = "9900000";
String conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9";
String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
File result = apiInstance.downloadConferenceRecording(accountId, conferenceId, recordingId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling ConferencesApi#downloadConferenceRecording");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Recordings

List Account Call Recordings

RecordingsApi apiInstance = new RecordingsApi(defaultClient);
String accountId = "9900000";
String to = "%2b19195551234";
String from = "%2b19195554321";
String minStartTime = "2022-06-21T19:13:21Z";
String maxStartTime = "2022-06-21T19:13:21Z";

try {
List<CallRecordingMetadata> result = apiInstance.listAccountCallRecordings(accountId, to, from, minStartTime, maxStartTime);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RecordingsApi#listAccountCallRecordings");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Update Recording

RecordingsApi apiInstance = new RecordingsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
UpdateCallRecording updateCallRecording = new UpdateCallRecording();

try {
apiInstance.updateCallRecordingState(accountId, callId, updateCallRecording);
} catch (ApiException e) {
System.err.println("Exception when calling RecordingsApi#updateCallRecordingState");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

List Call Recordings

RecordingsApi apiInstance = new RecordingsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
List<CallRecordingMetadata> result = apiInstance.listCallRecordings(accountId, callId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RecordingsApi#listCallRecordings");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Get Call Recording

RecordingsApi apiInstance = new RecordingsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
CallRecordingMetadata result = apiInstance.getCallRecording(accountId, callId, recordingId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RecordingsApi#getCallRecording");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Delete Recording

RecordingsApi apiInstance = new RecordingsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
apiInstance.deleteRecording(accountId, callId, recordingId);
} catch (ApiException e) {
System.err.println("Exception when calling RecordingsApi#deleteRecording");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Download Recording

RecordingsApi apiInstance = new RecordingsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
File result = apiInstance.downloadCallRecording(accountId, callId, recordingId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RecordingsApi#downloadCallRecording");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Delete Recording Media

RecordingsApi apiInstance = new RecordingsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
apiInstance.deleteRecordingMedia(accountId, callId, recordingId);
} catch (ApiException e) {
System.err.println("Exception when calling RecordingsApi#deleteRecordingMedia");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Get Transcription

RecordingsApi apiInstance = new RecordingsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
TranscriptionList result = apiInstance.getCallTranscription(accountId, callId, recordingId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling RecordingsApi#getCallTranscription");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Create Transcription Request

RecordingsApi apiInstance = new RecordingsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
TranscribeRecording transcribeRecording = new TranscribeRecording();

try {
apiInstance.transcribeCallRecording(accountId, callId, recordingId, transcribeRecording);
} catch (ApiException e) {
System.err.println("Exception when calling RecordingsApi#transcribeCallRecording");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Delete Transcription

RecordingsApi apiInstance = new RecordingsApi(defaultClient);
String accountId = "9900000";
String callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
String recordingId = "r-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try {
apiInstance.deleteCallTranscription(accountId, callId, recordingId);
} catch (ApiException e) {
System.err.println("Exception when calling RecordingsApi#deleteCallTranscription");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Telephone Number Lookup

Create Lookup

PhoneNumberLookupApi apiInstance = new PhoneNumberLookupApi(defaultClient);
String accountId = "9900000";
LookupRequest lookupRequest = new LookupRequest();

try {
CreateLookupResponse result = apiInstance.createLookup(accountId, lookupRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PhoneNumberLookupApi#createLookup");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Get Lookup Request Status

PhoneNumberLookupApi apiInstance = new PhoneNumberLookupApi(defaultClient);
String accountId = "9900000";
String requestId = "004223a0-8b17-41b1-bf81-20732adf5590";

try {
LookupStatus result = apiInstance.getLookupStatus(accountId, requestId);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling PhoneNumberLookupApi#getLookupStatus");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Multi-Factor Authentication

Voice MFA Code

MfaApi apiInstance = new MfaApi(defaultClient);
String accountId = "9900000";
String applicationId = "1234-qwer";
CodeRequest request = new CodeRequest();
request.setTo("+19195551234");
request.setFrom("+19195554321");
request.setApplicationId(applicationId);
request.setScope("scope");
request.setMessage("Your temporary {NAME} {SCOPE} code is {CODE}");
request.setDigits(6);

try {
VoiceCodeResponse result = apiInstance.generateVoiceCode(accountId, request);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MfaApi#generateVoiceCode");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Messaging MFA Code

MfaApi apiInstance = new MfaApi(defaultClient);
String accountId = "9900000";
String applicationId = "1234-qwer";
CodeRequest request = new CodeRequest();
request.setTo("+19195551234");
request.setFrom("+19195554321");
request.setApplicationId(applicationId);
request.setScope("scope");
request.setMessage("Your temporary {NAME} {SCOPE} code is {CODE}");
request.setDigits(6);

try {
MessagingCodeResponse result = apiInstance.generateMessagingCode(accountId, codeRequest);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MfaApi#generateMessagingCode");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}

Verify MFA Code

BigDecimal expirationTime = new BigDecimal(3);
Long minTn = 1111111111L;
Long maxTn = 9999999999L;

VerifyCodeRequest request = new VerifyCodeRequest();
request.setTo("+19195551234");
request.setScope("2FA");
request.setExpirationTimeInMinutes(expirationTime);
request.setCode("123456");

try {
VerifyCodeResponse result = apiInstance.verifyCode(accountId, request);
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling MfaApi#verifyCode");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}