protected void Page_Load(object sender, EventArgs e) { // Create a new instance of the Tropo object. Tropo tropo = new Tropo(); //tropo.Voice = Voice.UsEnglishFemale_Susan; // Create an array of signals - used to interupt the Ask. // string[] signals = new string[] {"endCall", "tooLong"}; // A prompt to use with the Ask. Say say = new Say("This is an Ask test with events. Please enter 1, 2 or 3."); var says = new Collection <Say>(); says.Add(new Say("Sorry, I did not hear anything.", "timeout")); says.Add(new Say("Don't think that was a year. ", "nomatch:1")); says.Add(new Say("Nope, still not a year.", "nomatch:2")); says.Add(new Say("No match 3.", "nomatch:3")); says.Add(new Say("What is your birth year?")); // Choices for the Ask. Choices choices = new Choices("[4 DIGITS]"); // Set up the dialog. tropo.Ask(1, true, 3, choices, null, "year", true, says, 7); tropo.On(Event.Continue, "YourAge.aspx", null); // Fires when the user provides valid input. tropo.On(Event.Incomplete, "FailAge.aspx", null); // Fires when the user provides valid input. //tropo.Hangup(); tropo.RenderJSON(Response); }
protected void Page_Load(object sender, EventArgs e) { using (StreamReader reader = new StreamReader(Request.InputStream)) { // Create a new instance of the Tropo object. Tropo tropo = new Tropo(); if (!String.IsNullOrEmpty(Request.QueryString["signal"])) { if (Request.QueryString["signal"] == "interruptConference") { tropo.Say(". Now, rejoin the conference. Press the pound key to exit without hanging up."); tropo.Conference(Request.QueryString["confid"], false, "testConference", false, true, "#"); tropo.Say("You have now left the conference."); tropo.Hangup(); } else { tropo.Say("The call is now over. Gooddbye."); tropo.Hangup(); } } else { // Get the JSON submitted from Tropo. string sessionJSON = TropoUtilities.parseJSON(reader); // Create a new Session object and pass in the JSON submitted from Tropo. Session tropoSession = new Session(sessionJSON); // Create a signal to end the conference. string[] signals = new string[] { "interruptConference", "endCall" }; // Call an outbound number and create a conference. tropo.Call(tropoSession.Parameters["callToNumber"]); tropo.Say("Welcome to the conference."); //tropo.Conference(tropoSession.Parameters["conferenceID"], signals, false, "testConference", false, true, "#"); JoinPrompt joinPrompt = new JoinPrompt("somebody join the conference"); LeavePrompt leavePrompt = new LeavePrompt("some one leave the conference"); tropo.Conference(tropoSession.Parameters["conferenceID"], signals, 3, false, "testConference", false, true, "#", joinPrompt, leavePrompt, "none"); tropo.On("interruptConference", "Conference.aspx?signal=interruptConference&confid=" + tropoSession.Parameters["conferenceID"], new Say("You have left the conference.")); tropo.On("endCall", "Conference.aspx?signal=endCall", new Say("You have left the conference.")); } tropo.RenderJSON(Response); } }
protected void Page_Load(object sender, EventArgs e) { // Create a new instance of the Tropo object. Tropo tropo = new Tropo(); // Create a transcription object to use with recording. Transcription trancription = new Transcription(); trancription.Url = "mailto:[email protected]"; trancription.EmailFormat = "omit"; trancription.Id = "asyncUploadNULL"; // Set up grammar for recording. Choices choices = new Choices(); choices.Value = "[10 DIGITS]"; choices.Terminator = "#"; // Construct a prompt to use with the recording. Say say = new Say(); say.Value = "Please say your account number"; //say.Value = "Fourscore and seven years ago our fathers brought forth, on this continent, a new nation, conceived in liberty, and dedicated to the proposition that all men are created equal.Now we are engaged in a great civil war, testing whether that nation, or any nation so conceived, and so dedicated, can long endure. We are met on a great battle - field of that war.We have come to dedicate a portion of that field, as a final resting-place for those who here gave their lives, that that nation might live.It is altogether fitting and proper that we should do this.But, in a larger sense, we cannot dedicate, we cannot consecrate—we cannot hallow—this ground.The brave men, living and dead, who struggled here, have consecrated it far above our poor power to add or detract. The world will little note, nor long remember what we say here, but it can never forget what they did here. It is for us the living, rather, to be dedicated here to the unfinished work which they who fought here have thus far so nobly advanced.It is rather for us to be here dedicated to the great task remaining before us—that from these honored dead we take increased devotion to that cause for which they here gave the last full measure of devotion—that we here highly resolve that these dead shall not have died in vain—that this nation, under God, shall have a new birth of freedom, and that government of the people, by the people, for the people, shall not perish from the earth."; tropo.Call("+8613466549249"); // Use the record() method to set up a recording. //tropo.Record(3, false, true, choices, AudioFormat.Wav, 10, 600, Method.Post, null, true, say, 15, trancription, null, "http://54.88.99.156:9080/FileUpload/uploadFile"); tropo.Record(3, null, null, null, null, choices, say, AudioFormat.Wav, 10, 600, Method.Post, "whname", true, trancription, "http://54.88.99.156:9080/FileUpload/uploadFile", null, null, 15, 5, null, "none"); tropo.On("continue", "TropoResult.aspx", new Say("This is a on say in record")); // Hangup when finished. //tropo.Hangup(); HttpContext.Current.Trace.Warn("learn trace of dot net" + DateTime.Now.ToString()); tropo.RenderJSON(Response); }
private static string ConvertCall(global::VoiceModel.Call model) { Tropo tmodel = new Tropo(); ConvertCall(model, ref tmodel); tmodel.On("continue", model.nextUri, null); return(tmodel.RenderJSON()); }
private static string ConvertSay(global::VoiceModel.Say model) { Tropo tmodel = new Tropo(); ConvertPromptList(model.prompts, model.json, ref tmodel); tmodel.On("continue", model.nextUri, null); return(tmodel.RenderJSON()); }
private static string ConvertAsk(global::VoiceModel.Ask model) { Tropo tmodel = new Tropo(); tmodel.Ask(3, true, ConvertGrammar(model.grammar), null, "result", null, ConvertPromptList(model.initialPrompt, model.json), null); tmodel.On("continue", model.nextUri, null); return(tmodel.RenderJSON()); }
private static string ConvertRecord(global::VoiceModel.Record model, string recordingUri) { Tropo tmodel = new Tropo(); string next = model.nextUri; model.nextUri = recordingUri; ConvertRecord(model, ref tmodel); tmodel.On("continue", next, null); return(tmodel.RenderJSON()); }
protected void Page_Load(object sender, EventArgs e) { // Create a new instance of the Tropo object. Tropo tropo = new Tropo(); // Say an introductory message to the caller. tropo.Say("Welcome to the claim test application."); // Create new choices to use with Ask. Choices choices = new Choices("[5 DIGITS]"); // Create new ask with desired prompt that will be sent to user. tropo.Ask(3, false, choices, null, "claim_id", true, new Say("Please enter your 5 digits claim ID."), 5); // Create On handlers for Tropo event. tropo.On(Event.Continue, "Answer.aspx", null); // Fires when the user provides valid input. tropo.On(Event.Error, "Error.aspx", null); // Fires when an error occurs. tropo.On(Event.Incomplete, "Error.aspx", null); // Fires when the user does not enter correct input. tropo.RenderJSON(Response); }
protected void Page_Load(object sender, EventArgs e) { // Create a new instance of the Tropo object Tropo tropo = new Tropo(); // Set the grammar to use when collecting input. Choices choices = new Choices("[5 DIGITS]"); // Create an event handler for when the input collection is finished. Tropo will POST Result object JSON. On on = new On(Event.Continue, "http://my-web-application-url/post", new Say("Please hold.")); // Call the ask method of the Tropo object and pass in values. tropo.Ask(3, false, choices, null, "zip", true, new Say("Please enter your 5 digit zip code"), 5); tropo.On(on); tropo.RenderJSON(Response); }
protected void Page_Load(object sender, EventArgs e) { // Create a new instance of the Tropo object. Tropo tropo = new Tropo(); //tropo.Voice = Voice.UsEnglishFemale_Susan; // Create an array of signals - used to interupt the Ask. string[] signals = new string[] { "endCall", "tooLong" }; // A prompt to use with the Ask. Say say = new Say("This is an Ask test with events. Please enter 1, 2 or 3yyyy."); // A prompt to use with the Ask. Say franksay = new Say("This is frank Ask test with events. Please enter your 5 digits credit card number."); // A prompt to use with the Ask.On. Say sayon = new Say("This is an Ask on say"); // Choices for the Ask. Choices choices = new Choices("1,2,3"); // frank's Choices for the Ask. Choices frankchoices = new Choices("[5 DIGITS]", "dtmf", "#"); // Set up the dialog. //tropo.GeneralLogSecurity("suppress"); //tropo.Ask(5, signals, false, null, choices, null, "test", Recognizer.UsEnglish, "suppress", "mask", "XXDD-", true, say, 30); //tropo.GeneralLogSecurity("none"); tropo.Ask(5, signals, false, null, frankchoices, null, "frank test", Recognizer.UsEnglish, true, franksay, 30, "suppress", "mask", "XXDD-"); tropo.Ask(5, signals, false, null, choices, null, "peter test", Recognizer.UsEnglish, true, say, 30, "suppress", "mask", "XXDD-"); tropo.On("continue", "TropoResult.aspx", sayon); //tropo.Hangup(); tropo.RenderJSON(Response); }
public void Page_Load(object sender, EventArgs args) { // Create a new instance of the Tropo object. Tropo tropo = new Tropo(); Say say1 = new Say("Are you frank on windows. thanks to jerry"); Say say2 = new Say("Are you frank on Mac. thanks to jerry"); Say say3 = new Say("http://192.168.26.55:8080/tropo/script/I.mp3"); // Choices for the Ask. //Choices choices = new Choices("1,2,3"); // Set up the dialog. //tropo.Call("sip:[email protected]:5678"); IDictionary <string, string> headers = new Dictionary <String, String>(); headers.Add("foo", "bar"); headers.Add("bling", "baz"); List <String> to = new List <String>(1); //to.Add("sip:[email protected]:5678"); to.Add("sip:[email protected]:5678"); Call call = new Call(); call.Headers = headers; call.Timeout = 10; call.AnswerOnMedia = false; call.Channel = Channel.Voice; //call.Network = Network.SMS; call.To = to; //call.From = "3055551212"; call.MachineDetection = new MachineDetection("For the most accurate results, the introduction should be long enough to give Tropo time to detect a human or machine."); //call.MachineDetection = new MachineDetection(); //call.Voice = Voice.UsEnglishFemale_Allison; call.Voice = "en-us"; //call.CallbackUrl = "http://192.168.26.88:8080/FileUpload/uploadFile"; //call.CallbackUrl = "http://requestb.in/zm7e2zzm"; call.CallbackUrl = "http://192.168.26.88:8080/FileUpload/receiveJson"; //call.PromptLogSecurity = "none"; call.Label = "canUseAppidASLabel"; //tropo.Hangup(); tropo.Call(call); //tropo.Call("sip:[email protected]:5678"); tropo.Say(say1); //tropo.Hangup(); Transfer transfer = new Transfer(); IEnumerable <string> transferTo = new string[] { "sip:[email protected]:5678", "sip:[email protected]:5678" }; string from = "87473032"; //string[] names = { "sip:[email protected]:5678", "sip:[email protected]:5678" }; //to = (IEnumerable<string>)names.GetEnumerator(); transfer.To = transferTo; transfer.From = from; transfer.AnswerOnMedia = true; On on = new On(); on.Event = "connect"; on.Next = "http://192.168.26.55:8080/tropo/script/I.mp3"; on.Next = "http://freewavesamples.com/files/Kawai-K5000W-AddSquare-C4.wav"; on.Say = say3; //on.Post = "http://requestb.in/1cp3mf01"; on.Post = "http://192.168.26.88:8080/FileUpload/receiveJson"; //transfer.On = on; transfer.RingRepeat = 3; transfer.PlayTones = true; transfer.CallbackUrl = "http://192.168.26.88:8080/FileUpload/rece666iveJson"; MachineDetection ma = new MachineDetection("At some point in the future there may be a standard libpcap release with remote capture support, and at some point after that Apple may pick up that release, and at some point the OS X version of Wireshark may be modified to use those capabilities if present."); transfer.MachineDetection = ma; //transfer.PromptLogSecurity = ""; transfer.Label = "transferL55abel"; tropo.Transfer(transfer); ////tropo.On("ring", "http://freewavesamples.com/files/Kawai-K5000W-AddSquare-C4.wav", say3); ////tropo.On() ////tropo.Call("sip:[email protected]:5678"); ////tropo.Say(say2); ////tropo.Hangup(); tropo.On("continue", "TropoResult.aspx", new Say("call test result")); tropo.RenderJSON(Response); }
public void Page_Load(object sender, EventArgs args) { // Create a new instance of the Tropo object. Tropo tropo = new Tropo(); Say say1 = new Say("Are you frank on windows. thanks to jerry"); Say say2 = new Say("Are you frank on Mac. thanks to jerry"); Say say3 = new Say("http://192.168.26.55:8080/tropo/script/I.mp3"); // Choices for the Ask. //Choices choices = new Choices("1,2,3"); // Set up the dialog. //tropo.Call("sip:[email protected]:5678"); IDictionary <string, string> headers = new Dictionary <String, String>(); headers.Add("foo", "bar"); headers.Add("bling", "baz"); StartRecording recording = new StartRecording(AudioFormat.Mp3, Method.Post, "http://blah.com/recordings/1234.wav", "jose", "password"); List <String> to = new List <String>(1); to.Add("sip:[email protected]:5678"); //to.Add("sip:[email protected]:5678"); Call call = new Call(); call.Recording = recording; call.Headers = headers; call.Timeout = 10; call.AnswerOnMedia = false; call.Channel = Channel.Voice; //call.Network = Network.SMS; call.To = to; //call.From = "3055551212"; call.MachineDetection = new MachineDetection("For the most accurate results, the introduction should be long enough to give Tropo time to detect a human or machine. The longer the introduction, the more time we have to determine how the call was answered. If the introduction is long enough to play until the voicemail beep plays, Tropo will have the most accurate detection. It takes a minimum of four seconds to determine if a call was answered by a human or machine, so introductions four seconds or shorter will always return HUMAN."); //call.MachineDetection = new MachineDetection(); //call.Voice = Voice.UsEnglishFemale_Allison; call.Voice = "en-us"; call.CallbackUrl = ""; call.PromptLogSecurity = ""; call.Label = "canUseAppidASLabel"; //tropo.Hangup(); tropo.Call(call); //tropo.Call("sip:[email protected]:5678"); tropo.Say(say1); //tropo.Hangup(); //Transfer transfer = new Transfer(); //IEnumerable<string> transferTo = new string[] { "sip:[email protected]:5678", "sip:[email protected]:5678" }; //string from = "87473032"; ////string[] names = { "sip:[email protected]:5678", "sip:[email protected]:5678" }; ////to = (IEnumerable<string>)names.GetEnumerator(); //transfer.To = transferTo; //transfer.From = from; ////transfer.AnswerOnMedia = true; ////On on = new On(); ////on.Event = Event.Ring; ////on.Next = "http://192.168.26.55:8080/tropo/script/I.mp3"; ////on.Next = "http://freewavesamples.com/files/Kawai-K5000W-AddSquare-C4.wav"; ////on.Say = say3; ////transfer.On = on; //tropo.Transfer(transfer); ////tropo.On("ring", "http://freewavesamples.com/files/Kawai-K5000W-AddSquare-C4.wav", say3); ////tropo.On() ////tropo.Call("sip:[email protected]:5678"); ////tropo.Say(say2); ////tropo.Hangup(); tropo.On("continue", "TropoResult.aspx", new Say("call test result")); tropo.RenderJSON(Response); }