Created
October 27, 2010 18:29
-
-
Save mheadd/649647 to your computer and use it in GitHub Desktop.
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 | |
| require_once 'path/to/tropo.class.php'; | |
| // Create a new instance of the Tropo object. | |
| $tropo = new Tropo(); | |
| // Create a say object and give it the URL of an audio file. | |
| $say = new Say("http://mp3server.com/someringtone.mp3"); | |
| // Create a new On object to handle the ring event. | |
| $on = new On('ring', null, $say); | |
| // Create a new transfer | |
| $tropo->transfer("+15407894563", array("timeout" => 60, "ringRepeat" => 5, "on" => $on)); | |
| // Hangup when done. | |
| $tropo->hangup(); | |
| // Render JSON for Tropo to consume. | |
| $tropo->renderJSON(); | |
| /* | |
| * Rendered JSON. | |
| * | |
| * { | |
| "tropo": [ | |
| { | |
| "transfer": { | |
| "to": "+15407894563", | |
| "ringRepeat": 5, | |
| "timeout": 60, | |
| "on": { | |
| "event": "ring", | |
| "say": { | |
| "value": "http://mp3server.com/someringtone.mp3" | |
| } | |
| } | |
| } | |
| }, | |
| { | |
| "hangup": "null" | |
| } | |
| ] | |
| } | |
| * | |
| */ | |
| ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment