C# Класс TwilioSharp.TwiML.TwiMLBuilder

A fluent like interface for creating TwiML Responses.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Build ( ) : TwiMLBuilder

Builds an instance.

DialConference ( string conferenceName, bool participantMuted = false, bool beepOnEnterOrExit = true, bool startConferenceOnEnter = true, bool endConferenceOnExit = false, string waitMusicUrl = "", ActionMethod waitMusicMethod = ActionMethod.POST, uint maxParticipants = 40, string actionUrl = "", ActionMethod methodUrl = ActionMethod.POST, uint timeoutSeconds = 30, bool hangupOnStar = false, uint timeLimitMilliseconds = 14400, string statusCallbackUrl = "", string callerIdNumber = "", bool record = null ) : TwiMLBuilder

Adds a Dial and Conference Element with the specified details.

DialNumber ( string numberToDial, string digitsToSendAfterConnect = "", string numberUrl = "", string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 30, bool hangupOnStar = false, uint timeLimitMilliseconds = 14400, string statusCallbackUrl = "", string callerIdNumber = "" ) : TwiMLBuilder

Adds a Dial and Number Element with the specified details.

Gather ( string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 5, char keyThatFinishes = '#', uint numDigitsToCollect = 1000 ) : TwiMLBuilder

Adds a Gather Element to the response.

GatherWhilePlaying ( string fileUrl, uint timesToLoop = 1, string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 5, char keyThatFinishes = '#', uint numDigitsToCollect = 1000 ) : TwiMLBuilder

Adds a Gather Element with a nested Playing Element.

GatherWhileSaying ( string textToSay, SayVoice voiceSex = SayVoice.man, SayLanguage voiceLanguage = SayLanguage.en, int loopTimes = 1, string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 5, char keyThatFinishes = '#', uint numDigitsToCollect = 1000 ) : TwiMLBuilder

Adds a Gather element with a nested say element.

Hangup ( ) : TwiMLBuilder

Adds a Hangup Element to the Response.

Pause ( uint secondsToPause = 1 ) : TwiMLBuilder

Adds a pause element to the response.

Play ( string fileUrl, uint timesToLoop = 1 ) : TwiMLBuilder

Adds a Play Element to the Response.

Record ( string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 5, char keyThatFinishes = '#', uint maxLengthMilliseconds = 3600, bool transcribeAudio = false, string transcribeCallbackUrl = "", bool playBeepBeforeStart = true ) : TwiMLBuilder

Adds a Record Element with the specified details.

Redirect ( string url, ActionMethod method = ActionMethod.POST ) : TwiMLBuilder

Adds a Redirect Element to the Response.

Reject ( RejectReason reason = RejectReason.rejected ) : TwiMLBuilder

Adds a Reject Element to the Response

Say ( string thingToSay, SayVoice voiceSex = SayVoice.man, SayLanguage voiceLanguage = SayLanguage.en, uint loopTimes = 1 ) : TwiMLBuilder

Adds a Say Element to the Response.

Sms ( string messageText, string toNumber = "", string fromNumber = "", string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST ) : TwiMLBuilder

Adds an Sms Element with the specified details.

ToXmlResponse ( ) : System.Xml.Linq.XElement

Converts the elements in this instance into a TwiML Response

Приватные методы

Метод Описание
AddVerb ( Verb verb, string value, object attributes ) : TwiMLBuilder
CreateAttributeDictionary ( object attributes ) : string>.Dictionary
CreateBuilderElement ( Verb verb, string value, object attributes ) : TwiMLBuilderElement
CreateVerbBase ( Verb verb, string value, object attributes ) : VerbBase
CreateXmlFromElement ( TwiMLBuilderElement elem ) : System.Xml.Linq.XElement
CreateXmlFromVerb ( VerbBase verb ) : System.Xml.Linq.XElement
TwiMLBuilder ( ) : System

Initializes a new instance of the TwiMLBuilder class.

Описание методов

Build() публичный статический Метод

Builds an instance.
public static Build ( ) : TwiMLBuilder
Результат TwiMLBuilder

DialConference() публичный Метод

Adds a Dial and Conference Element with the specified details.
public DialConference ( string conferenceName, bool participantMuted = false, bool beepOnEnterOrExit = true, bool startConferenceOnEnter = true, bool endConferenceOnExit = false, string waitMusicUrl = "", ActionMethod waitMusicMethod = ActionMethod.POST, uint maxParticipants = 40, string actionUrl = "", ActionMethod methodUrl = ActionMethod.POST, uint timeoutSeconds = 30, bool hangupOnStar = false, uint timeLimitMilliseconds = 14400, string statusCallbackUrl = "", string callerIdNumber = "", bool record = null ) : TwiMLBuilder
conferenceName string Name of the conference.
participantMuted bool if set to true [participant muted].
beepOnEnterOrExit bool if set to true [beep on enter or exit].
startConferenceOnEnter bool if set to true [start conference on enter].
endConferenceOnExit bool if set to true [end conference on exit].
waitMusicUrl string The wait music URL.
waitMusicMethod ActionMethod The wait music method.
maxParticipants uint The max participants.
actionUrl string The action URL.
methodUrl ActionMethod The method URL.
timeoutSeconds uint The timeout seconds.
hangupOnStar bool if set to true [hangup on star].
timeLimitMilliseconds uint The time limit milliseconds.
statusCallbackUrl string The status callback URL.
callerIdNumber string The caller id number.
record bool UNDOCUMENTED: Whether to record this conference or not.
Результат TwiMLBuilder

