<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>Hello,</p>
    <p><br>
    </p>
    <p>is there a '+' missing after sip: in the To of the re-invite vs
      the From of the initial invite?</p>
    <p><br>
    </p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <br>
    <div class="moz-cite-prefix">On 03/11/16 14:08, Tobias wrote:<br>
    </div>
    <blockquote
cite="mid:VI1PR0201MB15833A38952F9CE574292E6CF7A30@VI1PR0201MB1583.eurprd02.prod.outlook.com"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=windows-1252">
      <style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
      <div id="divtagdefaultwrapper"
style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;">
        <p>Hi,</p>
        <p><br>
        </p>
        <p>This is what it looks like.</p>
        <div><br>
        </div>
        <div>Initial INVITE after passing Kamailio:</div>
        <div>From: +num_1
<a class="moz-txt-link-rfc2396E" href="sip:+num_1@localip"><sip:+num_1@localip></a>;tag=SD1sf9001--45026-530b969-77c7543f-530b969.</div>
        <div>To: <a class="moz-txt-link-rfc2396E" href="sip:+num_2@localip:5060;user=phone"><sip:+num_2@localip:5060;user=phone></a>.</div>
        <div><br>
        </div>
        <div>Incoming reINVITE:</div>
        <div>From:
<a class="moz-txt-link-rfc2396E" href="sip:+num_2@remoteip:5060;user=phone"><sip:+num_2@remoteip:5060;user=phone></a>;tag=SD1sf9099-32997070347920161028161732.</div>
        <div>To: +num_1
          <a class="moz-txt-link-rfc2396E" href="sip:num_1@localip"><sip:num_1@localip></a>;tag=SD1sf9001--45026-530b969-77c7543f-530b969.</div>
        <div><br>
        </div>
        <div>Kind regards,</div>
        <div>/Tobias<br>
          <br>
          <br>
          <div style="color: rgb(0, 0, 0);">
            <hr tabindex="-1" style="display:inline-block; width:98%">
            <div id="divRplyFwdMsg" dir="ltr"><font
                style="font-size:11pt" face="Calibri, sans-serif"
                color="#000000"><b>From:</b> Daniel-Constantin Mierla
                <a class="moz-txt-link-rfc2396E" href="mailto:miconda@gmail.com"><miconda@gmail.com></a><br>
                <b>Sent:</b> Thursday, November 3, 2016 1:59 PM<br>
                <b>To:</b> Tobias; Kamailio (SER) - Users Mailing List<br>
                <b>Subject:</b> Re: [SR-Users] Malformed To header, or?</font>
              <div> </div>
            </div>
            <div>
              <p>Hello,</p>
              <p><br>
              </p>
              <p>the question is if the value in the step 5 is the same
                as in step 3, or the endpoint does further modifications
                (changing what it received in step 3)?</p>
              <p><br>
              </p>
              <p>Cheers,<br>
                Daniel<br>
              </p>
              <br>
              <div class="moz-cite-prefix">On 03/11/16 10:20, Tobias
                wrote:<br>
              </div>
              <blockquote type="cite">
                <div id="divtagdefaultwrapper" style="font-size:12pt;
                  color:#000000;
                  font-family:Calibri,Arial,Helvetica,sans-serif">
                  <p>Hi,</p>
                  <p><br>
                  </p>
                  <p>The To-header in the reINVITE is changed by the
                    endpoint as far as I can see (if I understand your
                    question correctly), i.e. something like this:</p>
                  <p>1) INVITE from endpoint to Kamailio</p>
                  <p>2) Kamailio performs uac_replace_from()</p>
                  <p>3) INVITE from Kamailio to endpoint (From-header
                    modified)</p>
                  <p>4) dialogue goes on..</p>
                  <p>5) reINVITE from endpoint to Kamailio (To-header
                    modified using data from modified From-header in
                    step #3)</p>
                  <p>6) reINVITE from Kamailio to endpoint, ip-address
                    becomes scrambled</p>
                  <p><br>
                  </p>
                  <p>I can send you the whole SIP conversation if it
                    helps.</p>
                  <p><br>
                  </p>
                  <p>Kind regards,</p>
                  <p>/Tobias</p>
                  <br>
                  <br>
                  <div style="color:rgb(0,0,0)">
                    <hr tabindex="-1" style="display:inline-block;
                      width:98%">
                    <div id="divRplyFwdMsg" dir="ltr"><font
                        style="font-size:11pt" face="Calibri,
                        sans-serif" color="#000000"><b>From:</b>
                        Daniel-Constantin Mierla
                        <a moz-do-not-send="true"
                          class="moz-txt-link-rfc2396E"
                          href="mailto:miconda@gmail.com"><miconda@gmail.com></a><br>
                        <b>Sent:</b> Thursday, November 3, 2016 9:57 AM<br>
                        <b>To:</b> Tobias; Kamailio (SER) - Users
                        Mailing List<br>
                        <b>Subject:</b> Re: [SR-Users] Malformed To
                        header, or?</font>
                      <div> </div>
                    </div>
                    <div>
                      <p>Hello,</p>
                      <p><br>
                      </p>
                      <p>are the From/To headers changed by the
                        endpoint? Or the are the same as in the initial
                        INVITE/200ok?</p>
                      <p><br>
                      </p>
                      <p>Cheers,<br>
                        Daniel<br>
                      </p>
                      <br>
                      <div class="moz-cite-prefix">On 02/11/16 14:57,
                        Tobias wrote:<br>
                      </div>
                      <blockquote type="cite">
                        <div id="divtagdefaultwrapper"
                          style="font-size:12pt; color:#000000;
                          font-family:Calibri,Arial,Helvetica,sans-serif">
                          <p
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:16px">Hello!</p>
                          <p
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:16px"><br>
                          </p>
                          <p
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:16px">Correct, we're using
                            uac_replace_from() when passing along the
                            initial INVITE. That INVITE looks good so
                            it's not until this reINVITE that the header
                            is scrambled.</p>
                          <p
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:16px"><br>
                          </p>
                          <p
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:16px">Kind regards,</p>
                          <p
                            style="font-family:Calibri,Arial,Helvetica,sans-serif;
                            font-size:16px">/Tobias</p>
                          <br>
                          <div style="color:rgb(0,0,0)">
                            <hr tabindex="-1"
                              style="display:inline-block; width:98%">
                            <div id="divRplyFwdMsg" dir="ltr"><font
                                style="font-size:11pt" face="Calibri,
                                sans-serif" color="#000000"><b>From:</b>
                                Daniel-Constantin Mierla
                                <a moz-do-not-send="true"
                                  class="moz-txt-link-rfc2396E"
                                  href="mailto:miconda@gmail.com"><miconda@gmail.com></a><br>
                                <b>Sent:</b> Wednesday, November 2, 2016
                                10:12 AM<br>
                                <b>To:</b> Tobias; Kamailio (SER) -
                                Users Mailing List<br>
                                <b>Subject:</b> Re: [SR-Users] Malformed
                                To header, or?</font>
                              <div> </div>
                            </div>
                            <div>
                              <p>Hello,</p>
                              <p><br>
                              </p>
                              <p>kamailio is not adding user=phone to To
                                header by itself, it has to be something
                                in the kamailio.cfg. What do you use to
                                change the To? Or for changing From in
                                initial INVITE?<br>
                              </p>
                              <p><br>
                              </p>
                              <p>Cheers,<br>
                                Daniel<br>
                              </p>
                              <br>
                              <div class="moz-cite-prefix">On 01/11/16
                                20:35, Tobias wrote:<br>
                              </div>
                              <blockquote type="cite">
                                <div id="divtagdefaultwrapper"
                                  style="font-size:12pt; color:#000000;
