Example #1
0
 /// <summary>
 /// Adds a Say Element to the Response.
 /// </summary>
 /// <param name="thingToSay">The thing to say.</param>
 /// <param name="voiceSex">The voice sex.</param>
 /// <param name="voiceLanguage">The voice language.</param>
 /// <param name="loopTimes">The loop times.</param>
 /// <returns></returns>
 public TwiMLBuilder Say(string thingToSay, SayVoice voiceSex = SayVoice.man, SayLanguage voiceLanguage = SayLanguage.en, uint loopTimes = 1)
 {
     return AddVerb(Verb.Say,
         thingToSay,
         new
         {
             voice = voiceSex,
             language = voiceLanguage,
             loop = loopTimes
         });
 }
Example #2
0
        /// <summary>
        /// Adds a Gather element with a nested say element.
        /// </summary>
        /// <param name="textToSay">The text to say.</param>
        /// <param name="actionUrl">The action URL.</param>
        /// <param name="actionMethod">The action method.</param>
        /// <param name="timeoutSeconds">The timeout seconds.</param>
        /// <param name="keyThatFinishes">The key that finishes.</param>
        /// <param name="numDigitsToCollect">The num digits to collect.</param>
        public TwiMLBuilder GatherWhileSaying(string textToSay, SayVoice voiceSex = SayVoice.man, SayLanguage voiceLanguage = SayLanguage.en, int loopTimes = 1,
            string actionUrl = "", ActionMethod actionMethod = ActionMethod.POST, uint timeoutSeconds = 5,
            char keyThatFinishes = '#', uint numDigitsToCollect = 1000)
        {
            var textChild = Tuple.Create(Verb.Say, textToSay,
                (object)new
                {
                    voice = voiceSex,
                    language = voiceLanguage,
                    loop = loopTimes
                });

            return Gather(actionUrl, actionMethod, timeoutSeconds, keyThatFinishes, numDigitsToCollect, textChild);
        }