只听插入

Listen Only as Barge

所以我有一个脚本,我需要向调用者朗读大约 30 分钟长的脚本。

一路上客户可能会打断阅读并提出问题。

需要解决调用方的问题,然后需要从中断之前的位置继续读取。

为了跟踪进度,我存储了一个带有步骤编号的会话变量。

我说一两句剧本。 | 我用 barge true

然后我重定向到脚本的下一部分。

这会在 say 之后和重定向之前创建一个等待呼叫者响应的暂停。

呃.... 所以我创建了一个 twilio 函数来检查步骤并在当前步骤之上添加步骤。结果看起来像这样

    {
            "Action": [
                    { "Say":"This is a couple sentences..." },
                    {"Remember":{"Step":1}},
                    { "Say":"This is a couple sentences..." },
                    {"Remember":{"Step":2}},
                    { "Say":"This is a couple sentences..." },
                    {"Remember":{"Step":3}},
                    { "Say":"This is a couple sentences..." },
                    {"Remember":{"Step":4}},
                    {"Listen":{"barge":true},
                    {"Redirect":"task://goodbye"}
            ]
    }

这里唯一的问题是用于识别读取位置的 Multiple Remembers 调用会导致错误。

任何想法都会很棒!!!

这里是 Twilio 开发人员布道者。

由于所有操作在 Twilio 函数的响应中同时返回,所有“记住”操作同时有效 运行。因此,在您的示例中,您试图同时使用不同的值编写相同的“记住”步骤,因此出现错误。

在阅读了您的操作后,我打算建议使用重定向方法,但您已经解释过这对您不起作用。

如果您可以使用常规 TwiML 而不是 Autopilot,您可以尝试使用 <Gather> with nested <Say> elements to read the script. When <Gather> doesn't receive a response from a user it continues to the next TwiML element in the document. So, if you set up several <Gather>s in a row with short timeouts and added the step to the action URL 您可以复制此行为。

例如:

<Response>
  <Gather action="/speech?step=1" timeout="1">
    <Say>First sentences</Say>
  </Gather>
  <Gather action="/speech?step=2" timeout="1">
    <Say>Next sentences</Say>
  </Gather>
  ... etc ...
</Response>

这有什么帮助吗?