Skip to main content

v10 -> v11

Client Initialization

using Bandwidth.Standard;

Configuration config = new Configuration();
config.BasePath = "http://localhost";
config.Username = "YOUR_USERNAME";
config.Password = "YOUR_PASSWORD";

var accountId = "YOUR_BW_ACCOUNT_ID";

Messaging

Create Message

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new MessagesApi(config);

var messageRequest = new MessageRequest(
applicationId: "1234-qwer",
to: new List<string> { "+12345678902" },
from: "+12345678901",
text: "Hello world"
);

try
{
Message result = apiInstance.CreateMessage(accountId, messageRequest);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MessagesApi.CreateMessage: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

List Message

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new MessagesApi(config);

try
{
MessagesList result = apiInstance.ListMessages(
accountId: accountId,
messageId: "1234-qwer",
sourceTn: "+12345678901",
destinationTn: "+12345678902",
messageStatus: MessageStatusEnum.DELIVERED,
messageDirection: ListMessageDirectionEnum.INBOUND,
carrierName: "Verizon",
messageType: MessageTypeEnum.Sms,
errorCode: 9902,
fromDateTime: DateTime.Parse("2022-09-14T18:20:16.000Z"),
toDateTime: DateTime.Parse("2022-09-14T18:20:16.000Z"),
sort: "sourceTn:desc",
pageToken: "gdEewhcJLQRB5",
limit: 50
);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MessagesApi.ListMessages: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Media

List Media

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new MediaApi(config);
var continuationToken = "1XEi2tsFtLo1JbtLwETnM1ZJ+PqAa8w6ENvC5QKvwyrCDYII663Gy5M4s40owR1tjkuWUif6qbWvFtQJR5/ipqbUnfAqL254LKNlPy6tATCzioKSuHuOqgzloDkSwRtX0LtcL2otHS69hK343m+SjdL+vlj71tT39";

try
{
List<Media> result = apiInstance.ListMedia(accountId, continuationToken);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.ListMedia: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Get Media

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new MediaApi(config);
var mediaId = "media-id-123";

try
{
System.IO.Stream result = apiInstance.GetMedia(accountId, mediaId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.GetMedia: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Upload Media

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new MediaApi(config);
var mediaId = "media-id-123";
var content = "Hello world";
var body = new MemoryStream(Encoding.UTF8.GetBytes(content));
var contentType = "text/plain";
var cacheControl = "no-cache";

try
{
apiInstance.UploadMedia(accountId, mediaId, body, contentType, cacheControl);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.UploadMedia: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Delete Media

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new MediaApi(config);
var mediaId = "media-id-123";

try
{
apiInstance.DeleteMedia(accountId, mediaId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MediaApi.DeleteMedia: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

BXML

Imports

using Bandwidth.Standard.Model.Bxml;
using Bandwidth.Standard.Model.Bxml.Verbs;

Bridge

Bridge bridge = new Bridge
{
TargetCall = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d",
BridgeCompleteUrl = "https://bridge.url/nextBXMLForSecondCall",
BridgeCompleteMethod = "POST",
BridgeCompleteFallbackUrl = "https://fallbackbridge.url/nextBXMLForSecondCall",
BridgeCompleteFallbackMethod = "POST",
BridgeTargetCompleteUrl = "https://bridge.url/nextBXMLForFirstCall",
BridgeTargetCompleteMethod = "POST",
BridgeTargetCompleteFallbackUrl = "https://fallbackbridge.url/nextBXMLForFirstCall",
BridgeTargetCompleteFallbackMethod = "POST",
Username = "username",
Password = "password",
FallbackUsername = "fallbackUsername",
FallbackPassword = "fallbackPassword",
Tag = "test"
};

Conference

Conference conference = new Conference {
Name = "my-conference-name",
Mute = true,
Hold = true,
CallIdsToCoach = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d,c-2a913f94-6a486f3a-3cae-4034-bcc3-f0c9fa77ca2f",
ConferenceEventUrl = "https://conference.url/nextBXML",
ConferenceEventMethod = "POST",
ConferenceEventFallbackUrl = "https://fallbackconference.url/nextBXML",
ConferenceEventFallbackMethod = "POST",
Username = "username",
Password = "password",
FallbackUsername = "fallbackUsername",
FallbackPassword = "fallbackPassword",
Tag = "test",
CallbackTimeout = 10
};

Forward

Forward forward = new Forward
{
To = "+10987654321",
From = "+11234567890",
CallTimeOut = 10,
DiversionTreatment = "stack",
DiversionReason = "user-busy",
Uui = "93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt"
};

Gather

Gather gather = new Gather
{
GatherUrl = "https://gather.url/nextBXML",
GatherMethod = "POST",
GatherFallbackUrl = "https://fallbackgather.url/nextBXML",
GatherFallbackMethod = "POST",
Username = "username",
Password = "password",
FallbackUsername = "fallbackUsername",
FallbackPassword = "fallbackPassword",
Tag = "test",
TerminatingDigits = "#",
MaxDigits = 10,
InterDigitTimeout = 10,
FirstDigitTimeout = 10,
repeatTimeout = 10,
SpeakSentence = new List<SpeakSentence> { speakSentence },
PlayAudio = new List<SpeakSentence> { playAudio }
};

Hangup

Hangup hangup = new Hangup();

Pause

Pause pause = new Pause
{
Duration = 2
};

Pause Recording

PauseRecording pause = new PauseRecording();

Play Audio

PlayAudio playAudio = new PlayAudio
{
AudioUri = "https://audio.url/audio1.wav",
Username = "username",
Password = "password"
};

Record

Record record = new Record
{
RecordCompleteUrl = "https://myapp.com/nextBXML",
RecordCompleteMethod = "POST",
RecordCompleteFallbackUrl = "https://fallbackmyapp.com/nextBXML",
RecordCompleteFallbackMethod = "POST",
RecordingAvailableUrl = "https://myapp.com/recordingAvailable",
RecordingAvailableMethod = "POST",
Transcribe = true,
DetectLanguage = true,
TranscriptionAvailableUrl = "https://transcription.url.server/transcribe/",
TranscriptionAvailableMethod = "POST",
Username = "username",
Password = "password",
FallbackUsername = "fallbackUsername",
FallbackPassword = "fallbackPassword",
Tag = "test",
TerminatingDigits = "#",
MaxDuration = 60,
SilenceTimeout = 0,
FileFormat = "wav"
};

Redirect

Redirect redirect = new Redirect
{
RedirectUrl = "http://flow.url/newFlow",
RedirectMethod = "POST",
RedirectFallbackUrl = "http://fallbackFlow.url/newFlow",
RedirectFallbackMethod = "POST",
Username = "username",
Password = "password",
FallbackPassword = "fallbackPassword",
FallbackUsername = "fallbackUsername",
Tag = "test"
};

Resume Recording

ResumeRecording resumeRecording = new ResumeRecording();

Ring

Ring ring = new Ring
{
Duration = 10,
AnswerCall = false
};

Send DTMF

SendDtmf sendDtmf = new SendDtmf
{
Digits = "12w34",
ToneDuration = 200,
ToneInterval = 400
};

Speak Sentence

SpeakSentence speakSentence = new SpeakSentence
{
Text = "test",
Voice = "kate",
Gender = "female",
Locale = "en_US"
};

Start Gather

StartGather startGather = new StartGather
{
DtmfUrl = "https://startgather.url/callback",
DtmfMethod = "POST",
Username = "username",
Password = "password",
Tag = "test"
};

Start Recording

StartRecording startRecording = new StartRecording
{
RecordingAvailableUrl = "https://myapp.com/noBXML",
RecordingAvailableMethod = "POST",
Transcribe = true,
DetectLanguage = true,
TranscriptionAvailableUrl = "https://transcriptionTest.url/",
TranscriptionAvailableMethod = "POST",
Username = "username",
Password = "password",
Tag = "test",
FileFormat = "mp3",
MultiChannel = true
};

Start Stream

StartStream startStream = new StartStream
{
Name = "live_audience",
Tracks = "both",
Destination = "wss://live-studio-audience.myapp.example.com",
StreamEventUrl = "https://myapp.example.com/noBXML",
StreamEventMethod = "POST",
Username = "username",
Password = "password",
StreamParam = new List<StreamParam> { streamParam }
};

Stop Gather

StopGather stopGather = new StopGather();

Stop Recording

StopRecording stopRecording = new StopRecording();

Stop Stream

StopStream stopStream = new StopStream
{
Name = "live_audience"
};

Tag

Tag tag = new Tag
{
Value = "audio ended"
};

Transfer

Transfer transfer = new Transfer
{
TransferCallerId = "Anonymous",
TransferCallerDisplayName = "test",
CallTimeout = 30,
TransferCompleteUrl = "http://test.com",
TransferCompleteMethod = "POST",
TransferCompleteFallbackUrl = "http://fallbackTest.com",
TransferCompleteFallbackMethod = "POST",
Username = "username",
Password = "password",
FallbackUsername = "fallbackUsername",
FallbackPassword = "fallbackPassword",
Tag = "test",
DiversionTreatment = "none",
DiversionReason = "user-busy",
PhoneNumbers = new PhoneNumber[] { phoneNumber },
SipUris = new SipUri[] { sipUri }
};

Calls

Create Call

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var createCall = new CreateCall(
to: "+12345678902",
from: "+12345678901",
applicationId: "1234-qwer",
answerUrl: "https://test.com"
);

try
{
CreateCallResponse result = apiInstance.CreateCall(accountId, createCall);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CallsApi.CreateCall: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Get Call State Information

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new CallsApi(config);
var callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

try
{
CallState result = apiInstance.GetCallState(accountId, callId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CallsApi.GetCallState: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Get Calls

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new CallsApi(config);

try
{
List<CallState> result = apiInstance.ListCalls(
accountId: accountId,
to: "+12345678902",
from: "+12345678901",
minStartTime: "2022-11-14T10:10:10Z",
maxStartTime: "2022-11-14T11:11:11Z",
disconnectCause: "hangup"
);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CallsApi.GetCallState: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Update Call

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new CallsApi(config);
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";

var updateCall = new updateCall
(
state: CallStateEnum.Completed
);

try
{
apiInstance.UpdateCall(accountId, callId, updateCall);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CallsApi.UpdateCall: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Update Call BXML


var apiInstance = new CallsApi(config);
var callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
var body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Bxml> <SpeakSentence>This is a test sentence.</SpeakSentence></Bxml>";

try
{
apiInstance.UpdateCallBxml(accountId, callId, body);
}
catch (ApiException e)
{
Debug.Print("Exception when calling CallsApi.UpdateCallBxml: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Conferences

List Conferences

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new ConferencesApi(config);
var name = "conference-name";
var minCreatedTime = "2022-06-21T19:13:21Z";
var maxCreatedTime = "2022-06-21T19:13:21Z";
var pageSize = 500;

try
{
List<Conference> result = apiInstance.ListConferences(accountId, name, minCreatedTime, maxCreatedTime, pageSize);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConferencesApi.ListConferences: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Get Conference

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new ConferencesApi(config);
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";

try
{
Conference result = apiInstance.GetConference(accountId, conferenceId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConferencesApi.GetConference: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Update Conference

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new ConferencesApi(config);
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";

var updateConference = new UpdateConference(
status: ConferenceStateEnum.Completed
);

try
{
apiInstance.UpdateConference(accountId, conferenceId, updateConference);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConferencesApi.UpdateConference: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Update Conference BXML

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new ConferencesApi(config);
var conferenceId = "conf-fe23a767-a75a5b77-20c5-4cca-b581-cbbf0776eca9";
var body = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><Bxml> <StopRecording/></Bxml>";

try
{
apiInstance.UpdateConferenceBxml(accountId, conferenceId, body);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConferencesApi.UpdateConferenceBxml: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Get Conference Member

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new ConferencesApi(config);
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
var memberId = "c-95ac8d8d-b81437f5-4586-4d5b-9b46-29f8b3fe0aaf";

try
{
ConferenceMember result = apiInstance.GetConferenceMember(accountId, conferenceId, memberId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConferencesApi.GetConferenceMember: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Update Conference Member

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new ConferencesApi(config);
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
var memberId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";

var updateConferenceMember = new UpdateConferenceMember(
mute: true
);

try
{
apiInstance.UpdateConferenceMember(accountId, conferenceId, memberId, updateConferenceMember);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConferencesApi.UpdateConferenceMember: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

List Conference Recordings

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new ConferencesApi(config);
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";

try
{
List<ConferenceRecordingMetadata> result = apiInstance.ListConferenceRecordings(accountId, conferenceId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConferencesApi.ListConferenceRecordings: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Get Conference Recording

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new ConferencesApi(config);
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";

try
{
ConferenceRecordingMetadata result = apiInstance.GetConferenceRecording(accountId, conferenceId, recordingId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConferencesApi.GetConferenceRecording: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Download Conference Recording

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new ConferencesApi(config);
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";

try
{
System.IO.Stream result = apiInstance.DownloadConferenceRecording(accountId, conferenceId, recordingId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling ConferencesApi.DownloadConferenceRecording: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Recordings

List Account Call Recordings

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new RecordingsApi(config);
var to = "+19195551234";
var from = "+19195554321";
var minStartTime = "2022-06-21T19:13:21Z";
var maxStartTime = "2022-06-21T19:13:21Z";

try
{
List<CallRecordingMetadata> result = apiInstance.ListAccountCallRecordings(accountId, to, from, minStartTime, maxStartTime);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.ListAccountCallRecordings: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Update Call Recording State

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new RecordingsApi(config);
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var updateCallRecording = new UpdateCallRecording(
state: RecordingStateEnum.Paused
);

try
{
apiInstance.UpdateCallRecordingState(accountId, callId, updateCallRecording);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.UpdateCallRecordingState: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

List Call Recordings

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new RecordingsApi(config);
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";

try
{
List<CallRecordingMetadata> result = apiInstance.ListCallRecordings(accountId, callId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.ListCallRecordings: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Get Call Recording

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new RecordingsApi(config);
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";

try
{
CallRecordingMetadata result = apiInstance.GetCallRecording(accountId, callId, recordingId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.GetCallRecording: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Delete Recording

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new RecordingsApi(config);
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";

try
{
apiInstance.DeleteRecording(accountId, callId, recordingId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.DeleteRecording: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Download Recording

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new RecordingsApi(config);
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";

try
{
System.IO.Stream result = apiInstance.DownloadCallRecording(accountId, callId, recordingId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.DownloadCallRecording: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Delete Recording Media

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new RecordingsApi(config);
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";

try
{
apiInstance.DeleteRecordingMedia(accountId, callId, recordingId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.DeleteRecordingMedia: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Get Call Transcription

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new RecordingsApi(config);
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";

try
{
TranscriptionList result = apiInstance.GetCallTranscription(accountId, callId, recordingId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.GetCallTranscription: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Create Transcription Request

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new RecordingsApi(config);
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";

try
{
TranscriptionList result = apiInstance.GetCallTranscription(accountId, callId, recordingId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.GetCallTranscription: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Delete Call Transcription

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new RecordingsApi(config);
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";

try
{
apiInstance.DeleteCallTranscription(accountId, callId, recordingId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.DeleteCallTranscription: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Telephone Number Lookup

Create Lookup

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new PhoneNumberLookupApi(config);
var lookupRequest = new LookupRequest(
tns: new List<string> { "+12345678902" }
);

try
{
CreateLookupResponse result = apiInstance.CreateLookup(accountId, lookupRequest);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PhoneNumberLookupApi.CreateLookup: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Get Lookup Status

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new PhoneNumberLookupApi(config);
var requestId = "8a358296-e188-4a3a-b974-8e4d12001dd8";

try
{
LookupStatus result = apiInstance.GetLookupStatus(accountId, requestId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling PhoneNumberLookupApi.GetLookupStatus: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Multi-Factor Authentication

Voice MFA Code

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new MFAApi(config);
var codeRequest = new CodeRequest(
to: "+19195551234",
from: "+19195554321",
applicationId: "1234-qwer",
scope: "sample",
message: "Your temporary {NAME} {SCOPE} code is {CODE}",
digits: 6
);

try
{
VoiceCodeResponse result = apiInstance.GenerateVoiceCode(accountId, codeRequest);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MFAApi.GenerateVoiceCode: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Messaging MFA Code

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new MFAApi(config);
var codeRequest = new CodeRequest(
to: "+19195551234",
from: "+19195554321",
applicationId: "1234-qwer",
scope: "sample",
message: "Your temporary {NAME} {SCOPE} code is {CODE}",
digits: 6
);

try
{
MessagingCodeResponse result = apiInstance.GenerateMessagingCode(accountId, codeRequest);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MFAApi.GenerateMessagingCode: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}

Verify MFA Code

using System.Collections.Generic;
using System.Diagnostics;
using Bandwidth.Standard.Api;
using Bandwidth.Standard.Client;
using Bandwidth.Standard.Model;

var apiInstance = new MFAApi(config);
var verifyCodeRequest = new VerifyCodeRequest(
to: "+19195551234",
scope: "sample",
expirationTimeInMinutes: 3,
code: "123456"
);

try
{
VerifyCodeResponse result = apiInstance.VerifyCode(accountId, verifyCodeRequest);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling MFAApi.VerifyCode: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}