aboutsummaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authortilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-07 23:41:11 +0000
committertilghman <tilghman@f38db490-d61c-443f-a65b-d21fe96a405b>2009-05-07 23:41:11 +0000
commit3186e19b219479839b397619eb86b7919bd7ec27 (patch)
tree3c193140e4e28559f0e2527de99fc7d4637a5755 /main
parent781f3fc9af5acfdd5540bc2c52b4c87ae32dca0b (diff)
Fix Background within a Macro for FreePBX.
If the single digit DTMF is an extension in the specified context, then go there and signal no DTMF. Otherwise, we should exit with that DTMF. If we're in Macro, we'll exit and seek that DTMF as the beginning of an extension in the Macro's calling context. If we're not in Macro, then we'll simply seek that extension in the calling context. Previously, someone complained about the behavior as it related to the interior of a Gosub routine, and the fix (#14011) inadvertently broke FreePBX (#14940). This change should fix both of these situations, but with the possible incompatibility that if a single digit extension does not exist (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. (closes issue #14940) Reported by: p_lindheimer Patches: 20090420__bug14940.diff.txt uploaded by tilghman (license 14) Tested by: p_lindheimer git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.4@193119 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main')
-rw-r--r--main/pbx.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/main/pbx.c b/main/pbx.c
index 0f970b85e..5af6f519e 100644
--- a/main/pbx.c
+++ b/main/pbx.c
@@ -5674,7 +5674,7 @@ static int pbx_builtin_background(struct ast_channel *chan, void *data)
{
int res = 0;
struct ast_flags flags = {0};
- char *parse;
+ char *parse, exten[2] = "";
AST_DECLARE_APP_ARGS(args,
AST_APP_ARG(filename);
AST_APP_ARG(options);
@@ -5736,7 +5736,22 @@ static int pbx_builtin_background(struct ast_channel *chan, void *data)
ast_stopstream(chan);
}
}
- if (strcmp(args.context, chan->context) && res) {
+
+ /*
+ * If the single digit DTMF is an extension in the specified context, then
+ * go there and signal no DTMF. Otherwise, we should exit with that DTMF.
+ * If we're in Macro, we'll exit and seek that DTMF as the beginning of an
+ * extension in the Macro's calling context. If we're not in Macro, then
+ * we'll simply seek that extension in the calling context. Previously,
+ * someone complained about the behavior as it related to the interior of a
+ * Gosub routine, and the fix (#14011) inadvertently broke FreePBX
+ * (#14940). This change should fix both of these situations, but with the
+ * possible incompatibility that if a single digit extension does not exist
+ * (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.
+ */
+ if ((exten[0] = res) && (ast_exists_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);
ast_copy_string(chan->context, args.context, sizeof(chan->context));
chan->priority = 0;