-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplayrecording.php
22 lines (20 loc) · 969 Bytes
/
playrecording.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
//Function that removes the +1 from the phone number and formats it so the text-speech can read the phone number properly
function cleanNumber($string){
//eliminate every char except 0-9
$justNums = preg_replace("/[^0-9]/", '', $string);
//eliminate leading 1 if its there
if (strlen($justNums) == 11) $justNums = preg_replace("/^1/", '',$justNums);
return trim(chunk_split($justNums, 1, ' '));
}
$RecordingUrl=$_REQUEST['RecordingUrl'];
$cid=$_REQUEST['cid'];
$number=cleanNumber($_REQUEST['From']);
header("Content-type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather action="handleinput.php?cid='.$cid.'" numDigits="1" hints="accept,reject" input="speech dtmf" timeout="10"> <Say>You have a call from </Say><Say>'.$number.'</Say>
<Play>'.$RecordingUrl.'.mp3 </Play>
<Play>Press one or say accept to connect to the call, or press two or say reject to disconnect from the call</Play>
</Gather>
</Response>'; ?>