[Asterisk-code-review] app queue: Revert broken queue channel reference patch (asterisk[16])
lvl
asteriskteam at digium.com
Mon Oct 22 07:49:13 CDT 2018
lvl has uploaded this change for review. ( https://gerrit.asterisk.org/10523
Change subject: app_queue: Revert broken queue channel reference patch
......................................................................
app_queue: Revert broken queue channel reference patch
Revert commit 6409e7b11a2310196a9978b30a6b79e2760be592, and add
NULl checks for all app_queu event handling code.
Change-Id: I37334ea184ebb56e54471496b82937d4927815a0
---
M apps/app_queue.c
1 file changed, 31 insertions(+), 24 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/23/10523/1
diff --git a/apps/app_queue.c b/apps/app_queue.c
index 3dc735a..5f61fe7 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -5986,10 +5986,6 @@
struct local_optimization caller_optimize;
/*! Local channel optimization details for the member */
struct local_optimization member_optimize;
- /*! Member channel */
- struct ast_channel *member_channel;
- /*! Caller channel */
- struct ast_channel *caller_channel;
};
/*!
@@ -6007,9 +6003,6 @@
ao2_cleanup(queue_data->member);
queue_unref(queue_data->queue);
ast_string_field_free_memory(queue_data);
-
- ao2_ref(queue_data->member_channel, -1);
- ao2_ref(queue_data->caller_channel, -1);
}
/*!
@@ -6057,15 +6050,6 @@
ao2_ref(mem, +1);
queue_data->member = mem;
- /*
- * During transfers it's possible for both the member and/or caller
- * channel(s) to not be available. Adding a reference here ensures
- * that the channels remain until app_queue is completely done with
- * them.
- */
- queue_data->member_channel = ao2_bump(peer);
- queue_data->caller_channel = ao2_bump(qe->chan);
-
return queue_data;
}
@@ -6197,14 +6181,20 @@
context = transfer_msg->context;
ast_debug(3, "Detected blind transfer in queue %s\n", queue_data->queue->name);
- ast_queue_log(queue_data->queue->name, caller_snapshot->uniqueid, queue_data->member->membername,
+ ast_queue_log(queue_data->queue->name, queue_data->caller_uniqueid, queue_data->member->membername,
"BLINDTRANSFER", "%s|%s|%ld|%ld|%d",
exten, context,
(long) (queue_data->starttime - queue_data->holdstart),
(long) (time(NULL) - queue_data->starttime), queue_data->caller_pos);
- send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,
+ if (caller_snapshot && member_snapshot) {
+ send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,
queue_data->holdstart, queue_data->starttime, TRANSFER);
+ }
+ else {
+ ast_log(LOG_WARNING, "Could not retrieve caller_snapshot or member_snapshot; not sending AgentComplete event\n");
+ }
+
update_queue(queue_data->queue, queue_data->member, queue_data->callcompletedinsl,
queue_data->starttime);
remove_stasis_subscriptions(queue_data);
@@ -6260,11 +6250,22 @@
ao2_unlock(queue_data);
ast_debug(3, "Detected attended transfer in queue %s\n", queue_data->queue->name);
-
- log_attended_transfer(queue_data, caller_snapshot, atxfer_msg);
-
- send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,
+
+ if (caller_snapshot) {
+ log_attended_transfer(queue_data, caller_snapshot, atxfer_msg);
+ }
+ else {
+ ast_log(LOG_WARNING, "Could not retrieve caller_snapshot; not logging attended transfer\n");
+ }
+
+ if (caller_snapshot && member_snapshot) {
+ send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,
queue_data->holdstart, queue_data->starttime, TRANSFER);
+ }
+ else {
+ ast_log(LOG_WARNING, "Could not retrieve caller_snapshot or member_snapshot; not sending AgentComplete event\n");
+ }
+
update_queue(queue_data->queue, queue_data->member, queue_data->callcompletedinsl,
queue_data->starttime);
remove_stasis_subscriptions(queue_data);
@@ -6459,13 +6460,19 @@
ast_debug(3, "Detected hangup of queue %s channel %s\n", reason == CALLER ? "caller" : "member",
channel_blob->snapshot->name);
- ast_queue_log(queue_data->queue->name, caller_snapshot->uniqueid, queue_data->member->membername,
+ ast_queue_log(queue_data->queue->name, queue_data->caller_uniqueid, queue_data->member->membername,
reason == CALLER ? "COMPLETECALLER" : "COMPLETEAGENT", "%ld|%ld|%d",
(long) (queue_data->starttime - queue_data->holdstart),
(long) (time(NULL) - queue_data->starttime), queue_data->caller_pos);
- send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,
+ if (caller_snapshot && member_snapshot) {
+ send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,
queue_data->holdstart, queue_data->starttime, reason);
+ }
+ else {
+ ast_log(LOG_WARNING, "Could not retrieve caller_snapshot or member_snapshot; not sending AgentComplete event\n");
+ }
+
update_queue(queue_data->queue, queue_data->member, queue_data->callcompletedinsl,
queue_data->starttime);
remove_stasis_subscriptions(queue_data);
--
To view, visit https://gerrit.asterisk.org/10523
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 16
Gerrit-MessageType: newchange
Gerrit-Change-Id: I37334ea184ebb56e54471496b82937d4927815a0
Gerrit-Change-Number: 10523
Gerrit-PatchSet: 1
Gerrit-Owner: lvl <digium at lvlconsultancy.nl>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181022/03b84c75/attachment.html>
More information about the asterisk-code-review
mailing list