Search code examples
twiliotwilio-twiml

Using Twiml How Do I Implement a Sequential Ring Group?


I want to use Twilio / Twiml to create a sequential ring group when a call comes in. What I have currently rings all phone numbers in the group simultaneously.

<dial timeout="30">
   <number>xxx-xxx-xxxx</number>
   <number>xxx-xxx-xxxx</number>
</dial>

I dont want the simultaneous behavior, instead I want the dial verb to dial the first number and wait 30 seconds, then if there is no answer, ring the next phone number and so on.

How do I implement this using twiml?

Thanks in advance.


Solution

  • Perhaps there is a more sophisticated way to do this but you could return multiple dial with a pause (and eventually a say) in between.

    The pause will give time to the initiator to hangup before a next dial is executed.

    <Dial timeout="30">
       <number>xxx-xxx-xxxx</number>
    </Dial>
    
    <Pause length="5"/>
    <Say>Moving to call the next number. You can hangup now if you wish to stop this.</Say>
    <Pause length="5"/>
    
    <Dial timeout="30">
       <number>xxx-xxx-xxxx</number>
    </Dial>
    
    <Pause length="5"/>
    <Say>Moving to call the next number. You can hangup now if you wish to stop this.</Say>
    <Pause length="5"/>
    
    <Dial timeout="30">
       <number>xxx-xxx-xxxx</number>
    </Dial>