From: Olle Johansson Date: Wed, 28 Jan 2009 14:37:16 +0000 (+0000) Subject: Add final part of previously committed work for answered elsewhere in queue - the... X-Git-Tag: 1.6.2.0-beta1~343 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=097822966bfe7391ee732eedf74dcb629bb41838;p=thirdparty%2Fasterisk.git Add final part of previously committed work for answered elsewhere in queue - the missing piece that started with app_dial() earlier on. This is to avoid having the list and counter of missed calls being touched by queue calls. Add the C option to queue() and nothing will be logged on phones that support the Reason: header on SIP cancel, like the SNOM phones. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@171924 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/apps/app_queue.c b/apps/app_queue.c index 8d250f7d94..5cf064a894 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -118,6 +118,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") + @@ -2222,15 +2225,15 @@ static void leave_queue(struct queue_ent *qe) } /*! \brief Hang up a list of outgoing calls */ -static void hangupcalls(struct callattempt *outgoing, struct ast_channel *exception) +static void hangupcalls(struct callattempt *outgoing, struct ast_channel *exception, int cancel_answered_elsewhere) { struct callattempt *oo; while (outgoing) { /* If someone else answered the call we should indicate this in the CANCEL */ /* Hangup any existing lines we have open */ - if (outgoing->chan && (outgoing->chan != exception)) { - if (exception) + if (outgoing->chan && (outgoing->chan != exception || cancel_answered_elsewhere)) { + if (exception || cancel_answered_elsewhere) ast_set_flag(outgoing->chan, AST_FLAG_ANSWERED_ELSEWHERE); ast_hangup(outgoing->chan); } @@ -3481,6 +3484,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce struct ao2_iterator memi; struct ast_datastore *datastore, *transfer_ds; struct queue_end_bridge *queue_end_bridge = NULL; + int cancel_answered_elsewhere = 0; ast_channel_lock(qe->chan); datastore = ast_channel_datastore_find(qe->chan, &dialed_interface_info, NULL); @@ -3548,6 +3552,9 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce case 'X': ast_set_flag(&(bridge_config.features_caller), AST_FEATURE_AUTOMIXMON); break; + case 'C': + cancel_answered_elsewhere = 1; + break; } @@ -3744,7 +3751,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce member = lpeer->member; /* Increment the refcount for this member, since we're going to be using it for awhile in here. */ ao2_ref(member, 1); - hangupcalls(outgoing, peer); + hangupcalls(outgoing, peer, cancel_answered_elsewhere); outgoing = NULL; if (announce || qe->parent->reportholdtime || qe->parent->memberdelay) { int res2; @@ -4147,7 +4154,7 @@ static int try_calling(struct queue_ent *qe, const char *options, char *announce ao2_ref(member, -1); } out: - hangupcalls(outgoing, NULL); + hangupcalls(outgoing, NULL, cancel_answered_elsewhere); return res; }