<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/2599/">https://reviewboard.asterisk.org/r/2599/</a>
     </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 David Lee.</div>
<div>By Joshua Colp.</div>


<p style="color: grey;"><i>Updated June 6, 2013, 7:08 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;">While implementing devicestate support for chan_pjsip I ran into a few problems which these changes solve:

1. stasis_cache_get makes no guarantee that any queued messages have been processed before returning

This is a problem when you want to query a cache for something that may have been queued immediately prior. As it is the cache may or may not reflect it. The change attached adds the ability to require that any pending queued messages are processed by queueing its own message with a pthread condition, which is signaled when processed.

2. ast_endpoint_add_channel does not immediately reflect added channels

As it is when ast_endpoint_add_channel returns the channel is not actually added to the endpoint, it is only done when the channel snapshot is received. The change attached adds the channel uniqueid immediately, which means that the code no longer has to check on every snapshot whether the channel is on the endpoint yet or not. It also means that anything querying the snapshot cache has a better chance of getting the actual current snapshot, when combined with the above stasis_cache_get guarantee.</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;">I&#39;ve been using this with the new chan_pjsip devicestate support and have confirmed that it functions as expected/needed.</pre>
  </td>
 </tr>
</table>


<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> (updated)</h1>
<ul style="margin-left: 3em; padding-left: 0;">

 <li>/trunk/include/asterisk/channel.h <span style="color: grey">(390667)</span></li>

 <li>/trunk/include/asterisk/stasis.h <span style="color: grey">(390667)</span></li>

 <li>/trunk/include/asterisk/stasis_endpoints.h <span style="color: grey">(390667)</span></li>

 <li>/trunk/main/channel_internal_api.c <span style="color: grey">(390667)</span></li>

 <li>/trunk/main/endpoints.c <span style="color: grey">(390667)</span></li>

 <li>/trunk/main/stasis_cache.c <span style="color: grey">(390667)</span></li>

 <li>/trunk/main/stasis_endpoints.c <span style="color: grey">(390667)</span></li>

 <li>/trunk/res/stasis_http/resource_endpoints.c <span style="color: grey">(390667)</span></li>

</ul>

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







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




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