<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/2996/">https://reviewboard.asterisk.org/r/2996/</a>
     </td>
    </tr>
   </table>
   <br />





 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">To make sure I better understand the situation...

Is it caching an old stale entry without address?

Then when device state is queried it uses that old stale entry instead of requerying realtime... so it thinks it has no address when in realtime there really is an address?</pre>
 <br />









<p>- Joshua Colp</p>


<br />
<p>On November 5th, 2013, 2:41 p.m. UTC, wdoekes wrote:</p>








<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.ab6f3b1072c9.png'); background-position: left top; background-repeat: repeat-x; border: 1px black solid;">
 <tr>
  <td>

<div>Review request for Asterisk Developers.</div>
<div>By wdoekes.</div>


<p style="color: grey;"><i>Updated Nov. 5, 2013, 2:41 p.m.</i></p>









<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;">When using realtime SIP peers as queue members, the device state as returned by sip_devicestate() is AST_DEVICE_UNAVAILABLE when the peer is not loaded into memory.

For uncached realtime SIP peers, this is practically always. That means that my queue doesn't have any available members.

This patch changes all p->realtime peers with a null p->addr to return AST_DEVICE_UNKNOWN instead. If we set the queue to accept unknown members, the queue correctly copes with devices with this UNKNOWN state:

    static int member_status_available(int status)
    {
        return status == AST_DEVICE_NOT_INUSE || status == AST_DEVICE_UNKNOWN;
    }


A different approach would have been to set the p->defaddr to non-null, but that would put the device in NOT_INUSE state which is not entirely correct, since I don't know if the device *is* available. And I haven't checked what other side-effects setting the p->defaddr has.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </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;">Tested on asterisk 10 and 11 with the SIP-devices in the state_interface column. Without the patch, the device state is unavailable, and the queue will report the members as unavailable. With the patch, the members have the unknown state and things work properly. </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/1.8/channels/chan_sip.c <span style="color: grey">(402467)</span></li>

</ul>

<p><a href="https://reviewboard.asterisk.org/r/2996/diff/" style="margin-left: 3em;">View Diff</a></p>







  </td>
 </tr>
</table>








  </div>
 </body>
</html>