-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
57 lines (47 loc) · 2.07 KB
/
Copy pathProgram.cs
File metadata and controls
57 lines (47 loc) · 2.07 KB
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
49
50
51
52
53
54
55
56
57
using System;
using System.Collections.Generic;
using TelAPI.InboundXML;
using TelAPI.InboundXML.Enum;
using TelAPI.InboundXML.Element;
namespace TelAPI.InboundXML.Example
{
class Program
{
/// <summary>
/// Url where Telapi will post data after InboundXML execution
/// </summary>
private const string UrlWhereToPost = "http://your-web-page.com";
/// <summary>
/// Url of audio resource to play on the call
/// </summary>
private const string UrlWhatToPlay = "http://url-of-audio-resource.com";
/// <summary>
/// Url of the grammar for GetSpeech()
/// </summary>
private const string UrlOfGrammar = "http://url-of-the-grammar.com";
/// <summary>
/// Phone number for dial while in the call
/// </summary>
private const string PhoneNumberToDial = "phone-number-to-dial";
static void Main(string[] args)
{
// We need to create Response object and after
// that we can call any method that we need
var response = new Response();
response.Say("Hello", null, null)
.Say("This is automated message", Voice.woman, null)
.Say("From now I will record this call", Voice.man, null)
.Record(UrlWhereToPost, null, 5, "#", 30, null, null, true, null, null)
.Say("I will dial another number now.")
.Dial(Dial.Create(PhoneNumberToDial))
.Play(UrlWhatToPlay)
.GetSpeech(GetSpeech.Create(UrlOfGrammar, UrlWhereToPost).Say("Pausing...", null, null).Pause())
.Say("I will hangup now. Goodbye!", null, null)
.Hangup();
// On the end we need to call CreateXml on Response object
// so that we can see our generated XML
Console.WriteLine("{0}", response.CreateXml());
Console.ReadKey();
}
}
}