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



 <p>Ship it!</p>



 <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Ship It!</pre>
 <br />









<p>- rmudgett</p>


<br />
<p>On January 29th, 2015, 11:20 a.m. CST, Scott Griepentrog 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 Scott Griepentrog.</div>


<p style="color: grey;"><i>Updated Jan. 29, 2015, 11:20 a.m.</i></p>







<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-24649">ASTERISK-24649</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;">During an attended transfer of a channel in stasis, where a local channel is used to replace (swap in for) a PJSIP channel, there is a race condition.  The PJSIP REFER transfer has been initiated (ast_bridge_impart) but will be completed later on another thread (bridge_channel_ind_thread), however, prior to the stasis bridging callback (bridge_stasis_push) being called the PJSIP channel is hungup, which allows the stasis app loop to exit, deleting the stasis control.  That prevents the stasis bridge callback from getting the app name from the channel being replaced (swap).

This patch adds a new stasis bridge callback push_peek, which is called from the ast_bridge_impart() thread.  This allows the new bridge_stasis_push_peek() function to copy the stasis app name from the originating channel before the PJSIP channel can be hungup.</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;">Running tests/rest_api/external_interaction/attended_transfer/stasis_bridge_to_stasis_app now does not result in an occasional failure.</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/13/res/stasis/stasis_bridge.c <span style="color: grey">(431296)</span></li>

 <li>/branches/13/main/bridge.c <span style="color: grey">(431296)</span></li>

 <li>/branches/13/include/asterisk/bridge.h <span style="color: grey">(431296)</span></li>

</ul>

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







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








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