Class AGI_1

Description
Variable Summary
 array $response
Method Summary
 AGI_1 AGI_1 ([string $config = false], [array $optconfig = false])
 array, agi_channel_status (string $channel)
 string agi_dtmf2text (integer $len)
 array agi_exec (string $str)
 array agi_getdtmf (integer $len, integer $timeout, [string $terminator = false], [string $prompt = false])
 void agi_goto (string $con, [string $ext = 's'], [string $pri = 1])
 void agi_hangup (string $channel)
 boolean agi_is_error (array $retarr)
 void agi_play (string $file)
 array agi_readresult ()
 void agi_recordfile (string $file, string $format, [integer $timeout = 5000], [string $prompt = FALSE])
 integer agi_response_code ()
 string agi_response_data ()
 integer agi_response_result ()
 mixed agi_response_var (string $var)
 void agi_saydigits (integer $digits)
 void agi_saynumber (integer $number)
 void agi_saytime ([integer $time = ''])
 void agi_setlanguage ([string $language = 'en'])
 void agi_verbose (string $str, [integer $vbl = 1])
 string arr2str (array $arr)
 void con_print_r (array $arr, [string $label = ''], mixed $lvl, integer $vbl)
 integer db_del (string $family, string $key)
 string db_get (string $family, string $key)
 integer db_put (string $family, string $key, string $val)
 array enum_lookup (string $telnumber, [string $rDNS = 'e164.org'])
 string enum_txtlookup (string $telnumber, [string $rDNS = 'e164.org'])
 array evalutate (string $command)
 string get_var (string $var)
 boolean send_image (string $image)
 boolean send_text ($text $txt)
 integer set_var (string $var, string $val)
Variables
array $response (line 52)

Response structure

array('code'=>$code, 'result'=>$result, 'data'=>$data)

  • access: public

Inherited Variables

Inherited from AGI

AGI::$asmanager
AGI::$audio
AGI::$config
AGI::$in
AGI::$out
AGI::$request
AGI::$socket
Methods
Constructor AGI_1 (line 60)

Constructor

AGI_1 AGI_1 ([string $config = false], [array $optconfig = false])
  • 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']
agi_channel_status (line 444)

Get the status of the specified channel.

array, agi_channel_status (string $channel)
  • string $channel
agi_dtmf2text (line 293)

Read $len characters as DTMF codes

string agi_dtmf2text (integer $len)
  • integer $len
agi_exec (line 87)

Execute an AGI command

  • return: ('code'=>$code, 'result'=>$result, 'data'=>$data)
  • access: private
array agi_exec (string $str)
  • string $str
agi_getdtmf (line 248)

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.

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.

array agi_getdtmf (integer $len, integer $timeout, [string $terminator = false], [string $prompt = false])
  • integer $len: number of digits to read
  • integer $timeout: milliseconds
  • string $terminator: character on which to quit
  • string $prompt: file to play. Do not include file extension.
agi_goto (line 486)

Goto - Set context, extension and priority

void agi_goto (string $con, [string $ext = 's'], [string $pri = 1])
  • string $con: context
  • string $ext: extension
  • string $pri: priority
agi_hangup (line 432)

Hangup the current channel.

void agi_hangup (string $channel)
  • string $channel
agi_is_error (line 98)

Check for error in result structure

  • return: true on error
boolean agi_is_error (array $retarr)
  • array $retarr
agi_play (line 474)

Play the given audio file, allowing playback to be interrupted by a #. 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.

void agi_play (string $file)
  • string $file: filename without extension, often in /var/lib/asterisk/sounds
agi_readresult (line 125)

Read the result from Asterisk

array agi_readresult ()
agi_recordfile (line 460)

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.

void agi_recordfile (string $file, string $format, [integer $timeout = 5000], [string $prompt = FALSE])
  • 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.
  • integer $timeout: is the maximum record time in milliseconds, or -1 for no timeout.
  • string $prompt: to play
agi_response_code (line 154)

Get the response code from the last command

integer agi_response_code ()
agi_response_data (line 175)

Get the response data from the last command

string agi_response_data ()
agi_response_is_error (line 198)

Check for error in response

  • return: true on error
boolean agi_response_is_error ()
agi_response_result (line 164)

Get the result code from the last command

integer agi_response_result ()
agi_response_var (line 186)

Get the response variable from the last command

mixed agi_response_var (string $var)
  • string $var
agi_saydigits (line 497)

Say the given digit string, returning early if # is received on the channel.

void agi_saydigits (integer $digits)
  • integer $digits
