Docs For Class AGI

## AGI

Description

AGI class

- link: http://www.voip-info.org/wiki-Asterisk+agi
- example: Ping an IP address
- example: Get DTMF tones from the user and say the digits
- example: Get text input from the user and say it back

Located in /phpagi.php (line 65)

Direct descendents

Class | Description
--- | ---
AGI_1 | Asterisk Manager class

Variable Summary
AGI_AsteriskManager $asmanager
mixed $audio
array $config
mixed $in
mixed $option_delim
mixed $out
array $request
Method Summary
AGI __construct ([string $config = NULL], [array $optconfig = array()])
array, answer ()
array, channel_status ([string $channel = ''])
void conlog (string $str, [integer $vbl = 1])
array, database_del (string $family, string $key)
array, database_deltree (string $family, [string $keytree = ''])
array, database_get (string $family, string $key)
array, database_put (string $family, string $key, string $value)
array evaluate (string $command)
array, exec (string $application, mixed $options)
array, exec_absolutetimeout ([$seconds $seconds = 0])
array, exec_agi (string $command, string $args)
array, exec_dial (string $type, string $identifier, [integer $timeout = NULL], [string $options = NULL], [string $url = NULL])
array, exec_enumlookup ($exten $exten)
array, exec_goto (string $a, [ $b = NULL], [ $c = NULL], string $b;, string $c;)
array, exec_setlanguage ([string $language = 'en'])
array, fastpass_get_data ( &$buffer, string $filename, [integer $timeout = NULL], [integer $max_digits = NULL], string $buffer)
array, fastpass_say_digits ( &$buffer, integer $digits, [string $escape_digits = ''], string $buffer)
array, fastpass_say_number ( &$buffer, integer $number, [string $escape_digits = ''], string $buffer)
array, fastpass_say_phonetic ( &$buffer, string $text, [string $escape_digits = ''], string $buffer)
array, fastpass_say_punctuation ( &$buffer, string $text, [string $escape_digits = ''], [integer $frequency = 8000], string $buffer)
array, fastpass_say_time ( &$buffer, [integer $time = NULL], [string $escape_digits = ''], string $buffer)
array, fastpass_stream_file ( &$buffer, string $filename, [string $escape_digits = ''], [integer $offset = 0], string $buffer)
array, fastpass_swift ( &$buffer, string $text, [string $escape_digits = ''], [integer $frequency = 8000], [ $voice = NULL], string $buffer)
array, fastpass_text2wav ( &$buffer, string $text, [string $escape_digits = ''], [integer $frequency = 8000], string $buffer)
array, get_data (string $filename, [integer $timeout = NULL], [integer $max_digits = NULL])
array, get_fullvariable (string $variable, [string $channel = FALSE], [boolean $getvalue = FALSE])
array, get_variable (string $variable, [boolean $getvalue = FALSE])
array, hangup ([string $channel = ''])
boolean make_folder (string $folder, [integer $perms = 0755])
mixed menu (array $choices, [ $timeout = 2000])
void &new_AsteriskManager ()
array, noop ([ $string = ""])
array('Name'=>$name, parse_callerid ([string $callerid = NULL])
array, receive_char ([integer $timeout = -1])
array, record_file (string $file, string $format, [string $escape_digits = ''], [integer $timeout = -1], [integer $offset = NULL], [boolean $beep = false], [integer $silence = NULL])
array, say_digits (integer $digits, [string $escape_digits = ''])
array, say_number (integer $number, [string $escape_digits = ''])
array, say_phonetic (string $text, [string $escape_digits = ''])
array, say_punctuation (string $text, [string $escape_digits = ''], [integer $frequency = 8000])
array, say_time ([integer $time = NULL], [string $escape_digits = ''])
array, send_image (string $image)
array, send_text ($text $text)
void setContext (string $context, [string $extension = 's'], [string $priority = 1])
array, set_autohangup ([integer $time = 0])
array, set_callerid (string $cid)
array, set_context (string $context)
array, set_extension (string $extension)
array, set_global_var (string $pVariable, string|int|float $pValue)
array, set_music ([boolean $enabled = true], [string $class = ''])
array, set_priority (integer $priority)
array, set_var (string $pVariable, string|int|float $pValue)
array, set_variable (string $variable, string $value)
array, stream_file (string $filename, [string $escape_digits = ''], [integer $offset = 0])
array, swift (string $text, [string $escape_digits = ''], [integer $frequency = 8000], [ $voice = NULL])
array, tdd_mode (string $setting)
array, text2wav (string $text, [string $escape_digits = ''], [integer $frequency = 8000])
string text_input ([ $mode = 'NUMERIC'])
array, verbose (string $message, [integer $level = 1])
array, wait_for_digit ([integer $timeout = -1])
string which (string $cmd, [string $checkpath = NULL])
Variables
AGI_AsteriskManager $asmanager (line 108)

Asterisk Manager

- access: public

mixed $audio = NULL (line 129)

Audio Stream

- access: public

array $config (line 100)

Config variables

- access: public

mixed $in = NULL (line 115)

Input Stream

- access: private

mixed $option_delim = "," (line 137)

Application option delimiter

- access: public

mixed $out = NULL (line 122)

Output Stream

- access: private

array $request (line 92)

Request variables read in on initialization.

Often contains any/all of the following: agi_request - name of agi script agi_channel - current channel agi_language - current language agi_type - channel type (SIP, ZAP, IAX, ...) agi_uniqueid - unique id based on unix time agi_callerid - callerID string agi_dnid - dialed number id agi_rdnis - referring DNIS number agi_context - current context agi_extension - extension dialed agi_priority - current priority agi_enhanced - value is 1.0 if started as an EAGI script agi_accountcode - set by SetAccount in the dialplan agi_network - value is yes if this is a fastagi agi_network_script - name of the script to execute

NOTE: program arguments are still in $_SERVER['argv'].

- access: public

Methods
Constructor __construct (line 145)

Constructor

AGI __construct ([string $config = NULL], [array $optconfig = array()])

- string $config: is the name of the config file to parse
- array $optconfig: is an array of configuration vars and vals, stuffed into $this->config['phpagi']

answer (line 231)

Answer channel if not already in answer state.

- return: see evaluate for return information. ['result'] is 0 on success, -1 on failure.
- link: http://www.voip-info.org/wiki-answer
- example: Ping an IP address
- example: Get DTMF tones from the user and say the digits
- example: Get text input from the user and say it back

array, answer ()
channel_status (line 243)

Get the status of the specified channel. If no channel name is specified, return the status of the current channel.

- return: see evaluate for return information. ['data'] contains description.
- link: http://www.voip-info.org/wiki-channel+status

array, channel_status ([string $channel = ''])

- string $channel

conlog (line 1667)

Log to console if debug mode.

- example: Ping an IP address

void conlog (string $str, [integer $vbl = 1])

- string $str
- integer $vbl: verbose level

database_del (line 272)

Deletes an entry in the Asterisk database for a given family and key.

- return: see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise.
- link: http://www.voip-info.org/wiki-database+del

array, database_del (string $family, string $key)

- string $family
- string $key

database_deltree (line 285)

Deletes a family or specific keytree within a family in the Asterisk database.

- return: see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise.
- link: http://www.voip-info.org/wiki-database+deltree

array, database_deltree (string $family, [string $keytree = ''])

- string $family
- string $keytree

database_get (line 300)

Retrieves an entry in the Asterisk database for a given family and key.

- return: see evaluate for return information. ['result'] is 1 on sucess, 0 failure. ['data'] holds the value
- link: http://www.voip-info.org/wiki-database+get

array, database_get (string $family, string $key)

- string $family
- string $key

database_put (line 313)

Adds or updates an entry in the Asterisk database for a given family, key, and value.

- return: see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise

array, database_put (string $family, string $key, string $value)

- string $family
- string $key
- string $value

evaluate (line 1571)

Evaluate an AGI command.

- return: ('code'=>$code, 'result'=>$result, 'data'=>$data)
- access: private

array evaluate (string $command)

- string $command

exec (line 365)

Executes the specified Asterisk application with given options.

- return: see evaluate for return information. ['result'] is whatever the application returns, or -2 on failure to find application
- link: http://www.voip-info.org/wiki-Asterisk+-+documentation+of+application+commands
- link: http://www.voip-info.org/wiki-exec

array, exec (string $application, mixed $options)

- string $application
- mixed $options

exec_absolutetimeout (line 821)

Set absolute maximum time of call.

Note that the timeout is set from the current time forward, not counting the number of seconds the call has already been up. Each time you call AbsoluteTimeout(), all previous absolute timeouts are cancelled. Will return the call to the T extension so that you can playback an explanatory note to the calling party (the called party will not hear that)

- return: see evaluate for return information.
- link: http://www.dynx.net/ASTERISK/AGI/ccard/agi-ccard.agi
- link: http://www.voip-info.org/wiki-Asterisk+-+documentation+of+application+commands

array, exec_absolutetimeout ([$seconds $seconds = 0])

- $seconds $seconds: allowed, 0 disables timeout

exec_agi (line 833)

Executes an AGI compliant application.

- return: see evaluate for return information. ['result'] is -1 on hangup or if application requested hangup, or 0 on non-hangup exit.

array, exec_agi (string $command, string $args)

- string $command
- string $args

exec_dial (line 879)

Dial.

Dial takes input from ${VXML_URL} to send XML Url to Cisco 7960 Dial takes input from ${ALERT_INFO} to set ring cadence for Cisco phones Dial returns ${CAUSECODE}: If the dial failed, this is the errormessage. Dial returns ${DIALSTATUS}: Text code returning status of last dial attempt.

- return: see evaluate for return information.
- link: http://www.voip-info.org/wiki-Asterisk+cmd+Dial

array, exec_dial (string $type, string $identifier, [integer $timeout = NULL], [string $options = NULL], [string $url = NULL])

- string $type
- string $identifier
- integer $timeout
- string $options
- string $url

exec_enumlookup (line 858)

Do ENUM Lookup.

Note: to retrieve the result, use get_variable('ENUM');

- return: see evaluate for return information.

array, exec_enumlookup ($exten $exten)

- $exten $exten

exec_goto (line 895)

Goto.

This function takes three arguments: context,extension, and priority, but the leading arguments are optional, not the trailing arguments. Thuse goto($z) sets the priority to $z.

- return: see evaluate for return information.

array, exec_goto (string $a, [ $b = NULL], [ $c = NULL], string $b;, string $c;)

- string $a
- string $b;
- string $c;
- $b
- $c

exec_setlanguage (line 844)

Set Language.

- return: see evaluate for return information.

array, exec_setlanguage ([string $language = 'en'])

- string $language: code

fastpass_get_data (line 1176)

Plays the given file and receives DTMF data.

Return early if $buffer is adequate for request.

This is similar to STREAM FILE, but this command can accept and return many DTMF digits, while STREAM FILE returns immediately after the first DTMF digit is detected.

Asterisk looks for the file to play in /var/lib/asterisk/sounds by default.

If the user doesn't press any keys when the message plays, there is $timeout milliseconds of silence then the command ends.

The user has the opportunity to press a key at any time during the message or the post-message silence. If the user presses a key while the message is playing, the message stops playing. When the first key is pressed a timer starts counting for $timeout milliseconds. Every time the user presses another key the timer is restarted. The command ends when the counter goes to zero or the maximum number of digits is entered, whichever happens first.

If you don't specify a time out then a default timeout of 2000 is used following a pressed digit. If no digits are pressed then 6 seconds of silence follow the message.

If you don't specify $max_digits then the user can enter as many digits as they want.

Pressing the # key has the same effect as the timer running out: the command ends and any previously keyed digits are returned. A side effect of this is that there is no way to read a # key using this command.

- return:

  see evaluate for return information. ['result'] holds the digits and ['data'] holds the timeout if present.

  This differs from other commands with return DTMF as numbers representing ASCII characters.

- link: http://www.voip-info.org/wiki-get+data

array, fastpass_get_data ( &$buffer, string $filename, [integer $timeout = NULL], [integer $max_digits = NULL], string $buffer)

- string $buffer
- string $filename: file to play. Do not include file extension.
- integer $timeout: milliseconds
- integer $max_digits
- &$buffer

fastpass_say_digits (line 916)

Say the given digit string, returning early if any of the given DTMF escape digits are received on the channel.

Return early if $buffer is adequate for request.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-say+digits

array, fastpass_say_digits ( &$buffer, integer $digits, [string $escape_digits = ''], string $buffer)

- string $buffer
- integer $digits
- string $escape_digits
- &$buffer

fastpass_say_number (line 945)

Say the given number, returning early if any of the given DTMF escape digits are received on the channel.

Return early if $buffer is adequate for request.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-say+number

array, fastpass_say_number ( &$buffer, integer $number, [string $escape_digits = ''], string $buffer)

- string $buffer
- integer $number
- string $escape_digits
- &$buffer

fastpass_say_phonetic (line 974)

Say the given character string, returning early if any of the given DTMF escape digits are received on the channel.

Return early if $buffer is adequate for request.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-say+phonetic

array, fastpass_say_phonetic ( &$buffer, string $text, [string $escape_digits = ''], string $buffer)

- string $buffer
- string $text
- string $escape_digits
- &$buffer

fastpass_say_punctuation (line 1121)

Say Puncutation in a string.

Return early if $buffer is adequate for request.

- return: see evaluate for return information.

array, fastpass_say_punctuation ( &$buffer, string $text, [string $escape_digits = ''], [integer $frequency = 8000], string $buffer)

- string $buffer
- string $text
- string $escape_digits
- integer $frequency
- &$buffer

fastpass_say_time (line 1003)

Say a given time, returning early if any of the given DTMF escape digits are received on the channel.

Return early if $buffer is adequate for request.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-say+time

array, fastpass_say_time ( &$buffer, [integer $time = NULL], [string $escape_digits = ''], string $buffer)

- string $buffer
- integer $time: number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
- string $escape_digits
- &$buffer

fastpass_stream_file (line 1035)

Play the given audio file, allowing playback to be interrupted by a DTMF digit. This command is similar to the GET DATA command but this command returns after the first DTMF digit has been pressed while GET DATA can accumulated any number of digits before returning.

Return early if $buffer is adequate for request.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-stream+file

array, fastpass_stream_file ( &$buffer, string $filename, [string $escape_digits = ''], [integer $offset = 0], string $buffer)

- string $buffer
- string $filename: without extension, often in /var/lib/asterisk/sounds
- string $escape_digits
- integer $offset
- &$buffer

fastpass_swift (line 1093)

Use Cepstral Swift to read text.

Return early if $buffer is adequate for request.

- return: see evaluate for return information.
- link: http://www.cepstral.com/

array, fastpass_swift ( &$buffer, string $text, [string $escape_digits = ''], [integer $frequency = 8000], [ $voice = NULL], string $buffer)

- string $buffer
- string $text
- string $escape_digits
- integer $frequency
- &$buffer
- $voice

fastpass_text2wav (line 1064)

Use festival to read text.

Return early if $buffer is adequate for request.

- return: see evaluate for return information.
- link: http://www.cstr.ed.ac.uk/projects/festival/

array, fastpass_text2wav ( &$buffer, string $text, [string $escape_digits = ''], [integer $frequency = 8000], string $buffer)

- string $buffer
- string $text
- string $escape_digits
- integer $frequency
- &$buffer

get_data (line 408)

Plays the given file and receives DTMF data.

This is similar to STREAM FILE, but this command can accept and return many DTMF digits, while STREAM FILE returns immediately after the first DTMF digit is detected.

Asterisk looks for the file to play in /var/lib/asterisk/sounds by default.

If the user doesn't press any keys when the message plays, there is $timeout milliseconds of silence then the command ends.

The user has the opportunity to press a key at any time during the message or the post-message silence. If the user presses a key while the message is playing, the message stops playing. When the first key is pressed a timer starts counting for $timeout milliseconds. Every time the user presses another key the timer is restarted. The command ends when the counter goes to zero or the maximum number of digits is entered, whichever happens first.

If you don't specify a time out then a default timeout of 2000 is used following a pressed digit. If no digits are pressed then 6 seconds of silence follow the message.

If you don't specify $max_digits then the user can enter as many digits as they want.

Pressing the # key has the same effect as the timer running out: the command ends and any previously keyed digits are returned. A side effect of this is that there is no way to read a # key using this command.

- return:

  see evaluate for return information. ['result'] holds the digits and ['data'] holds the timeout if present.

  This differs from other commands with return DTMF as numbers representing ASCII characters.

- link: http://www.voip-info.org/wiki-get+data
- example: Ping an IP address

array, get_data (string $filename, [integer $timeout = NULL], [integer $max_digits = NULL])

- string $filename: file to play. Do not include file extension.
- integer $timeout: milliseconds
- integer $max_digits

get_fullvariable (line 446)

Fetch the value of a full variable.

- return: see evaluate for return information. ['result'] is 0 if variable hasn't been set, 1 if it has. ['data'] holds the value. returns value if $getvalue is TRUE
- link: http://www.voip-info.org/wiki-Asterisk+variables
- link: http://www.voip-info.org/wiki/view/get+full+variable

array, get_fullvariable (string $variable, [string $channel = FALSE], [boolean $getvalue = FALSE])

- string $variable: name
- string $channel: channel
- boolean $getvalue: return the value only

get_variable (line 424)

Fetch the value of a variable.

Does not work with global variables. Does not work with some variables that are generated by modules.

- return: see evaluate for return information. ['result'] is 0 if variable hasn't been set, 1 if it has. ['data'] holds the value. returns value if $getvalue is TRUE
- link: http://www.voip-info.org/wiki-Asterisk+variables
- link: http://www.voip-info.org/wiki-get+variable

array, get_variable (string $variable, [boolean $getvalue = FALSE])

- string $variable: name
- boolean $getvalue: return the value only

hangup (line 477)

Hangup the specified channel. If no channel name is given, hang up the current channel.

With power comes responsibility. Hanging up channels other than your own isn't something that is done routinely. If you are not sure why you are doing so, then don't.

- return: see evaluate for return information. ['result'] is 1 on success, -1 on failure.
- link: http://www.voip-info.org/wiki-hangup
- example: Ping an IP address
- example: Get DTMF tones from the user and say the digits
- example: Get text input from the user and say it back

array, hangup ([string $channel = ''])

- string $channel

make_folder (line 1713)

Make a folder recursively.

- access: private

boolean make_folder (string $folder, [integer $perms = 0755])

- string $folder
- integer $perms

menu (line 1216)

Menu.

This function presents the user with a menu and reads the response

- return: key pressed on sucess, -1 on failure

mixed menu (array $choices, [ $timeout = 2000])

- array $choices: has the following structure: array('1'=>'*Press 1 for this', // festival reads if prompt starts with * '2'=>'some-gsm-without-extension', '*'=>'*Press star for help');
- $timeout

new_AsteriskManager (line 1550)

Create a new AGI_AsteriskManager.

void &new_AsteriskManager ()
noop (line 488)

Does nothing.

- return: see evaluate for return information.
- link: http://www.voip-info.org/wiki-noop

array, noop ([ $string = ""])

- $string

parse_callerid (line 1279)

Parse caller id.

- return: 'Number'=>$number)
- example: Get text input from the user and say it back
- example: Get DTMF tones from the user and say the digits

array('Name'=>$name, parse_callerid ([string $callerid = NULL])

- string $callerid

receive_char (line 502)

Receive a character of text from a connected channel. Waits up to $timeout milliseconds for a character to arrive, or infinitely if $timeout is zero.

- return: see evaluate for return information. ['result'] is 0 on timeout or not supported, -1 on failure. Otherwise it is the decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-receive+char

array, receive_char ([integer $timeout = -1])

- integer $timeout: milliseconds

record_file (line 523)

Record sound to a file until an acceptable DTMF digit is received or a specified amount of time has passed. Optionally the file BEEP is played before recording begins.

- return: see evaluate for return information. ['result'] is -1 on error, 0 on hangup, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-record+file

array, record_file (string $file, string $format, [string $escape_digits = ''], [integer $timeout = -1], [integer $offset = NULL], [boolean $beep = false], [integer $silence = NULL])

- string $file: to record, without extension, often created in /var/lib/asterisk/sounds
- string $format: of the file. GSM and WAV are commonly used formats. MP3 is read-only and thus cannot be used.
- string $escape_digits
- integer $timeout: is the maximum record time in milliseconds, or -1 for no timeout.
- integer $offset: to seek to without exceeding the end of the file.
- boolean $beep
- integer $silence: number of seconds of silence allowed before the function returns despite the lack of dtmf digits or reaching timeout.

say_digits (line 540)

Say the given digit string, returning early if any of the given DTMF escape digits are received on the channel.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-say+digits

array, say_digits (integer $digits, [string $escape_digits = ''])

- integer $digits
- string $escape_digits

say_number (line 554)

Say the given number, returning early if any of the given DTMF escape digits are received on the channel.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-say+number

array, say_number (integer $number, [string $escape_digits = ''])

- integer $number
- string $escape_digits

say_phonetic (line 568)

Say the given character string, returning early if any of the given DTMF escape digits are received on the channel.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-say+phonetic

array, say_phonetic (string $text, [string $escape_digits = ''])

- string $text
- string $escape_digits

say_punctuation (line 1501)

Say Puncutation in a string.

- return: see evaluate for return information.

array, say_punctuation (string $text, [string $escape_digits = ''], [integer $frequency = 8000])

- string $text
- string $escape_digits
- integer $frequency

say_time (line 582)

Say a given time, returning early if any of the given DTMF escape digits are received on the channel.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-say+time

array, say_time ([integer $time = NULL], [string $escape_digits = ''])

- integer $time: number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
- string $escape_digits

send_image (line 598)

Send the specified image on a channel.

Most channels do not support the transmission of images.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if the image is sent or channel does not support image transmission.
- link: http://www.voip-info.org/wiki-send+image

array, send_image (string $image)

- string $image: without extension, often in /var/lib/asterisk/images

Redefined in descendants as:

- AGI_1::send_image() : Send the specified image on a channel.

send_text (line 613)

Send the given text to the connected channel.

Most channels do not support transmission of text.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if the text is sent or channel does not support text transmission.
- link: http://www.voip-info.org/wiki-send+text

array, send_text ($text $text)

- $text $text

Redefined in descendants as:

- AGI_1::send_text() : Send the given text to the connected channel.

setContext (line 1261)

setContext - Set context, extension and priority.

void setContext (string $context, [string $extension = 's'], [string $priority = 1])

- string $context
- string $extension
- string $priority

set_autohangup (line 628)

Cause the channel to automatically hangup at $time seconds in the future.

If $time is 0 then the autohangup feature is disabled on this channel.

If the channel is hungup prior to $time seconds, this setting has no effect.

- return: see evaluate for return information.
- link: http://www.voip-info.org/wiki-set+autohangup

array, set_autohangup ([integer $time = 0])

- integer $time: until automatic hangup

set_callerid (line 645)

Changes the caller ID of the current channel.

- return: see evaluate for return information.
- link: http://www.voip-info.org/wiki-set+callerid

array, set_callerid (string $cid)

- string $cid: example: "John Smith"<1234567> This command will let you take liberties with the <caller ID specification> but the format shown in the example above works well: the name enclosed in double quotes followed immediately by the number inside angle brackets. If there is no name then you can omit it. If the name contains no spaces you can omit the double quotes around it. The number must follow the name immediately; don't put a space between them. The angle brackets around the number are necessary; if you omit them the number will be considered to be part of the name.

set_context (line 663)

Sets the context for continuation upon exiting the application.

Setting the context does NOT automatically reset the extension and the priority; if you want to start at the top of the new context you should set extension and priority yourself.

If you specify a non-existent context you receive no error indication (['result'] is still 0) but you do get a warning message on the Asterisk console.

- return: see evaluate for return information.
- link: http://www.voip-info.org/wiki-set+context

array, set_context (string $context)

- string $context

set_extension (line 681)

Set the extension to be used for continuation upon exiting the application.

Setting the extension does NOT automatically reset the priority. If you want to start with the first priority of the extension you should set the priority yourself.

If you specify a non-existent extension you receive no error indication (['result'] is still 0) but you do get a warning message on the Asterisk console.

- return: see evaluate for return information.
- link: http://www.voip-info.org/wiki-set+extension

array, set_extension (string $extension)

- string $extension

set_global_var (line 329)

Sets a global variable, using Asterisk 1.6 syntax.

- return: see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise
- link: http://www.voip-info.org/wiki/view/Asterisk+cmd+Set

array, set_global_var (string $pVariable, string|int|float $pValue)

- string $pVariable
- string|int|float $pValue

set_music (line 694)

Enable/Disable Music on hold generator.

- return: see evaluate for return information.
- link: http://www.voip-info.org/wiki-set+music

array, set_music ([boolean $enabled = true], [string $class = ''])

- boolean $enabled
- string $class

set_priority (line 710)

Set the priority to be used for continuation upon exiting the application.

If you specify a non-existent priority you receive no error indication (['result'] is still 0) and no warning is issued on the Asterisk console.

- return: see evaluate for return information.
- link: http://www.voip-info.org/wiki-set+priority

array, set_priority (integer $priority)

- integer $priority

set_var (line 347)

Sets a variable, using Asterisk 1.6 syntax.

- return: see evaluate for return information. ['result'] is 1 on sucess, 0 otherwise
- link: http://www.voip-info.org/wiki/view/Asterisk+cmd+Set

array, set_var (string $pVariable, string|int|float $pValue)

- string $pVariable
- string|int|float $pValue

Redefined in descendants as:

- AGI_1::set_var() : Sets a variable to the specified value. The variables so created can later be used by later using ${<variablename>} in the dialplan.

set_variable (line 728)

Sets a variable to the specified value. The variables so created can later be used by later using ${<variablename>} in the dialplan.

These variables live in the channel Asterisk creates when you pickup a phone and as such they are both local and temporary. Variables created in one channel can not be accessed by another channel. When you hang up the phone, the channel is deleted and any variables in that channel are deleted as well.

- return: see evaluate for return information.
- link: http://www.voip-info.org/wiki-set+variable

array, set_variable (string $variable, string $value)

- string $variable: is case sensitive
- string $value

stream_file (line 748)

Play the given audio file, allowing playback to be interrupted by a DTMF digit. This command is similar to the GET DATA command but this command returns after the first DTMF digit has been pressed while GET DATA can accumulated any number of digits before returning.

- return: see evaluate for return information. ['result'] is -1 on hangup or error, 0 if playback completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-stream+file
- example: Ping an IP address

array, stream_file (string $filename, [string $escape_digits = ''], [integer $offset = 0])

- string $filename: without extension, often in /var/lib/asterisk/sounds
- string $escape_digits
- integer $offset

swift (line 1380)

Use Cepstral Swift to read text.

- return: see evaluate for return information.
- link: http://www.cepstral.com/

array, swift (string $text, [string $escape_digits = ''], [integer $frequency = 8000], [ $voice = NULL])

- string $text
- string $escape_digits
- integer $frequency
- $voice

tdd_mode (line 760)

Enable or disable TDD transmission/reception on the current channel.

- return: see evaluate for return information. ['result'] is 1 on sucess, 0 if the channel is not TDD capable.
- link: http://www.voip-info.org/wiki-tdd+mode

array, tdd_mode (string $setting)

- string $setting: can be on, off or mate

text2wav (line 1331)

Use festival to read text.

- return: see evaluate for return information.
- link: http://www.cstr.ed.ac.uk/projects/festival/
- example: Ping an IP address
- example: Get text input from the user and say it back
- example: Get DTMF tones from the user and say the digits

array, text2wav (string $text, [string $escape_digits = ''], [integer $frequency = 8000])

- string $text
- string $escape_digits
- integer $frequency

text_input (line 1434)

Text Input.

Based on ideas found at http://www.voip-info.org/wiki-Asterisk+cmd+DTMFToText

Example: UC H LC i , SP h o w SP a r e SP y o u ? $string = '*8'.'44*'.'*5'.'444*'.'00*'.'0*'.'44*'.'666*'.'9*'.'0*'.'2*'.'777*'.'33*'.'0*'.'999*'.'666*'.'88*'.'0000*';

- link: http://www.voip-info.org/wiki-Asterisk+cmd+DTMFToText
- example: Get text input from the user and say it back

string text_input ([ $mode = 'NUMERIC'])

- $mode

verbose (line 780)

Sends $message to the Asterisk console via the 'verbose' message system.

If the Asterisk verbosity level is $level or greater, send $message to the console.

The Asterisk verbosity system works as follows. The Asterisk user gets to set the desired verbosity at startup time or later using the console 'set verbose' command. Messages are displayed on the console if their verbose level is less than or equal to desired verbosity set by the user. More important messages should have a low verbose level; less important messages should have a high verbose level.

- return: see evaluate for return information.
- link: http://www.voip-info.org/wiki-verbose

array, verbose (string $message, [integer $level = 1])

- string $message
- integer $level: from 1 to 4

wait_for_digit (line 798)

Waits up to $timeout milliseconds for channel to receive a DTMF digit.

- return: see evaluate for return information. ['result'] is 0 if wait completes with no digit received, otherwise a decimal value of the DTMF tone. Use chr() to convert to ASCII.
- link: http://www.voip-info.org/wiki-wait+for+digit

array, wait_for_digit ([integer $timeout = -1])

- integer $timeout: in millisecons. Use -1 for the timeout value if you want the call to wait indefinitely.

which (line 1690)

Find an execuable in the path.

- return: the path to the command
- access: private

string which (string $cmd, [string $checkpath = NULL])

- string $cmd: command to find
- string $checkpath: path to check

Documentation generated on Thu, 30 Sep 2010 02:21:59 -0700 by phpDocumentor 1.4.2