1
votes

on Twilio's tutorial it sets action parameter to /handleDialCallStatus but I have no clue what happens when it redirects to the url. How can I handle the status of calls .How can I redirect to another url when the call has completed

1

1 Answers

1
votes

Twilio evangelist here.

When the <Dial> call ends, the action URL tells Twilio where to send a GET or POST request. A DialCallStatus is passed to the action URL according to one of the following scenarios:

  • Nobody picks up, DialCallStatus=no-answer
  • The line is busy, DialCallStatus=busy
  • When calling a conference and the call is connected, DialCallStatus=answered
  • Someone answered the call and was connected to the caller, DialCallStatus=connected
  • An invalid phone number was provided, DialCallStatus=failed
  • Call canceled via the REST API before it was answered, DialCallStatus=canceled

How do you handle these scenarios? In the action attribute URL of the Dial verb.

<Dial timeout='50' action='your_url'>

The web app hosted at this action URL can then look at the DialCallStatus and send a response to Twilio telling it what to do next.

You can replace your_url with another URL (absolute or relative) to redirect there, and Twilio will continue the initial call after the dialed party hangs up. No TwiML verbs included after that <Dial> will be reachable, so if you want to take more actions on that initial call, you need to respond to Twilio's request with TwiML instructions on how to handle the call.

Any TwiML verbs included after this <Dial> will be unreachable, as your response to Twilio takes full control of the initial call. If you want to take more actions on that initial call, you must respond to Twilio's request with TwiML instructions on how to handle the call.

Hope this helps.