anonn023432
anonn023432

Reputation: 3120

Monitor Twilio Voice Call Status

I am implementing the Twilio Programmable Voice to allow Outgoing calls to phone numbers from my Website.

I want to display a timer after the call has been picked by the client but I can't figure out how to monitor the status of a call in React.

Twilio Docs - .status() can be used to get the current status of the call.

They have the following endpoint status() which can be used but in this case, should I create a function which keeps on checking the status of the call somehow until it reaches the accepted state?

Is there a way I can track this?

Upvotes: 0

Views: 868

Answers (1)

philnash
philnash

Reputation: 73027

Twilio developer evangelist here.

The best way to track the status of a Twilio Client call at the moment is via the webhook status callbacks that you can set up in TwiML. This means you need to somehow send the data from the webhook to your client, but it is more accurate than polling.

Alternatively, you could just set up a setInterval to check every 100ms, for example, and set your state, cancelling the interval when it is the correct state.

Upvotes: 1

Related Questions