<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="8" style="border: 1px #c9c399 solid;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://reviewboard.asterisk.org/r/2878/">https://reviewboard.asterisk.org/r/2878/</a>
</td>
</tr>
</table>
<br />
<table bgcolor="#e0e0e0" width="100%" cellpadding="8" style="border: 1px gray solid;">
<tr>
<td>
<h1 style="margin-right: 0.2em; padding: 0; font-size: 10pt;">This change has been marked as submitted.</h1>
</td>
</tr>
</table>
<br />
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/static/rb/images/review_request_box_top_bg.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
<tr>
<td>
<div>Review request for Asterisk Developers and Mark Michelson.</div>
<div>By Matt Jordan.</div>
<p style="color: grey;"><i>Updated Sept. 28, 2013, 3:38 p.m.</i></p>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Changes</h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Committed in revision 400060</pre>
</td>
</tr>
</table>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="https://issues.asterisk.org/jira/browse/ASTERISK-22507">ASTERISK-22507</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
Asterisk
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">app_queue does an admirable job of attempting to manage the Lovecraftian nightmare that are Local channel optimizations. Sometimes, however, even it can't defeat the horror.
Consider the following scenario:
SIP/foo <-> L;1 <-> L;2 <-> SIP/agent
SIP/agent answers, triggering a Local channel optimization. This is fine - app_queue will normally do the following:
* Listen for the Local optimization events and update our agent accordingly to SIP/agent
* When we get a hangup, publish the AgentComplete event based on our information (SIP/foo and SIP/agent)
However, as with all things that depend on sanity from something as capricious as Local channels, things can go wrong:
(1) SIP/agent immediately hangs up upon answering, because "customer service is our #1 priority" doesn't apply on casual Fridays
(2) Asterisk is either (a) Running under valgrind; (b) Running under gdb; (c) Running on Richard's dev machine/some other ancient piece of equipment that should have been put out of its misery ages ago
In that case, the messages *may* arrive to app_queue in the following order:
* Hangup SIP/Agent
* Hangup SIP/foo
* Optimize L;1/L;2
* Hangup L;2
* Hangup L;1
When we receive the hangup of the agent or the caller, we'll attempt to publish the AgentComplete event. However, we now have a problem - we think our agent is L;1. We haven't received the optimization messages - but L;1 is already dead, so any attempts to query it from the Stasis cache result in a big fat NULL.
There are two options here:
(1) If we can't retrieve channel information, bail
(2) If we can't retrieve channel information, publish what we know
This patch goes with option #2. We still have a lot of pertinent queue information (interface, queue name, etc.) - and we may as well tell the user what we know. They will still at least get the "AgentComplete" event, which "completes" the known Agent information.</pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>./branches/12/apps/app_queue.c <span style="color: grey">(399746)</span></li>
</ul>
<p><a href="https://reviewboard.asterisk.org/r/2878/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>