function demo_error() { $tropo = new Tropo(); $tropo->say("Please try your request again later."); $tropo->hangup(); return $tropo->renderJSON(); }
function zip_error() { // Step 1. Create a new instance of the Tropo object. $tropo = new Tropo(); // Step 2. This is the last thing the user will be told before the session ends. $tropo->say("Please try your request again later."); // Step 3. End the session. $tropo->hangup(); // Step 4. Render the JSON for the Tropo WebAPI to consume. return $tropo->renderJSON(); }
<?php include_once 'tropo.class.php'; $token = 'your token here'; $number = 'the number you would like to dial'; $tropo = new Tropo(); try { $session = new Session(); if ($session->getParams("action") == "create") { $tropo->call($session->getParams("dial")); $tropo->say('This is an outbound call.'); } else { $tropo->say('Thank you for calling us.'); } $tropo->renderJSON(); } catch (Exception $e) { if ($e->getCode() == '1') { // The session object threw an exception, so this file wasn't // loaded as part of a Tropo session. Launch a Tropo session. if ($tropo->createSession($token, array('dial' => $number))) { print 'Call launched to ' . $number; } } }