DialNumber() публичный Метод

Adds a Dial and Number Element with the specified details.
public DialNumber ( string numberToDial, string digitsToSendAfterConnect = "", string numberUrl = "", string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 30, bool hangupOnStar = false, uint timeLimitMilliseconds = 14400, string statusCallbackUrl = "", string callerIdNumber = "" ) : TwiMLBuilder
numberToDial string The number to dial.
digitsToSendAfterConnect string The digits to send after connect.
numberUrl string The number URL.
actionUrl string The action URL.
actionMethod ActionMethod The action method.
timeoutSeconds uint The timeout seconds.
hangupOnStar bool if set to true [hangup on star].
timeLimitMilliseconds uint The time limit milliseconds.
statusCallbackUrl string The status callback URL.
callerIdNumber string The caller id number.
Результат TwiMLBuilder

Gather() публичный Метод

Adds a Gather Element to the response.
public Gather ( string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 5, char keyThatFinishes = '#', uint numDigitsToCollect = 1000 ) : TwiMLBuilder
actionUrl string The action URL.
actionMethod ActionMethod The action method.
timeoutSeconds uint The timeout seconds.
keyThatFinishes char The key that finishes collection.
numDigitsToCollect uint The num digits to collect.
Результат TwiMLBuilder

GatherWhilePlaying() публичный Метод

Adds a Gather Element with a nested Playing Element.
public GatherWhilePlaying ( string fileUrl, uint timesToLoop = 1, string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 5, char keyThatFinishes = '#', uint numDigitsToCollect = 1000 ) : TwiMLBuilder
fileUrl string The file URL.
timesToLoop uint The times to loop.
actionUrl string The action URL.
actionMethod ActionMethod The action method.
timeoutSeconds uint The timeout seconds.
keyThatFinishes char The key that finishes.
numDigitsToCollect uint The num digits to collect.
Результат TwiMLBuilder

GatherWhileSaying() публичный Метод

Adds a Gather element with a nested say element.
public GatherWhileSaying ( string textToSay, SayVoice voiceSex = SayVoice.man, SayLanguage voiceLanguage = SayLanguage.en, int loopTimes = 1, string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 5, char keyThatFinishes = '#', uint numDigitsToCollect = 1000 ) : TwiMLBuilder
textToSay string The text to say.
voiceSex SayVoice
voiceLanguage SayLanguage
loopTimes int
actionUrl string The action URL.
actionMethod ActionMethod The action method.
timeoutSeconds uint The timeout seconds.
keyThatFinishes char The key that finishes.
numDigitsToCollect uint The num digits to collect.
Результат TwiMLBuilder

Hangup() публичный Метод

Adds a Hangup Element to the Response.
public Hangup ( ) : TwiMLBuilder
Результат TwiMLBuilder

Pause() публичный Метод

Adds a pause element to the response.
public Pause ( uint secondsToPause = 1 ) : TwiMLBuilder
secondsToPause uint The seconds to pause.
Результат TwiMLBuilder

Play() публичный Метод

Adds a Play Element to the Response.
public Play ( string fileUrl, uint timesToLoop = 1 ) : TwiMLBuilder
fileUrl string The file URL.
timesToLoop uint The times to loop.
Результат TwiMLBuilder

Record() публичный Метод

Adds a Record Element with the specified details.
public Record ( string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 5, char keyThatFinishes = '#', uint maxLengthMilliseconds = 3600, bool transcribeAudio = false, string transcribeCallbackUrl = "", bool playBeepBeforeStart = true ) : TwiMLBuilder
actionUrl string The action URL.
actionMethod ActionMethod The action method.
timeoutSeconds uint The timeout seconds.
keyThatFinishes char The key that finishes.
maxLengthMilliseconds uint The max length milliseconds.
transcribeAudio bool if set to true [transcribe audio].
transcribeCallbackUrl string The transcribe callback URL.
playBeepBeforeStart bool if set to true [play beep before start].
Результат TwiMLBuilder

Redirect() публичный Метод

Adds a Redirect Element to the Response.
public Redirect ( string url, ActionMethod method = ActionMethod.POST ) : TwiMLBuilder
url string The URL.
method ActionMethod The method.
Результат TwiMLBuilder

Reject() публичный Метод

Adds a Reject Element to the Response
public Reject ( RejectReason reason = RejectReason.rejected ) : TwiMLBuilder
reason RejectReason The reason for rejection.
Результат TwiMLBuilder

Say() публичный Метод

Adds a Say Element to the Response.
public Say ( string thingToSay, SayVoice voiceSex = SayVoice.man, SayLanguage voiceLanguage = SayLanguage.en, uint loopTimes = 1 ) : TwiMLBuilder
thingToSay string The thing to say.
voiceSex SayVoice The voice sex.
voiceLanguage SayLanguage The voice language.
loopTimes uint The loop times.
Результат TwiMLBuilder

Sms() публичный Метод

Adds an Sms Element with the specified details.
public Sms ( string messageText, string toNumber = "", string fromNumber = "", string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST ) : TwiMLBuilder
messageText string The message text.
toNumber string To number.
fromNumber string From number.
actionUrl string The action URL.
actionMethod ActionMethod The action method.
Результат TwiMLBuilder

ToXmlResponse() публичный Метод

Converts the elements in this instance into a TwiML Response
public ToXmlResponse ( ) : System.Xml.Linq.XElement
Результат System.Xml.Linq.XElement