<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/4345/">https://reviewboard.asterisk.org/r/4345/</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.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 Mark Michelson.</div>


<p style="color: grey;"><i>Updated Jan. 29, 2015, 2:58 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 431426</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-24646">ASTERISK-24646</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;">PJSIP introduced a change prior to the 2.3 release that made their INVITE-handling code RFC compliant with regards to checking for SIPS URIs in Contact headers of received requests/responses. Specifically, they added checks for languaged outlined in RFC 3261 section 8.1.1.8 and 12.1.1. A simplified version of what PJSIP does is the following:

* On incoming INVITE and UPDATE requests, if the request URI is SIPS but the Contact header is not, then the request receives a 480 response
* On an incoming 200 OK response to an INVITE or UPDATE, if the request URI is SIPS but the Contact header is not, then PJSIP issues an immediate BYE to end the session.

For softphones that use PJSIP, this means they have trouble interoperating with Asterisk. This is because Asterisk never places a SIPS URI in a contact header. So if a client using PJSIP sends an INVITE to a SIPS URI in Asterisk, we were responding with a non-SIPS Contact header. The PJSIP client would then immediately send a BYE terminating the call.

This patch aims to fix this issue by implementing requirements of RFC 3261 sections 8.1.1.8 and 12.1.1
* There is a new module that registers a service that operates on all outgoing requests. If the request is to a SIPS URI, or if the topmost Route header is a SIPS URI, then we set our Contact header to a SIPS URI.
* The code that creates a UAS dialog will create the local Contact header based on whether the Request-URI or the topmost Record-Route URI is a SIPS URI.

For this patch, I have elected to keep the ;transport=tls parameter in the Contact header since I have a feeling removing it will cause more trouble than it actually fixes.

A similar patch against chan_sip for the 11 branch is posted at /r/4346</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;">Honestly, not much. It compiles. I attempted to set up a TLS client (Jitsi, to be specific), but failed. I got no help from either Asterisk or Jitsi to explain what was going wrong. In the end, I gave that up.

What I was able to do, oddly, was use SIPp to send a SIP INVITE to Asterisk over UDP using a SIPS Request URI. I then was able to make sure that Asterisk sent a SIPS contact header back in the 200 OK. I'm not making a testsuite test out of this though because it feels like a bug that I can send a request to a SIPS URI over UDP and that Asterisk will accept the request.</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/res_pjsip_sips_contact.c <span style="color: grey">(PRE-CREATION)</span></li>

 <li>/branches/13/res/res_pjsip.c <span style="color: grey">(430625)</span></li>

</ul>

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







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




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