Twilio - 拨号时记录属性错误 [英] Twilio - Dial with Record attribute error

查看:27
本文介绍了Twilio - 拨号时记录属性错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 twimlbin 服务来测试一些简单的 Twilio xml:

I'm using the twimlbin service to test a simple bit of Twilio xml:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>This call may be recorded for quality purposes</Say>  
<Dial record="true" action="http://testmyapp.ca/sendmail.php" method="GET">
    555-404-3200
</Dial>
</Response>

在操作 url 处,我收到录音的 url 和持续时间,并向自己发送电子邮件.一切顺利,电子邮件已发送,但电话中的声音说发生了应用程序错误.错误是 12100 错误 (http://www.twilio.com/docs/errors/12100).从调试器服务中,我收到文档第 1 行错误:文件过早结束.请确保响应正文是有效的 XML 文档."除了从我的 php 文件发送电子邮件之外,我什么都不做 - 我应该从我的 php 文件中返回对 Twilio 的响应吗?我已经注释掉了 sendmail.php 的任何输出我收到了带有我期望的 GET 参数的电子邮件,但语音仍然说发生了应用程序错误.非常感谢任何帮助.

At the action url I receive the url of the recording and the duration and send an email to myself. All goes well, the email is sent, but the voice on the phone says an application error has occurred. The error is a 12100 error (http://www.twilio.com/docs/errors/12100). From the debugger service I get "Error on line 1 of document : Premature end of file. Please ensure that the response body is a valid XML document." I'm not doing anything but sending an email from my php file - should I be returning a response to Twilio here from my php file? I've commented out any output from sendmail.php I receive the email with the GET parameters I expect but the voice still says an application error has occurred. Any help much appreciated.

推荐答案

我遇到了同样的问题,以下是我解决它的方法.只需将此标题添加到您的 mail.php 文件:

I had this same problem and here is how I solved it. Just add this header to your mail.php file:

<?php
/**
 * This section ensures that Twilio gets a response.
 */
header('Content-type: text/xml');
echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<Response></Response>'; //Place the desired response (if any) here.

就是这样.无需作出回应.在该标题之后,是发送电子邮件的部分.

That's it. No need to place a response. After that header, comes the section that sends the email.

我在某处读到您需要挂断回复.不需要那个.另外,我应该提到我的 mail.php 文件以这样的行结尾

I read somewhere that you need a Hangup response. No need for that. Also, I should mention my mail.php file ended with a line like this

echo '</Response>';

我刚刚删除了那行.这是不必要的.

I just deleted that line. It was unnecessary.

我希望这可以帮助其他遇到同样问题的人.

I hope this helps anybody else running into the same problem.

这篇关于Twilio - 拨号时记录属性错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