<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>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
cite="mid:DB5PR0201MB1575FB04B07C966AD743A042F7A10@DB5PR0201MB1575.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 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 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 class="moz-txt-link-rfc2396E" href="sip:123456789@127*0-)'.:/)&7'...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 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 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 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>