当前位置: 首页>>代码示例>>C#>>正文


C# Tropo.Hangup方法代码示例

本文整理汇总了C#中TropoCSharp.Tropo.Tropo.Hangup方法的典型用法代码示例。如果您正苦于以下问题:C# Tropo.Hangup方法的具体用法?C# Tropo.Hangup怎么用?C# Tropo.Hangup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TropoCSharp.Tropo.Tropo的用法示例。


在下文中一共展示了Tropo.Hangup方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Page_Load

        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.Uri = "mailto:[email protected]";
            trancription.EmailFormat = "omit";

            // 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";

            // Use the record() method to set up a recording.
            tropo.Record(3, false, true, choices, AudioFormat.Wav, 10, 60, Method.Post, null, true, say, 5, trancription, null, "http://somehost.com/record.aspx");

            // Hangup when finished.
            tropo.Hangup();
            
            // Render the JSON for Tropo to consume.
            Response.Write(tropo.RenderJSON());
        }
开发者ID:Shannon-McCoy,项目名称:tropo-webapi-csharp,代码行数:28,代码来源:RecordWithTranscription.aspx.cs

示例2: Page_Load

        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());
            }
        }
开发者ID:Shannon-McCoy,项目名称:tropo-webapi-csharp,代码行数:46,代码来源:Conference.aspx.cs

示例3: AskWithEvents

 public void AskWithEvents()
 {
     Tropo tropo = new Tropo();
     string[] signals = new string[] { "endCall", "tooLong" };
     Say say = new Say("This is an Ask test with events. Please enter 1, 2 or 3.");
     Choices choices = new Choices("1,2,3");
     tropo.Ask(5, signals, false, choices, null, "test", true, say, 30);
     tropo.Hangup();
     Assert.AreEqual(this.askJsonWithEvents, tropo.RenderJSON());
 }
开发者ID:khalidabuhakmeh,项目名称:tropo-webapi-csharp,代码行数:10,代码来源:TropoClassesTests.cs

示例4: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // Play an error message to the caller.
            tropo.Say("I'm sorry, there was an error. Please try you call again later.");

            // End the current session.
            tropo.Hangup();

            // Render JSON for Tropo to consume.
            Response.Write(tropo.RenderJSON());
        }
开发者ID:Shannon-McCoy,项目名称:tropo-webapi-csharp,代码行数:14,代码来源:Error.aspx.cs

示例5: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            using (StreamReader reader = new StreamReader(Request.InputStream))
            {
                // Get the JSON submitted from Tropo. 
                string resultJSON = TropoUtilities.parseJSON(reader);

                // Create a new instance of the Tropo object.
                Tropo tropo = new Tropo();

                try
                {

                    // Create a new Result object and pass in the JSON submitted from Tropo.
                    Result tropoResult = new Result(resultJSON);

                    // Parse the Actions object and get the value property.
                    JContainer Actions = TropoUtilities.parseActions(tropoResult.Actions);

                    // Get the input submited by the user.
                    // This value can be used to query a database, hit a web service, etc.
                    // In the example, we'll simply read the number back to the caller.
                    string answer = TropoUtilities.removeQuotes(Actions["value"].ToString());
                    tropo.Say("You entered, " + TropoUtilities.addSpaces(answer) + ". Goodbye");

                }

                // In the event of an error in rendering the page, play an error message to the caller.
                catch (JsonReaderException ex)
                {
                    tropo.Say("An error occured. " + ex.Message);
                }

                catch (Exception ex)
                {
                    tropo.Say("An error occured. " + ex.Message);
                }

                finally
                {
                    // Render JSON for Tropo to consume.
                    tropo.Hangup();
                    Response.Write(tropo.RenderJSON());

                }
            }
        }
开发者ID:Shannon-McCoy,项目名称:tropo-webapi-csharp,代码行数:47,代码来源:Answer.aspx.cs

示例6: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // 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.");

            // Choices for the Ask.
            Choices choices = new Choices("1,2,3");

            // Set up the dialog.
            tropo.Ask(5, signals, false, choices, null, "test", true, say, 30);
            tropo.Hangup();

            // Render the dialog JSON for Tropo to consume.
            Response.Write(tropo.RenderJSON());
        }
开发者ID:khalidabuhakmeh,项目名称:tropo-webapi-csharp,代码行数:21,代码来源:AskTest.aspx.cs

示例7: Page_Load

        protected void Page_Load(object sender, EventArgs e)
        {
            using (StreamReader sr = new StreamReader(Request.InputStream))
            {
                // Get the JSON submitted from Tropo.
                string sessionJSON = GetJSON(sr);

                // Create a new Session object and pass in the JSON submitted from Tropo.
                Session tropoSession = new Session(sessionJSON);

                // Create a new instance of the Tropo object.
                Tropo tropo = new Tropo();

                // Call an outbound number and create a conference.
                tropo.Call(tropoSession.Parameters["callToNumber"]);
                tropo.Say("Welcome to the conference.");
                tropo.Conference(tropoSession.Parameters["conferenceID"], false, "testConference", false, true, "#");
                tropo.Say("Thanks for joining our conference. Goodbye.");
                tropo.Hangup();

                // Render the JSON for Tropo to consume.
                Response.Write(tropo.RenderJSON());
            }
        }
开发者ID:khalidabuhakmeh,项目名称:tropo-webapi-csharp,代码行数:24,代码来源:Conference.aspx.cs


注:本文中的TropoCSharp.Tropo.Tropo.Hangup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。