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());
        }
Exemplo n.º 3
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.º 4
0
        /// <summary>
        /// Overload for Record that allows all events
        /// </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="interdigitTimeout">Defines how long to wait - in seconds - between key presses to determine the user has stopped entering input.</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, Array allowSignals, bool?bargein, bool?beep, Choices choices, string format, int?interdigitTimeout, 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.InterdigitTimeout = interdigitTimeout;
            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.º 5
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");
        }