System information

For an example of the variables that might be sent to an AGI application, see the AGI
communication debug output in “Quick Start” on page 475. The end of the list of
variables will be indicated by a blank line. Example 21-1 handles these variables by
reading lines of input in a loop until a blank line is received. At that point, the appli-
cation continues and begins executing AGI commands.
Async AGI
When you use async AGI, Asterisk will send out a manager event to initiate the async
AGI session. Here is an example manager event sent out by Asterisk:
Event: AsyncAGI
Privilege: agi,all
SubEvent: Start
Channel: SIP/0000FFFF0001-00000000
Env: agi_request%3A%20async%0Aagi_channel%3A%20SIP%2F0000FFFF0001-00000000%0A \
agi_language%3A%20en%0Aagi_type%3A%20SIP%0Aagi_uniqueid%3A%201285219743.0%0A \
agi_version%3A%201.8.0-beta5%0Aagi_callerid%3A%2012565551111%0A \
agi_calleridname%3A%20Julie%20Bryant%0Aagi_callingpres%3A%200%0A \
agi_callingani2%3A%200%0Aagi_callington%3A%200%0Aagi_callingtns%3A%200%0A \
agi_dnid%3A%20111%0Aagi_rdnis%3A%20unknown%0Aagi_context%3A%20LocalSets%0A \
agi_extension%3A%20111%0Aagi_priority%3A%201%0Aagi_enhanced%3A%200.0%0A \
agi_accountcode%3A%20%0Aagi_threadid%3A%20-1339524208%0A%0A
The value of the Env header in this AsyncAGI manager event is all on one
line. The long value of the Env header has been URI encoded.
Commands and Responses
Once an AGI session has been set up, Asterisk begins performing call processing in
response to commands sent from the AGI application. As soon as an AGI command
has been issued to Asterisk, no further commands will be processed on that channel
until the current command has been completed. When it finishes processing a com-
mand, Asterisk will respond with the result.
The AGI processes commands in a serial manner. Once a command has
been executed, no further commands can be executed until Asterisk has
returned a response. Some commands can take a very long time to ex-
ecute. For example, the EXEC AGI command executes an Asterisk ap-
plication. If the command is EXEC Dial, AGI communication is blocked
until the call is done. If your AGI application needs to interact further
with Asterisk at this point, it can do so using the AMI, which is covered
in Chapter 20.
482 | Chapter 21:Asterisk Gateway Interface (AGI)