function app_choice()
{
    // Accessing the result object
    $result = new Result();
    $choice = $result->getValue();
    // Create a new instance of the Tropo object.
    $tropo = new Tropo();
    // Provide a prompt based on the value
    if ($choice == "1") {
        $tropo->say("You picked Lord of the Rings.  Did you know Gandalf is also Mag knee toe?  Weird.");
    }
    if ($choice == "2") {
        $tropo->say("You picked the original Star Wars.  I hear Leonard Nimoy was awe some in those.");
    }
    if ($choice == "3") {
        $tropo->say("You picked the Star Wars prequels.  Stop calling this number, Mr. Lucas, we know it's you.");
    }
    if ($choice == "4") {
        $tropo->say("You picked the Matrix. Dude, woe.");
    }
    // Tell Tropo what to do next. This redirects to the instructions under dispatch_post('/hangup', 'app_hangup').
    $tropo->on(array("event" => "continue", "next" => "testapp.php?uri=hangup"));
    // Tell Tropo what to do if there's an problem, like a timeout. This redirects to the instructions under dispatch_post('/incomplete', 'app_incomplete').
    $tropo->on(array("event" => "incomplete", "next" => "testapp.php?uri=incomplete"));
    // Render the JSON for the Tropo WebAPI to consume.
    return $tropo->RenderJson();
}
function app_continue()
{
    $tropo = new Tropo();
    @($result = new Result());
    $userType = $result->getUserType();
    $tropo->say("You are a {$userType}");
    $tropo->RenderJson();
}
function zip_end()
{
    // Create a new instance of the result object and get the value of the user input.
    $result = new Result();
    $zip = $result->getValue();
    // Create a new instance of the Tropo object.
    $tropo = new Tropo();
    // Get the weather information for the entered zip code.
    formatWeatherResponse($tropo, $zip);
    // Render the JSON for the Tropo WebAPI to consume.
    return $tropo->RenderJson();
}
function conference()
{
    global $voice;
    $tropo = new Tropo();
    $tropo->setVoice($voice);
    $result = new Result();
    $conference = $result->getValue();
    $tropo->say('<speak>Conference ID <say-as interpret-as=\'vxml:digits\'>' . $conference . '</say-as> accepted.</speak>');
    $tropo->say('You will now be placed into the conference. Please announce yourself. To exit the conference without disconnecting, press pound.');
    $tropo->conference($conference, array('id' => $conference, 'terminator' => '#'));
    $tropo->say('You have left the conference.');
    $tropo->on(array("event" => "continue", "next" => "restart"));
    $tropo->RenderJson();
}