Aditya
Aditya

Reputation: 41

How to get the exact status of the Twilio outbound call

I have a requirement to save the exact status of a outbound call in my repository like 1)Not connected - When phone is switched off or Busy 2)UnAnswered - Call connected, But user did not pick up the call 3)Answered - Call picked up the user.

i have written some event listeners for "Ringing" , "Accept". But Ringing is getting even though the phone is switched off.

Upvotes: 1

Views: 916

Answers (1)

philnash
philnash

Reputation: 73075

Twilio developer evangelist here.

To get the status of an outbound call from Twilio you need to set up to receive webhook callbacks with the call status.

When you make the outbound call from <Dial> (as you are doing in this question) you should set the action attribute to a URL in your application. When the call is complete, Twilio will make a request to that URL with parameters that will include a DialCallStatus which could be "completed", "answered", "busy", "no-answer", "failed" or "canceled".

You should use the call Sid and this status to update your database with the final state of the call.

Upvotes: 1

Related Questions