diff options
-rw-r--r-- | CHANGES | 6 | ||||
-rw-r--r-- | res/res_agi.c | 14 |
2 files changed, 18 insertions, 2 deletions
@@ -188,6 +188,12 @@ res_corosync is a replacement for the res_ais module that was in previous releases of Asterisk. +AGI +--- + * A new channel variable, AGIEXITONHANGUP, has been added which allows + Asterisk to behave like it did in Asterisk 1.4 and earlier where the + AGI application would exit immediately after a channel hangup is detected. + ------------------------------------------------------------------------------ --- Functionality changes from Asterisk 1.8 to Asterisk 10 ------------------- ------------------------------------------------------------------------------ diff --git a/res/res_agi.c b/res/res_agi.c index 511f44003..444029161 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -819,7 +819,10 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") hangup from the channel except when using DeadAGI. A fast AGI server will correspondingly receive a HANGUP inline with the command dialog. Both of theses signals may be disabled by setting the <variable>AGISIGHUP</variable> channel - variable to <literal>no</literal> before executing the AGI application.</para> + variable to <literal>no</literal> before executing the AGI application. + Alternatively, if you would like the AGI application to exit immediately + after a channel hangup is detected, set the <variable>AGIEXITONHANGUP</variable> + variable to <literal>yes</literal>.</para> <para>Use the CLI command <literal>agi show commands</literal> to list available agi commands.</para> <para>This application sets the following channel variable upon completion:</para> @@ -3477,10 +3480,14 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi int retry = AGI_NANDFS_RETRY; int send_sighup; const char *sighup_str; + const char *exit_on_hangup_str; + int exit_on_hangup; ast_channel_lock(chan); sighup_str = pbx_builtin_getvar_helper(chan, "AGISIGHUP"); - send_sighup = ast_strlen_zero(sighup_str) || !ast_false(sighup_str); + send_sighup = !ast_false(sighup_str); + exit_on_hangup_str = pbx_builtin_getvar_helper(chan, "AGIEXITONHANGUP"); + exit_on_hangup = ast_true(exit_on_hangup_str); ast_channel_unlock(chan); if (!(readf = fdopen(agi->ctrl, "r"))) { @@ -3504,6 +3511,9 @@ static enum agi_result run_agi(struct ast_channel *chan, char *request, AGI *agi ast_agi_send(agi->fd, chan, "HANGUP\n"); } } + if (exit_on_hangup) { + break; + } } ms = -1; if (dead) { |