[Asterisk-code-review] app_queue: fixed ordering of events for queue agent dial (...asterisk[16])

Nathan Bruning asteriskteam at digium.com
Wed Feb 27 17:57:56 CST 2019


Nathan Bruning has uploaded this change for review. ( https://gerrit.asterisk.org/c/asterisk/+/11058


Change subject: app_queue: fixed ordering of events for queue agent dial
......................................................................

app_queue: fixed ordering of events for queue agent dial

Send out AgentCalled and DialBegin *before* calling the channel
of the queue agent.

Before this, the AgentCalled event could either be sent before or after the
events of the queue agent, depending on thread scheduling.

ASTERISK-28310 #close

Change-Id: Id0865fb306136f30a1aa8be82f3753c47059ff2d
---
M apps/app_queue.c
1 file changed, 8 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/58/11058/1

diff --git a/apps/app_queue.c b/apps/app_queue.c
index 9b1f486..79d8710 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -4577,6 +4577,14 @@
 	/* Save the original channel name to detect call pickup masquerading in. */
 	tmp->orig_chan_name = ast_strdup(ast_channel_name(tmp->chan));
 
+	blob = ast_json_pack("{s: s, s: s, s: s}",
+						 "Queue", qe->parent->name,
+						 "Interface", tmp->interface,
+						 "MemberName", tmp->member->membername);
+	queue_publish_multi_channel_blob(qe->chan, tmp->chan, queue_agent_called_type(), blob);
+
+	ast_channel_publish_dial(qe->chan, tmp->chan, tmp->interface, NULL);
+
 	ast_channel_unlock(tmp->chan);
 	ast_channel_unlock(qe->chan);
 
@@ -4594,19 +4602,6 @@
 		return 0;
 	}
 
-	ast_channel_lock_both(tmp->chan, qe->chan);
-
-	blob = ast_json_pack("{s: s, s: s, s: s}",
-			     "Queue", qe->parent->name,
-			     "Interface", tmp->interface,
-			     "MemberName", tmp->member->membername);
-	queue_publish_multi_channel_blob(qe->chan, tmp->chan, queue_agent_called_type(), blob);
-
-	ast_channel_publish_dial(qe->chan, tmp->chan, tmp->interface, NULL);
-
-	ast_channel_unlock(tmp->chan);
-	ast_channel_unlock(qe->chan);
-
 	ast_verb(3, "Called %s\n", tmp->interface);
 
 	return 1;

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/11058
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-Change-Id: Id0865fb306136f30a1aa8be82f3753c47059ff2d
Gerrit-Change-Number: 11058
Gerrit-PatchSet: 1
Gerrit-Owner: Nathan Bruning <nathan at iperity.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190227/1ecdcdc2/attachment-0001.html>


More information about the asterisk-code-review mailing list