[asterisk-commits] tilghman: branch 1.4 r237405 - in /branches/1.4: include/asterisk/ main/ res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jan 4 12:19:06 CST 2010


Author: tilghman
Date: Mon Jan  4 12:19:00 2010
New Revision: 237405

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=237405
Log:
Add a flag to disable the Background behavior, for AGI users.
This is in a section of code that relates to two other issues, namely
issue #14011 and issue #14940), one of which was the behavior of
Background when called with a context argument that matched the current
context.  This fix broke FreePBX, however, in a post-Dial situation.
Needless to say, this is an extremely difficult collision of several
different issues.  While the use of an exception flag is ugly, fixing all
of the issues linked is rather difficult (although if someone would like
to propose a better solution, we're happy to entertain that suggestion).
(closes issue #16434)
 Reported by: rickead2000
 Patches: 
       20091217__issue16434.diff.txt uploaded by tilghman (license 14)
       20091222__issue16434__1.6.1.diff.txt uploaded by tilghman (license 14)
 Tested by: rickead2000

Modified:
    branches/1.4/include/asterisk/channel.h
    branches/1.4/main/pbx.c
    branches/1.4/res/res_agi.c

Modified: branches/1.4/include/asterisk/channel.h
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/include/asterisk/channel.h?view=diff&rev=237405&r1=237404&r2=237405
==============================================================================
--- branches/1.4/include/asterisk/channel.h (original)
+++ branches/1.4/include/asterisk/channel.h Mon Jan  4 12:19:00 2010
@@ -517,6 +517,10 @@
 	AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 17),
 	/*! This flag indicates whether the channel is in the channel list or not. */
 	AST_FLAG_IN_CHANNEL_LIST = (1 << 19),
+	/*! Disable certain workarounds.  This reintroduces certain bugs, but allows
+	 *  some non-traditional dialplans (like AGI) to continue to function.
+	 */
+	AST_FLAG_DISABLE_WORKAROUNDS = (1 << 20),
 };
 
 /*! \brief ast_bridge_config flags */

Modified: branches/1.4/main/pbx.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/main/pbx.c?view=diff&rev=237405&r1=237404&r2=237405
==============================================================================
--- branches/1.4/main/pbx.c (original)
+++ branches/1.4/main/pbx.c Mon Jan  4 12:19:00 2010
@@ -5775,8 +5775,13 @@
 	 * (but a longer extension COULD have matched), it would have previously
 	 * gone immediately to the "i" extension, but will now need to wait for a
 	 * timeout.
+	 *
+	 * Later, we had to add a flag to disable this workaround, because AGI
+	 * users can EXEC Background and reasonably expect that the DTMF code will
+	 * be returned (see #16434).
 	 */
-	if ((exten[0] = res) &&
+	if (!ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS) &&
+			(exten[0] = res) &&
 			ast_canmatch_extension(chan, args.context, exten, 1, chan->cid.cid_num) &&
 			!ast_matchmore_extension(chan, args.context, exten, 1, chan->cid.cid_num)) {
 		snprintf(chan->exten, sizeof(chan->exten), "%c", res);

Modified: branches/1.4/res/res_agi.c
URL: http://svnview.digium.com/svn/asterisk/branches/1.4/res/res_agi.c?view=diff&rev=237405&r1=237404&r2=237405
==============================================================================
--- branches/1.4/res/res_agi.c (original)
+++ branches/1.4/res/res_agi.c Mon Jan  4 12:19:00 2010
@@ -1125,7 +1125,7 @@
 
 static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv)
 {
-	int res;
+	int res, workaround;
 	struct ast_app *app;
 
 	if (argc < 2)
@@ -1140,7 +1140,13 @@
 		if(!strcasecmp(argv[1], PARK_APP_NAME)) {
 			ast_masq_park_call(chan, NULL, 0, NULL);
 		}
+		if (!(workaround = ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS))) {
+			ast_set_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS);
+		}
 		res = pbx_exec(chan, app, argc == 2 ? "" : argv[2]);
+		if (!workaround) {
+			ast_clear_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS);
+		}
 	} else {
 		ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]);
 		res = -2;




More information about the asterisk-commits mailing list