Ask is essentially a say that requires input; it requests information from the caller and waits for a response.
Inheritance: TropoBase
        public void testAskFromObject()
        {
            Say say = new Say("Please enter your 5 digit zip code.");
            Choices choices = new Choices("[5 DIGITS]");
            Ask ask = new Ask(choices, "foo", say);

            Tropo tropo = new Tropo();
            tropo.Ask(ask);
            Assert.AreEqual(this.askJson, tropo.RenderJSON());
        }
示例#2
0
        /// <summary>
        /// Sends a prompt to the user and optionally waits for a response. 
        /// </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="choices">The grammar to use in recognizing and validating input.</param>
        /// <param name="minConfidence">How confident should Tropo be in a speech recognition match?</param>
        /// <param name="name">identifies the return value of an ask, so you know the context for the returned information.</param>
        /// <param name="required">Is input required here?</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>
        public void Ask(int? attempts, bool? bargein, Choices choices, int? minConfidence, string name, bool? required, Say say, float? timeout)
        {
            Ask ask = new Ask();
            ask.Attempts = attempts;
            ask.Bargein = bargein;
            ask.Choices = choices;
            ask.MinConfidence = minConfidence;
            ask.Name = name;
            ask.Required = required;
            ask.Voice = String.IsNullOrEmpty(this.Voice) ? null : this.Voice;
            ask.Say = say;
            ask.Timeout = timeout;

            Serialize(ask, "ask");
        }
        public void testAskWithOptions()
        {
            Say say = new Say("Please enter your 5 digit zip code.");
            Choices choices = new Choices("[5 DIGITS]");
            Ask ask = new Ask();
            ask.Choices = choices;
            ask.Name = "foo";
            ask.Say = say;
            ask.Timeout = 30;
            ask.Required = true;
            ask.MinConfidence = 30;
            ask.Attempts = 1;
            ask.Bargein = false;

            Tropo tropo = new Tropo();
            tropo.Ask(ask);
            Assert.AreEqual(this.askJsonWithOptions, tropo.RenderJSON());
        }
        public void testAskWithOptions()
        {
            Say say = new Say("Please enter your 5 digit zip code.");
            Choices choices = new Choices("[5 DIGITS]");
            Ask ask = new Ask();
            ask.choices = choices;
            ask.name = "foo";
            ask.say = say;
            ask.timeout = 30;
            ask.required = true;
            ask.minConfidence = 30;
            ask.attempts = 1;
            ask.bargein = false;

            Tropo tropo = new Tropo();
            tropo.ask(ask);
            Assert.AreEqual(this.askJsonWithOptions, TropoJSON.render(tropo));
        }
        /// <summary>
        /// Overload method for Ask that allows events to be set via allowSignals.
        /// </summary>
        /// <param name="attempts">How many times the caller can attempt input before an error is thrown.</param>
        /// <param name="allowSignals">Allows for the assignment of an interruptable signal for this Tropo function</param>
        /// <param name="bargein">Should the user be allowed to barge in before TTS is complete?</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="choices">The grammar to use in recognizing and validating input</param>
        /// <param name="minConfidence">How confident should Tropo be in a speech reco match?</param>
        /// <param name="name">Identifies the return value of an Ask, so you know the context for the returned information.</param>
        /// <param name="recognizer">Tells Tropo what language to listen for</param>
        /// <param name="required">Is input required here?</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>
        public void Ask(int? attempts, Array allowSignals, bool? bargein, int? interdigitTimeout, Choices choices, int? minConfidence, string name, string recognizer, bool? required, Say say, float? timeout)
        {
            Ask ask = new Ask();
            ask.Attempts = attempts;
            ask.allowSignals = allowSignals;
            ask.Bargein = bargein;
            ask.Choices = choices;
            ask.InterdigitTimeout = interdigitTimeout;
            ask.MinConfidence = minConfidence;
            ask.Name = name;
            ask.Recognizer = recognizer;
            ask.Required = required;
            ask.Voice = String.IsNullOrEmpty(this.Voice) ? null : this.Voice;
            ask.Say = say;
            ask.Timeout = timeout;

            Serialize(ask, "ask");
        }
示例#6
0
 /// <summary>
 /// Overload for Ask that allows an Ask object to be passed.
 /// </summary>
 /// <param name="ask">An Ask object.</param>
 public void Ask(Ask ask)
 {
     Ask(ask.Attempts, ask.Bargein, ask.Choices, ask.MinConfidence, ask.Name, ask.Required, ask.Say, ask.Timeout);
 }
示例#7
0
 /// <summary>
 /// Overload for Ask that allows an Ask object to be passed.
 /// </summary>
 /// <param name="ask">An Ask object.</param>
 public void Ask(Ask ask)
 {
     Ask(ask.Attempts, ask.Bargein, ask.Choices, ask.MinConfidence, ask.Name, ask.Required, ask.Say, ask.Timeout);
 }
示例#8
0
 /// <summary>
 /// Overload for Ask that allows an Ask object to be passed.
 /// </summary>
 /// <param name="ask">An Ask object.</param>
 public void ask(Ask ask)
 {
     this.ask(ask.attempts, ask.bargein, ask.choices, ask.minConfidence, ask.name, ask.required, ask.say, ask.timeout);
 }
示例#9
0
        /// <summary>
        /// Overload method for Ask that allows an array of events to be used.
        /// </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="choices">The grammar to use in recognizing and validating input</param>
        /// <param name="minConfidence">How confident should Tropo be in a speech reco match?</param>
        /// <param name="name">Identifies the return value of an Ask, so you know the context for the returned information.</param>
        /// <param name="required">Is input required here?</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="events">??</param>
        public void ask(int? attempts, bool? bargein, Choices choices, int? minConfidence, string name, bool? required, Say say, float? timeout, Array events)
        {
            Ask ask = new Ask();
            ask.attempts = attempts;
            ask.bargein = bargein;
            ask.choices = choices;
            ask.minConfidence = minConfidence;
            ask.name = name;
            ask.required = required;

            if (!String.IsNullOrEmpty(this.Voice))
            {
                say.voice = this.Voice;
            }

            ask.say = say;
            ask.timeout = timeout;

            serialize(ask, "ask");

            // TODO: How is the events array supposed to be added to the Tropo object?
        }
示例#10
0
        /// <summary>
        /// Sends a prompt to the user and optionally waits for a response. 
        /// </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="choices">The grammar to use in recognizing and validating input.</param>
        /// <param name="minConfidence">How confident should Tropo be in a speech recognition match?</param>
        /// <param name="name">identifies the return value of an ask, so you know the context for the returned information.</param>
        /// <param name="required">Is input required here?</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>
        public void ask(int? attempts, bool? bargein, Choices choices, int? minConfidence, string name, bool? required, Say say, float? timeout)
        {
            Ask ask = new Ask();
            ask.attempts = attempts;
            ask.bargein = bargein;
            ask.choices = choices;
            ask.minConfidence = minConfidence;
            ask.name = name;
            ask.required = required;

            if(!String.IsNullOrEmpty(this.Voice))
            {
                say.voice = this.Voice;
            }

            ask.say = say;
            ask.timeout = timeout;

            serialize(ask, "ask");
        }
示例#11
0
        /// <summary>
        /// Overload method for Ask that allows an array of events to be used.
        /// </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="choices">The grammar to use in recognizing and validating input</param>
        /// <param name="minConfidence">How confident should Tropo be in a speech reco match?</param>
        /// <param name="name">Identifies the return value of an Ask, so you know the context for the returned information.</param>
        /// <param name="required">Is input required here?</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="events">??</param>
        public void Ask(int? attempts, bool? bargein, Choices choices, int? minConfidence, string name, bool? required, Say say, float? timeout, Array events)
        {
            Ask ask = new Ask();
            ask.Attempts = attempts;
            ask.Bargein = bargein;
            ask.Choices = choices;
            ask.MinConfidence = minConfidence;
            ask.Name = name;
            ask.Required = required;
            ask.Voice = String.IsNullOrEmpty(this.Voice) ? null : this.Voice;
            ask.Say = say;
            ask.Timeout = timeout;

            Serialize(ask, "ask");

            // TODO: How is the events array supposed to be added to the Tropo object?
        }