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


C# Tropo.Call方法代码示例

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


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

示例1: Page_Load

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

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

                    // Get parameters submitted with Session API call.
                    string sendToNumber = tropoSession.Parameters.Get("sendToNumber");
                    string sendFromNumber = tropoSession.Parameters.Get("sendFromNumber");
                    string channel = tropoSession.Parameters.Get("channel");
                    string network = tropoSession.Parameters.Get("network");
                    string msg = tropoSession.Parameters.Get("msg");

                    // Send an outbound message.
                    tropo.Call(sendToNumber, sendFromNumber, network, channel, true, 60, null, null);
                    tropo.Say(msg);

                    // Render the JSON for Tropo to consume.
                    Response.Write(tropo.RenderJSON());

                }

                catch (JsonReaderException ex)
                {
                    EventLog log = new EventLog();
                    log.Source = "TROPOWEBAPI";
                    log.WriteEntry("Tropo WebAPI Exception " + ex.Message, EventLogEntryType.Error);
                    Response.StatusCode = 500;
                    tropo.Say("An error occured in the application. Bad JSON");

                }

                catch (Exception ex)
                {
                    EventLog log = new EventLog();
                    log.Source = "TROPOWEBAPI";
                    log.WriteEntry("Tropo WebAPI Exception " + ex.Message, EventLogEntryType.Error);
                    Response.StatusCode = 500;
                    tropo.Say("An error occured in the application.");
                }

                finally
                {
                    Response.Write(tropo.RenderJSON());
                }
            }
        }
开发者ID:Shannon-McCoy,项目名称:tropo-webapi-csharp,代码行数:56,代码来源:OutboundSMS.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: 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

示例4: testToOnly

        public void testToOnly()
        {
            List<String> numbersToCall = new List<String>();
            numbersToCall.Add("3055195825");
            numbersToCall.Add("3054445567");

            Tropo tropo = new Tropo();
            tropo.Call(numbersToCall);
            Assert.AreEqual(this.callJson, tropo.RenderJSON());
        }
开发者ID:nSource,项目名称:tropo-webapi-csharp,代码行数:10,代码来源:TropoClassesTests.cs

示例5: testCallUsingCallObject

        public void testCallUsingCallObject()
        {
            Tropo tropo = new Tropo();

            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("3055195825");

            Call call = new Call();
            call.Recording = recording;
            call.Headers = headers;
            call.Timeout = 10;
            call.AnswerOnMedia = false;
            call.Channel = Channel.Text;
            call.Network = Network.SMS;
            call.To = to;
            call.From = "3055551212";

            tropo.Call(call);
            Assert.AreEqual(this.callJsonAllOptions, tropo.RenderJSON());
        }
开发者ID:nSource,项目名称:tropo-webapi-csharp,代码行数:26,代码来源:TropoClassesTests.cs

示例6: testCallUseAllOptions

        public void testCallUseAllOptions()
        {
            Tropo tropo = new Tropo();

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

            tropo.Call("3055195825", "3055551212", Network.SMS, Channel.Text, false, 10, headers, recording);
            Assert.AreEqual(this.callJsonAllOptions, tropo.RenderJSON());
        }
开发者ID:nSource,项目名称:tropo-webapi-csharp,代码行数:13,代码来源:TropoClassesTests.cs

示例7: testConferenceWithEvents

        public void testConferenceWithEvents()
        {
            Tropo tropo = new Tropo();
            string[] signals = new string[] { "conferenceOver" };
            tropo.Call("3035551212");
            tropo.Say("Welcome to the conference.");
            tropo.Conference("123456789098765432", signals, false, "testConference", false, true, "#");

            Assert.AreEqual(this.conferenceJsonWithEvents, tropo.RenderJSON());
        }
开发者ID:sanyaade,项目名称:tropo-webapi-csharp,代码行数:10,代码来源:TropoClassesTests.cs

示例8: testConference

        public void testConference()
        {
            Tropo tropo = new Tropo();
            tropo.Call("3035551212");
            tropo.Say("Welcome to the conference.");
            tropo.Conference("123456789098765432", false, "testConference", false, true, "#");
            tropo.Say("Thank you for joining the conference.");

            Assert.AreEqual(this.conferenceJson, tropo.RenderJSON());
        }
开发者ID:sanyaade,项目名称:tropo-webapi-csharp,代码行数:10,代码来源:TropoClassesTests.cs

示例9: testCallWithEvents

        public void testCallWithEvents()
        {
            Tropo tropo = new Tropo();

            string[] signals = new string[] { "tooLong", "callOver" };

            IDictionary<string, string> headers = new Dictionary<String, String>();
            headers.Add("x-foo", "bar");
            headers.Add("x-bling", "baz");

            tropo.Call("3055195825", signals, "3055551414", Network.Pstn, Channel.Voice, true, 60, headers, null);
            Assert.AreEqual(this.callJsonWithEvents, tropo.RenderJSON());
        }
开发者ID:sanyaade,项目名称:tropo-webapi-csharp,代码行数:13,代码来源:TropoClassesTests.cs


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