font-family:Calibri,Arial,Helvetica,sans-serif">
                                  <p>Hi Daniel,</p>
                                  <p><br>
                                  </p>
                                  <p>Thanks for your quick response.
                                    Makes totally sense, I'll need to
                                    debug why I'm getting that malformed
                                    header.</p>
                                  <p><br>
                                  </p>
                                  <p>Do you think my second question is
                                    related? I cannot see the same
                                    malformed data in the example where
                                    the to-header is rewritten, it just
                                    looks like Kamailio adds
                                    ";user=phone" but the ip address is
                                    all obfuscated:</p>
                                  <div>A similar issue seen, which for
                                    some reason doesn't create an ERROR,
                                    is when Kamailio receives a reINVITE
                                    looking like this which it's
                                    supposed to proxy:</div>
                                  <div>To: +123456789 <a
                                      moz-do-not-send="true"
                                      class="moz-txt-link-rfc2396E"
                                      href="sip:123456789@127.0.0.1">
                                      <sip:123456789@127.0.0.1></a>;tag=SD1sf9001--45026-530b969-77c7543f-530b969.</div>
                                  <div>which is rewritten into:</div>
                                  <div>To: +123456789 <a
                                      moz-do-not-send="true"
                                      class="moz-txt-link-rfc2396E"
                                      href="sip:123456789@127*0-%29%27.:/%29&7%27...0;user=phone">
