-
Notifications
You must be signed in to change notification settings - Fork 1
/
wishlist.php
62 lines (47 loc) · 1.84 KB
/
wishlist.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
<?php
//imports
require 'vendor/autoload.php';
require "vendor/predis/predis/autoload.php";
require("includes/utils.php");
Predis\Autoloader::Register();
//post data
$caller = $_POST['callerNumber'];
$isCallActive = $_POST['isActive'];
$direction = $_POST['direction'];
$sessionID = $_POST['sessionId'];
try {
$redis = new Predis\Client();
$callstate = GetCallState($redis, $sessionID, $caller);
if ($isCallActive == 1 && $direction == "Outbound") {
if ($callstate == "Intro") {
$str = "Welcome to the North Pole. I am Elfie. Press 1 followed by the hash sign to continue";
$callstate = "Reception";
SetCallState($redis, $sessionID, $caller, $callstate);
SendResponse(true, $str);
}
elseif ($callstate == "Reception") {
$userinput = $_POST['dtmfDigits'];
if ($userinput == "1") {
$str = "Okay. What would you like for Christmas. Press 1 followed by hash if you want a cup for Christmas. Press 2 followed by hash if you want a girlfriend for Christmas";
$callstate = "Options";
SetCallState($redis, $sessionID, $caller, $callstate);
SendResponse(true, $str);
}
}
elseif ($callstate == "Options") {
$userinput = $_POST['dtmfDigits'];
$callstate = "End";
if ($userinput == "1" || $userinput == "2") {
$str = "That is a good choice. We've sent the Northern Express to deliver. Merry Christmas";
}
SetCallState($redis, $sessionID, $caller, $callstate);
SendResponse(false, $str);
}
}
else {
SendResponse(false);
}
} catch (Exception $e) {
echo $e->getMessage();
}
?>