aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-04 18:30:36 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2010-01-04 18:30:36 +0000
commita48e3b7f2dc36101e98120f9b3adac4f7870f780 (patch)
tree82d07e2fe47075c3ff4a3181191e0ef696fccbc8
parent0aedc3afff778f72c00bae04b0d9a30b88556a25 (diff)
Merged revisions 237406 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ................ r237406 | tilghman | 2010-01-04 12:28:28 -0600 (Mon, 04 Jan 2010) | 23 lines Merged revisions 237405 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.4 ........ r237405 | tilghman | 2010-01-04 12:19:00 -0600 (Mon, 04 Jan 2010) | 16 lines 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 ........ ................ git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.6.0@237407 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--include/asterisk/channel.h4
-rw-r--r--main/pbx.c7
-rw-r--r--res/res_agi.c14
3 files changed, 20 insertions, 5 deletions
diff --git a/include/asterisk/channel.h b/include/asterisk/channel.h
index 4c15b482a..a00c0979a 100644
--- a/include/asterisk/channel.h
+++ b/include/asterisk/channel.h
@@ -594,6 +594,10 @@ enum {
AST_FLAG_BRIDGE_HANGUP_DONT = (1 << 18),
/*! 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 */
diff --git a/main/pbx.c b/main/pbx.c
index 176a4eda2..557800ca9 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -7985,8 +7985,13 @@ static int pbx_builtin_background(struct ast_channel *chan, void *data)
* (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);
diff --git a/res/res_agi.c b/res/res_agi.c
index 86846b03a..c3be14b43 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -1485,18 +1485,21 @@ static int handle_hangup(struct ast_channel *chan, AGI *agi, int argc, char **ar
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)
return RESULT_SHOWUSAGE;
- ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argv[2]);
+ ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argc >= 3 ? argv[2] : "");
if ((app = pbx_findapp(argv[1]))) {
- if (ast_compat_res_agi && !ast_strlen_zero(argv[2])) {
+ if (!(workaround = ast_test_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS))) {
+ ast_set_flag(chan, AST_FLAG_DISABLE_WORKAROUNDS);
+ }
+ if (ast_compat_res_agi && argc >= 3 && !ast_strlen_zero(argv[2])) {
char *compat = alloca(strlen(argv[2]) * 2 + 1), *cptr, *vptr;
- for (cptr = compat, vptr = (argc == 2) ? "" : argv[2]; *vptr; vptr++) {
+ for (cptr = compat, vptr = argv[2]; *vptr; vptr++) {
if (*vptr == ',') {
*cptr++ = '\\';
*cptr++ = ',';
@@ -1511,6 +1514,9 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv
} else {
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;