summaryrefslogtreecommitdiff
path: root/res/res_agi.c
diff options
context:
space:
mode:
authorTilghman Lesher <tilghman@meg.abyt.es>2010-01-04 18:28:28 +0000
committerTilghman Lesher <tilghman@meg.abyt.es>2010-01-04 18:28:28 +0000
commit386b847075297f09daaf259f9cdfc77f82a0133d (patch)
tree8b5fd868954d27ebb5f14f89939fe5de6d7a7f03 /res/res_agi.c
parent688e1bbac6f601add35d791973c4d222011801c7 (diff)
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: https://origsvn.digium.com/svn/asterisk/trunk@237406 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'res/res_agi.c')
-rw-r--r--res/res_agi.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/res/res_agi.c b/res/res_agi.c
index b4396acb2..154ac4789 100644
--- a/res/res_agi.c
+++ b/res/res_agi.c
@@ -2280,22 +2280,25 @@ static int handle_hangup(struct ast_channel *chan, AGI *agi, int argc, const cha
static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, const char * const argv[])
{
- int res;
+ int res, workaround;
struct ast_app *app_to_exec;
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_to_exec = pbx_findapp(argv[1]))) {
if(!strcasecmp(argv[1], PARK_APP_NAME)) {
ast_masq_park_call(chan, NULL, 0, NULL);
}
- 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;
const char *vptr;
- for (cptr = compat, vptr = (argc == 2) ? "" : argv[2]; *vptr; vptr++) {
+ for (cptr = compat, vptr = argv[2]; *vptr; vptr++) {
if (*vptr == ',') {
*cptr++ = '\\';
*cptr++ = ',';
@@ -2310,6 +2313,9 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, const char
} else {
res = pbx_exec(chan, app_to_exec, 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;