Dialing Multiple Numbers Simultaneously with Twilio

May 14, 2009
Written by
Danielle Morrill
Contributor
Opinions expressed by Twilio contributors are their own

Twilio Bug Logo

Yesterday, Brad Gessler asked whether he could use Twilio to simultaneously call multiple people for a call routing app.  This is a common use case, even for something as simple as a front desk phone of a small business that rings multiple people and hangs up once the first person answers.

Twilio-multi-dial-twitter-Q

Answer: YES, you can do that with Twilio.

I’m going to show you the TwiML you’ll need to
implement it.

Because the element can be nested within , you can include multiple numbers under the same element, like this:

<?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>

This command will dial all three numbers simultaneously, and the first number to answer will be connected to the call while the other two will be hung up on.

Tips & Advice When Using This Feature

A word to the wise, in the case of calling a phone that automatically goes to voicemail or an automated answering system, it’s likely the call will be picked up faster by one of these machines than any human being can answer.

If you want to offer a voicemail box as a fall back in the case that all three lines do not answer, try using a handler to determine the next step for the call based on the DialStatus, like this:

<?xml version="1.0" encoding="UTF-8"?>
<Response>
  <Dial action="/handleDialStatus.php" method="GET">
    <Number>877-555-1212</Number>
    <Number>877-999-1234</Number>
    <Number>877-123-4567</Number>
  </Dial>
</Response>

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

  • nobody picks up, DialStatus=no-answer
  • the line is busy,
    DialStatus=busy
  • he called party picked up, DialStatus=answered
  • an
    invalid phone number was provided, DialStatus=failed

Your web application can look at the DialStatus parameter and decide what to
do next.
If an action URL is provided for Dial, Twilio will always post to it, regardless of outcome of Dial.
All verbs remaining in the document will be unreachable and ignored.

Related Resources in the Twilio Documentation:

TwiML Dial Verb

Twilio REST API Call Resource