-
Notifications
You must be signed in to change notification settings - Fork 25
/
handle.php
36 lines (24 loc) · 1.06 KB
/
handle.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
<?php
// First read in a couple of POST variables passed in with the request
// This is a unique ID generated for this call
$sessionId = $_POST['sessionId'];
// Check to see whether this call is active
$isActive = $_POST['isActive'];
if ($isActive == 1) {
//simulating a database call
// Compose the response
$response = '<?xml version="1.0" encoding="UTF-8"?>';
$response .= '<Response>';
$response .= '<Dial phoneNumbers="+254787235065" record="true" ringBackTone="http://1ac4c2a1.ngrok.io/Rabbit.mp3" sequential="true"/>';
$response .= '</Response>';
// Print the response onto the page so that our gateway can read it
header('Content-type: text/plain');
echo $response;
} else {
// Read in call details (duration, cost). This flag is set once the call is completed.
// Note that the gateway does not expect a response in thie case
$duration = $_POST['durationInSeconds'];
$currencyCode = $_POST['currencyCode'];
$amount = $_POST['amount'];
// You can then store this information in the database for your records
}