-
Notifications
You must be signed in to change notification settings - Fork 74
/
voiceMenu.php
executable file
·76 lines (68 loc) · 3.07 KB
/
voiceMenu.php
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<?php
//1. Receive POST from AT
$isActive = $_POST['isActive'];
$callerNumber =$_POST['callerNumber'];
$dtmfDigits = $_POST['dtmfDigits'];
$sessionId = $_POST['sessionId'];
//2. Check if isActive=1 to act on the call or isActive=='0' to store the result
if($isActive=='1'){
//2a. Switch through the DTMFDigits
switch ($dtmfDigits) {
case "0":
//2b. Compose response - talk to sales...
$response = '<?xml version="1.0" encoding="UTF-8"?>';
$response .= '<Response>';
$response .= '<Say>Please hold while we connect you to Sales.</Say>';
$response .= '<Dial phoneNumbers="[email protected]" ringbackTone="http://62.12.117.25:8010/media/SautiFinaleMoney.mp3"/>';
$response .= '</Response>';
// Print the response onto the page so that our gateway can read it
header('Content-type: text/plain');
echo $response;
break;
case "1":
//2c. Compose response - talk to support...
$response = '<?xml version="1.0" encoding="UTF-8"?>';
$response .= '<Response>';
$response .= '<Say>Please hold while we connect you to Support.</Say>';
$response .= '<Dial phoneNumbers="[email protected]" ringbackTone="http://62.12.117.25:8010/media/SautiFinaleMoney.mp3"/>';
$response .= '</Response>';
// Print the response onto the page so that our gateway can read it
header('Content-type: text/plain');
echo $response;
break;
case "2":
//2d. Redirect to the main IVR...
$response = '<?xml version="1.0" encoding="UTF-8"?>';
$response .= '<Response>';
$response .= '<Redirect>http://62.12.117.25/MF-Ussd-Live/voiceCall.php</Redirect>';
$response .= '</Response>';
// Print the response onto the page so that our gateway can read it
header('Content-type: text/plain');
echo $response;
break;
default:
//2e. By default talk to support
$response = '<?xml version="1.0" encoding="UTF-8"?>';
$response .= '<Response>';
$response .= '<Say>Please hold while we connect you to Support.</Say>';
$response .= '<Dial phoneNumbers="[email protected]" ringbackTone="http://62.12.117.25:8010/media/SautiFinaleMoney.mp3"/>';
$response .= '</Response>';
// Print the response onto the page so that our gateway can read it
header('Content-type: text/plain');
echo $response;
}
}else{
//3. Store the data from the POST
$durationInSeconds=$_POST['durationInSeconds'];
$direction=$_POST['direction'];
$amount=$_POST['amount'];
$callerNumber=$_POST['callerNumber'];
$destinationNumber=$_POST['destinationNumber'];
$sessionId=$_POST['sessionId'];
$callStartTime=$_POST['callStartTime'];
$isActive=$_POST['isActive'];
$currencyCode=$_POST['currencyCode'];
$status=$_POST['status'];
//3a. Store the data, write your SQL statements here...
}
?>