Index: doc/channelvariables.txt =================================================================== --- doc/channelvariables.txt (revision 29803) +++ doc/channelvariables.txt (working copy) @@ -602,6 +602,7 @@ instead of, as in Asterisk 1.0, changing the dial plan priority (+101). For the various status values, see each application's help text. +${AGISTATUS} * agi() ${AQMSTATUS} * addqueuemember() ${AVAILSTATUS} * chanisavail() ${CHECKGROUPSTATUS} * checkgroup() Index: res/res_agi.c =================================================================== --- res/res_agi.c (revision 29803) +++ res/res_agi.c (working copy) @@ -90,7 +90,10 @@ " hangup, or 0 on non-hangup exit. \n" "Using 'EAGI' provides enhanced AGI, with incoming audio available out of band\n" "on file descriptor 3\n\n" -"Use the CLI command 'show agi' to list available agi commands\n"; +"Use the CLI command 'show agi' to list available agi commands\n" +" This application sets the following channel variable upon completion:\n" +" AGISTATUS The status of the attempt to the run the AGI script\n" +" text string, one of SUCCESS | FAILED\n"; static int agidebug = 0; @@ -1971,7 +1974,8 @@ close(efd); } ast_localuser_remove(me, u); - return res; + pbx_builtin_setvar_helper(chan, "AGISTATUS", res ? "FAILED" : "SUCCESS"); + return 0; } static int agi_exec(struct ast_channel *chan, void *data)