protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            //tropo.Voice = Voice.UsEnglishFemale_Susan;

            // Create an array of signals - used to interupt the Ask.
            // string[] signals = new string[] {"endCall", "tooLong"};

            // A prompt to use with the Ask.
            Say say = new Say("This is an Ask test with events. Please enter 1, 2 or 3.");

            var says = new Collection <Say>();

            says.Add(new Say("Sorry, I did not hear anything.", "timeout"));
            says.Add(new Say("Don't think that was a year. ", "nomatch:1"));
            says.Add(new Say("Nope, still not a year.", "nomatch:2"));
            says.Add(new Say("No match 3.", "nomatch:3"));
            says.Add(new Say("What is your birth year?"));


            // Choices for the Ask.
            Choices choices = new Choices("[4 DIGITS]");

            // Set up the dialog.
            tropo.Ask(1, true, 3, choices, null, "year", true, says, 7);
            tropo.On(Event.Continue, "YourAge.aspx", null);   // Fires when the user provides valid input.
            tropo.On(Event.Incomplete, "FailAge.aspx", null); // Fires when the user provides valid input.

            //tropo.Hangup();

            tropo.RenderJSON(Response);
        }
        public void testAskMethodWithAllArguements()
        {
            Tropo tropo = new Tropo();

            tropo.Ask(1, false, new Choices("[5 DIGITS]"), 30, "foo", true, new Say("Please enter your 5 digit zip code."), 30);
            Assert.AreEqual(this.askJsonWithOptions, renderJSONToText(tropo));
        }
        public void testAskMethodWithLogArguements2()
        {
            Tropo tropo = new Tropo();

            // Create an array of signals - used to interupt the Ask.
            string[] signals = new string[] { "endCall", "tooLong" };
            tropo.Ask(5, signals, false, null, new Choices("[5 DIGITS]"), 30, "foo", Recognizer.UsEnglish, true, new Say("Please enter your 5 digit zip code."), 2, 3.0f, 4.0f, 30, "suppress", "mask", "XXDD-");
            Assert.AreEqual(this.askJsonWithLogArguements2, renderJSONToText(tropo));
        }
        private static string ConvertAsk(global::VoiceModel.Ask model)
        {
            Tropo tmodel = new Tropo();

            tmodel.Ask(3, true, ConvertGrammar(model.grammar), null, "result", null, ConvertPromptList(model.initialPrompt, model.json), null);
            tmodel.On("continue", model.nextUri, null);

            return(tmodel.RenderJSON());
        }
Exemple #5
0
        public void testAsk()
        {
            Say     say     = new Say("Please enter your 5 digit zip code.");
            Choices choices = new Choices("[5 DIGITS]");

            Tropo tropo = new Tropo();

            tropo.Ask(null, null, choices, null, "foo", null, say, null);
            Assert.AreEqual(this.askJson, tropo.RenderJSON());
        }
        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, renderJSONToText(tropo));
        }
Exemple #7
0
        public void testAskWithEvents()
        {
            Tropo tropo = new Tropo();

            string[] signals = new string[] { "endCall", "tooLong" };
            Say      say     = new Say("This is an Ask test with events. Please enter 1, 2 or 3.");
            Choices  choices = new Choices("1,2,3");

            tropo.Ask(5, signals, false, null, choices, null, "test", Recognizer.UsEnglish, true, say, 30);
            tropo.Hangup();
            Assert.AreEqual(this.askJsonWithEvents, tropo.RenderJSON());
        }
Exemple #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            //tropo.Voice = Voice.UsEnglishFemale_Susan;

            // Create an array of signals - used to interupt the Ask.
            string[] signals = new string[] { "endCall", "tooLong" };

            // A prompt to use with the Ask.
            Say say = new Say("This is an Ask test with events. Please enter 1, 2 or 3yyyy.");

            // A prompt to use with the Ask.
            Say franksay = new Say("This is frank Ask test with events. Please enter your 5 digits credit card number.");

            // A prompt to use with the Ask.On.
            Say sayon = new Say("This is an Ask on say");

            // Choices for the Ask.
            Choices choices = new Choices("1,2,3");

            // frank's Choices for the Ask.
            Choices frankchoices = new Choices("[5 DIGITS]", "dtmf", "#");

            // Set up the dialog.
            //tropo.GeneralLogSecurity("suppress");
            //tropo.Ask(5, signals, false, null, choices, null, "test", Recognizer.UsEnglish, "suppress", "mask", "XXDD-", true, say, 30);
            //tropo.GeneralLogSecurity("none");
            tropo.Ask(5, signals, false, null, frankchoices, null, "frank test", Recognizer.UsEnglish, true, franksay, 30, "suppress", "mask", "XXDD-");
            tropo.Ask(5, signals, false, null, choices, null, "peter test", Recognizer.UsEnglish, true, say, 30, "suppress", "mask", "XXDD-");
            tropo.On("continue", "TropoResult.aspx", sayon);
            //tropo.Hangup();

            tropo.RenderJSON(Response);
        }
        public void testAskWithSayEvents()
        {
            var says = new Collection <Say>();

            says.Add(new Say("Are you still there?", "timeout"));
            says.Add(new Say("Please enter your 5 digit zip code."));

            Choices choices = new Choices("[5 DIGITS]");

            Tropo tropo = new Tropo();

            tropo.Ask(null, null, 1, choices, null, "foo", null, says, null);

            var rendered = renderJSONToText(tropo);

            Assert.AreEqual(this.askJsonWithSayEvents, rendered);
        }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object
            Tropo tropo = new Tropo();

            // Set the grammar to use when collecting input.
            Choices choices = new Choices("[5 DIGITS]");

            // Create an event handler for when the input collection is finished. Tropo will POST Result object JSON.
            On on = new On(Event.Continue, "http://my-web-application-url/post", new Say("Please hold."));

            // Call the ask method of the Tropo object and pass in values.
            tropo.Ask(3, false, choices, null, "zip", true, new Say("Please enter your 5 digit zip code"), 5);
            tropo.On(on);

            tropo.RenderJSON(Response);
        }
        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, renderJSONToText(tropo));
        }
Exemple #12
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            // Say an introductory message to the caller.
            tropo.Say("Welcome to the claim test application.");

            // Create new choices to use with Ask.
            Choices choices = new Choices("[5 DIGITS]");

            // Create new ask with desired prompt that will be sent to user.
            tropo.Ask(3, false, choices, null, "claim_id", true, new Say("Please enter your 5 digits claim ID."), 5);

            // Create On handlers for Tropo event.
            tropo.On(Event.Continue, "Answer.aspx", null);  // Fires when the user provides valid input.
            tropo.On(Event.Error, "Error.aspx", null);      // Fires when an error occurs.
            tropo.On(Event.Incomplete, "Error.aspx", null); // Fires when the user does not enter correct input.

            tropo.RenderJSON(Response);
        }
Exemple #13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Create a new instance of the Tropo object.
            Tropo tropo = new Tropo();

            tropo.Voice = Voice.UsEnglishFemale_Susan;

            // Create an array of signals - used to interupt the Ask.
            string[] signals = new string[] { "endCall", "tooLong" };

            // A prompt to use with the Ask.
            Say say = new Say("This is an Ask test with events. Please enter 1, 2 or 3.");

            // Choices for the Ask.
            Choices choices = new Choices("1,2,3");

            // Set up the dialog.
            tropo.Ask(5, signals, false, null, choices, null, "test", Recognizer.UsEnglish, true, say, 30);
            tropo.Hangup();

            // Render the dialog JSON for Tropo to consume.
            Response.Write(tropo.RenderJSON());
        }