Created
March 8, 2012 01:18
-
-
Save TMcManus/1997785 to your computer and use it in GitHub Desktop.
Simple Twilio Conditional Logic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ---- Setting up this script ---- | |
| 1) Upload these files to a location that is publicly accessible on the internet. | |
| 2) Enter the URL of the file named "index.xml" into the Voice Request URL of the number you want to setup. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <Response> | |
| <Gather action="switch.php" method="POST"> | |
| <Say>To listen to a robot speak, press 1.</Say> | |
| <Say>To call a fake movie number, press 2.</Say> | |
| </Gather> | |
| </Response> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <Response> | |
| <Say>You selected 1, so you get to speak to a robot!</Say> | |
| <Pause length="2"/> | |
| <Say voice="woman">I just paused for 2 seconds, and now I'm a female robot, apparently...</Say> | |
| </Response> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?xml version="1.0" encoding="UTF-8"?> | |
| <Response> | |
| <Say>You are about to dial a fake number, which won't work. Try replacing this with a real number.</Say> | |
| <Dial>+15555555555</Dial> | |
| </Response> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| switch ($_REQUEST['Digits']): | |
| case '1': | |
| include('option-1.xml'); | |
| break; | |
| case '2': | |
| include('option-2.xml'); | |
| break; | |
| default: | |
| include('index.xml'); | |
| endswitch; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment