<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <p>Hello,</p>
    <p>that can happen when you do many operations over the contact
      header (e.g., functions like fix_natted_contact()), see more
      details for a similar case at:</p>
    <p>  *
<a class="moz-txt-link-freetext" href="https://www.kamailio.org/wiki/tutorials/faq/main#why_parts_of_fromto_header_app">https://www.kamailio.org/wiki/tutorials/faq/main#why_parts_of_fromto_header_app</a></p>
    <p>If you need many operations, then you have to use
      msg_apply_changes() in between.</p>
    <p>Cheers,<br>
      Daniel<br>
    </p>
    <div class="moz-cite-prefix">On 06.01.21 17:05, Devang Dhandhalya
      wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CAP0uOe8oz=pja4ggUJmqyOSf--1xcpsQ3AnZsME1v7C+SrHTuA@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">in my requirement call coming from sbc to kamailio
        proxy and we route to pbx server in that when 
        <div>kamailio proxy get the call at that time i am removing
          Contact header using remove_hf("Contact") and adding contact
          Header using append_hf("$uac_req(hdrs)") for route to PBX
          server . in that signaling i am getting modified Contact
          header but old contact header not removed properly some junks
          are remain in the signaling </div>
        <div><br>
        </div>
        <div>scenario : </div>
        <div><br>
        </div>
        <div>SBC ---------> Kamailio proxy ------> PBX</div>
        <div><br>
        </div>
        <div>before using remove_hf("Contact") </div>
        <div><br>
        </div>
        <div>INVITE <a href="mailto:sip%3A5678@opensips.org"
            target="_blank" moz-do-not-send="true">sip:user2@</a><a
            href="http://domain.org" moz-do-not-send="true">domain.org</a>;transport=UDP
          SIP/2.0<br>
          Via: SIP/2.0/UDP
          10.212.xxx.xxx:port;branch=z9hG4bK-524287-1---8c5ac8642f321a9e<br>
          Max-Forwards: 70<br>
          Contact: <a class="moz-txt-link-rfc2396E" href="sip:user1@10.212.xxx.xxx:39931;transport=UDP"><sip:user1@10.212.xxx.xxx:39931;transport=UDP></a><br>
          To: <<a href="mailto:sip%3A5678@opensips.org"
            target="_blank" moz-do-not-send="true">sip:user2@</a><a
            href="http://domain.org" moz-do-not-send="true">domain.org</a>;transport=UDP><br>
          From: <<a href="mailto:sip%3A1234@opensips.org"
            target="_blank" moz-do-not-send="true">sip:user1@</a><a
            href="http://domain.org" moz-do-not-send="true">domain.org</a>;transport=UDP>;tag=891fd646<br>
          Call-ID: t9Ff-fCrin_VN1IO9Xf1mA..<br>
          CSeq: 2 INVITE<br>
          Content-Type: application/sdp<br>
          Proxy-Authorization: Digest username="user1",realm="domain<a
            href="http://opensips.org" target="_blank"
            moz-do-not-send="true">.org</a>",nonce="5ff5a660afc72502212b4a611bb0d689efadafab",uri="<a
            href="mailto:sip%3A5678@opensips.org" target="_blank"
            moz-do-not-send="true">sip:user2@domain.org</a>;transport=UDP",response="f926e3742cbdcb8c68ea9b5<br>
82ac2dc",cnonce="9b3276d6d37aaa6107a835df8e5b3a87",nc=00000001,qop=auth,algorithm=MD5<br>
          User-Agent: Z 3.15.40006 rv2.8.20<br>
          Allow-Events: presence, kpml, talk<br>
          Content-Length: 243<br>
          <br>
          v=0<br>
          o=Z 0 0 IN IP4 10.212.xxx.xxx<br>
          s=Z<br>
          c=IN IP4 10.212.xxx.xxx<br>
          t=0 0<br>
          m=audio 8000 RTP/AVP 3 110 8 0 97 101<br>
          a=rtpmap:110 speex/8000<br>
          a=rtpmap:97 iLBC/8000<br>
          a=fmtp:97 mode=30<br>
          a=rtpmap:101 telephone-event/8000<br>
          a=fmtp:101 0-16<br>
          a=sendrecv<br>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>after using remove-hf("Contact") function removing contact
          header but some junks are left and that eats next To header
          line and breaks Invite packet </div>
        <div><br>
        </div>
        <div><span
id="m_6086192861765755615gmail-docs-internal-guid-08b58fff-7fff-3787-298f-839fdb972470">
            <p dir="ltr"
              style="line-height:1.38;margin-top:0pt;margin-bottom:0pt">INVITE
              <a class="moz-txt-link-freetext" href="sip:user2@domain.org:;transport=UDP">sip:user2@domain.org:;transport=UDP</a> SIP/2.0<br>
              Record-Route:
<a class="moz-txt-link-rfc2396E" href="sip:172.xx.xx.xxx;lr=on;ftag=891fd646;vst=AAAAAFFTQVkuCENVXUEpHwNLAQEOSwdcDhwUcG9ydD1VRFA-;vsf=AAAAAFVCQ1U0ChwlAQMMHgBHHwFJVAYVYW5zcG9ydD1VRFA-"><sip:172.xx.xx.xxx;lr=on;ftag=891fd646;vst=AAAAAFFTQVkuCENVXUEpHwNLAQEOSwdcDhwUcG9ydD1VRFA-;vsf=AAAAAFVCQ1U0ChwlAQMMHgBHHwFJVAYVYW5zcG9ydD1VRFA-></a><br>
              Via: SIP/2.0/UDP
              172.xx.xx.xxx;branch=z9hG4bKbe4c.9743b885ad3452287530994a2cad6e50.0<br>
              Via: SIP/2.0/UDP
10.212.xxx.xxx:39931;rport=39931;received=172.xx.xx.x;branch=z9hG4bK-524287-1---8c5ac8642f321a9e<br>
              Max-Forwards: 69<br>
              <a class="moz-txt-link-freetext" href="sip:user1@172.xx.xx.x:39931;transport=UDPTo">sip:user1@172.xx.xx.x:39931;transport=UDPTo</a>: <<a
                href="mailto:sip%3Adevang3032@opensips.org"
                target="_blank" moz-do-not-send="true">sip:user2@domain.org</a>><br>
              From: <<a href="mailto:sip%3Adppatel@opensips.org"
                target="_blank" moz-do-not-send="true">sip:user1@domain.org</a>>;tag=891fd646<br>
              Call-ID: t9Ff-fCrin_VN1IO9Xf1mA..<br>
              CSeq: 2 INVITE<br>
              Content-Type: application/sdp<br>
              User-Agent: Z 3.15.40006 rv2.8.20<br>
              Allow-Events: presence, kpml, talk<br>
              Content-Length: 534<br>
              Contact: <<a
                href="http://sip:dppatel@172.16.16.163:5060"
                target="_blank" moz-do-not-send="true">sip:user2@172.xx.xx.xxx:5060</a>><br>
              <br>
              v=0<br>
              o=Z 0 0 IN IP4 10.212.xxx.xxx<br>
              s=Z<br>
              c=IN IP4 172.xx.xx.xxx<br>
              t=0 0<br>
              m=audio 11210 RTP/AVP 3 110 8 0 97 101<br>
              a=rtpmap:3 GSM/8000<br>
              a=rtpmap:110 speex/8000<br>
              a=rtpmap:8 PCMA/8000<br>
              a=rtpmap:0 PCMU/8000<br>
              a=rtpmap:97 iLBC/8000<br>
              a=rtpmap:101 telephone-event/8000<br>
              a=fmtp:97 mode=30<br>
              a=fmtp:101 0-16<br>
              a=sendrecv<br>
              a=rtcp:11211<br>
              a=ice-ufrag:lzjregPe<br>
              a=ice-pwd:RtA9x3jUWk4yNpJlzPL60nsRck<br>
              a=candidate:LhtmUSbPt9BJs4ZC 1 UDP 2130706431
              172.16.16.163 11210 typ host<br>
              a=candidate:LhtmUSbPt9BJs4ZC 2 UDP 2130706430
              172.16.16.163 11211 typ host<br>
            </p>
            <p dir="ltr"
              style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><br>
            </p>
            <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt">As
              you can see Contact header is gone but
              <a class="moz-txt-link-freetext" href="sip:1234@172.xx.xx.x:39931;transport=UDP">sip:1234@172.xx.xx.x:39931;transport=UDP</a> part left before
              To header . and its breake invite packet .</p>
            <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><br>
            </p>
            <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><span style="color:rgb(0,0,0);white-space:pre-wrap">Any suggestion will be highly appreciated.</span></p>
            <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><br>
            </p>
            <p style="line-height:1.38;margin-top:0pt;margin-bottom:0pt"><br>
            </p>
          </span></div>
      </div>
      <br>
      <div><font style="background-color:white" size="2" face="Arial"
          color="#808080"><b>Disclaimer</b></font></div>
      <div>
        <div><span
style="background-color:white;color:rgb(128,128,128);font-family:Arial;font-size:small">In
            addition to generic Disclaimer which you have agreed on our
            website, any views or opinions presented in this email are
            solely those of the originator and do not necessarily
            represent those of the Company or its sister concerns. Any
            liability (in negligence, contract or otherwise) arising
            from any third party taking any action, or refraining from
            taking any action on the basis of any of the information
            contained in this email is hereby excluded.</span></div>
      </div>
      <div><span
style="background-color:white;color:rgb(128,128,128);font-family:Arial;font-size:small"><br>
        </span></div>
      <div><font style="background-color:white" size="2" face="Arial"
          color="#808080"><b>Confidentiality</b></font></div>
      <div><font style="background-color:white" size="2" face="Arial"
          color="#808080">This communication (including any
          attachment/s) is intended only for the use of the addressee(s)
          and contains information that is PRIVILEGED AND CONFIDENTIAL.
          Unauthorized reading, dissemination, distribution, or copying
          of this communication is prohibited. Please inform originator
          if you have received it in error.</font></div>
      <div><font style="background-color:white" size="2" face="Arial"
          color="#808080"><br>
        </font></div>
      <div><span
style="background-color:white;color:rgb(128,128,128);font-family:Arial;font-size:small"><b>Caution
            for viruses, malware etc.</b></span></div>
      <div><font style="background-color:white" size="2" face="Arial"
          color="#808080">This communication, including any attachments,
          may not be free of viruses, trojans, similar or new
          contaminants/malware, interceptions or interference, and may
          not be compatible with your systems. You shall carry out
          virus/malware scanning on your own before opening any
          attachment to this e-mail. The sender of this e-mail and
          Company including its sister concerns shall not be liable for
          any damage that may incur to you as a result of viruses,
          incompleteness of this message, a delay in receipt of this
          message or any other computer problems. </font></div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
    </blockquote>
    <pre class="moz-signature" cols="72">-- 
Daniel-Constantin Mierla -- <a class="moz-txt-link-abbreviated" href="http://www.asipto.com">www.asipto.com</a>
<a class="moz-txt-link-abbreviated" href="http://www.twitter.com/miconda">www.twitter.com/miconda</a> -- <a class="moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda">www.linkedin.com/in/miconda</a>
Funding: <a class="moz-txt-link-freetext" href="https://www.paypal.me/dcmierla">https://www.paypal.me/dcmierla</a></pre>
  </body>
</html>