From 526cc089a9b158c7cc3f3abaf61267305c28c16f Mon Sep 17 00:00:00 2001
From: Olle Johansson <oej@edvina.net>
Date: Thu, 15 Jan 2009 13:01:52 +0000
Subject: [PATCH] Add support for setting the Reason header when cancelling a
 call in the queue because someone else answered. Previously, only dial() was
 supported.

EDV-102


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@168636 65c4cc65-6c06-0410-ace0-fbb531ad65f3
---
 apps/app_queue.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 85d15881fc..ada7da82de 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2228,9 +2228,13 @@ static void hangupcalls(struct callattempt *outgoing, struct ast_channel *except
 	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 (outgoing->chan && (outgoing->chan != exception)) {
+			if (exception)
+				ast_set_flag(outgoing->chan, AST_FLAG_ANSWERED_ELSEWHERE);
 			ast_hangup(outgoing->chan);
+		}
 		oo = outgoing;
 		outgoing = outgoing->q_next;
 		if (oo->member)
-- 
GitLab