[Asterisk-code-review] app queue: Ensure that the caller channel is being redirected (asterisk[13])

Sean Bright asteriskteam at digium.com
Tue Mar 21 13:37:13 CDT 2017


Sean Bright has uploaded a new change for review. ( https://gerrit.asterisk.org/5278 )

Change subject: app_queue: Ensure that the caller channel is being redirected
......................................................................

app_queue: Ensure that the caller channel is being redirected

While checking if the caller channel is leaving the bridge, make sure that
it is being redirected first. This prevents timing issues that may occur
when the channel is leaving the bridge by other means, such as an attended
transfer.

Change-Id: I10d3ba912d28c55f0127049db0386f7c2b66c182
---
M apps/app_queue.c
1 file changed, 19 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/78/5278/1

diff --git a/apps/app_queue.c b/apps/app_queue.c
index ddb62d2..43b226b 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -5902,6 +5902,20 @@
 	}
 }
 
+static int is_being_redirected(struct ast_channel *chan)
+{
+	int res = 0;
+
+	ast_channel_lock(chan);
+	if (ast_test_flag(ast_channel_flags(chan), AST_SOFTHANGUP_ASYNCGOTO)
+		|| ast_channel_softhangup_internal_flag(chan) & AST_SOFTHANGUP_ASYNCGOTO) {
+		res = 1;
+	}
+	ast_channel_unlock(chan);
+
+	return res;
+}
+
 /*!
  * \internal
  * \brief Handle a stasis bridge leave event.
@@ -5940,6 +5954,11 @@
 		return;
 	}
 
+	if (!is_being_redirected(queue_data->caller_channel)) {
+		ao2_unlock(queue_data);
+		return;
+	}
+
 	caller_snapshot = ast_channel_snapshot_get_latest(queue_data->caller_uniqueid);
 	member_snapshot = ast_channel_snapshot_get_latest(queue_data->member_uniqueid);
 

-- 
To view, visit https://gerrit.asterisk.org/5278
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I10d3ba912d28c55f0127049db0386f7c2b66c182
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>



More information about the asterisk-code-review mailing list