1

我尝试运行呼叫筛选示例。当我的其他电话号码接到电话时,错误消息显示为“抱歉出现错误,请检查调试链接”。发生此错误后,我没有做任何事情,电话也没有挂断。所以我按了键盘上的一个键,它接通了电话。呼叫筛选应用程序假设打电话给某人并询问他们是否想接听电话。该功能有效,但我不确定它为什么会读取错误消息。此外,在我挂断电话接听电话后,下一个号码正在接听电话,这不应该发生,因为第一个电话号码接听了电话。

尝试调用.php

<?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
}
?>

screen_for_machine.php

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather action="complete_call.xml">
<Say>Press any key to accept this call</Say>
</Gather>
<Hangup/>
</Response>

完成调用.xml

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>Connecting</Say>
</Response>

我们说话的时候,我正在调查它。我认为他们网站上的错误是他们正在调用某些文件 .xml 并将其用作代码中的 .php 。

调试链接说:

错误:HTTP 检索失败
组件:TwiML 错误 httpResponse:500 ErrorCode:11200 url:http ://test.com.testExample.com/Call/screen_for_machine.php

错误代码 11200 内容如下:

错误 - 11200 HTTP 检索失败

尝试检索此 URL 的内容失败 可能的原因

Web server returned a 4xx or 5xx HTTP response to Twilio
Misconfigured Web Server
Network disruptions between Twilio and your web server

可能的解决方案

Doublecheck that your TwiML URL does not return a 4xx or 5xx error
Make certain that the URL does not perform a 302 redirect to an invalid URL
Confirm the URL requested is not protected by HTTP Auth
Make sure your webserver allows HTTP POST requests to static resources (if the url referes to .xml or .html files)
Verify your web server is up and responsive
Check to see that the URL host is not a private or local IP address
Verify the ping times and packet loss between your web server and www.twilio.com

我的分析认为 Screen php 文件有问题,因为它甚至没有向我读到 xml 说按任意键拿起..

错误已修复...问题出在

4

2 回答 2

2

我们提供的示例中存在错误。该<?xml version="1.0" encoding="UTF-8"?>行会导致PHP出现问题,因此需要像这样写出:

screen_for_machine.php

<?php header("content-type: text/xml"); 
echo '<?xml version="1.0" encoding="UTF-8"?>'; 
?> 
<Response>
<Gather action="complete_call.xml">
<Say>Press any key to accept this call</Say>
</Gather>
<Hangup/>
</Response>
于 2011-07-28T21:41:33.457 回答
0

如果其他人有问题,我发现在我从 Twilio 下载的 zip 文件中,不知何故缺少一个结束引号:

<?php header("content-type: text/xml"); 
    echo '<?xml version="1.0" encoding="UTF-8"?>'; //The " after the 'UTF-8' was missing
?> 

这可能是我做过的事情,但它困扰了我很久。

于 2013-12-05T19:26:13.050 回答