我的目标是能够屏蔽来电,并将其发送到语音信箱。下面的代码正确地进行了筛选,但是如果我接听电话,然后只是挂断电话就会被取消,而不是将其指向语音信箱。我怎么能做到这一点?
<Say>Please wait while we connect you to Aaron. Calls may be recorded for quality assurance purposes.</Say>
<Dial action="voicemail.php?email=aaron" timeout="15">
<Number url="screen-caller.xml">+11231231234</Number>
</Dial>
丝网caller.xml:
<Response>
<Gather action="handle-screen-input.php" numDigits="1">
<Say>To accept, press 1.</Say>
</Gather>
<!-- If customer doesn't input anything, prompt and try again. -->
<Say>Sorry, I didn't get your response.</Say>
<Redirect>screen-caller.xml</Redirect>
</Response>
手柄丝网input.php:
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response>';
$user_pushed = (int) $_REQUEST['Digits'];
if ($user_pushed == 1)
{
echo '<Say>Connecting. Calls are recorded.</Say>';
}
else {
echo '<Hangup />';
}
echo '</Response>';
voicemail.php:
header("content-type: text/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>';
$email = $_REQUEST['email'];
?>
<Response>
<?php if ($_REQUEST['DialCallStatus'] == 'completed') { ?>
<Hangup/>
<?php } else { ?>
<Say>Please leave a message at the beep. Press the star key when finished.</Say>
<Record transcribe="true" action="goodbye.php" transcribeCallback="voicemail-send.php?email=<?php echo $email; ?>" maxLength="120" finishOnKey="*" />
<Say>I did not receive a recording.</Say>
<Redirect>voicemail.php</Redirect>
<?php } ?>
</Response>
答案 0 :(得分:0)
[[edit]]
唉唉!我知道它是什么!以下答案(我为子孙后代所保留的)是完全错误的。
当被拨打的人和耳语挂断时,action
动词上的<Dial>
被呼叫。在文档中,the DialCallStatus
values can be:已完成,正忙,无应答,失败或已取消。当该人拿起电话时,状态不能为忙,无应答,失败或取消。因此,当他们在耳语结束之前挂断电话时,呼叫状态将会完成。
因此,当您的操作被调用时,DialCallStatus
将完成,您的voicemail.php将挂断。
您还会收到一个DialCallDuration
,这样您就可以查看通话的持续时间,并确定通话是否已连接或该用户是否已挂断。
希望现在有所帮助!
[[原始回答]]
Twilio开发者传道者在这里。
如果你在通话的私语部分挂机,那么原来的来电者将继续通过他们给出的TwiML。在这种情况下,你只给他们一个<Dial>
动词,所以一旦你挂断了,调用者完成<Dial>
动作,到达他们的TwiML结束并挂起。
尝试在第一个TwiML中的<Redirect>/voicemail.php?email=aaron</Redirect>
之后添加<Dial>
。
如果有帮助,请告诉我。