Twilio Studio - How do I hang up a call?
Asked Answered
A

2

5

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.

Aurelioaurelius answered 19/3, 2019 at 16:53 Comment(0)
L
8

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);
};


Libation answered 19/3, 2019 at 17:48 Comment(0)
F
3

No need to use Runtime when you're already in Studio just for that. You could just have a "say/play" widget saying "No input, will hangup the call now" with nothing attached to the "audio complete" transition.

Fibroid answered 12/4, 2019 at 5:54 Comment(3)
Won't this leave the call hanging though?Chesnut
No, any studio widget which has no transition destination results in Twilio disconnecting.Fibroid
That's not true. I am trying this now and the call just rings forever. I need a hangup of some kind.Saransk

© 2022 - 2024 — McMap. All rights reserved.