System information

Command: VERBOSE "Puppies like cotton candy." 1
Response: Success
ActionID: my-action-id
Message: Added AGI command to queue
Event: AsyncAGI
Privilege: agi,all
SubEvent: Exec
Channel: SIP/0004F2060EB4-00000013
CommandID: my-command-id
Result: 200%20result%3D1%0A
The following output is what was seen on the Asterisk console during this async AGI
session:
-- Executing [7011@phones:1] AGI("SIP/0004F2060EB4-00000013",
"agi:async") in new stack
agi:async: Puppies like cotton candy.
== Spawn extension (phones, 7011, 1) exited non-zero on 'SIP/0004F2060EB4-00000013'
Ending an AGI Session
An AGI session ends when your AGI application is ready for it to end. The details about
how this happens depend on whether your application is using process-based AGI,
FastAGI, or async AGI.
Process-based AGI/FastAGI
Your AGI application may exit or close its connection at any time. As long as the channel
has not hung up before your application ends, dialplan execution will continue. If
channel hangup occurs while your AGI session is still active, Asterisk will provide no-
tification that this has occurred so that your application can adjust its operation as
appropriate.
This is an area where behavior has changed since Asterisk 1.4. In
Asterisk 1.4 and earlier versions, AGI would automatically exit and stop
operation as soon as the channel hung up. It now gives your application
the opportunity to continue running if needed.
If a channel hangs up while your AGI application is still executing, a couple of things
will happen. If an AGI command is in the middle of executing, you may receive a result
code of -1. You should not depend on this, though, since not all AGI commands require
channel interaction. If the command being executed does not require channel interac-
tion, the result will not reflect the hangup.
The next thing that happens after a channel hangs up is that an explicit notification of
the hangup is sent to your application. For process-based AGI, the signal SIGHUP will
be sent to the process to notify it of the hangup. For a FastAGI connection, Asterisk
486 | Chapter 21:Asterisk Gateway Interface (AGI)