camelCase
我尝试上面的代码,但它不适用于耳语消息。我想问一下'other-script'页面上要写什么?
答案 0 :(得分:1)
请详细说明问题。 请参阅此页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>';
答案 1 :(得分:0)
Twilio开发者传道者在这里。
在这种情况下, "other-script"
将需要指向一个URL,该URL将您想要播放的TwiML返回给接收呼叫的人作为&#34; Whisper&#34;在他们与呼叫者联系之前。
因此,如果您只是希望被呼叫者在连接到呼叫者之前接收语音消息,则需要"/other-script"
指向一个文件:
<Response>
<Say>You are being connected to a caller.</Say>
</Response>
这只是读出消息然后连接两个电话。
如果你想使用&#34; Whisper&#34;为了给呼叫者一个拒绝呼叫的选项,你需要"/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教程,您可能会发现它也很有用。