Asterisk Docs: AGI

Note: Sections highlighted in green should be available for all calls. Everything else requires a special client (such as GnoPhone).

Notify the webmaster if you need to correct something here.
DATABASE PUT <family> <key> <value>
FunctionAdds or updates an entry in the Asterisk database for a given family, key, and value. 
Returns1 if successful
0 otherwise 
Notes 
DATABASE GET <family> <key>
FunctionRetrieves an entry in the Asterisk database for a given family and key. 
Returns0 if <key> is not set.
1 if <key> is set and returns the variable in parenthesis 
Notesexample return code: 200 result=1 (testvariable) 
DATABASE DEL <family> <key>
FunctionDeletes an entry in the Asterisk database for a given family and key. 
Returns1 if successful
0 otherwise 
Notes 
DATABASE DELTREE <family> [keytree]
FunctionDeletes a family or specific keytree within a family in the Asterisk database. 
Returns1 if successful
0 otherwise 
Notes 
VERBOSE <message> <level>
FunctionSends <message> to the console via verbose message system. 
ReturnsAlways returns 1 
Notes<level> is the the verbose level (1-4) 
GET VARIABLE <variablename>
Function 
Returns0 if <variablename> is not set.
1 if <variablename> is set and returns the variable in parenthesis 
Notesexample return code: 200 result=1 (testvariable) 
SET VARIABLE <variablename> <value>
Function 
Returns 
Notes 
CHANNEL STATUS [<channelname>]
FunctionReturns the status of the specified channel. If no channel name is given, returns the status of the current channel. 
Returns0 Channel is down and available
1 Channel is down, but reserved
2 Channel is off hook
3 Digits (or equivalent) have been dialed
4 Line is ringing
5 Remote end is ringing
6 Line is up
7 Line is busy 
Notes 
SET CALLERID <number>
FunctionChanges the callerid of the current channel. 
Returns 
Notes 
EXEC <application> <options>
FunctionExecutes <application> with given <options>. 
ReturnsWhatever the application returns
-2 on failure to find application 
Notes 
HANGUP [<channelname>]
FunctionHangs up the specified channel. If no channel name is given, hangs up the current channel 
Returns 
Notes 
ANSWER
FunctionAnswers channel if not already in answer state. 
Returns-1 on channel failure
0 if successful. 
Notes 
WAIT FOR DIGIT <timeout>
FunctionWaits up to 'timeout' milliseconds for channel to receive a DTMF digit. 
Returns-1 on channel failure, 0 if no digit is received in the timeout, or the numerical value of the ascii of the digit if one is received. 
NotesUse -1 for the timeout value if you desire the call to block indefinitely. 
SEND TEXT "<text to send>"
FunctionSends the given text on a channel. Most channels do not support the transmission of text. 
Returns0 if text is sent, or if the channel does not support text transmission.
-1 only on error/hangup. 
NotesText consisting of greater than one word should be placed in quotes since the command only accepts a single argument. 
RECEIVE CHAR <timeout>
FunctionReceives a character of text on a channel. 
Returnsthe decimal value of the character if one is received
0 if the channel does not support text reception
-1 only on error/hangup. 
NotesSpecify timeout to be the maximum time to wait for input in milliseconds, or 0 for infinite.Most channels do not support the reception of text. 
TDD MODE <on|off>
FunctionEnable/Disable TDD transmission/reception on a channel 
Returns1 if successful
0 if channel is not TDD-capable. 
Notes 
SEND IMAGE <image>
FunctionSends the given image on a channel 
Returns0 if image is sent, or if the channel does not support image transmission
-1 only on error/hangup. 
NotesMost channels do not support the transmission of images.
Image names should not include extensions 
STREAM FILE <filename> <escape digits>
FunctionSend the given file, allowing playback to be interrupted by the given digits, if any 
Returns0 if playback completes without a digit being pressed
the ASCII numerical value of the digit if one was pressed
-1 on error or if the channel was disconnected 
NotesUse double quotes for the digits if you wish none to be permitted.
The file extension must not be included in the filename. 
SAY NUMBER <number> <escape digits>
FunctionSay a given number, returning early if any of the given DTMF digits are received on the channel 
Returns0 if playback completes without a digit being pressed
the ASCII numerical value of the digit if one was pressed
-1 on error/hangup 
Notes 
GET DATA <file to be streamed> [timeout] [max digits]
FunctionStream the given file, and receive DTMF data 
Returnsthe digits received from the channel at the other end 
Notes 
SET CONTEXT <desired context>
FunctionSets the context for continuation upon exiting the application 
Returns 
Notes 
SET EXTENSION <new extension>
FunctionChanges the extension for continuation upon exiting the application 
Returns 
Notes 
SET PRIORITY <num>
FunctionChanges the priority for continuation upon exiting the application 
Returns 
Notes 
RECORD FILE <filename> <format> <escape digits> <timeout> [BEEP]
FunctionRecord to a file until a given dtmf digit in the sequence is received 
Returns-1 on hangup or error
 
NotesThe format will specify what kind of file will be recorded.
The timeout is the maximum record time in milliseconds, or -1 for no timeout