C# Class TwilioSharp.TwiML.TwiMLBuilder

A fluent like interface for creating TwiML Responses.
Afficher le fichier Open project: jgable/TwilioSharp Class Usage Examples

Méthodes publiques

Méthode Description
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

Private Methods

Méthode Description
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.

Method Details

Build() public static méthode

Builds an instance.
public static Build ( ) : TwiMLBuilder
Résultat TwiMLBuilder

DialConference() public méthode

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.
Résultat TwiMLBuilder

DialNumber() public méthode

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.
Résultat TwiMLBuilder

Gather() public méthode

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.
Résultat TwiMLBuilder

GatherWhilePlaying() public méthode

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.
Résultat TwiMLBuilder

GatherWhileSaying() public méthode

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.
Résultat TwiMLBuilder

Hangup() public méthode

Adds a Hangup Element to the Response.
public Hangup ( ) : TwiMLBuilder
Résultat TwiMLBuilder

Pause() public méthode

Adds a pause element to the response.
public Pause ( uint secondsToPause = 1 ) : TwiMLBuilder
secondsToPause uint The seconds to pause.
Résultat TwiMLBuilder

Play() public méthode

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.
Résultat TwiMLBuilder

Record() public méthode

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].
Résultat TwiMLBuilder

Redirect() public méthode

Adds a Redirect Element to the Response.
public Redirect ( string url, ActionMethod method = ActionMethod.POST ) : TwiMLBuilder
url string The URL.
method ActionMethod The method.
Résultat TwiMLBuilder

Reject() public méthode

Adds a Reject Element to the Response
public Reject ( RejectReason reason = RejectReason.rejected ) : TwiMLBuilder
reason RejectReason The reason for rejection.
Résultat TwiMLBuilder

Say() public méthode

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.
Résultat TwiMLBuilder

Sms() public méthode

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.
Résultat TwiMLBuilder

ToXmlResponse() public méthode

Converts the elements in this instance into a TwiML Response
public ToXmlResponse ( ) : System.Xml.Linq.XElement
Résultat System.Xml.Linq.XElement