Twilio <Gather> 执行 webhook 操作太慢

Twilio <Gather> perform webhook action too slow

我正在 python 中使用 Twilio 编写 IVR 应用程序 这是 Twiml 示例:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Gather action="/twilio/ivr/action/callback" input="dtmf" method="GET">
        <Say>Press 1 to do something</Say>
    </Gather>
</Response>

twilio/ivr/action/callback

中的示例 Twiml
<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Sa>Please say something</Say>
    <Record method="GET" timeout="3" trim="do-not-trim" />
</Response>

但是当用户按下 1 时,我必须等待 5 到 6 秒才能收到回调操作。我认为我的 IVR 系统太慢了。这是正常的反应时间吗?或者这与我的国家有关?

我的服务区域是台湾,服务器搭建在 AWS 东京。

您可以在 <Gather> 上使用 timeout 属性,因此它不会默认为 5 秒。此外,如果您只需要一位数字,则可以使用 numDigits 属性。

<?xml version="1.0" encoding="UTF-8"?>
<Response>
    <Gather 
      action="/twilio/ivr/action/callback" 
      input="dtmf" 
      method="GET" 
      timeout="3" 
      numDigits="1"
    >
        <Say>Press 1 to do something</Say>
    </Gather>
</Response>

更多信息:https://www.twilio.com/docs/api/twiml/gather#attributes