当前位置: 动力学知识库 > 问答 > 编程问答 >

Twilio - Interrupt a Say Block

问题描述:

I have a Play block, that Says many .mp3 files (it reads an account balance and other information about an account.

The result is a a message that takes a while to listen to. The messages vary in length, depending what is said.

I'd like 'any' key to end playing the messages and skip back to the c#.

I tried using a Gather, but the timeout value either truncates the Say block, or waits for ages at the end (if no key pressed)

Any thought on how to achieve this?

The current flow is this:

<?xml version="1.0"?>

<Response>

<Play>/Voice/test/messages/CurrentlyYourPAYGBalanceIs_.mp3</Play>

<Play>/Voice/test/common/numbers/78.mp3</Play>

<Play>/Voice/test/common/currency/_pounds_.mp3</Play>

<Play>/Voice/test/common/misc/_and_.mp3</Play>

<Play>/Voice/test/common/numbers/91.mp3</Play>

<Play>/Voice/test/common/currency/Pence.mp3</Play>

<Play>/Voice/test/messages/_AndYouHavea_.mp3</Play>

<Play>/Voice/test/products/BD021.mp3</Play>

<Play>/Voice/test/common/misc/_with_.mp3</Play>

<Play>/Voice/test/common/numbers/95.mp3</Play>

<Play>/Voice/test/messages/_VoiceBalance.mp3</Play>

<Play>/Voice/test/common/misc/_and_.mp3</Play>

<Play>/Voice/test/common/numbers/2.mp3</Play>

<Play>/Voice/test/common/data/_gigabytes_.mp3</Play>

<Play>/Voice/test/common/numbers/200.mp3</Play>

<Play>/Voice/test/common/misc/_and_.mp3</Play>

<Play>/Voice/test/common/numbers/94.mp3</Play>

<Play>/Voice/test/common/data/_megabytes_.mp3</Play>

<Play>/Voice/test/common/misc/_remaining.mp3</Play>

<Play>/Voice/test/common/misc/Expiring_.mp3</Play>

<Play>/Voice/test/common/dates/31.mp3</Play>

<Play>/Voice/test/common/months/_of12_.mp3</Play>

<Play>/Voice/test/common/years/2016.mp3</Play>

</Response>

网友答案:

David, check out this question:

Twilio play pause/resume

Specifically:

The playback is interrupt-able as it is wrapped in Gather which points to Pause action.

You can wrap your <Play> TwiML in a <Gather> and point to a URL containing the instructions you wish.

分享给朋友:
您可能感兴趣的文章:
随机阅读: