Search code examples
twiliotwilio-apitwilio-twiml

Is it possible to modify live call statusCallback value?


Is it possible to modify the statusCallback, statusCallbackEvent and statusCallbackMethod of the live call ?

I've used this article as a reference https://www.twilio.com/docs/voice/modify-live-calls In the article, it said you can POST to update the live call but when I tried to update the statusCallback URL, it's not working. There is nothing trigger new statusCallback URL when the call end.

My use case is to

  1. Tracking call status of inbound call
  2. Tracking call status of outbound call from Web Client (which we use TwilioClient SDK to make a call to Twiml App)

I know that I can set the statusCallback URL in phone number page for inbound call and in Twiml App page for outbound call. But there are 2 problems with that.

  1. There is no field to specify the statusCallbackEvent type I need.
  2. my statusCallback URL is generated dynamically so I can't use hardcode the statusCallback URL. (that's why I'm trying to update the statusCallback URL) (eg. ${BASE_URL}/voice/:conferenceKey/call/callback)

I'm using NodeJS and here is the example code I used to update the statusCallback. I've also double check that call_sid is matched with live call sid.

return client.calls(call_sid)
         .update({
           statusCallback: `${process.env.API_HOST}/voice/${conferenceKey}/call/callback`,
           statusCallbackMethod: 'POST',
           statusCallbackEvent: ['answered', 'completed'],
         });

Any help is appreciated, thanks! :)


Solution

  • Twilio developer evangelist here.

    The only things you can update for a call that's in progress are the current URL (redirect the call to new TwiML) or the status (set to complete to end the call). You can't update the statusCallback URL during a call.

    If your calls are going to a conference, then might conference statusCallback events help?