public void Page_Load(object sender, EventArgs args)
        {
            using (StreamReader reader = new StreamReader(Request.InputStream))
            {
                Tropo tropo = new Tropo();

                try
                {
                    IEnumerable <string> redirect2     = new string[] { "sip:[email protected]" };
                    IEnumerable <string> redirect1     = new string[] { "sip:[email protected]:5678" };
                    IEnumerable <string> redirectfrank = new string[] { "sip:[email protected]:5678" };
                    string too  = "sip:[email protected]:5678";      // in my test, X-Lite client did not success
                    string too2 = "sip:[email protected]:5678"; // use another application success
                    tropo.Redirect(too2, "redirectwindows", null);
                }

                catch (JsonReaderException)
                {
                    tropo.Say("Sorry, an error occured. I choked on some JSON");
                }

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

                finally
                {
                    tropo.RenderJSON(Response);
                }
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // Set the voice property.
            //tropo.Voice = Voice.UsEnglishMale_Steven;

            Say say = new Say("Please record your 45 second message after the 32 beeps, press pound when complete.");

            tropo.Say(say);

            StartRecording startRecording = new StartRecording();

            startRecording.AsyncUpload = true;
            tropo.StartRecording(false, AudioFormat.Wav, Method.Post, "http://192.168.26.88:8080/FileUpload/uploadFile", "", "", "", "plain", "");

            //Say say2 = new Say("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.");
            Say say2 = new Say("I love beijing, hi tropo new version");

            tropo.Say(say2);


            tropo.StopRecording();


            Say say3 = new Say("is it wait 8 seconds?");

            tropo.Say(say3);

            tropo.RenderJSON(Response);
        }
        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());
                }
            }
        }
        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, renderJSONToText(tropo));
        }
        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 numberToDial    = tropoSession.Parameters.Get("numberToDial");
                    string textMessageBody = tropoSession.Parameters.Get("textMessageBody");

                    string sendFromNumber = "+17754641173";
                    string channel        = "TEXT";
                    string network        = "SMS";

                    // Send an outbound message.
                    //tropo.Call(numberToDial, sendFromNumber, network, channel, true, 60, null);
                    tropo.Call(numberToDial);
                    tropo.Say("You will hear current time " + textMessageBody);
                    tropo.Hangup();
                }

                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
                {
                    tropo.RenderJSON(Response);
                }
            }
        }
        public void testGeneralLogSecurity()
        {
            Tropo tropo = new Tropo();

            tropo.GeneralLogSecurity("suppress");
            tropo.Say("this is not logged");
            tropo.GeneralLogSecurity("none");
            tropo.Say("this will be logged");

            Assert.AreEqual(this.generalLogSecurityJson, renderJSONToText(tropo));
        }
        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);
            }
        }
        public void Page_Load(object sender, EventArgs args)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // Call the say method of the Tropo object and give it a prompt to say.
            tropo.Say("Hello World!");
            tropo.Say("hello London", null, null, "shname", null, null, null);
            tropo.Say("hello Tokyo", null, null, "shname", null, null, "none");
            tropo.Say("hello Moscow", null, null, "shname", null, null, "suppress");

            //HttpContext.Current.Trace.Warn("tropo.JSONToTe666666xt() is " + tropo.JSONToText());

            tropo.RenderJSON(Response);
        }
示例#9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // Set the voice property.
            tropo.Voice = Voice.UsEnglishMale_Steven;

            Say say = new Say("Please record your 45 second message after the beep, press pound when complete.");

            tropo.Say(say);

            Record record = new Record()
            {
                Bargein = true,
                Beep    = true,
                Say     = new Say(""),
                Format  = "audio/mp3",
                MaxTime = 45,
                Choices = new Choices("", "dtmf", "#"),
                Url     = "../UploadRecording"
            };

            tropo.Record(record);

            // Render JSON for Tropo to consume.
            Response.Write(tropo.RenderJSON());
        }
示例#10
0
        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 = Result.getResult(resultJSON);

                    // Parse the Actions object and get the value property.

                    // 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.

                    foreach (var item in tropoResult.Actions)
                    {
                        string answer = item.Value;
                        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
                {
                    tropo.Hangup();
                    tropo.RenderJSON(Response);
                }
            }
        }
示例#11
0
 private static void ConvertPrompt(global::VoiceModel.Prompt prompt, string json, ref Tropo tmodel, string sayOnEvent = null)
 {
     foreach (IAudio audio in prompt.audios)
     {
         TropoCSharp.Tropo.Say s = AudioToSay(audio, json);
         tmodel.Say(s);
     }
 }
示例#12
0
        private static string ConversionError()
        {
            Tropo tmodel = new Tropo();

            tmodel.Say("Error translating VoiceModel to Tropo object.");

            return(tmodel.RenderJSON());
        }
        public void testSay()
        {
            Tropo tropo = new Tropo();

            tropo.Say("hello Moscow", null, null, "shname", null, null, "suppress");

            Assert.AreEqual(this.sayJson, renderJSONToText(tropo));
        }
