コード例 #1
0
function app_start()
{
    $tropo = new Tropo();
    $tropo->call("+14071234321", array("machineDetection" => "This is just a test to see if you are a human or a machine. PLease hold while we determine. Almost finished. Thank you!", "voice" => "Kate"));
    $tropo->on(array("event" => "continue", "next" => "your_app.php?uri=continue"));
    $tropo->RenderJson();
}
コード例 #2
0
ファイル: CallTest.php プロジェクト: akalsey/TropoPHP
 public function testCallUsingCallObject()
 {
     $tropo = new Tropo();
     $rec = new StartRecording('recording', 'audio/mp3', 'POST', 'password', 'http://blah.com/recordings/1234.wav', 'jose');
     $call = new Call("3055195825", "3055551212", "SMS", "TEXT", false, 10, array('foo' => 'bar', 'bling' => 'baz'), $rec);
     $tropo->call($call);
     $this->assertEquals('{"tropo":[{"call":{"to":"3055195825","from":"3055551212","network":"SMS","channel":"TEXT","timeout":10,"answerOnMedia":false,"headers":{"foo":"bar","bling":"baz"},"recording":{"format":"audio/mp3","method":"POST","password":"******","url":"http://blah.com/recordings/1234.wav","username":"******"}}}]}', sprintf($tropo));
 }
コード例 #3
0
ファイル: tropo_api.php プロジェクト: anupkelkar02/FSM
 public function voice($number = '', $initial_text = '')
 {
     $this->set_output_mode(MY_Controller::OUTPUT_NORMAL);
     $session = new Session();
     $phone_number = $session->getParameters('phone_number');
     $message = $session->getParameters('message');
     $tropo = new Tropo();
     $tropo->call("sip:{$phone_number}@shims.starhub.net.sg");
     $tropo->wait(1000);
     $tropo->say($message);
     $caller = $session->getFrom();
     $called = $session->getTo();
     $tropo->say('Your number is ' . $caller['id']);
     //$tropo->say('This is via '.$called['channel']);
     $tropo->ask('Press 1 to hangup or 2 to continue', array('choices' => "1,2", 'name' => 'digit', 'timeout' => 60));
     $tropo->on(array('event' => 'continue', 'next' => 'voice_continue'));
     $tropo->RenderJson();
 }
コード例 #4
0
<?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;
        }
    }
}
コード例 #5
0
<?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
?>
 
コード例 #6
0
 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();
 }
コード例 #7
0
<?php

require 'tropo.class.php';
$tropo = new Tropo();
$tropo->call("+xxx");
$transcription = new Transcription("mailto:example@xx.xx", "12345", null, "de_DE");
$tropo->record(array('name' => 'recording', 'say' => 'Bitte lassen Sie eine Nachricht.', 'terminator' => '#', 'maxSilence' => 7, 'maxTime' => 60, 'transcription' => $transcription, 'timeout' => 10, 'voice' => 'Katrin'));
$tropo->RenderJson();