function app_continue() { $tropo = new Tropo(); @($result = new Result()); $userType = $result->getUserType(); $tropo->say("You are a {$userType}"); $tropo->RenderJson(); }
public function voice_continue() { $this->set_output_mode(MY_Controller::OUTPUT_NORMAL); $tropo = new Tropo(); @($result = new Result()); $answer = $result->getValue(); $tropo->say("You said " . $answer); $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(); }
function demo_end() { $result = new Result(); $zip = $result->getValue(); $weather_info = getWeather($zip); $city = array_pop($weather_info); $tropo = new Tropo(); $tropo->say("The current weather for {$city} is..."); foreach ($weather_info as $info) { $tropo->say("{$info}."); } $tropo->say("Thank you for calling. Goodbye."); $tropo->hangup(); return $tropo->RenderJson(); }
function app_error() { $tropo = new Tropo(); $tropo->say("Something has gone wrong, please call back."); $tropo->hangup(); return $tropo->RenderJson(); }
<?php require 'tropo.class.php'; error_reporting(0); $tropo = new Tropo(); $session = new Session(); $from = $session->getFrom(); $callerID = $from["id"]; $tropo->say("You are about to enter the conference"); $tropo->conference(null, array("id" => "1234", "name" => "joinleave", "joinPrompt" => "{$callerID} has entered the conference", "leavePrompt" => "{$callerID} has left the conference", "voice" => "Kate")); $tropo->RenderJson();
<?php //this example accepts parameters passed to it from an outside REST request (such as a curl app) - //it extracts the values of the passed parameters and uses it to send, in this case, an outbound text use Tropo\Action\Session; require 'tropo.class.php'; //brings in the Tropo library $session = new Session(); $to = "+" . $session->getParameters("numbertodial"); $name = $session->getParameters("customername"); $msg = $session->getParameters("msg"); //extracts the contents of the passed parameters and assigns them as variables for later use $tropo = new Tropo(); $tropo->call($to, array('network' => 'SMS')); $tropo->say("OMG " . $name . ", " . $msg . "!"); //actually creates the call, passed the "to" value and then adds in the other variables for the message return $tropo->RenderJson(); //defines the response to Tropo in JSON ?>
protected function _send_reply_message() { $tropo = new Tropo(); $tropo->call($this->_session->from_phone_number, array('network' => 'SMS')); $tropo->say($this->_session->message); $tropo->RenderJson(); }