I would like to know how to end / hang up a call in Twilio Studio flow.
For example, in Gather widget, if there is no input, I want to end the call.
It seems there is no way to do this.
Also, I want to know how the flow execution ends in Twilio flow.
There is no Hangup
widget as far as I know.
If your Gather
widget does not get any input it will take the No input
path and if that is not connected to anything, the flow will end and the call will end (hangup), you can see this by checking the Studio's logs.
But, let's say that before the end of the call if there is no input from user, you would like to let the user know and then end the call with your hangup
, you could create a function under Runtime
and connect No input
to your own Hangup
function.
The Hangup
function could be something like this:
exports.handler = function(context, event, callback) {
let twiml = new Twilio.twiml.VoiceResponse();
twiml.say('No input, will hangup the call now.');
twiml.hangup();
callback(null, twiml);
};