aboutsummaryrefslogtreecommitdiffstats
path: root/apps/app_dial.c
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-29 17:08:22 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2009-01-29 17:08:22 +0000
commit10712d118c170020a39fe18f2394bb0172c9f5f5 (patch)
treede5917bbd7b2b261e6caa93c380ee86afd42f892 /apps/app_dial.c
parent28cfff1ebc779edec3ffdd581f8b5e8f35e68a8c (diff)
Fix "cancel answered elsewhere" through app_queue with members in chan_local.
Also, implement a private cause code (as suggested by Tilghman). This works with chan_sip, but doesn't propagate through chan_local. git-svn-id: http://svn.digium.com/svn/asterisk/trunk@172318 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_dial.c')
-rw-r--r--apps/app_dial.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/app_dial.c b/apps/app_dial.c
index f4e8aabd6..41c85d521 100644
--- a/apps/app_dial.c
+++ b/apps/app_dial.c
@@ -568,8 +568,12 @@ static void hanguptree(struct chanlist *outgoing, struct ast_channel *exception,
while (outgoing) {
/* Hangup any existing lines we have open */
if (outgoing->chan && (outgoing->chan != exception)) {
- if (answered_elsewhere)
+ if (answered_elsewhere) {
+ /* The flag is used for local channel inheritance and stuff */
ast_set_flag(outgoing->chan, AST_FLAG_ANSWERED_ELSEWHERE);
+ /* This is for the channel drivers */
+ outgoing->chan->hangupcause = AST_CAUSE_ANSWERED_ELSEWHERE;
+ }
ast_hangup(outgoing->chan);
}
oo = outgoing;
@@ -1567,6 +1571,7 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
goto done;
}
+
if (ast_test_flag64(&opts, OPT_OPERMODE)) {
opermode = ast_strlen_zero(opt_args[OPT_ARG_OPERMODE]) ? 1 : atoi(opt_args[OPT_ARG_OPERMODE]);
ast_verb(3, "Setting operator services mode to %d.\n", opermode);
@@ -1780,6 +1785,14 @@ static int dial_exec_full(struct ast_channel *chan, void *data, struct ast_flags
/* If we have an outbound group, set this peer channel to it */
if (outbound_group)
ast_app_group_set_channel(tc, outbound_group);
+ /* If the calling channel has the ANSWERED_ELSEWHERE flag set, inherit it. This is to support local channels */
+ if (ast_test_flag(chan, AST_FLAG_ANSWERED_ELSEWHERE))
+ ast_set_flag(tc, AST_FLAG_ANSWERED_ELSEWHERE);
+
+ /* Check if we're forced by configuration */
+ if (ast_test_flag64(&opts, OPT_CANCEL_ELSEWHERE))
+ ast_set_flag(tc, AST_FLAG_ANSWERED_ELSEWHERE);
+
/* Inherit context and extension */
ast_string_field_set(tc, dialcontext, ast_strlen_zero(chan->macrocontext) ? chan->context : chan->macrocontext);