Skip to content

Instantly share code, notes, and snippets.

@bookingninja
Last active July 14, 2022 00:10
Show Gist options
  • Save bookingninja/0916d8ae4a184bc7f5d31e392d711281 to your computer and use it in GitHub Desktop.
Save bookingninja/0916d8ae4a184bc7f5d31e392d711281 to your computer and use it in GitHub Desktop.
Twilio TwiML sequential call forwarding | Fwd to multiple numbers in order with a "press 1 to accept option". If no answer then returns call to Studio flow
<?xml version="1.0" encoding="UTF-8"?>
<!--This is the first bin to get triggered from the Studio flow-->
<Response>
<Dial timeout="12" action="forward_to_second_number.xml">
<Number url="whisper_instructions.xml">+13105559999
</Number>
</Dial>
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<!--forward_to_second_number.xml-->
<Response>
<Dial timeout="12" action="forward_to_third_number.xml">
<Number url="whisper_instructions.xml">+13105558888
</Number>
</Dial>
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<!--forward_to_third_number.xml-->
<Response>
<Dial timeout="12" action="return_to_studio.xml">
<Number url="whisper_instructions.xml">+13105557777
</Number>
</Dial>
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Redirect>https://webhooks.twilio.com/v1/Accounts/xx**acctSID**xx/Flows/xx**FlowSID**xx?FlowEvent=return&amp;callFwd=noAnswer</Redirect>
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Say>
Thank you. We're connecting your call now.
</Say>
</Response>
<?xml version="1.0" encoding="UTF-8"?>
<Response>
<Gather timeout="5" numDigits="1" action="success_connection.xml">
<Say>
You have an incoming call from your company. Press 1 to accept.
</Say>
</Gather>
</Response>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment