summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorOlle Johansson <oej@edvina.net>2009-01-29 17:08:22 +0000
committerOlle Johansson <oej@edvina.net>2009-01-29 17:08:22 +0000
commit7ecda454826ec42c79a6e6537963568c7e9b28b9 (patch)
treede5917bbd7b2b261e6caa93c380ee86afd42f892 /channels
parentb3ab95317c51f2dcc622c7e31af61dbc8fc4906d (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: https://origsvn.digium.com/svn/asterisk/trunk@172318 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_local.c15
-rw-r--r--channels/chan_sip.c5
2 files changed, 17 insertions, 3 deletions
diff --git a/channels/chan_local.c b/channels/chan_local.c
index 754f49b8c..71994c20b 100644
--- a/channels/chan_local.c
+++ b/channels/chan_local.c
@@ -532,6 +532,11 @@ static int local_call(struct ast_channel *ast, char *dest, int timeout)
return -1;
}
+ /* Make sure we inherit the ANSWERED_ELSEWHERE flag if it's set on the queue/dial call request in the dialplan */
+ if (ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE)) {
+ ast_set_flag(p->chan, AST_FLAG_ANSWERED_ELSEWHERE);
+ }
+
/* copy the channel variables from the incoming channel to the outgoing channel */
/* Note that due to certain assumptions, they MUST be in the same order */
AST_LIST_TRAVERSE(&p->owner->varshead, varptr, entries) {
@@ -567,9 +572,14 @@ static int local_hangup(struct ast_channel *ast)
ast_mutex_lock(&p->lock);
- if (p->chan && ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE))
- ast_set_flag(p->chan, AST_FLAG_ANSWERED_ELSEWHERE);
isoutbound = IS_OUTBOUND(ast, p);
+
+ if (p->chan && ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE)) {
+ ast_set_flag(p->chan, AST_FLAG_ANSWERED_ELSEWHERE);
+ ast_debug(2, "This local call has the ANSWERED_ELSEWHERE flag set.\n");
+ }
+ /* Make sure the hangupcause follows down the chain of channels */
+
if (isoutbound) {
const char *status = pbx_builtin_getvar_helper(p->chan, "DIALSTATUS");
if ((status) && (p->owner)) {
@@ -600,6 +610,7 @@ static int local_hangup(struct ast_channel *ast)
DEADLOCK_AVOIDANCE(&p->lock);
}
if (p->chan) {
+ p->chan->hangupcause = ast->hangupcause;
ast_queue_hangup(p->chan);
ast_channel_unlock(p->chan);
}
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 2fbb77e65..b99e92607 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -5509,8 +5509,11 @@ static int sip_hangup(struct ast_channel *ast)
ast_debug(1, "Asked to hangup channel that was not connected\n");
return 0;
}
- if (ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE)) {
+ if (ast_test_flag(ast, AST_FLAG_ANSWERED_ELSEWHERE) || ast->hangupcause == AST_CAUSE_ANSWERED_ELSEWHERE) {
ast_debug(1, "This call was answered elsewhere");
+ if (ast->hangupcause == AST_CAUSE_ANSWERED_ELSEWHERE) {
+ ast_debug(1, "####### It's the cause code, buddy. The cause code!!!\n");
+ }
append_history(p, "Cancel", "Call answered elsewhere");
p->answered_elsewhere = TRUE;
}