我如何向 Twilio 工作室说/播放小部件添加暂停 [英] How can i add pause to Twilio studio Say/Play widget

查看:20
本文介绍了我如何向 Twilio 工作室说/播放小部件添加暂停的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个发言权

> "Hello ... Thanks"

我已经尝试向该元素添加一个像 twilML 这样的暂停字符串

I've tried add a pause string like twilML to that element like so

> "Hello  <Pause length="10"/> ... Thanks"

但它只是说出了Pause length="10" 部分

如何为说/播放小部件添加暂停?

how can i add a pause to a Say/Play widget ?

推荐答案

根据 Twilio关于小部件的文档,可以通过放置空格分隔的句点来添加暂停,其中 15 个句点相当于 1 秒延迟.

According to Twilio documentation on widgets, pauses can be added by placing space separated periods, where 15 of these is equivalent to 1 second delay.

因此,以下要说的文字在句子之间会有 1 秒的延迟:

So, the following Text to say would have a 1 second delay between sentences:

Hello, John!
 . . . . . . . . . . . . . . .
Today is a very nice day.

这仅适用于非 [Polly] 声音(爱丽丝、男人、女人 - 小部件配置中消息语音"字段中的选项).

this will only work for non-[Polly] voices (Alice, Man, Woman - options in "Message Voice" field in the widget's configuration).

另一种替代方法是使用 Twilio Functions 并向 Flow 添加一个 Run Function 小部件.有关更多说明,请遵循 Twilio 的添加延迟"说明(特别提到在 Studio Flow 中使用.

Another alternative to it is using Twilio Functions and adding a Run Function widget to the Flow. For more instructions, follow Twilio's instructions for "Add Delay" (specifically mentioning for using in Studio Flow.

// Description
// Add a delay, useful for using with Twilio Studio Run Function Widget

exports.handler = function (context, event, callback) {
  // Function can run up to 10 seconds (value of delay is milliseconds)

  // Pass in delay as a URL query parameter
  // Example: https://x.x.x.x/<path>?delay=5000
  let delayInMs = event.delay || 5000;

  let timerUp = () => {
    return callback(null, `Timer Up: ${delayInMs}ms`);
  };

  setTimeout(timerUp, delayInMs);
};

这篇关于我如何向 Twilio 工作室说/播放小部件添加暂停的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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