问题
I have a say widget
> "Hello ... Thanks"
I've tried add a pause string like twilML to that element like so
> "Hello <Pause length="10"/> ... Thanks"
but it just speaks out the Pause length="10"
section
how can i add a pause to a Say/Play widget ?
回答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.
So, the following Text to say would have a 1 second delay between sentences:
Hello, John!
. . . . . . . . . . . . . . .
Today is a very nice day.
回答2:
Really somebody at Twilio should create a PAUSE
widget for Studio.
Until then if you're happy using an ugly hack... here it is:
Since you can add a function widget in the flow, create a Twilio "Runtime Function" (I called it "Pause")
exports.handler = function(context, event, callback) {
const duration = event.duration || 1500;
setTimeout(
function() {
// console.log(duration);
callback();
} , duration);
};
then, replace one "Say" widget with "Say" widget + "Pause" function widget + "Say" widget.
When you add the "Pause" widget configure it with parameters, add a duration
parameter with a value that is no more than about 3000 to 4000 (I don't know exactly how to explain why but functions will 'runtime timeout' if the function takes more than 5 seconds to execute).
When you add parameters, make sure they are in fact added..., I had some trouble until I figured out that you need to click on "Add Parameter" link after you fill the "Key", "Value" fields, instead I was clicking on the big "Save" button.
Since you are looking for a 10 seconds pause, you might try to cascade 3 "Pause" widgets with duration parameter (3000, 3000, 4000), between your "Say" widgets.
I've tested this and I was able to make a pause between 2 "Say" widgets of 7 seconds by inserting one 3000 pause and one 4000 pause functions.
I hope it helps.
回答3:
Got this from Twilio support
The spaced out periods only works for the legacy voices (man, woman, alice).
If you're using the new Polly voices, you need to embed SSML in the Say text area, such as:
<speak>Hello. <break time="5s"/> Goodbye.</speak>
Worked fine for me.
来源:https://stackoverflow.com/questions/50977722/how-can-i-add-pause-to-twilio-studio-say-play-widget