Twilio Voice Call State shows "Connected" even if the receiver has not picked up the call

Viewed 362

I am using twilio programmable voice in android. Voice call feature is working perfectly. But the state of an initiated call is showing "connected" even if the dialled party has declined or still haven't answered the call.

I have to get call duration based on it. But the way the listener shows the state of a call, it is not correct. so how can i get the information/status of a call when it is finally answered by receiver?

1 Answers

Twilio developer evangelist here.

You can find out the duration that a call lasted by requesting it from the API and querying the Duration property.

If you need to more accurately show when a call is answered (and not just dialling) in your application, then you can't do that with only the Voice SDK.

Instead, you will need to set a statusCallback URL in the <Number> or <Client> that you use in your TwiML application. You can set to receive a webhook when the call is answered. You can then use that webhook event to update your application's UI.

Let me know if that helps at all.

Related