我正在使用 twilio 制作呼叫筛选应用程序,我使用 url 属性为被呼叫者提供选项,但我无法回到呼叫者的观点。
<?php
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<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>
url 属性将被调用者发送到“hello-monkey-name.php”,它为他/她提供了三个选项。
<?php
session_start();
$var_value = $_SESSION['RecordingUrl'];
// now greet the caller
header("content-type: text/xml");
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<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>
一旦被调用者按下一个按钮,它就会发送到“hello-monkey-called.php”,在那里它会收集数字并决定它需要做什么,我可以让它完成通话并挂断通话,但是当我无法得到它时将呼叫转接到语音信箱 sip 地址。如果它有帮助的话,我如何让它回到调用者的角度的任何想法都可以为该部分编码。
<?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\"?>\n";
>
<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>