public void InboundXmlWithAttributesTest() { // creates the new builder var builder = new InboundXmlBuilder(); // creates the node builder.GetRequestNode() .Dial("(555)555-5555", "dial action", "POST", 15, "caller id", false, "dial music", "dial callback url", "POST", "dial confirm sound", "ww12w3221", false, "dial heartbeat url", "POST", "dial forwarded from", IfMachineEnum.@continue, "dial if machine url", "POST", false, RecordDirectionEnum.@out, "dial record callback url") .StartInner() .Conference("CPaaSExampleChat", false, true, true, true, 15, "conference wait sound", false, "conference callback url", "POST", "ww12w3221", false, false, "conference record callback url", RecordFileFormatEnum.wav) .Number("(555)555-5555", "ww12w3221") .Sip("*****@*****.**", "username", "password") .EndInner() .Gather(input: GatherInputEnum.speech, language: BCPLanguageEnum.ar_ae) .StartInner() .Say("Ready for pause?", loop: 6) .Play("play tone stream", loop: 4) .Pause(length: 2) .EndInner() .Hangup(schedule: 4, reason: HangupReasonEnum.rejected) .Ping("http://webhookr.com/ping-test", "POST") .Pause(length: 5) .Play("play tone stream", loop: 2) .PlayLastRecording() .Record("record action", "POST", 8, "5", 3000, true, TranscribeQualityEnum.auto, "record transcribe callback", true, RecordDirectionEnum.@in, RecordFileFormatEnum.mp3, true, false) .Redirect("redirect", "POST") .Reject(HangupReasonEnum.busy) .Say(value: "I want to say sth!", voice: VoiceEnum.female, language: LanguageEnum.en, loop: 3) .Sms("+12345", "+34567", "Test message from CPaaS", "sms action", "POST", "sms status callback"); var data = builder.Build(); }
/// <summary> /// Example of using Inbound XML builder /// </summary> public static void Example() { try { var builder = new InboundXmlBuilder(); builder.GetRequestNode() .Dial("(555)555-5555", hideCallerId: false, dialMusic: "dial music", confirmSound: "dial confirm sound", digitsMatch: "ww12w3221", record: false, recordDirection: RecordDirectionEnum.@out) .StartInner() .Sip("*****@*****.**", "username", "password") .EndInner() .Gather(input: GatherInputEnum.speech, language: BCPLanguageEnum.ar_ae) .StartInner() .Say(language: LanguageEnum.en, loop: 3, value: "Welcome to CPaaS!", voice: VoiceEnum.female) .Pause(length: 2) .EndInner() .Mms(to: "+123456", from: "+654321", mediaUrl: "https://media.giphy.com/media/zZJzLrxmx5ZFS/giphy.gif") .Hangup(schedule: 4, reason: HangupReasonEnum.rejected); var result = builder.Build(); Console.WriteLine(result); } catch (CPaaSException e) { Console.WriteLine(e.Message); } }
public void InboundXmlTest() { // creates the new builder var builder = new InboundXmlBuilder(); // creates the node builder.GetRequestNode() .Dial() .StartInner() .Conference() .Number() .Sip() .EndInner() .Gather(input: GatherInputEnum.speech, language: BCPLanguageEnum.ar_ae) .StartInner() .Say() .Play() .Pause() .EndInner() .Hangup() .Ping() .Pause() .Play() .PlayLastRecording() .Record() .Redirect() .Reject() .Say() .Sms("+12345", "+34567"); // exports the node var stringData = RemoveXmlWhitespace(builder.Build()); // does the test Assert.AreEqual(EXPTECTED_XML_STRING, stringData); }