-
Notifications
You must be signed in to change notification settings - Fork 50
Tropo Classes
The Tropo Classes, can be used to render JSON objects that are executed by the Tropo WebAPI.
Primary Tropo Class
Most methods will accept either an object (a secondary Tropo object – discussed below) or a combination of string or an array to generate JSON which is consumed by the Tropo WebAPI.
void ask(string|Ask $ask, [ $params = NULL])
void call(string|Call $call, [ $params = NULL])
void conference(string|Conference $conference, [ $params = NULL])
void hangup()
void message(string|Message $message, [ $params = null])
void on( $params)
void record(string|Record $record, [ $params = NULL])
void redirect(string|Redirect $redirect, [ $params = NULL])
void reject()
void renderJSON()
void say(string|Say $say, [ $params = NULL])
void setLanguage(string $language)
void setVoice(string $voice)
void startRecording(string|StartRecording $startRecording, [ $params = NULL])
void stopRecording()
void transfer(string|Transfer $transfer, [ $params = NULL])
// Simple incovation. $tropo = new Tropo(); $tropo->Say("Hello World!"); $tropo->RenderJSON(); ... // Complex invocation. Note - see Helper Classes Wiki page. $say = new Say("123456789", SayAs::$number, Event::$continue, Format::$digits); $tropo->say($say); $tropo->RenderJSON();
Secondary Tropo Classes
These classes are used by the primary Tropo class to render JSON. They can be used directly and then given to the appropriate primary Tropo method. Most action methods in the primary Tropo class can accept a secondary object. If primary Tropo class methods are invoked by passing in a secondary object, no additional parameters are needed.
- Ask: Sends a prompt to the user and optionally waits for a response.
- Call: This object allows Tropo to make an outbound call. of the text channels.
- Choices: Defines the input to be collected from the user.
- Conference: This object allows multiple lines in separate sessions to be conferenced together so that the parties on each line can talk to each other simultaneously.
- Hangup: This object instructs Tropo to “hang-up” or disconnect the session associated with the current session.
- Message: This object instructs Tropo to send a message.
- On: Adds an event callback so that your application may be notified when a particular event occurs.
- Record: Plays a prompt (audio file or text to speech) and optionally waits for a response from the caller that is recorded.
- Redirect: The redirect function forwards an incoming call to another destination / phone number before answering it.
- Reject: Allows Tropo applications to reject incoming sessions before they are answered.
- Say: When the current session is a voice channel this key will either play a message or an audio file from a URL.
- StartRecording: Allows Tropo applications to begin recording the current session.
- StopRecording: Stop an already started recording.
- Transfer: Transfers an already answered call to another destination / phone number.
$tropo = new Tropo(); $startRecording = new StartRecording(AudioFormat::$mp3, "POST", "foo", "http://someurl.com/recording.php", "bar"); $tropo->startRecording($startRecording); $tropo->RenderJSON();