<p>lvl has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10727">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">app_queue: Revert broken queue channel reference patch<br><br>Revert commit 6409e7b11a2310196a9978b30a6b79e2760be592, and add<br>NULL checks for all app_queue event handling code.<br><br>Related issues: ASTERISK~25185, ASTERISK~27006, ASTERISK~25844<br><br>ASTERISK-28125<br><br>Change-Id: I37334ea184ebb56e54471496b82937d4927815a0<br>---<br>M apps/app_queue.c<br>1 file changed, 11 insertions(+), 24 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/27/10727/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/apps/app_queue.c b/apps/app_queue.c</span><br><span>index 2e59bf6..264b54f 100644</span><br><span>--- a/apps/app_queue.c</span><br><span>+++ b/apps/app_queue.c</span><br><span>@@ -2183,7 +2183,12 @@</span><br><span> return;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_multi_channel_blob_add_channel(payload, "caller", caller_snapshot);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (caller_snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_multi_channel_blob_add_channel(payload, "caller", caller_snapshot);</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_debug(1, "Empty caller_snapshot; sending incomplete event\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> if (agent_snapshot) {</span><br><span> ast_multi_channel_blob_add_channel(payload, "agent", agent_snapshot);</span><br><span> }</span><br><span>@@ -5975,10 +5980,6 @@</span><br><span> struct local_optimization caller_optimize;</span><br><span> /*! Local channel optimization details for the member */</span><br><span> struct local_optimization member_optimize;</span><br><span style="color: hsl(0, 100%, 40%);">- /*! Member channel */</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_channel *member_channel;</span><br><span style="color: hsl(0, 100%, 40%);">- /*! Caller channel */</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_channel *caller_channel;</span><br><span> };</span><br><span> </span><br><span> /*!</span><br><span>@@ -5996,9 +5997,6 @@</span><br><span> ao2_cleanup(queue_data->member);</span><br><span> queue_unref(queue_data->queue);</span><br><span> ast_string_field_free_memory(queue_data);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_ref(queue_data->member_channel, -1);</span><br><span style="color: hsl(0, 100%, 40%);">- ao2_ref(queue_data->caller_channel, -1);</span><br><span> }</span><br><span> </span><br><span> /*!</span><br><span>@@ -6046,15 +6044,6 @@</span><br><span> ao2_ref(mem, +1);</span><br><span> queue_data->member = mem;</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- /*</span><br><span style="color: hsl(0, 100%, 40%);">- * During transfers it's possible for both the member and/or caller</span><br><span style="color: hsl(0, 100%, 40%);">- * channel(s) to not be available. Adding a reference here ensures</span><br><span style="color: hsl(0, 100%, 40%);">- * that the channels remain until app_queue is completely done with</span><br><span style="color: hsl(0, 100%, 40%);">- * them.</span><br><span style="color: hsl(0, 100%, 40%);">- */</span><br><span style="color: hsl(0, 100%, 40%);">- queue_data->member_channel = ao2_bump(peer);</span><br><span style="color: hsl(0, 100%, 40%);">- queue_data->caller_channel = ao2_bump(qe->chan);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span> return queue_data;</span><br><span> }</span><br><span> </span><br><span>@@ -6066,10 +6055,9 @@</span><br><span> * attended transfer was completed.</span><br><span> *</span><br><span> * \param queue_data Data pertaining to the particular call in the queue.</span><br><span style="color: hsl(0, 100%, 40%);">- * \param caller The channel snapshot for the caller channel in the queue.</span><br><span> * \param atxfer_msg The stasis attended transfer message data.</span><br><span> */</span><br><span style="color: hsl(0, 100%, 40%);">-static void log_attended_transfer(struct queue_stasis_data *queue_data, struct ast_channel_snapshot *caller,</span><br><span style="color: hsl(120, 100%, 40%);">+static void log_attended_transfer(struct queue_stasis_data *queue_data,</span><br><span> struct ast_attended_transfer_message *atxfer_msg)</span><br><span> {</span><br><span> RAII_VAR(struct ast_str *, transfer_str, ast_str_create(32), ast_free);</span><br><span>@@ -6098,7 +6086,7 @@</span><br><span> return;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_log(queue_data->queue->name, caller->base->uniqueid, queue_data->member->membername, "ATTENDEDTRANSFER", "%s|%ld|%ld|%d",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_queue_log(queue_data->queue->name, queue_data->caller_uniqueid, queue_data->member->membername, "ATTENDEDTRANSFER", "%s|%ld|%ld|%d",</span><br><span> ast_str_buffer(transfer_str),</span><br><span> (long) (queue_data->starttime - queue_data->holdstart),</span><br><span> (long) (time(NULL) - queue_data->starttime), queue_data->caller_pos);</span><br><span>@@ -6186,7 +6174,7 @@</span><br><span> context = transfer_msg->context;</span><br><span> </span><br><span> ast_debug(3, "Detected blind transfer in queue %s\n", queue_data->queue->name);</span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_log(queue_data->queue->name, caller_snapshot->base->uniqueid, queue_data->member->membername,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_queue_log(queue_data->queue->name, queue_data->caller_uniqueid, queue_data->member->membername,</span><br><span> "BLINDTRANSFER", "%s|%s|%ld|%ld|%d",</span><br><span> exten, context,</span><br><span> (long) (queue_data->starttime - queue_data->holdstart),</span><br><span>@@ -6249,8 +6237,7 @@</span><br><span> ao2_unlock(queue_data);</span><br><span> </span><br><span> ast_debug(3, "Detected attended transfer in queue %s\n", queue_data->queue->name);</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- log_attended_transfer(queue_data, caller_snapshot, atxfer_msg);</span><br><span style="color: hsl(120, 100%, 40%);">+ log_attended_transfer(queue_data, atxfer_msg);</span><br><span> </span><br><span> send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,</span><br><span> queue_data->holdstart, queue_data->starttime, TRANSFER);</span><br><span>@@ -6448,7 +6435,7 @@</span><br><span> ast_debug(3, "Detected hangup of queue %s channel %s\n", reason == CALLER ? "caller" : "member",</span><br><span> channel_blob->snapshot->base->name);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_log(queue_data->queue->name, caller_snapshot->base->uniqueid, queue_data->member->membername,</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_queue_log(queue_data->queue->name, queue_data->caller_uniqueid, queue_data->member->membername,</span><br><span> reason == CALLER ? "COMPLETECALLER" : "COMPLETEAGENT", "%ld|%ld|%d",</span><br><span> (long) (queue_data->starttime - queue_data->holdstart),</span><br><span> (long) (time(NULL) - queue_data->starttime), queue_data->caller_pos);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10727">change 10727</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10727"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I37334ea184ebb56e54471496b82937d4927815a0 </div>
<div style="display:none"> Gerrit-Change-Number: 10727 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: lvl <digium@lvlconsultancy.nl> </div>