Donovan H
Donovan H

Reputation: 13

Twilio Studio Engagement Not Completing

I am having difficulty understanding why my Twilio Studio engagement gets "stuck" after my function's callback.

exports.handler = function(context, event, callback) {
    let twiml = new Twilio.twiml.VoiceResponse();
    twiml.say("Hello sir");
    console.log(twiml.toString());
    callback(null,twiml);
    };

picture of Studio flow

My Studio flow will execute up to function_2, return a 200 status but it will never move on to either say_play_2 or say_play_3. I have to go into the Flow Logs and manually Stop Engagement.

Am I missing something in the callback to indicate there is no more code to run?

Upvotes: 1

Views: 317

Answers (1)

LaylaCodesIt
LaylaCodesIt

Reputation: 166

Twilio developer evangelist here - albeit a new one!

The issue is that your callback function hangs up and say_play_2 is left hanging - which means the engagement doesn't complete.

I intentionally broke the code in the Twilio Function and say_play_3 then said "Failure" and the engagement completed, proving that that part of your Flow was correct.

If you swap say_play_2 for a Send Message widget, for example, the engagement will complete as it can send a message on successfully completing the function.

I hope that helps!

Upvotes: 2

Related Questions