diff options
Diffstat (limited to 'res/res_agi.c')
-rw-r--r-- | res/res_agi.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/res/res_agi.c b/res/res_agi.c index 57cf128da..952c28c27 100644 --- a/res/res_agi.c +++ b/res/res_agi.c @@ -1456,7 +1456,23 @@ static int handle_exec(struct ast_channel *chan, AGI *agi, int argc, char **argv ast_verb(3, "AGI Script Executing Application: (%s) Options: (%s)\n", argv[1], argv[2]); if ((app = pbx_findapp(argv[1]))) { - res = pbx_exec(chan, app, argv[2]); + if (ast_compat_res_agi && !ast_strlen_zero(argv[2])) { + char *compat = alloca(strlen(argv[2]) * 2 + 1), *cptr, *vptr; + for (cptr = compat, vptr = argv[2]; *vptr; vptr++) { + if (*vptr == ',') { + *cptr++ = '\\'; + *cptr++ = ','; + } else if (*vptr == '|') { + *cptr++ = ','; + } else { + *cptr++ = *vptr; + } + } + *cptr = '\0'; + res = pbx_exec(chan, app, compat); + } else { + res = pbx_exec(chan, app, argv[2]); + } } else { ast_log(LOG_WARNING, "Could not find application (%s)\n", argv[1]); res = -2; |