Pass the Status of a Second Call Leg to the Browser in Twilio Voice JavaScript SDK Calls

The Twilio Voice JavaScript SDK does not have a built-in ability to relay the status of a child call back to the user. That said, it is possible to build this into your application.

A simple way to do this would be for the Voice SDK app to make an AJAX or WebSocket request to your server where your TwiML webhook is hosted. This request can check if certain TwiML has been requested, and then pass that information in a response to the AJAX request. Here are some examples you could use to check:

  • a <Number> url attribute call "whisper tone" or pre-answer announcement to the callee - this indicates the call has been answered.
  • a <Dial> action attribute post call URL fetch - this indicates the call has ended.
Have more questions? Submit a request
Powered by Zendesk