【发布时间】:2015-04-08 01:41:07
【问题描述】:
我正在使用https://www.twilio.com/docs/howto/callscreening 的呼叫筛选示例
当我通过座机拨打我传入的 Twilio 号码时,它会被转发到我的手机,并提示我“按一个键接受” 问题是,只要我在手机上接听电话,来电就会停止铃声并保持静音,直到我按下任意键约 5 秒。
只要我在手机上接听电话,用户就会看到沉默,并认为电话已被接听,但直到我按下一个键来接听电话,直到 Twilio 进行连接在通话中,这就是我可以与此人交谈的重点。
我可以向他们播放音乐或铃声,直到真正连接到我的电话?
这是转发的代码
<?php
// Set the numbers to call
$numbers = array("<number to call 1>", "<number to call 2>", "<number to call n>");
$number_index = isset($_REQUEST['number_index']) ? $_REQUEST['number_index'] : "0";
$DialCallStatus = isset($_REQUEST['DialCallStatus']) ? $_REQUEST['DialCallStatus'] : "";
header("content-type: text/xml");
// Check the status of the call and
// that there is a valid number to call
if($DialCallStatus!="completed" && $number_index<count($numbers)){
?>
<Response>
<Dial action="attempt_call.php?number_index=<?php echo $number_index+1 ?>">
<Number url="screen_for_machine.php">
<?php echo $numbers[$number_index] ?>
</Number>
</Dial>
</Response>
<?php
} else {
?>
<Response>
<Hangup/>
</Response>
<?php
}
?>
以及要求我接听电话的部分
<?php header("content-type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<Response>
<Gather action="complete_call.php">
<Say>Press any key to accept this call</Say>
</Gather>
<Hangup/>
</Response>
【问题讨论】:
标签: twilio