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










<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
 <p style="margin-top: 0;">On March 21st, 2014, 6:05 a.m. CET, <b>Corey Farrell</b> wrote:</p>
 <blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
  



<table width="100%" border="0" bgcolor="white" style="border: 1px solid #C0C0C0; border-collapse: collapse; margin: 2px padding: 2px;">
 <thead>
  <tr>
   <th colspan="4" bgcolor="#F0F0F0" style="border-bottom: 1px solid #C0C0C0; font-size: 9pt; padding: 4px 8px; text-align: left;">
    <a href="https://reviewboard.asterisk.org/r/3349/diff/7/?file=56285#file56285line131" style="color: black; font-weight: bold; text-decoration: underline;">/trunk/channels/sip/reqresp_parser.c</a>
    <span style="font-weight: normal;">

     (Diff revision 7)

    </span>
   </th>
  </tr>
 </thead>

 <tbody style="background-color: #e4d9cb; padding: 4px 8px; text-align: center;">
  <tr>

   <td colspan="4"><pre style="font-size: 8pt; line-height: 140%; margin: 0; ">int parse_uri_full(char *uri, const char *scheme, char **user, char **pass,</pre></td>

  </tr>
 </tbody>



 
 

 <tbody>

  <tr>
    <th bgcolor="#b1ebb0" style="border-right: 1px solid #C0C0C0;" align="right"><font size="2"></font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "></pre></td>
    <th bgcolor="#b1ebb0" style="border-left: 1px solid #C0C0C0; border-right: 1px solid #C0C0C0;" align="right"><font size="2">131</font></th>
    <td bgcolor="#c5ffc4" width="50%"><pre style="font-size: 8pt; line-height: 140%; margin: 0; "><span class="tb">   </span><span class="tb">  </span><span class="tb">  </span><span class="n">error</span> <span class="o">=</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span></pre></td>
  </tr>

 </tbody>

</table>

  <pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">I'm getting a segfault with the test "tel:911".  userinfo == NULL causes strchr to segfault on Ubuntu x86_64 (eglibc 2.17).  I believe we need to add:
userinfo = uri = "";

blank userinfo to prevent the segfault, blank uri to prevent "911" from being returned in residue.


Program received signal SIGSEGV, Segmentation fault.
__strchr_sse2 () at ../sysdeps/x86_64/multiarch/../strchr.S:32
32      ../sysdeps/x86_64/multiarch/../strchr.S: No such file or directory.
(gdb) bt full
#0  __strchr_sse2 () at ../sysdeps/x86_64/multiarch/../strchr.S:32
No locals.
#1  0x00007fff88f2e52a in parse_uri_full (uri=0x7fffffffb7d4 "911", scheme=0x7fff88f5661e "sip:,sips:,tel:", user=0x7fffffffb7a0, pass=0x7fffffffb7a8, hostport=0x7fffffffb7b0, params=0x7fffffffb730, 
    headers=0x7fffffffb728, residue=0x0) at sip/reqresp_parser.c:149
        userinfo = 0x0
        parameters = 0x0
        endparams = 0x0
        c = 0x0
        error = -1
        teluri_scheme = 1
        __PRETTY_FUNCTION__ = "parse_uri_full"
#2  0x00007fff88f2f90e in parse_uri (uri=0x7fffffffb7d0 "tel:911", scheme=0x7fff88f5661e "sip:,sips:,tel:", user=0x7fffffffb7a0, pass=0x7fffffffb7a8, hostport=0x7fffffffb7b0, transport=0x7fffffffb7b8)
    at sip/reqresp_parser.c:524
        ret = -1
        headers = 0x7fff88f55f57 ""
        params = {transport = 0x7fff88f55f57 "", user = 0x7fff88f55f57 "", method = 0x29e88f55f57 <Address 0x29e88f55f57 out of bounds>, 
          ttl = 0x7fff88f583a0 <__PRETTY_FUNCTION__.27916> "sip_parse_uri_test", maddr = 0x7fff88f55e24 "sip/reqresp_parser.c", lr = -1997185193}
</pre>
 </blockquote>





</blockquote>
<pre style="margin-left: 1em; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;">Return userinfo when RFC 3966 does not include neither global number, nor context.
In this case hostport will not be available.
Avoid NULL string reference segmentation fault by adding explicit test && (userinfo != NULL) before strstr test.</pre>
<br />




<p>- Geert</p>


<br />
<p>On March 21st, 2014, 8:32 a.m. CET, Geert Van Pamel 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, Corey Farrell, lmadensen, Matt Jordan, and wdoekes.</div>
<div>By Geert Van Pamel.</div>


<p style="color: grey;"><i>Updated March 21, 2014, 8:32 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-17179">ASTERISK-17179</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;">Implements RFC-3966 TEL URI incoming INVITE.

See https://issues.asterisk.org/jira/browse/ASTERISK-17179 for a description of the original isssue.

I have been patching all versions since Asterisk 1.6. I would like to include the code into the main trunk for version 13.

Previously Asterisk was failing with error on incoming IMS call:

Nov 13 17:52:05 NOTICE[27459]: chan_sip.c:6973 check_user_full: From address missing 'sip:', using it anyway

Nov 13 17:52:05 WARNING[27459]: chan_sip.c:6525 get_destination: Huh? Not a SIP header (tel:0987654321;phone-context=+32987654321)?

Reason: tel: protocol was not recognized.</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;">Executed an incoming TEL URI INVITE connection.
CLI was present on the display and in the CDR file.
No errors on SIP debug output.
</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>/trunk/channels/sip/reqresp_parser.c <span style="color: grey">(410429)</span></li>

 <li>/trunk/channels/chan_sip.c <span style="color: grey">(410429)</span></li>

</ul>

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



<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">File Attachments </h1>

<ul>

 <li><a href="https://reviewboard.asterisk.org/media/uploaded/files/2014/03/13/cad7a996-88c1-47fe-a2a9-cc6987af3b75__rfc-3966-tel-uri-patch-diff.txt">RFC-3966 tel URI patch</a></li>

</ul>





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








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