0
votes

I have been using Twilio to receive incoming calls.I am able to gather incoming prompts, send DTMF , or play speech prompts.

Occasionally the incoming prompts is very large, and I like Twilio to stop collecting prompt after a given timeout and provide me with partial gather, so I can bargein with a DTMF digit. I have this but it looks like it hangs

resp.gather(input='speech dtmf', timeout=3, speech_timeout=3, action='/gather', method='POST')

When I check the documentation I see:

timeout - allows you to set the limit (in seconds) that Twilio will wait for the caller to press another digit or say another word before it sends data to your action url.

speechTimeout- sets the limit (in seconds) that Twilio will wait before it stops its speech recognition.

If you use both timeout and speechTimeout in your , timeout will take precedence for DTMF input and speechTimeout will take precedence for speech.

Somehow in cases of very large prompt I never get to

@app.route("/gather", methods=['GET', 'POST'])
def gather():
    print("--> gather")
    resp = VoiceResponse()
1

1 Answers

0
votes

Twilio developer evangelist here.

You can set up the partialResultCallback attribute which will start delivering speech results as they are processed asynchronously. Those callbacks are delivered asynchronously to the call itself, so returning TwiML doesn't affect the call, but you can update the call resource with a redirect using the API if you recognise the user's intent early.

Does that help at all?