System information
A full list of available AGI commands can be retrieved from the Asterisk console by
running the command agi show commands. These commands are described in Ta-
ble 21-2. To get more detailed information on a specific AGI command, including
syntax information for any arguments that a command expects, use agi show commands
topic <COMMAND>. For example, to see the built-in documentation for the ANSWER
AGI command, you would use agi show commands topic ANSWER.
Table 21-2. AGI commands
AGI command Description
ANSWER Answer the incoming call.
ASYNCAGI BREAK End an async AGI session and have the channel return to the Asterisk dialplan.
CHANNEL STATUS 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.
DATABASE DEL Delete a key/value pair from the built-in AstDB.
DATABASE DELTREE Delete a tree of key/value pairs from the built-in AstDB.
DATABASE GET Retrieve the value for a key in the AstDB.
DATABASE PUT Set the value for a key in the AstDB.
EXEC 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.
GET DATA Read digits from the caller.
GET FULL VARIABLE 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 com-
mand 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.
GET OPTION Stream a sound file while waiting for a digit from the caller. This is similar to the Back
ground() dialplan application.
GET VARIABLE Retrieve the value of a channel variable.
HANGUP Hang up the channel.
a
NOOP 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 CHAR 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 TEXT Receive a text message. This only works in the same cases as RECEIVE CHAR.
RECORD FILE Record the audio from the caller to a file. This is a blocking operation similar to the Record()
dialplan application. To record a call in the background while you perform other operations, use
EXEC Monitor or EXEC MixMonitor.
SAY ALPHA Say a string of characters. You can find an example of this in “Quick Start” on page 475. To get
localized handling of this and the other SAY commands, set the channel language either in the
device configuration file (e.g., sip.conf) or in the dialplan, by setting the CHANNEL(language)
dialplan function.
AGI Communication Overview | 483