v10 -> v11
Client Initialization
- v10
- v11
using Bandwidth.Standard;
var client = new BandwidthClient.Builder()
.Environment(Bandwidth.Standard.Environment.Production)
.MessagingBasicAuthCredentials("YOUR_USERNAME", "YOUR_PASSWORD")
.VoiceBasicAuthCredentials("YOUR_USERNAME", "YOUR_PASSWORD")
.TwoFactorAuthBasicAuthCredentials("YOUR_USERNAME", "YOUR_PASSWORD")
.WebRtcBasicAuthCredentials("YOUR_USERNAME", "YOUR_PASSWORD")
.Build();
var accountId = "YOUR_BW_ACCOUNT_ID";
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
- v10
- v11
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Messaging.Models;
var request = new MessageRequest()
{
ApplicationId = "1234-qwer",
To = new List<string> { "+12345678902" },
From = "+12345678901",
Text = "Hello world"
};
try
{
var response = await client.Messaging.APIController.CreateMessageAsync(accountId, request);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Messaging.Models;
var accountId = accountId;
var bandwidthNumber = "+12345678901";
try
{
var response = await client.Messaging.APIController.GetMessagesAsync(accountId, sourceTn: bandwidthNumber);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Messaging.Models;
try
{
var response = await client.Messaging.APIController.ListMediaAsync(accountId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Messaging.Models;
var mediaId = "media-id-123";
try
{
var response = await client.Messaging.APIController.GetMediaAsync(accountId, mediaId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.IO;
using System.Text;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Http.Client;
var mediaId = "media-id-123";
var content = "Hello world";
var contentType = "text/plain";
var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(content));
var fileStreamInfo = new FileStreamInfo(memoryStream);
try
{
await client.Messaging.APIController.UploadMediaAsync(accountId, mediaId, fileStreamInfo, contentType);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Messaging.Models;
var mediaId = "media-id-123";
try
{
await client.Messaging.APIController.DeleteMediaAsync(accountId, mediaId);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using Bandwidth.Standard.Voice.Bxml;
using Bandwidth.Standard.Model.Bxml;
using Bandwidth.Standard.Model.Bxml.Verbs;
Bridge
- v10
- v11
Bridge bridge = new Bridge
{
CallId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d",
BridgeCompleteUrl = "https://bridge.url/nextBXMLForSecondCall",
BridgeCompleteMethod = "POST",
BridgeTargetCompleteUrl = "https://bridge.url/nextBXMLForFirstCall"
BridgeTargetCompleteMethod = "POST",
Username = "username",
Password = "password",
Tag = "test",
BridgeCompleteFallbackUrl = "https://fallbackbridge.url/nextBXMLForSecondCall",
BridgeCompleteFallbackMethod = "POST",
BridgeTargetCompleteFallbackUrl = "https://fallbackbridge.url/nextBXMLForFirstCall",
BridgeTargetCompleteFallbackMethod = "POST",
FallbackUsername = "fallbackUsername",
FallbackPassword = "fallbackPassword"
};
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
- v10
- v11
Conference conference = new Conference {
Name = "my-conference-name",
Username = "username",
Password = "password",
Tag = "test",
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",
FallbackUsername = "fallbackUsername",
FallbackPassword = "fallbackPassword"
};
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
- v10
- v11
Forward forward = new Forward
{
To = "+10987654321",
From = "+11234567890",
CallTimeOut = 10,
DiversionTreatment = "stack",
DiversionReason = "user-busy"
};
Forward forward = new Forward
{
To = "+10987654321",
From = "+11234567890",
CallTimeOut = 10,
DiversionTreatment = "stack",
DiversionReason = "user-busy",
Uui = "93d6f3c0be5845960b744fa28015d8ede84bd1a4;encoding=base64,asdf;encoding=jwt"
};
Gather
- v10
- v11
Gather gather = new Gather
{
GatherUrl = "https://gather.url/nextBxml",
GatherMethod = "POST",
TerminatingDigits = "#",
Tag = "test",
MaxDigits = 10,
InterDigitTimeout = 10,
Username = "username",
Password = "password",
FirstDigitTimeout = 10,
RepeatCount = 10,
SpeakSentence = speakSentence
AudioProducers = new List<AudioProducer> { playAudio },
GatherFallbackUrl = "https://fallbackgather.url/nextBXML",
GatherFallbackMethod = "POST",
FallbackPassword = "fallbackPassword",
FallbackUsername = "fallbackUsername"
};
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
- v10
- v11
Hangup hangup = new Hangup();
Hangup hangup = new Hangup();
Pause
- v10
- v11
Pause pause = new Pause
{
Duration = 2
};
Pause pause = new Pause
{
Duration = 2
};
Pause Recording
- v10
- v11
PauseRecording pause = new PauseRecording();
PauseRecording pause = new PauseRecording();
Play Audio
- v10
- v11
PlayAudio playAudio = new PlayAudio
{
Url = "https://audio.url/audio1.wav",
Username = "username",
Password = "password"
};
PlayAudio playAudio = new PlayAudio
{
AudioUri = "https://audio.url/audio1.wav",
Username = "username",
Password = "password"
};
Record
- v10
- v11
Record record = new Record
{
DetectLanguage = true,
Transcribe = true,
SilenceTimeout = 0,
TranscriptionAvailableUrl = "https://transcription.url.server/transcribe/",
TranscriptionAvailableMethod = "POST",
RecordCompleteUrl = "https://myapp.com/nextBXML",
RecordCompleteMethod = "POST",
RecordingAvailableUrl = "https://myapp.com/recordingAvailable",
RecordingAvailableMethod = "POST",
Tag = "test",
TerminatingDigits = "#",
MaxDuration = 60,
FileFormat = "wav",
Username = "username",
Password = "password",
FallbackPassword = "fallbackPassword",
FallbackUsername = "fallbackUsername",
RecordCompleteFallbackUrl = "https://fallbackmyapp.com/nextBXML",
RecordCompleteFallbackMethod = "POST"
};
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
- v10
- v11
Redirect redirect = new Redirect
{
RedirectUrl = "http://flow.url/newFlow",
RedirectMethod = "POST",
Tag = "test",
Username = "username",
Password = "password",
FallbackPassword = "fallbackPassword",
FallbackUsername = "fallbackUsername",
RedirectFallbackUrl = "http://fallbackFlow.url/newFlow",
RedirectFallbackMethod = "POST"
};
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
- v10
- v11
ResumeRecording resumeRecording = new ResumeRecording();
ResumeRecording resumeRecording = new ResumeRecording();
Ring
- v10
- v11
Ring ring = new Ring
{
Duration = 10,
AnswerCall = false
};
Ring ring = new Ring
{
Duration = 10,
AnswerCall = false
};
Send DTMF
- v10
- v11
SendDtmf sendDtmf = new SendDtmf
{
ToneDuration = 200,
ToneInterval = 400,
Digits = "12w34"
};
SendDtmf sendDtmf = new SendDtmf
{
Digits = "12w34",
ToneDuration = 200,
ToneInterval = 400
};
Speak Sentence
- v10
- v11
SpeakSentence speakSentence = new SpeakSentence
{
Gender = "female",
Locale = "en_US",
Voice = "kate",
Sentence = "test"
};
SpeakSentence speakSentence = new SpeakSentence
{
Text = "test",
Voice = "kate",
Gender = "female",
Locale = "en_US"
};
Start Gather
- v10
- v11
StartGather startGather = new StartGather
{
DtmfUrl = "https://startgather.url/callback",
DtmfMethod = "POST",
Username = "username",
Password = "password",
Tag = "test"
};
StartGather startGather = new StartGather
{
DtmfUrl = "https://startgather.url/callback",
DtmfMethod = "POST",
Username = "username",
Password = "password",
Tag = "test"
};
Start Recording
- v10
- v11
StartRecording startRecording = new StartRecording
{
DetectLanguage = true,
Transcribe = true,
TranscriptionAvailableUrl = "https://transcriptionTest.url/",
TranscriptionAvailableMethod = "POST",
RecordingAvailableUrl = "https://myapp.com/noBXML",
RecordingAvailableMethod = "POST",
Tag = "test",
FileFormat = "mp3",
MultiChannel = true,
Username = "username",
Password = "password"
};
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
- v10
- v11
StartStream startStream = new StartStream
{
Destination = "wss://live-studio-audience.myapp.example.com",
Name = "live_audience",
Tracks = "both",
StreamEventUrl = "https://myapp.example.com/noBXML",
StreamEventMethod = "POST",
Username = "username",
Password = "password",
StreamParam = new List<StreamParam> { streamParam }
};
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
- v10
- v11
StopGather stopGather = new StopGather();
StopGather stopGather = new StopGather();
Stop Recording
- v10
- v11
StopRecording stopRecording = new StopRecording();
StopRecording stopRecording = new StopRecording();
Stop Stream
- v10
- v11
StopStream stopStream = new StopStream
{
Name = "live_audience"
};
StopStream stopStream = new StopStream
{
Name = "live_audience"
};
Tag
- v10
- v11
Tag tag = new Tag
{
Value = "audio ended"
};
Tag tag = new Tag
{
Value = "audio ended"
};
Transfer
- v10
- v11
Transfer transfer = new Transfer
{
TransferCallerId = "Anonymous",
CallTimeout = 30,
Tag = "test",
TransferCompleteUrl = "http://test.com",
TransferCompleteMethod = "POST",
Username = "username",
Password = "password",
DiversionTreatment = "none",
DiversionReason = "user-busy",
PhoneNumbers = new PhoneNumber[] { phoneNumber },
SipUris = new SipUri[] { sipUri },
TransferCompleteFallbackUrl = "http://fallbackTest.com",
TransferCompleteFallbackMethod = "POST",
FallbackUsername = "fallbackUsername",
FallbackPassword = "fallbackPassword"
};
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var request = new CreateCallRequest()
{
ApplicationId = "1234-qwer",
To = "+12345678902",
From = "+12345678901",
AnswerUrl = "https://test.com"
};
try
{
var response = await client.Voice.APIController.CreateCallAsync(accountId, request);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-15ac29a2-1331029c-2cb0-4a07-b215-b22865662d85";
try
{
var response = await client.Voice.APIController.GetCallAsync(accountId, callId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
This functionality was not available in v10
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var request = new ModifyCallRequest()
{
State = StateEnum.Completed
};
try
{
await client.Voice.APIController.ModifyCallAsync(accountId, callId, request);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
This functionality was not available in v10
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
try
{
var response = await client.Voice.APIController.GetConferencesAsync(accountId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
try
{
var response = await client.Voice.APIController.GetConferenceAsync(accountId, conferenceId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
var request = new ModifyConferenceRequest
{
Status = StatusEnum.Completed
};
try
{
await client.Voice.APIController.ModifyConferenceAsync(accountId, conferenceId, request);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
This functionality was not available in v10
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
var memberId = "c-95ac8d8d-b81437f5-4586-4d5b-9b46-29f8b3fe0aaf";
try
{
var response = await client.Voice.APIController.GetConferenceMemberAsync(accountId, conferenceId, memberId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var detail = new ConferenceMemberState
{
Mute = true
};
try
{
await client.Voice.APIController.ModifyConferenceMemberAsync(accountId, conferenceId, callId, detail);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
try
{
var response = await client.Voice.APIController.GetConferenceRecordingsAsync(accountId, conferenceId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";
try
{
var response = await client.Voice.APIController.GetConferenceRecordingAsync(accountId, conferenceId, recordingId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var conferenceId = "conf-95ac8d8d-28e06798-2afe-434c-b0f4-666a79cd47f8";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";
try
{
var response = await client.Voice.APIController.GetDownloadConferenceRecordingAsync(accountId, conferenceId, recordingId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
try
{
var response = await client.Voice.APIController.GetQueryCallRecordingsAsync(accountId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var state = new ModifyCallRecordingRequest
{
State = State1Enum.PAUSED
};
try
{
await client.Voice.APIController.ModifyCallRecordingStateAsync(accountId, callId, state);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
try
{
var response = await client.Voice.APIController.GetCallRecordingsAsync(accountId, callId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";
try
{
var response = await client.Voice.APIController.GetCallRecordingAsync(accountId, callId, recordingId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";
try
{
await client.Voice.APIController.DeleteRecordingAsync(accountId, callId, recordingId);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";
try
{
var response = await client.Voice.APIController.GetDownloadCallRecordingAsync(accountId, callId, recordingId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";
try
{
await client.Voice.APIController.DeleteRecordingMediaAsync(accountId, callId, recordingId);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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 Recording Transcription
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";
try
{
var response = await client.Voice.APIController.GetRecordingTranscriptionAsync(accountId, callId, recordingId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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.GetRecordingTranscription(accountId, callId, recordingId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.GetRecordingTranscription: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Create Transcription Request
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";
try
{
var response = await client.Voice.APIController.GetCallRecordingAsync(accountId, callId, recordingId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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.GetRecordingTranscription(accountId, callId, recordingId);
Debug.WriteLine(result);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.GetRecordingTranscription: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Delete Recording Transcription
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.Voice.Models;
var callId = "c-95ac8d6e-1a31c52e-b38f-4198-93c1-51633ec68f8d";
var recordingId = "r-d68201ef-d53e-4c6d-a743-1c1283909d41";
try
{
await client.Voice.APIController.DeleteRecordingTranscriptionAsync(accountId, callId, recordingId);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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.DeleteRecordingTranscription(accountId, callId, recordingId);
}
catch (ApiException e)
{
Debug.Print("Exception when calling RecordingsApi.DeleteRecordingTranscription: " + e.Message);
Debug.Print("Status Code: " + e.ErrorCode);
Debug.Print(e.StackTrace);
}
Telephone Number Lookup
Create Lookup
- v10
- v11
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.PhoneNumberLookup.Models;
var request = new OrderRequest
{
Tns = new List<string> { "+12345678902" }
};
try
{
var response = await client.PhoneNumberLookup.APIController.CreateLookupRequestAsync(accountId, request);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
var requestId = "8a358296-e188-4a3a-b974-8e4d12001dd8";
try
{
var response = await client.PhoneNumberLookup.APIController.GetLookupRequestStatusAsync(accountId, requestId);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.MultiFactorAuth.Models;
var request = new TwoFactorCodeRequestSchema
{
ApplicationId = "1234-qwer",
To = "+19195551234";
From = "+19195554321";
Scope = "sample",
Digits = 6,
Message = "Your temporary {NAME} {SCOPE} code is {CODE}"
};
try
{
var response = await client.MultiFactorAuth.MFAController.CreateVoiceTwoFactorAsync(accountId, request);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.MultiFactorAuth.Models;
var request = new TwoFactorCodeRequestSchema
{
ApplicationId = "1234-qwer",
To = "+19195551234",
From = "+19195554321",
Scope = "sample",
Digits = 6,
Message = "Your temporary {NAME} {SCOPE} code is {CODE}"
};
try
{
var response = await client.MultiFactorAuth.MFAController.CreateMessagingTwoFactorAsync(accountId, request);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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
- v10
- v11
using System;
using System.Threading.Tasks;
using Bandwidth.Standard;
using Bandwidth.Standard.Exceptions;
using Bandwidth.Standard.MultiFactorAuth.Models;
var request = new TwoFactorVerifyRequestSchema
{
ApplicationId = "1234-qwer",
To = "+19195551234",
Scope = "sample",
Code = "123456",
ExpirationTimeInMinutes = 3
};
try
{
var response = await client.MultiFactorAuth.MFAController.CreateVerifyTwoFactorAsync(accountId, request);
Console.WriteLine(response.Data);
}
catch (ApiException e)
{
Console.WriteLine(e.Message);
}
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);
}