twiliophone-call

Twilio: call multiple phone numbers at once and get connected to the first one which answers


I want to call multiple numbers and get connected to the first one which answers. Also as soon as someone answers, the other numbers should stop ringing.

I am aware of the solution described here: https://www.twilio.com/blog/2009/05/dialing-multiple-numbers-simultaneously-with-twilio.html

Which basically consists of one Dial verb with multiple Numbers:

<Response>
  <Dial action="/handleDialStatus.php" method="GET">
    <Number>877-555-1212</Number>
    <Number>877-999-1234</Number>
    <Number>877-123-4567</Number>
  </Dial>
</Response>

But as they say:

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.

That's a big problem for me, and they don't offer a solution for that!

I implemented Call Screening as described here. The idea is to ask the callees to press any key before they are connected to the caller to avoid answering machines.

However as soon as the screening process starts for a number, the other phones stops ringing! Basically it acts as if the callee had already been connected, so it doesn't solve the problem at all.

Any other solution?


Solution

  • Twilio developer evangelist here.

    Rather than trying to connect to each caller via <Dial> which has the problem you describe, why not make and control each of the calls separately through the REST API.

    That way, you could create a call to each of the numbers you want to call. Then when a phone is answered, present the call screening challenge, then if the call succeeds connect it through to the original call and cancel all the other calls that you made.

    The downside here is that you would need to register for callback events for each of the calls so that you could tell if none of them were successfully answered and then do something with your original call after that.

    Let me know if that helps at all.