[Asterisk-code-review] app queue: Revert broken queue channel reference patch (asterisk[16])

George Joseph asteriskteam at digium.com
Mon Dec 3 15:08:47 CST 2018


George Joseph has submitted this change and it was merged. ( 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_queue event handling code.

Related issues: ASTERISK~25185, ASTERISK~27006, ASTERISK~25844

ASTERISK-28125

Change-Id: I37334ea184ebb56e54471496b82937d4927815a0
---
M apps/app_queue.c
1 file changed, 11 insertions(+), 24 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve; Verified
  Matthew Fredrickson: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  George Joseph: Approved for Submit



diff --git a/apps/app_queue.c b/apps/app_queue.c
index 17e35f9..450a4db 100644
--- a/apps/app_queue.c
+++ b/apps/app_queue.c
@@ -2183,7 +2183,12 @@
 		return;
 	}
 
-	ast_multi_channel_blob_add_channel(payload, "caller", caller_snapshot);
+	if (caller_snapshot) {
+		ast_multi_channel_blob_add_channel(payload, "caller", caller_snapshot);
+	} else {
+		ast_debug(1, "Empty caller_snapshot; sending incomplete event\n");
+	}
+
 	if (agent_snapshot) {
 		ast_multi_channel_blob_add_channel(payload, "agent", agent_snapshot);
 	}
@@ -5975,10 +5980,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;
 };
 
 /*!
@@ -5996,9 +5997,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);
 }
 
 /*!
@@ -6046,15 +6044,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;
 }
 
@@ -6066,10 +6055,9 @@
  * attended transfer was completed.
  *
  * \param queue_data Data pertaining to the particular call in the queue.
- * \param caller The channel snapshot for the caller channel in the queue.
  * \param atxfer_msg The stasis attended transfer message data.
  */
-static void log_attended_transfer(struct queue_stasis_data *queue_data, struct ast_channel_snapshot *caller,
+static void log_attended_transfer(struct queue_stasis_data *queue_data,
 		struct ast_attended_transfer_message *atxfer_msg)
 {
 	RAII_VAR(struct ast_str *, transfer_str, ast_str_create(32), ast_free);
@@ -6098,7 +6086,7 @@
 		return;
 	}
 
-	ast_queue_log(queue_data->queue->name, caller->uniqueid, queue_data->member->membername, "ATTENDEDTRANSFER", "%s|%ld|%ld|%d",
+	ast_queue_log(queue_data->queue->name, queue_data->caller_uniqueid, queue_data->member->membername, "ATTENDEDTRANSFER", "%s|%ld|%ld|%d",
 			ast_str_buffer(transfer_str),
 			(long) (queue_data->starttime - queue_data->holdstart),
 			(long) (time(NULL) - queue_data->starttime), queue_data->caller_pos);
@@ -6186,7 +6174,7 @@
 	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),
@@ -6249,8 +6237,7 @@
 	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);
+	log_attended_transfer(queue_data, atxfer_msg);
 
 	send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,
 			queue_data->holdstart, queue_data->starttime, TRANSFER);
@@ -6448,7 +6435,7 @@
 	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);

-- 
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: merged
Gerrit-Change-Id: I37334ea184ebb56e54471496b82937d4927815a0
Gerrit-Change-Number: 10523
Gerrit-PatchSet: 9
Gerrit-Owner: lvl <digium at lvlconsultancy.nl>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2 (1000185)
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-Reviewer: Matthew Fredrickson <creslin at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: lvl <digium at lvlconsultancy.nl>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20181203/26966663/attachment.html>


More information about the asterisk-code-review mailing list