The Hitchhiker's Guide to Asterisk | ||
---|---|---|
<<< Previous | Scripting with the Asterisk Gateway Interface (AGI) | Next >>> |
Communication between the AGI script and Asterisk is accomplished through the standard input, output, and error file descriptors of the AGI script. At initialization, Asterisk sends several important pieces of initialization information to the AGI script. This data needs to be read before any commands are passed to Asterisk; otherwise, it will not be available.
Table 1. Initialization Data
Name | Sample Value | Explanation/Notes |
---|---|---|
agi_accountcode | 123 | Set by SetAccount in the dialplan |
agi_callerid | 2128675309 | Remember, this may not always be a number |
agi_channel | SIP/1001-6476 | |
agi_context | default | |
agi_dnid | 2890 | Dialed Number Identifier. More likely will show up as "unknown" |
agi_enhanced | 0.0 | Value is 1.0 if started as an EAGI script |
agi_extension | 100 | |
agi_language | en | |
agi_priority | 1 | |
agi_rdnis | 2494 | The current referring DNIS number from the Zaptel ISDN subsystem. |
agi_request | myagi.agi | ??? |
agi_type | SIP | Could also be ZAP, H323, etc. |
agi_uniqueid | 1077328545.0 | Note that uniqueids are based on Unix time. |
Commands are passed to Asterisk in the format [command] <arg1> <arg2> ... <argn>. A list of available commands may be fetched with the Asterisk Console command show agi.
The standard error channel can be used to send messages to the Asterisk console. The test AGI scripts included with Asterisk contain an example of this behavior.
<<< Previous | Home | Next >>> |
What languages can I use? | Up | Language-specific AGI notes and examples |