<sip:123456789@127*0-)'.:/)&7'...0;user=phone></a>;tag=SD1sf9001--45026-530b969-77c7543f-530b969.</div>
                                  <div>and sent out..</div>
                                  <div><br>
                                  </div>
                                  <div>Thanks,</div>
                                  <div>/Tobias</div>
                                  <br>
                                  <br>
                                  <br>
                                  <div style="color:rgb(0,0,0)">
                                    <hr tabindex="-1"
                                      style="display:inline-block;
                                      width:98%">
                                    <div id="divRplyFwdMsg" dir="ltr"><font
                                        style="font-size:11pt"
                                        face="Calibri, sans-serif"
                                        color="#000000"><b>From:</b>
                                        sr-users
                                        <a moz-do-not-send="true"
                                          class="moz-txt-link-rfc2396E"
href="mailto:sr-users-bounces@lists.sip-router.org">
<sr-users-bounces@lists.sip-router.org></a> on behalf of
                                        Daniel-Constantin Mierla
                                        <a moz-do-not-send="true"
                                          class="moz-txt-link-rfc2396E"
href="mailto:miconda@gmail.com"><miconda@gmail.com></a><br>
                                        <b>Sent:</b> Monday, October 31,
                                        2016 9:07 AM<br>
                                        <b>To:</b> Kamailio (SER) -
                                        Users Mailing List<br>
                                        <b>Subject:</b> Re: [SR-Users]
                                        Malformed To header, or?</font>
                                      <div> </div>
                                    </div>
                                    <div>
                                      <p>Hello,</p>
                                      <p><br>
                                      </p>
                                      <p>the to header doesn't have the
                                        ending '>' after its uri:</p>
                                      <p><br>
                                      </p>
                                      <p><<+123456789 <a
                                          moz-do-not-send="true"
                                          class="moz-txt-link-rfc2396E"