示例#14
0
        public void Page_Load(object sender, EventArgs args)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // Call the say method of the Tropo object and give it a prompt to say.
            tropo.Say("Welcome To Beijing, who are you ");

            tropo.RenderJSON(Response);
        }
        public void Page_Load(object sender, EventArgs args)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // Call the say method of the Tropo object and give it a prompt to say.
            tropo.Say("Hello World!");

            // Render the JSON for Tropo to consume.
            Response.Write(tropo.RenderJSON());
        }
        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, renderJSONToText(tropo));
        }
示例#17
0
        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 class.
                Tropo tropo = new Tropo();

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

                    // Get Actions container and parse.
                    // JContainer Actions = TropoUtilities.parseActions(tropoResult.Actions);

                    //A simple example showing how to access properties of the Result object.
                    tropo.Say("The State of the current session is " + tropoResult.State);
                    tropo.Say("The Sequence of this Result payload is " + tropoResult.Sequence);
                    tropo.Say("The session ID for the current session is is " + TropoUtilities.addSpaces(tropoResult.SessionId));
                    //tropo.Say("The value selected by the caller is " + TropoUtilities.removeQuotes(Actions["value"].ToString()));
                }

                catch (JsonReaderException)
                {
                    tropo.Say("Sorry, an error occured. I choked on some JSON");
                }

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

                finally
                {
                    tropo.RenderJSON(Response);
                }
            }
        }
        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();

            tropo.RenderJSON(Response);
        }
        public void testConferenceWithPromptsAndpromptLogSecurity()
        {
            Tropo tropo = new Tropo();

            string[] signals = new string[] { "conferenceOver" };
            tropo.Call("3035551212");
            tropo.Say("Welcome to the conference.");
            JoinPrompt  joinPrompt  = new JoinPrompt("somebody join the conference");
            LeavePrompt leavePrompt = new LeavePrompt("some one leave the conference");

            tropo.Conference("123456789098765432", signals, 4, false, "testConference", false, true, "#", joinPrompt, leavePrompt, "none");

            Assert.AreEqual(this.conferenceJsonWithWithPromptsAndpromptLogSecurity, renderJSONToText(tropo));
        }
        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");

            IDictionary <string, string> headers = new Dictionary <String, String>();

            headers.Add("P-Header", "value goes here");
            headers.Add("Remote-Party-ID", "\"John Doe\"<sip:[email protected]>;party=calling;id-type=subscriber;privacy=full;screen=yes");

            //Answer answer = new Answer();
            //answer.Headers = headers;

            tropo.Answer(headers);
            tropo.Say(say1);
            tropo.RenderJSON(Response);
        }
示例#21
0
        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)
        {
            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 class.
                Tropo tropo = new Tropo();

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

                    tropo.Say("The Tropo Session ID is " + tropoSession.Id);
                    tropo.Say("The channnel of the called party is " + tropoSession.To.Channel);
                    tropo.Say("The channel of the calling party is " + tropoSession.From.Channel);
                    tropo.Say("This initial text sent with the call is " + tropoSession.InitialText);
                    tropo.Say("The From SIP header on the call is " + TropoUtilities.removeQuotes(tropoSession.Headers["From"]));
                }

                catch (JsonReaderException)
                {
                    tropo.Say("Sorry, an error occured. I choked on some JSON");
                }

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

                finally
                {
                    Response.Write(tropo.RenderJSON());
                }
            }
        }
