예제 #1
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;

            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());
        }
        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());
        }
        public void testRecordTranscription()
        {
            Say say = new Say("Please say your account number");
            Choices choices = new Choices("[5 DIGITS]", null, "#");
            Transcription transcription = new Transcription();

            transcription.Uri = "http://example.com/";
            transcription.Id = "foo";
            transcription.EmailFormat = "encoded";

            Tropo tropo = new Tropo();
            tropo.Record(1, false, true, choices, AudioFormat.Wav, 5, 30, Method.Post, "foo", true, say, 5, transcription, "bar", "http://example.com/");
            Assert.AreEqual(this.recordJsonWithTranscription, tropo.RenderJSON());
        }
        public void testNewRecordObjectWithOptionsInDifferentOrder()
        {
            Say say = new Say("Please say your account number");
            Choices choices = new Choices("[5 DIGITS]", null, "#");
            Record record = new Record();
            record.Say = say;
            record.Method = Method.Post;
            record.Choices = choices;
            record.Format = AudioFormat.Wav;
            record.Required = true;

            Tropo tropo = new Tropo();
            tropo.Record(record);
            Assert.AreEqual(this.recordJson, tropo.RenderJSON());
        }
        public void testNewRecord()
        {
            Say say = new Say("Please say your account number");
            Choices choices = new Choices("[5 DIGITS]", null, "#");

            Tropo tropo = new Tropo();
            tropo.Record(null, null, null, choices, AudioFormat.Wav, null, null, Method.Post, null, null, say, null, null, null);
        }