Skip to content

Instantly share code, notes, and snippets.

@mheadd
Created October 27, 2010 18:29
Show Gist options
  • Select an option

  • Save mheadd/649647 to your computer and use it in GitHub Desktop.

Select an option

Save mheadd/649647 to your computer and use it in GitHub Desktop.
<?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