diff options
author | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-01-28 14:37:16 +0000 |
---|---|---|
committer | oej <oej@f38db490-d61c-443f-a65b-d21fe96a405b> | 2009-01-28 14:37:16 +0000 |
commit | 42758ad88a51957a051d61677b28eef43e1a0fc6 (patch) | |
tree | 8e2b49c3a3dcfe502272b98da06ad2716465e80f /apps/app_queue.c | |
parent | 1d25cd40bc8905ac85598931bb4a2358224933b0 (diff) |
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: http://svn.digium.com/svn/asterisk/trunk@171924 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'apps/app_queue.c')
-rw-r--r-- | apps/app_queue.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/apps/app_queue.c b/apps/app_queue.c index 8d250f7d9..5cf064a89 100644 --- a/apps/app_queue.c +++ b/apps/app_queue.c @@ -118,6 +118,9 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") <parameter name="queuename" required="true" /> <parameter name="options"> <optionlist> + <option name="C"> + <para>Mark all calls as "answered elsewhere" when cancelled.</para> + </option> <option name="c"> <para>Continue in the dialplan if the callee hangs up.</para> </option> @@ -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; } |