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, "#"); 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.")); } // Render the JSON for Tropo to consume. Response.Write(tropo.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. // Render JSON for Tropo to consume. Response.Write(tropo.RenderJSON()); }
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); // Render the JSON for Tropo to consume. Response.Write(tropo.RenderJSON()); }