Exemplo n.º 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());
        }
Exemplo n.º 2
0
        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);
        }
        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());
        }
Exemplo n.º 4
0
 /// <summary>
 /// Overload for Record that allows a Record object to be passed.
 /// </summary>
 /// <param name="record">A Record object.</param>
 public void Record(Record record)
 {
     Record(record.Attempts, record.Bargein, record.Beep, record.Choices, record.Format, record.MaxSilence, record.MaxTime, record.Method, record.Password, record.Required, record.Say, record.Timeout, record.Username, record.Url);
 }
Exemplo n.º 5
0
        /// <summary>
        /// Overload for Record that allows events to be set via allowSignals.
        /// </summary>
        /// <param name="attempts"></param>
        /// <param name="allowSignals">Allows for the assignment of an interruptable signal for this Tropo function</param>
        /// <param name="bargein"></param>
        /// <param name="beep"></param>
        /// <param name="choices"></param>
        /// <param name="format"></param>
        /// <param name="maxSilence"></param>
        /// <param name="maxTime"></param>
        /// <param name="method"></param>
        /// <param name="password"></param>
        /// <param name="required"></param>
        /// <param name="say"></param>
        /// <param name="timeout"></param>
        /// <param name="transcription"></param>
        /// <param name="username"></param>
        /// <param name="url"></param>
        public void Record(int? attempts, Array allowSignals, bool? bargein, bool? beep, Choices choices, string format, float? maxSilence, float? maxTime, string method, string password, bool? required, Say say, float? timeout, Transcription transcription, string username, string url)
        {
            Record record = new Record();
            record.Attempts = attempts;
            record.allowSignals = allowSignals;
            record.Bargein = bargein;
            record.Beep = beep;
            record.Choices = choices;
            record.Format = format;
            record.MaxSilence = maxSilence;
            record.MaxTime = maxTime;
            record.Method = method;
            record.Password = password;
            record.Required = required;
            record.Say = say;
            record.Timeout = timeout;
            record.Transcription = transcription;
            record.Url = url;
            record.Username = username;

            Serialize(record, "record");
        }
Exemplo n.º 6
0
 /// <summary>
 /// Overload for Record that allows a Record object to be passed.
 /// </summary>
 /// <param name="record">A Record object.</param>
 public void record(Record record)
 {
     this.record(record.attempts, record.bargein, record.beep, record.choices, record.format, record.maxSilence, record.maxTime, record.method, record.password, record.required, record.say, record.timeout, record.username, record.url);
 }
Exemplo n.º 7
0
        /// <summary>
        /// Overload for Record that allows a Transcription object to be passed.
        /// </summary>
        /// <param name="attempts">How many times the caller can attempt input before an error is thrown.</param>
        /// <param name="bargein">Should the user be allowed to barge in before TTS is complete?</param>
        /// <param name="beep">When set to true, callers will hear a tone indicating the recording has begun.</param>
        /// <param name="choices">The grammar to use in recognizing and validating input.</param>
        /// <param name="format">This specifies the format for the audio recording.</param>
        /// <param name="maxSilence">The maximum amount of time, in seconds, to wait for silence after a user stops speaking.</param>
        /// <param name="maxTime">The maximum amount of time, in seconds, the user is allotted for input.</param>
        /// <param name="method">This defines how you want to send the audio file.</param>
        /// <param name="password">This identifies the FTP account password.</param>
        /// <param name="required">Determines whether Tropo should move on to the next action.</param>
        /// <param name="say">This determines what is played or sent to the caller.</param>
        /// <param name="timeout">The amount of time Tropo will wait, in seconds, after sending or playing the prompt for the user to begin a response.</param>
        /// <param name="transcription">This allows you to submit a recording to be transcribed and specifies where to send the transcription.</param>
        /// <param name="username">This identifies the FTP account username.</param>
        /// <param name="url">This is the destination URL to send the recording.</param>
        public void record(int? attempts, bool? bargein, bool? beep, Choices choices, string format, float? maxSilence, float? maxTime, string method, string password, bool? required, Say say, float? timeout, Transcription transcription, string username, string url)
        {
            Record record = new Record();
            record.attempts = attempts;
            record.bargein = bargein;
            record.beep = beep;
            record.choices = choices;
            record.format = format;
            record.maxSilence = maxSilence;
            record.maxTime = maxTime;
            record.method = method;
            record.password = password;
            record.required = required;
            record.say = say;
            record.timeout = timeout;
            record.transcription = transcription;
            record.url = url;
            record.username = username;

            serialize(record, "record");
        }
Exemplo n.º 8
0
        public void testNewRecordFromObject()
        {
            Say say = new Say("Please say your account number");
            Choices choices = new Choices("[5 DIGITS]", null, "#");
            Record record = new Record();
            record.choices = choices;
            record.format = AudioFormat.wav;
            record.method = Method.post;
            record.say = say;
            record.required = true;

            Tropo tropo = new Tropo();
            tropo.record(record);
            Assert.AreEqual(this.recordJson, TropoJSON.render(tropo));
        }