agi_saynumber (line 508)

Say the given number, returning early if # is received on the channel.

void agi_saynumber (integer $number)
  • integer $number
agi_saytime (line 519)

Say a given time, returning early if # is received on the channel.

void agi_saytime ([integer $time = ''])
  • integer $time: number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal Time (UTC).
agi_setlanguage (line 530)

Set Language

void agi_setlanguage ([string $language = 'en'])
  • string $language: code
agi_verbose (line 144)

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

If the Asterisk verbosity level is $vbl or greater, send $str 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.

void agi_verbose (string $str, [integer $vbl = 1])
  • string $str
  • integer $vbl: from 1 to 4
arr2str (line 342)

Alias of PHP join function

string arr2str (array $arr)
  • array $arr
con_print_r (line 210)

Log to console if debug mode

void con_print_r (array $arr, [string $label = ''], mixed $lvl, integer $vbl)
  • array $arr: to print
  • string $label
  • integer $vbl: verbose level
db_del (line 384)

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

integer db_del (string $family, string $key)
  • string $family
  • string $key
db_get (line 355)

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

string db_get (string $family, string $key)
  • string $family
  • string $key
db_put (line 370)

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

  • return: result code
integer db_put (string $family, string $key, string $val)
  • string $family
  • string $key
  • string $val
enum_lookup (line 542)

Perform enum lookup

array enum_lookup (string $telnumber, [string $rDNS = 'e164.org'])
  • string $telnumber
  • string $rDNS
enum_txtlookup (line 594)

Perform enum txt lookup

string enum_txtlookup (string $telnumber, [string $rDNS = 'e164.org'])
  • string $telnumber
  • string $rDNS
evalutate (line 74)

Evaluate an AGI command

  • return: ('code'=>$code, 'result'=>$result, 'data'=>$data)
  • access: private
array evalutate (string $command)
  • string $command
get_var (line 400)

Fetch the value of a variable.

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

string get_var (string $var)
  • string $var: variable name
send_image (line 649)

Send the specified image on a channel.

Most channels do not support the transmission of images.

boolean send_image (string $image)
  • string $image: without extension, often in /var/lib/asterisk/images

Redefinition of:
AGI::send_image()
Send the specified image on a channel.
send_text (line 633)

Send the given text to the connected channel.

Most channels do not support transmission of text.

boolean send_text ($text $txt)
  • $text $txt

Redefinition of:
AGI::send_text()
Send the given text to the connected channel.
set_var (line 420)

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.

integer set_var (string $var, string $val)
  • string $var: is case sensitive
  • string $val

Inherited Methods

Inherited From AGI

 AGI::AGI()
 AGI::answer()
 AGI::channel_status()
 AGI::conlog()
 AGI::database_del()
 AGI::database_deltree()
 AGI::database_get()
 AGI::database_put()
 AGI::evaluate()
 AGI::exec()
 AGI::exec_absolutetimeout()
 AGI::exec_agi()
 AGI::exec_dial()
 AGI::exec_enumlookup()
 AGI::exec_goto()
 AGI::exec_setaccountcode()
 AGI::exec_setlanguage()
 AGI::fastpass_get_data()
 AGI::fastpass_say_digits()
 AGI::fastpass_say_number()
 AGI::fastpass_say_phonetic()
 AGI::fastpass_say_punctuation()
 AGI::fastpass_say_time()
 AGI::fastpass_stream_file()
 AGI::fastpass_swift()
 AGI::fastpass_text2wav()
 AGI::get_data()
 AGI::get_variable()
 AGI::goto()
 AGI::hangup()
 AGI::make_folder()
 AGI::menu()
 AGI::new_AsteriskManager()
 AGI::noop()
 AGI::parse_callerid()
 AGI::receive_char()
 AGI::record_file()
 AGI::say_digits()
 AGI::say_number()
 AGI::say_phonetic()
 AGI::say_punctuation()
 AGI::say_time()
 AGI::send_image()
 AGI::send_text()
 AGI::set_autohangup()
 AGI::set_callerid()
 AGI::set_context()
 AGI::set_extension()
 AGI::set_music()
 AGI::set_priority()
 AGI::set_variable()
 AGI::stream_file()
 AGI::swift()
 AGI::tdd_mode()
 AGI::text2wav()
 AGI::text_input()
 AGI::verbose()
 AGI::wait_for_digit()
 AGI::which()

Documentation generated on Wed, 16 Nov 2005 12:49:28 -0700 by phpDocumentor 1.3.0RC3