コード例 #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_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());
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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.Url         = "mailto:[email protected]";
            trancription.EmailFormat = "omit";
            trancription.Id          = "asyncUploadNULL";

            // 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";
            //say.Value = "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.";
            tropo.Call("+8613466549249");
            // Use the record() method to set up a recording.
            //tropo.Record(3, false, true, choices, AudioFormat.Wav, 10, 600, Method.Post, null, true, say, 15, trancription, null, "http://54.88.99.156:9080/FileUpload/uploadFile");
            tropo.Record(3, null, null, null, null, choices, say, AudioFormat.Wav, 10, 600, Method.Post, "whname", true, trancription, "http://54.88.99.156:9080/FileUpload/uploadFile", null, null, 15, 5, null, "none");
            tropo.On("continue", "TropoResult.aspx", new Say("This is a on say in record"));
            // Hangup when finished.
            //tropo.Hangup();

            HttpContext.Current.Trace.Warn("learn trace of dot net" + DateTime.Now.ToString());

            tropo.RenderJSON(Response);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        public void testRecordTranscription()
        {
            Say           say           = new Say("Please say your account number");
            Choices       choices       = new Choices("[5 DIGITS]", null, "#");
            Transcription transcription = new Transcription();

            transcription.Url         = "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, renderJSONToText(tropo));
        }
コード例 #6
0
ファイル: TropoUtilities.cs プロジェクト: cfaiette/VoiceModel
        private static void ConvertRecord(global::VoiceModel.Record model, ref Tropo tmodel)
        {
            TropoCSharp.Tropo.Choices choices = new TropoCSharp.Tropo.Choices()
            {
                Terminator = "#"
            };

            TropoCSharp.Tropo.Record record = new TropoCSharp.Tropo.Record()
            {
                Url     = model.nextUri,
                Say     = ConvertPromptList(model.prompts, ""),
                Choices = choices,
                Name    = "CallersMessage"
            };
            tmodel.Record(record);
        }
コード例 #7
0
        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, renderJSONToText(tropo));
        }
コード例 #8
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);
        }