href="sip:123456789@127.0.0.1;tag=as4aa27bd0">
<sip:123456789@127.0.0.1;tag=as4aa27bd0></a>></p>
                                      <p><br>
                                      </p>
                                      <p>The first << and last
                                        >> are from the log
                                        messages, but before ;tag=, it
                                        has to be another >, to close
                                        the one started before <sip:</p>
                                      <p><br>
                                      </p>
                                      <p>Cheers,<br>
                                        Daniel<br>
                                      </p>
                                      <br>
                                      <div class="moz-cite-prefix">On
                                        28/10/16 21:14, Tobias wrote:<br>
                                      </div>
                                      <blockquote type="cite">
                                        <div id="divtagdefaultwrapper"
                                          style="font-size:12pt;
                                          color:#000000;
                                          font-family:Calibri,Arial,Helvetica,sans-serif">
                                          <div>Hi!</div>
                                          <div><br>
                                          </div>
                                          <div>Having some issues with
                                            Kamailio 4.3 reporting a
                                            malformed header, but I
                                            cannot seem to figure out
                                            what's wrong.</div>
                                          <div><br>
                                          </div>
                                          <div>The problem seen is:</div>
                                          <div>Oct 27 13:48:56
                                             /usr/sbin/kamailio[13765]:
                                            ERROR: <core>
                                            [parser/parse_addr_spec.c:678]:
                                            parse_addr_spec(): ERROR:
                                            parse_to : unexpected char
                                            [#015] in status 6:
                                            <<+123456789
                                            <a moz-do-not-send="true"
                                              class="moz-txt-link-rfc2396E"
href="sip:123456789@127.0.0.1;tag=as4aa27bd0"><sip:123456789@127.0.0.1;tag=as4aa27bd0></a>>
                                            .</div>
                                          <div>Oct 27 13:48:56
                                             /usr/sbin/kamailio[13765]:
                                            ERROR: <core>
                                            [parser/msg_parser.c:165]:
                                            get_hdr_field(): ERROR:
                                            get_hdr_field: bad to header</div>
                                          <div>Oct 27 13:48:56
                                             /usr/sbin/kamailio[13765]:
                                            INFO: <core>
                                            [parser/msg_parser.c:338]:
                                            parse_headers(): ERROR: bad
                                            header field [To: +123456789
                                            <si]</div>
                                          <div>Oct 27 13:48:56
                                             /usr/sbin/kamailio[13765]:
                                            ERROR: tm [t_lookup.c:1050]:
                                            t_check_msg(): ERROR: reply
                                            cannot be parsed</div>
                                          <div>Oct 27 13:48:56
                                             /usr/sbin/kamailio[13765]:
                                            ERROR: <core>
                                            [parser/parse_addr_spec.c:678]:
                                            parse_addr_spec(): ERROR:
                                            parse_to : unexpected char
                                            [#015] in status 6:
                                            <<+123456789
                                            <a moz-do-not-send="true"
                                              class="moz-txt-link-rfc2396E"
href="sip:123456789@127.0.0.1;tag=as4aa27bd0"><sip:123456789@127.0.0.1;tag=as4aa27bd0></a>>
                                            .</div>
                                          <div>Oct 27 13:48:56
                                             /usr/sbin/kamailio[13765]:
                                            ERROR: <core>
                                            [parser/msg_parser.c:165]:
                                            get_hdr_field(): ERROR:
                                            get_hdr_field: bad to header</div>
                                          <div>Oct 27 13:48:56
                                             /usr/sbin/kamailio[13765]:
                                            INFO: <core>
                                            [parser/msg_parser.c:338]:
                                            parse_headers(): ERROR: bad
                                            header field [To: +123456789
                                            <si]</div>
                                          <div>Oct 27 13:48:56
                                             /usr/sbin/kamailio[13765]:
                                            ERROR: <core>
                                            [msg_translator.c:1457]:
                                            adjust_clen(): error parsing
                                            content-length</div>
                                          <div>Oct 27 13:48:56
                                             /usr/sbin/kamailio[13765]:
                                            ERROR: <core>
                                            [msg_translator.c:2214]:
                                            generate_res_buf_from_sip_res():
                                            error while adjusting
                                            Content-Length</div>
                                          <div>Oct 27 13:48:56
                                             /usr/sbin/kamailio[13765]:
                                            ERROR: <core>
                                            [forward.c:760]:
                                            do_forward_reply(): building
                                            failed</div>
                                          <div><br>
                                          </div>
                                          <div>And the To header seen at
                                            this point is:</div>
                                          <div>To: +123456789 <a
                                              moz-do-not-send="true"
                                              class="moz-txt-link-rfc2396E"
href="sip:123456789@127.0.0.1">
<sip:123456789@127.0.0.1></a>;tag=as24ed5606.</div>
                                          <div><br>
                                          </div>
                                          <div>version: kamailio 4.3.4
                                            (x86_64/linux) </div>
                                          <div>flags: STATS: Off,
                                            USE_TCP, USE_TLS, USE_SCTP,
                                            TLS_HOOKS, USE_RAW_SOCKS,
                                            DISABLE_NAGLE, USE_MCAST,
                                            DNS_IP_HACK, SHM_MEM,
                                            SHM_MMAP, PKG_MALLOC,
                                            DBG_QM_MALLOC, USE_FUTEX,
                                            FAST_LOCK-ADAPTIVE_WAIT,
                                            USE_DNS_CACHE,
                                            USE_DNS_FAILOVER, USE_NAPTR,
                                            USE_DST_BLACKLIST,
                                            HAVE_RESOLV_RES</div>
                                          <div>ADAPTIVE_WAIT_LOOPS=1024,
                                            MAX_RECV_BUFFER_SIZE 262144,
                                            MAX_LISTEN 16, MAX_URI_SIZE
                                            1024, BUF_SIZE 65535,
                                            DEFAULT PKG_SIZE 8MB</div>
                                          <div>poll method support:
                                            poll, epoll_lt, epoll_et,
                                            sigio_rt, select.</div>
                                          <div>id: unknown </div>
                                          <div>compiled with gcc 4.7.2</div>
                                          <div><br>
                                          </div>
                                          <div>I obviously understand
                                            Kamailio views this To
                                            header as malformed, but
                                            what I cannot understand is
                                            why? Is it as simple as the
                                            number +123456789 is not
                                            enclosed with ", i.e. it
                                            should be sent
                                            as "+123456789"?</div>
                                          <div><br>
                                          </div>
                                          <div>A similar issue seen,
                                            which for some reason
                                            doesn't create an ERROR, is
                                            when Kamailio receives a
                                            reINVITE looking like this
                                            which it's supposed to
                                            proxy:</div>
                                          <div><span>To: +<span style="">123456789</span>
                                              <sip:<span style="">123456789</span>@127.0.0.1>;tag=SD1sf9001--45026-530b969-77c7543f-530b969.</span><br>
                                          </div>
                                          <div>which is rewritten into:</div>
                                          <div><span>To: +<span style="">123456789</span>
                                              <sip:<span style="">123456789</span>@127*0-)'.:/)&7'...0;user=phone>;tag=SD1sf9001--45026-530b969-77c7543f-530b969.</span><br>
                                          </div>
                                          <div>and sent out..</div>
                                          <div><br>
                                          </div>
                                          <div><br>
                                          </div>
                                          <div>Thanks for your help,</div>
                                          <div>/Tobias</div>
                                          <br>
                                        </div>
                                        <br>
                                        <fieldset
                                          class="mimeAttachmentHeader"></fieldset>
                                        <br>
                                        <pre>_______________________________________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users">http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
                                      </blockquote>
                                      <br>
                                      <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://twitter.com/#%21/miconda">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
                                    </div>
                                  </div>
                                </div>
                              </blockquote>
                              <br>
                              <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://twitter.com/#%21/miconda">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
                            </div>
                          </div>
                        </div>
                      </blockquote>
                      <br>
                      <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://twitter.com/#%21/miconda">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
                    </div>
                  </div>
                </div>
              </blockquote>
              <br>
              <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://twitter.com/#%21/miconda">http://twitter.com/#!/miconda</a> - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
            </div>
          </div>
        </div>
      </div>
    </blockquote>
    <br>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="moz-txt-link-freetext" href="http://twitter.com/#!/miconda">http://twitter.com/#!/miconda</a> - <a class="moz-txt-link-freetext" href="http://www.linkedin.com/in/miconda">http://www.linkedin.com/in/miconda</a>
Kamailio Advanced Training, Berlin, Nov 28-30, 2016 - <a class="moz-txt-link-freetext" href="http://www.asipto.com">http://www.asipto.com</a></pre>
  </body>
</html>