I can't seem to find any documentation on this, but I'd like to say "one moment" in a Gather block in between when a user stops speaking and when the speech recognition processor delivers the words they said (since anecdotally this can take a few seconds and result in dead air in the meantime).
I can't seem to find anything like that in the documentation. All of the examples are for things like:
<Response>
<Gather>
<Say>Voice prompt to read to the user before collection</Say>
<Say>Say more things if you want</Say>
</Gather>
<Say>Something to say if the user doesn't provide feedback</Say>
</Response>
Having around 5 seconds of dead air isn't the worst thing ever, but it lacks polish.
Twilio developer evangelist here.
There is nothing to provide for a message after the user finishes speaking to the <Gather>
and after the speech result is ready and sent to the action
URL, however I think you might be characterising the delay wrong.
Twilio streams the voice to the speech detection service, so we get real time results (you can get partial results by setting a partialResultCallback
URL). Instead, the time that elapses between the end of the caller speaking and the action
being called is based on the timeout
which is 5 seconds by default.
What I would suggest is that you try different values for the speechTimout
attribute including auto
, which "will stop speech recognition when there is a pause in speech and return the results immediately."
Let me know if that helps at all.