Skip to content

Instantly share code, notes, and snippets.

@mheadd
Created August 13, 2010 19:15
Show Gist options
  • Save mheadd/523398 to your computer and use it in GitHub Desktop.
Save mheadd/523398 to your computer and use it in GitHub Desktop.
<?php
// Include Tropo classes.
require('library/TropoClasses.php');
// Create a new instance of the Tropo object.
$tropo = new Tropo();
// Create a new Tropo Session Object and determine the channel in use.
$session = new Session();
$from_info = $session->getFrom();
// Ask the caller to say or enter start, depending on the channel used.
if($from_info["channel"] == Channel::$voice) {
$tropo->ask("To begin, say start.", array("choices" => "start", "attempts" => 3));
} else {
$tropo->ask("To begin, enter start.", array("choices" => "start"));
}
$tropo->on(array("event" => "continue", "next" => "test-2.php", "say" => "Please hold..."));
// Render the JSON for the Tropo WebAPI to consume.
$tropo->RenderJson();
?>
<?php
// Include Tropo classes.
require('library/TropoClasses.php');
// Create a new instance of the Result object.
$result = new Result();
// Create a new instance of the Tropo object.
$tropo = new Tropo();
// Tell the user what they entered.
$tropo->say("You entered, ".$result->getValue());
// Hangup when finished.
$tropo->hangup();
// Render the JSON for the Tropo WebAPI to consume.
$tropo->RenderJson();
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment