Twilio:TwiML <Hangup> 动词不结束呼叫
Twilio: TwiML <Hangup> verb not ending call
我最近 运行 遇到了 TwiML <Hangup>
动词的问题。我有一个简单的设置,其工作方式如下:
我有一个 Twilio 号码设置来接收来电,并配置为使用如下所示的 TwiML bin:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Record timeout="5" transcribe="false" trim="trim-silence" maxLength="10"/>
<Hangup/>
</Response>
目标是让号码接听来电,录制最多 10 秒的音频,trim 静音,然后挂断。它正确地完成了所有这些,除了挂断。
此时,不是挂断,而是在达到maxLength
10s 的录音结束后,开始新的录音。这种情况一直持续到通话结束,并且通常会导致每次通话进行 2-5 次录音。就好像 <Hangup>
动词被完全忽略了一样。这是我的意思的一个例子:
Twilio Call Details Screen
我想知道以前是否有人遇到过这个问题(以及您如何解决这个问题),或者我如何才能在录音后正确挂断电话。我目前的解决方案是:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<!-- This is a hacky solution. I found by accident that passing an invalid action argument causes the call to forcibly hangup (after the recording is completed) - hence the action "breakcall" below. = -->
<Record timeout="5" transcribe="false" trim="trim-silence"
action="breakcall" maxLength="10"/>
</Response>
但是这很老套,我宁愿找出正确的方法。
谢谢!
您遇到这个问题是因为
Any TwiML verbs occurring after a <Record>
are unreachable.
此处记录:(https://www.twilio.com/docs/voice/twiml/record).
关于你的第一个代码片段,没有 action
If no 'action' is provided, will default to requesting the current document's URL.
因此,您进入了一个循环,这就解释了为什么您最终会有多个录音。
如何修复:
创建另一个响应 <Hangup/>
的容器,并将第一个容器的 action
指向它。
第一个箱子
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Record
action="[hangup_bin_url]"
timeout="5"
transcribe="false"
trim="trim-silence"
maxLength="10"
/>
</Response>
第二箱
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Hangup />
</Response>
希望对您有所帮助。
我最近 运行 遇到了 TwiML <Hangup>
动词的问题。我有一个简单的设置,其工作方式如下:
我有一个 Twilio 号码设置来接收来电,并配置为使用如下所示的 TwiML bin:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Record timeout="5" transcribe="false" trim="trim-silence" maxLength="10"/>
<Hangup/>
</Response>
目标是让号码接听来电,录制最多 10 秒的音频,trim 静音,然后挂断。它正确地完成了所有这些,除了挂断。
此时,不是挂断,而是在达到maxLength
10s 的录音结束后,开始新的录音。这种情况一直持续到通话结束,并且通常会导致每次通话进行 2-5 次录音。就好像 <Hangup>
动词被完全忽略了一样。这是我的意思的一个例子:
Twilio Call Details Screen
我想知道以前是否有人遇到过这个问题(以及您如何解决这个问题),或者我如何才能在录音后正确挂断电话。我目前的解决方案是:
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<!-- This is a hacky solution. I found by accident that passing an invalid action argument causes the call to forcibly hangup (after the recording is completed) - hence the action "breakcall" below. = -->
<Record timeout="5" transcribe="false" trim="trim-silence"
action="breakcall" maxLength="10"/>
</Response>
但是这很老套,我宁愿找出正确的方法。
谢谢!
您遇到这个问题是因为
Any TwiML verbs occurring after a
<Record>
are unreachable.
此处记录:(https://www.twilio.com/docs/voice/twiml/record).
关于你的第一个代码片段,没有 action
If no 'action' is provided, will default to requesting the current document's URL.
因此,您进入了一个循环,这就解释了为什么您最终会有多个录音。
如何修复:
创建另一个响应 <Hangup/>
的容器,并将第一个容器的 action
指向它。
第一个箱子
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Record
action="[hangup_bin_url]"
timeout="5"
transcribe="false"
trim="trim-silence"
maxLength="10"
/>
</Response>
第二箱
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Hangup />
</Response>
希望对您有所帮助。