text
stringlengths
0
152
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.
AGI Communication Overview
|
321
The AGI processes commands in a serial manner. Once a com‐
mand has been executed, no further commands can be executed
until Asterisk has returned a response. Some commands can take a
very long time to execute. For example, the EXEC AGI command
executes an Asterisk application. 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 17.
You can retrieve a full list of available AGI commands from the Asterisk console by
running the command agi show commands. These commands are described in
Table 18-2. To get more detailed information on a specific AGI command, including
syntax information for any arguments that a command expects, use agi show com
mands topic COMMAND. For example, to see the built-in documentation for the ANSWER
AGI command, you would use agi show commands topic ANSWER.
Table 18-2. AGI commands
AGI command
ANSWER
ASYNCAGI BREAK
CHANNEL STATUS
DATABASE DEL
DATABASE DELTREE
DATABASE GET
DATABASE PUT
EXEC
GET DATA
GET FULL VARIABLE
GET OPTION
GET VARIABLE
HANGUP
NOOP
RECEIVE CHAR
RECEIVE TEXT
Description
Answer the incoming call.
End an async AGI session and have the channel return to the Asterisk dialplan.
Retrieve the status of the channel. This is used to retrieve the current state of the channel,
such as up (answered), down (hung up), or ringing.
Delete a key/value pair from the built-in AstDB.
Delete a tree of key/value pairs from the built-in AstDB.
Retrieve the value for a key in the AstDB.
Set the value for a key in the AstDB.
Execute an Asterisk dialplan application on the channel. This command is very powerful in
that between EXEC and GET FULL VARIABLE, you can do anything with the call that
you can do from the Asterisk dialplan.
Read digits from the caller.
Evaluate an Asterisk dialplan expression. You can send a string that contains variables and/or
dialplan functions, and Asterisk will return the result after making the appropriate
substitutions. This command is very powerful in that between EXEC and GET FULL VARI
ABLE, you can do anything with the call that you can do from the Asterisk dialplan.
Stream a sound file while waiting for a digit from the caller. This is similar to the Back
ground() dialplan application.
Retrieve the value of a channel variable.
Hang up the channel.a
Do nothing. You will get a result response from this command, just like any other. It can be
used as a simple test of the communication path with Asterisk.
Receive a single character. This only works for channel types that support it, such as IAX2
using TEXT frames or SIP using the MESSAGE method.
Receive a text message. This only works in the same cases as RECEIVE CHAR.
322
|