-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathReportCompletionAfterReceivingVoiceCall.cs
More file actions
59 lines (49 loc) · 1.99 KB
/
ReportCompletionAfterReceivingVoiceCall.cs
File metadata and controls
59 lines (49 loc) · 1.99 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
58
59
using System;
using System.Collections.Generic;
using Telesign;
namespace TelesignEnterprise.Example.VerifyCompletion
{
class ReportCompletionAfterReceivingVoiceCall
{
public static void Main(string[] args)
{
string customerId = "FFFFFFFF-EEEE-DDDD-1234-AB1234567890";
string apiKey = "EXAMPLETE8sTgg45yusumoN6BYsBVkh+yRJ5czgsnCehZaOYldPJdmFh6NeX8kunZ2zU1YWaUw/0wV6xfw==";
string phoneNumber = "phone_number";
string verifyCode = "12345";
Dictionary<string, string> parameters = new Dictionary<string, string>();
parameters["verify_code"] = verifyCode;
try
{
VerifyClient verifyClient = new VerifyClient(customerId, apiKey);
RestClient.TelesignResponse telesignResponse = verifyClient.Voice(phoneNumber, parameters);
string referenceId = telesignResponse.Json["reference_id"].ToString();
Console.WriteLine("Please enter your verification code:");
string code = Console.ReadLine().Trim();
if (verifyCode == code)
{
Console.WriteLine("Your code is correct.");
telesignResponse = verifyClient.Completion(referenceId);
if (telesignResponse.OK && telesignResponse.Json["status"]["code"].ToString() == "1900")
{
Console.WriteLine("Completion successfully reported.");
}
else
{
Console.WriteLine("Error reporting completion.");
}
}
else
{
Console.WriteLine("Your code is incorrect.");
}
}
catch (Exception e)
{
Console.WriteLine(e);
}
Console.WriteLine("Press any key to quit.");
Console.ReadKey();
}
}
}