<p>lvl has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/10523">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_queu event handling code.<br><br>Change-Id: I37334ea184ebb56e54471496b82937d4927815a0<br>---<br>M apps/app_queue.c<br>1 file changed, 31 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/23/10523/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 3dc735a..5f61fe7 100644</span><br><span>--- a/apps/app_queue.c</span><br><span>+++ b/apps/app_queue.c</span><br><span>@@ -5986,10 +5986,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>@@ -6007,9 +6003,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>@@ -6057,15 +6050,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>@@ -6197,14 +6181,20 @@</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->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> (long) (time(NULL) - queue_data->starttime), queue_data->caller_pos);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,</span><br><span style="color: hsl(120, 100%, 40%);">+ if (caller_snapshot && member_snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+ 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 style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Could not retrieve caller_snapshot or member_snapshot; not sending AgentComplete event\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> update_queue(queue_data->queue, queue_data->member, queue_data->callcompletedinsl,</span><br><span> queue_data->starttime);</span><br><span> remove_stasis_subscriptions(queue_data);</span><br><span>@@ -6260,11 +6250,22 @@</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(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">+ if (caller_snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+ log_attended_transfer(queue_data, caller_snapshot, atxfer_msg);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Could not retrieve caller_snapshot; not logging attended transfer\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span style="color: hsl(120, 100%, 40%);">+ if (caller_snapshot && member_snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+ 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 style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Could not retrieve caller_snapshot or member_snapshot; not sending AgentComplete event\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span> update_queue(queue_data->queue, queue_data->member, queue_data->callcompletedinsl,</span><br><span> queue_data->starttime);</span><br><span> remove_stasis_subscriptions(queue_data);</span><br><span>@@ -6459,13 +6460,19 @@</span><br><span> ast_debug(3, "Detected hangup of queue %s channel %s\n", reason == CALLER ? "caller" : "member",</span><br><span> channel_blob->snapshot->name);</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">- ast_queue_log(queue_data->queue->name, caller_snapshot->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><span style="color: hsl(0, 100%, 40%);">- send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,</span><br><span style="color: hsl(120, 100%, 40%);">+ if (caller_snapshot && member_snapshot) {</span><br><span style="color: hsl(120, 100%, 40%);">+ send_agent_complete(queue_data->queue->name, caller_snapshot, member_snapshot, queue_data->member,</span><br><span> queue_data->holdstart, queue_data->starttime, reason);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_log(LOG_WARNING, "Could not retrieve caller_snapshot or member_snapshot; not sending AgentComplete event\n");</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ </span><br><span> update_queue(queue_data->queue, queue_data->member, queue_data->callcompletedinsl,</span><br><span> queue_data->starttime);</span><br><span> remove_stasis_subscriptions(queue_data);</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10523">change 10523</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/10523"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </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: 10523 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: lvl <digium@lvlconsultancy.nl> </div>