System information

will send a line containing the word HANGUP. If you would like to disable having Asterisk
send the SIGHUP signal to your process-based AGI application or the HANGUP string to
your FastAGI server, you can do so by setting the AGISIGHUP channel variable, as dem-
onstrated in the following short example:
;
; Don't send SIGHUP to an AGI process
; or the "HANGUP" string to a FastAGI server.
;
exten => 500,1,Set(AGISIGHUP=no)
same => n,AGI(my-agi-application)
At this point, Asterisk automatically adjusts its operation to be in DeadAGI mode. This
just means that an AGI application can run on a channel that has been hung up. The
only AGI commands that may be used at this point are those that do not require channel
interaction. The documentation for the AGI commands built into Asterisk includes an
indication of whether or not each command can be used once the channel has been
hung up.
Async AGI
When you’re using async AGI, the manager interface provides mechanisms to notify
you about channel hangups. When you would like to end an async AGI session for a
channel, you must execute the ASYNCAGI BREAK command. When the async AGI session
ends, Asterisk will send an AsyncAGI manager event with a SubEvent of End. The fol-
lowing is an example of ending an async AGI session:
Action: AGI
Channel: SIP/0004F2060EB4-0000001b
ActionID: my-action-id
CommandID: my-command-id
Command: ASYNCAGI BREAK
Response: Success
ActionID: my-action-id
Message: Added AGI command to queue
Event: AsyncAGI
Privilege: agi,all
SubEvent: End
Channel: SIP/0004F2060EB4-0000001b
At this point, the channel returns to the Asterisk dialplan if it has not yet been hung up.
Development Frameworks
There have been a number of efforts to create frameworks or libraries that make AGI
programming easier. Table 21-3 lists some of them. If you do not see a library listed
here for your preferred programming language, do a quick search for it and you’re likely
to find one, as others do exist.
Development Frameworks | 487