示例#23
0
        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);
                Console.WriteLine("resultJSONis:" + resultJSON);
                HttpContext.Current.Trace.Warn(DateTime.Now.ToString() + " I Made It HerresultJSONis" + resultJSON);

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

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

                    // Get Actions container and parse.
                    List <TropoCSharp.Tropo.Action> Actions = tropoResult.Actions;

                    tropo.Say("session id is beijing " + tropoResult.SessionId);

                    foreach (TropoCSharp.Tropo.Action item in Actions)
                    {
                        tropo.Say("action Name is: " + item.Name);
                        tropo.Say("attempts is " + item.Attempts);
                        tropo.Say("disposition is " + item.Disposition);
                        tropo.Say("ConnectedDuration is " + item.ConnectedDuration);
                        tropo.Say("Duration is " + item.Duration);
                        tropo.Say("confidence is " + item.Confidence);
                        tropo.Say("interpretation is " + item.Interpretation);
                        tropo.Say("utterance is " + item.Utterance);
                        tropo.Say("value is " + item.Value);
                        tropo.Say("concept is: " + item.Concept);
                        //tropo.Say("xml is " + item.xml);
                        tropo.Say("uploadStatus is " + item.UploadStatus);
                        tropo.Say("inner user type is " + item.UserType);
                    }
                    tropo.Say("user type is " + tropoResult.UserType);
                }

                catch (JsonReaderException)
                {
                    tropo.Say("Sorry, an error occured. I choked on some JSON");
                }

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

                finally
                {
                    tropo.RenderJSON(Response);
                }
            }
        }
        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 class.
                Tropo tropo = new Tropo();

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

                    //tropo.Say("The Tropo Session ID is " + tropoSession.Id);
                    //tropo.Say("The channnel of the called party is " + tropoSession.To.Channel);
                    //tropo.Say("The channel of the calling party is " + tropoSession.From.Channel);
                    //tropo.Say("This initial text sent with the call is " + tropoSession.InitialText);
                    //tropo.Say("The From SIP header on the call is " + TropoUtilities.removeQuotes(tropoSession.Headers["From"]));


                    string fromName    = tropoSession.From.Name;
                    string fromChannel = tropoSession.From.Channel;
                    string toName      = tropoSession.To.Name;
                    string toE164Id    = tropoSession.To.E164Id;
                    string fromE164Id  = tropoSession.From.E164Id;

                    string accountId = tropoSession.AccountId;
                    string callId    = tropoSession.CallId;

                    tropo.Say("from Name is " + fromName);
                    tropo.Say("to E164 Id is " + toE164Id);
                    tropo.Say("fro mE164Id is " + fromE164Id);

                    tropo.Say("account Id is " + accountId);
                    tropo.Say("call Id is " + callId);


                    if (fromName.Contains("xiang"))
                    {
                        tropo.Say("Welcome frank");
                        tropo.Say("Just beep beep beep");
                    }
                    else
                    {
                        // tropo.Say("Sorry Alex");
                        HttpContext.Current.Trace.Warn(fromName + " You had been rejected cruely ");
                        tropo.Reject();
                    }
                }

                catch (JsonReaderException)
                {
                    tropo.Say("Sorry, an error occured. I choked on some JSON");
                }

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

                finally
                {
                    tropo.RenderJSON(Response);
                    //HttpContext.Current.Trace.Warn("tropo.JSONToTe666666xt() is" + tropo.JSONToText());
                    //Response.Write("{\"tropo\":[{ \"reject\":null}]}");
                }
            }
        }
        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 numberToDial = tropoSession.Parameters.Get("numberToDial");
                    //numberToDial = "5093176303";
                    string sendFromNumber = tropoSession.Parameters.Get("sendFromNumber");
                    //sendFromNumber = "14082041999";
                    string channel         = tropoSession.Parameters.Get("channel");
                    string network         = tropoSession.Parameters.Get("network");
                    string textMessageBody = tropoSession.Parameters.Get("textMessageBody");

                    string[] week = new string[4];
                    week[0] = "http://artifacts.voxeolabs.net.s3.amazonaws.com/test/test.png";
                    week[1] = "this is 这是第二行";
                    week[2] = "https://www.travelchinaguide.com/images/photogallery/2012/beijing-tiananmen-tower.jpg";
                    week[3] = "Today is 13 Aug";
                    //week[3] = "https://me888dia.giphy.com/media/LHZyixOnHwDDy/giphy.gif";


                    string currenT = DateTime.Now.ToString("yyyy/MM/dd HH:MM tt");
                    Say    say     = new Say();
                    say.Value = "this is MMS test for webapi Csharp SDk sent @ " + currenT;
                    say.Media = week;



                    // Send an outbound message.
                    tropo.Call(numberToDial, sendFromNumber, network, channel, true, 60, null);
                    // tropo.Say(textMessageBody);
                    tropo.Say(say);

                    //tropo.RenderJSON(Response);
                }

                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
                {
                    tropo.RenderJSON(Response);
                }
            }
        }
示例#26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // Set the voice property.
            //tropo.Voice = Voice.UsEnglishMale_Steven;

            Say say = new Say("Please record your 45 second message after the beep, press pound when complete.");

            tropo.Say(say);

            RecordUrlTuple RecordUrlTuple1 = new RecordUrlTuple()
            {
                Url      = "http://fakeurl.one.com",
                Username = "******",
                Password = "******",
                Method   = "POST"
            };

            RecordUrlTuple RecordUrlTuple2 = new RecordUrlTuple()
            {
                Url = "http://192.168.26.88:8080/FileUpload/uploadFile",
                //Username = "******",
                //Password = ""
                //Method = "POST"
            };

            RecordUrlTuple RecordUrlTuple3 = new RecordUrlTuple()
            {
                Url      = "http://fakeurl.three.com",
                Password = "******",
                Method   = "PUT"
            };

            RecordUrlTuple RecordUrlTuple4 = new RecordUrlTuple()
            {
                Url      = "http://fakeurl.four.com",
                Password = "******",
                Method   = "put"
            };

            IEnumerable <RecordUrlTuple> recordingURL = new RecordUrlTuple[] { RecordUrlTuple1, RecordUrlTuple2, RecordUrlTuple3, RecordUrlTuple4 };

            Record record = new Record()
            {
                Bargein = true,
                Beep    = true,
                Say     = new Say("this is say in record"),
                Format  = "audio/mp3",
                MaxTime = 45,
                Choices = new Choices("", "dtmf", "#"),
                //Choices = new Choices("#"),
                //Url = "http://192.168.26.88:8080/FileUpload/uploadFile",
                RecordingURL = recordingURL
            };

            tropo.Record(record);

            tropo.RenderJSON(Response);
        }
示例#27
0
        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);
        }
        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);
        }