I am using twilio to make a call screening app, I use the url attribute to give the callee options but I cannot get back to the callers point of view.
<?php
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
?>
<Response>
<Say>please hold while we locate mike</Say>
<Dial>
<Number url="hello-monkey-name.php">+12154678556</Number>
<Number url="hello-monkey-name.php">+12123645995</Number>
</Dial>
</Response>
The url attribute sends the callee to "hello-monkey-name.php" where it gives him/her three options.
<?php
session_start();
$var_value = $_SESSION['RecordingUrl'];
// now greet the caller
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
?>
<Response>
// <Play><?php echo $_REQUEST['RecordingUrl']; ?></Play>
<Say> is calling <Say/>
<Gather numDigits="1" action="hello-monkey-called.php" method="POST">
<Say>To accept the call, press 1. To send call to voicemail, press 2. to hangup, press 3</Say>
</Gather>
</Response>
Once the callee presses a button its sent to "hello-monkey-called.php" where it gathers the digits and decides what it need to do, I can get it to complete the call and to hangup the call but when I cannot get it to forward the call to a voicemail sip address. Any ideas how I can get it to be back in the callers perspective heres to code for that part if it helps at all.
<?php
// if the caller pressed anything but 1 or 2 send them back
if($_REQUEST['Digits'] != '1' and $_REQUEST['Digits'] != '2' and $_REQUEST['Digits'] != '3') {
header("Location: hello-monkey-name.php");
die;
}
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
";
>
<Response>
<?php if ($_REQUEST['Digits'] == '1') { ?>
<?php } elseif ($_REQUEST['Digits'] == '2') { ?>
<Dial>
<Sip> vm.johnsmith@junctionnetworks.com <Sip/>
<Dial/>
<?php } elseif ($_REQUEST['Digits'] == '3') { ?>
<Hangup/>
<?php } ?>
</Response>