/
AskTestpull6.aspx.cs
48 lines (38 loc) · 1.68 KB
/
AskTestpull6.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
using System;
using System.Collections.ObjectModel;
using System.Web.UI;
using TropoCSharp.Structs;
using TropoCSharp.Tropo;
namespace TropoSample
{
/// <summary>
/// A simple example demonstrating how to use the Ask method.
/// </summary>
public partial class AskTestpull6 : Page
{
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);
}
}
}