<Response>
<Dial>
<Number url="other-script">
4151234567
</Number>
</Dial>
</Response>
我尝试上面的代码,但它不适用于耳语消息。我想问一下在'other-script'页面上写什么?twilio中的悄悄话消息php
<Response>
<Dial>
<Number url="other-script">
4151234567
</Number>
</Dial>
</Response>
我尝试上面的代码,但它不适用于耳语消息。我想问一下在'other-script'页面上写什么?twilio中的悄悄话消息php
请详细说明问题。 请参阅此页https://www.twilio.com/docs/tutorials/ivrs-extensions 下载ivr.zip。
请参考本代码 - IVR日志和报告文件
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response>';
$user_pushed = (int) $_REQUEST['Digits'];
if ($user_pushed == 0)
{
echo '<Say>Taking you back to the main menu</Say>';
echo '<Redirect>handle-incoming-call.xml</Redirect>';
}
else if ($user_pushed == 1)
{
echo '<Say>Connecting you to agent 1. All calls are recorded.</Say>';
echo '<Dial record="true">';
echo '<Number url="screen-caller.xml">+1NNNNNNNNNN</Number>';
echo '</Dial>';
}
else if ($user_pushed == 2)
{
echo '<Say>Connecting you to agent 2. All calls are recorded.</Say>';
echo '<Dial record="true">';
echo '<Number url="screen-caller.xml">+1NNNNNNNNNN</Number>';
echo '</Dial>';
}
else {
echo "<Say>Sorry, that extension is unknown.</Say>";
echo '<Redirect method="GET">handle-user-input.php?Digits=2</Redirect>';
}
echo '</Response>';
Twilio开发者传道这里。
"other-script"
在这种情况下,需要指向一个URL,它会在接到呼叫的人之前将您要播放的TwiML作为“Whisper”发送给接听电话的人。
所以,如果你只是想的人被称为连接到主叫方,你需要"/other-script"
为指向读取文件之前收到语音消息:
<Response>
<Say>You are being connected to a caller.</Say>
</Response>
这只会读出消息,然后连接两个呼叫。
如果你想用“耳语”给呼叫者一个选项,拒绝呼叫,则需要"/other-script"
指向一个脚本,说是这样的:
<Response>
<Gather action="/handle-input" numDigits="1">
<Say>You are receiving a call. Dial one to accept and any other digit to decline</Say>
</Gather>
<!-- If customer doesn't input anything, prompt and try again. -->
<Say>Sorry, I didn't get your response.</Say>
<Redirect>/other-script</Redirect>
</Response>
在这种情况下,你将需要在"/handle-input"
也提供一些TwiML。这需要根据数字输入进行操作,因此需要使用脚本。我看你标记的问题PHP,所以这里是它可能看起来像在PHP中:
<?php
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response>';
$user_pushed = (int) $_REQUEST['Digits'];
if ($user_pushed == 1)
{
echo '<Say>Connecting you to the caller.</Say>';
}
else {
echo '<Hangup />';
}
echo '</Response>';
?>
这将连接电话,如果接到电话的人在系统提示拨1或对方挂断电话拨打任何其他数字。
Twilio文档中提供了关于call whispers and recording calls的更深入的教程,您可能也会发现它们也有用。