Twilio API:正在将连接转移到转发的号码?
Twilio API: Transferring connection to a forwarded number?
我打了一个出站电话,根据 Twilio 发出的自动消息,它通过连接呼叫我的 phone。
这是放置 phone 调用的脚本。
import os
from twilio.rest import Client
account_sid = "xxxx"
auth_token = "xxxx"
client = Client(account_sid, auth_token)
call = client.calls.create( url='http://myhost.com/rec.php',to='+1234',from_='+9876')
print(call.sid)
发出 phone 调用,操作脚本发送 TwiML 收集响应。这里是 rec.php
echo '<Response>
<Gather input="speech"
partialResultCallback="http://myhost.com/partial.php"
action="http://myhost.com/finalresult.php">
</Gather>
</Response>
我得到了记录文本的部分页面。但是当我转接电话时,我的 phone 响铃一秒钟,然后断开。调试器也没有错误。
这里是partial.php
if(contains("To continue in English", $_REQUEST['UnstableSpeechResult'])){
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<Response>
<Dial>+myPhoneNumber</Dial>
</Response>";
}
这是最终结果,我认为是在 phone 调用完成时调用的?我不确定。
if(contains("To continue in English", $_POST['SpeechResult'])){
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<Response>
<Dial>+myPhoneNumber</Dial>
</Response>";
}
根据文档,partialResultCallback 不处理 TwiML。
The webhooks Twilio makes to your partialResultCallback are
asynchronous. They do not accept any TwiML in response. If you want to
take more actions based on this partial result, you need to use the
REST API to modify the call.
鉴于上述情况,不确定您的 phone 响铃情况如何。您可以提供的更多详细信息将有助于解决问题。
我打了一个出站电话,根据 Twilio 发出的自动消息,它通过连接呼叫我的 phone。
这是放置 phone 调用的脚本。
import os
from twilio.rest import Client
account_sid = "xxxx"
auth_token = "xxxx"
client = Client(account_sid, auth_token)
call = client.calls.create( url='http://myhost.com/rec.php',to='+1234',from_='+9876')
print(call.sid)
发出 phone 调用,操作脚本发送 TwiML 收集响应。这里是 rec.php
echo '<Response>
<Gather input="speech"
partialResultCallback="http://myhost.com/partial.php"
action="http://myhost.com/finalresult.php">
</Gather>
</Response>
我得到了记录文本的部分页面。但是当我转接电话时,我的 phone 响铃一秒钟,然后断开。调试器也没有错误。
这里是partial.php
if(contains("To continue in English", $_REQUEST['UnstableSpeechResult'])){
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<Response>
<Dial>+myPhoneNumber</Dial>
</Response>";
}
这是最终结果,我认为是在 phone 调用完成时调用的?我不确定。
if(contains("To continue in English", $_POST['SpeechResult'])){
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<Response>
<Dial>+myPhoneNumber</Dial>
</Response>";
}
根据文档,partialResultCallback 不处理 TwiML。
The webhooks Twilio makes to your partialResultCallback are asynchronous. They do not accept any TwiML in response. If you want to take more actions based on this partial result, you need to use the REST API to modify the call.
鉴于上述情况,不确定您的 phone 响铃情况如何。您可以提供的更多详细信息将有助于解决问题。