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


<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="8" style="background-image: url('https://reviewboard.asterisk.org/media/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.</div>
<div>By Mark Michelson.</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 Asterisk receives what it believes to be a dialog-starting INVITE with a to-tag, Asterisk will reply with a 481. There was an issue where Asterisk would not recognize the incoming ACK of the 481 because Asterisk&#39;s internally generated to-tag did not match the actual to-tag used in the transaction. My initial fix for this was to make Asterisk send its generated to-tag in the 481 to essentially &quot;change&quot; the to-tag of the transaction. This way, the UA would respond with an ACK with a matching to-tag and all would be happy.

Unfortunately, it was pointed out to me that just because Asterisk thinks that an INVITE is out-of-dialog doesn&#39;t make it so. For instance, Asterisk could crash with a SIP dialog up, be restarted, and then receive a reinvite for that dialog. The new Asterisk instance would have no knowledge of the dialog, so it would think the INVITE was out-of-dialog with an illegitimate to-tag. In this case, the sender of the reinvite would not recognize the 481 as being in-dialog and would thus continue retransmitting the reinvite until the transaction timed out.

The new approach here is to update Asterisk&#39;s local tag to be the to-tag present in the INVITE in the case that Asterisk will be transmitting a 481 response. Taking this approach meant having to change the local tag to be a string field instead of a static buffer and rewriting the make_our_tag() method.</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 have tested using Walter Doekes&#39;s 481 test. The 481 that Asterisk sends has the same to-tag as the INVITE, and Asterisk properly recognizes the inbound ACK.</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-19892">ASTERISK-19892</a>


</div>


<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">(368625)</span></li>

 <li>/branches/1.8/channels/sip/include/sip.h <span style="color: grey">(368624)</span></li>

</ul>

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




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




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