[asterisk-commits] russell: trunk r355102 - in /trunk: CHANGES res/res_agi.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Feb 13 18:43:54 CST 2012
Author: russell
Date: Mon Feb 13 18:43:50 2012
New Revision: 355102
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=355102
Log:
res_agi: Add AGIEXITONHANGUP variable.
This patch adds a variable AGIEXITONHANGUP for res_agi. If this variable is
set to "yes" on a channel, AGI() will exit immediately once a channel hangup
has been detected. This was the behavior of AGI() in Asterisk 1.4 and earlier
and is still desired by some people.
Review: https://reviewboard.asterisk.org/r/1734/
Modified:
trunk/CHANGES
trunk/res/res_agi.c
Modified: trunk/CHANGES
URL: http://svnview.digium.com/svn/asterisk/trunk/CHANGES?view=diff&rev=355102&r1=355101&r2=355102
==============================================================================
--- trunk/CHANGES (original)
+++ trunk/CHANGES Mon Feb 13 18:43:50 2012
@@ -187,6 +187,12 @@
Device State (presence) information. This module is very similar to, and
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 -------------------
Modified: trunk/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/trunk/res/res_agi.c?view=diff&rev=355102&r1=355101&r2=355102
==============================================================================
--- trunk/res/res_agi.c (original)
+++ trunk/res/res_agi.c Mon Feb 13 18:43:50 2012
@@ -819,7 +819,10 @@
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 @@
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"))) {
@@ -3503,6 +3510,9 @@
} else if (agi->fast) {
ast_agi_send(agi->fd, chan, "HANGUP\n");
}
+ }
+ if (exit_on_hangup) {
+ break;
}
}
ms = -1;
More information about the asterisk-commits
mailing list