Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AGI Reference

Commands (47 total)

ConstantAGI CommandDescription
ANSWERANSWER
HANGUPHANGUP
STREAM_FILESTREAM FILE
GET_DATAGET DATA
SAY_DIGITSSAY DIGITS
SAY_NUMBERSAY NUMBER
SET_VARIABLESET VARIABLE
GET_VARIABLEGET VARIABLE
EXECEXEC
WAIT_FOR_DIGITWAIT FOR DIGIT
CHANNEL_STATUSCHANNEL STATUS
VERBOSEVERBOSE
SET_CALLERIDSET CALLERID
DATABASE_GETDATABASE GET
DATABASE_PUTDATABASE PUT
DATABASE_DELDATABASE DEL
CONTROL_STREAM_FILECONTROL STREAM FILE
DATABASE_DELTREEDATABASE DELTREE
GET_FULL_VARIABLEGET FULL VARIABLE
GET_OPTIONGET OPTION
GOSUBGOSUB
NOOPNOOP
RECEIVE_CHARRECEIVE CHAR
RECEIVE_TEXTRECEIVE TEXT
RECORD_FILERECORD FILE
SAY_ALPHASAY ALPHA
SAY_DATESAY DATE
SAY_DATETIMESAY DATETIME
SAY_PHONETICSAY PHONETIC
SAY_TIMESAY TIME
SEND_IMAGESEND IMAGE
SEND_TEXTSEND TEXT
SET_AUTOHANGUPSET AUTOHANGUP
SET_CONTEXTSET CONTEXT
SET_EXTENSIONSET EXTENSION
SET_MUSICSET MUSIC
SET_PRIORITYSET PRIORITY
SPEECH_ACTIVATE_GRAMMARSPEECH ACTIVATE GRAMMAR
SPEECH_CREATESPEECH CREATE
SPEECH_DEACTIVATE_GRAMMARSPEECH DEACTIVATE GRAMMAR
SPEECH_DESTROYSPEECH DESTROY
SPEECH_LOAD_GRAMMARSPEECH LOAD GRAMMAR
SPEECH_RECOGNIZESPEECH RECOGNIZE
SPEECH_SETSPEECH SET
SPEECH_UNLOAD_GRAMMARSPEECH UNLOAD GRAMMAR
TDD_MODETDD MODE
ASYNCAGI_BREAKASYNCAGI BREAK

Channel Methods (48 total)

MethodDescription
send_command()send a raw command string and parse the response the command should already be formatted with a trailing newline. checks the hung_up flag before sending to avoid writing to a dead channel.
answer()answer the channel
hangup()hang up the channel, optionally specifying which channel to hang up
stream_file()stream a sound file, allowing the caller to interrupt with escape digits
get_data()play a prompt and collect DTMF digits
say_digits()say a digit string with escape digits
say_number()say a number with escape digits
set_variable()set a channel variable
get_variable()get a channel variable
exec()execute an asterisk application
wait_for_digit()wait for a DTMF digit, -1 for infinite timeout
channel_status()get the status of a channel
verbose()send a verbose message to the asterisk console
set_callerid()set the caller id for the current channel
database_get()get a value from the asterisk database
database_put()set a value in the asterisk database
database_del()delete a key from the asterisk database
database_deltree()delete a family or key tree from the asterisk database
control_stream_file()stream file with ability to control (pause, rewind, fast forward)
get_full_variable()get a full variable expression, evaluating functions and expressions
get_option()stream file with playback offset, allowing the caller to interrupt with escape digits
gosub()execute a dialplan subroutine
noop()do nothing, used for testing
receive_char()receive a character from the connected channel
receive_text()receive a text message from the connected channel
record_file()record audio to a file
say_alpha()say an alphabetic string with escape digits
say_date()say a date (unix timestamp) with escape digits
say_datetime()say a date and time (unix timestamp) with escape digits
say_phonetic()say a string phonetically with escape digits
say_time()say a time (unix timestamp) with escape digits
send_image()send an image to the connected channel
send_text()send text to the connected channel
set_autohangup()set the auto-hangup timer in seconds (0 to disable)
set_context()set the dialplan context for continuation after agi completes
set_extension()set the dialplan extension for continuation after agi completes
set_music()enable or disable music on hold
set_priority()set the dialplan priority for continuation after agi completes
speech_create()create a speech recognition object
speech_destroy()destroy the current speech recognition object
speech_activate_grammar()activate a loaded grammar for recognition
speech_deactivate_grammar()deactivate a grammar
speech_load_grammar()load a grammar from a file
speech_unload_grammar()unload a previously loaded grammar
speech_recognize()play a prompt and perform speech recognition
speech_set()set a speech engine setting
tdd_mode()enable or disable tdd mode on the channel
asyncagi_break()break out of async agi