Henry Henderson
Henry Henderson

Reputation: 151

Dial multiple numbers, hangup on non-answered and connect answered call (twilio)

I'm trying to setup a dialer system for a sales department that will dial multiple numbers from a supplied list, and await for one to be answered by a human. When this occurs, the other phones ringing should immediately be dropped.

According to this Twilio blog post from 2009, nesting in a TwiML command should do exactly this. However, upon my testing I find that if a single phone rejects the call no others will be dialed and the entire call-event ends. Is this no longer possible since this post in 2009, or has something changed?

I am using the twilio-client in a web interface and the node helper library to handle receiving events and generating TwiXML responses.

Upvotes: 3

Views: 944

Answers (1)

idarak
idarak

Reputation: 124

When you give the twiML response as

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial>
    <Number>877-555-1212</Number>
    <Number>877-999-1234</Number>
    <Number>877-123-4567</Number>
  </Dial>
</Response>

All the numbers will be called simultaneously and If the call is rejected from any one of the numbers, the other numbers will surely be dialed out until the timeout attribute (in seconds) in the Dial verb

So you can extend this timeout as below,

<Dial timeout='50'>

Refer This documentation for more on timeout attribute.

In case if you again want to do some action based on the dialcallstatus,

When ends, Twilio will submit to the action URL with the parameter DialStatus with one of the following scenarios:

  1. nobody picks up, DialStatus=no-answer
  2. the line is busy, DialStatus=busy
  3. the called party picked up, DialStatus=answered
  4. an invalid phone number was provided, DialStatus=failed

You can handle it in the action attribute of Dial verb as below

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

So in the Response construction you can handle the other stuff based on the dialcallstatus param in the request of your mentioned "action url" from Twilio.

Upvotes: 4

Related Questions