<div dir="auto"><div>Hi All. <div dir="auto"><br></div><div dir="auto">I have similar task. But i have to remove server and user-agent headers from all request an replyes. </div><div dir="auto"><br></div><div dir="auto">You can try:</div><div dir="auto"><br></div><div dir="auto"><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">I have added route:</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px"># Fix user-agent and server</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">route[RemoveHeader] {</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">        remove_hf("server");</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">        remove_hf("user-agent");</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">        return;</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">}</span><br style="font-family:sans-serif;font-size:10.112px"><br style="font-family:sans-serif;font-size:10.112px"><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">I use it form</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">request_route {</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">route(RemoveHeader);</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">.....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">}</span><br style="font-family:sans-serif;font-size:10.112px"><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">failure_route[--- all what i have ---] {</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">route(RemoveHeader);</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">.....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">}</span><br style="font-family:sans-serif;font-size:10.112px"><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">branch_route[MANAGE_BRANCH]{</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">route(RemoveHeader);</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">.....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">}</span><br style="font-family:sans-serif;font-size:10.112px"><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">onreply_route[MANAGE_REPLY] {</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">route(RemoveHeader);</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">.....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">}</span><br style="font-family:sans-serif;font-size:10.112px"><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">failure_route[MANAGE_FAILURE] {</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">route(RemoveHeader);</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">.....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">}</span><br style="font-family:sans-serif;font-size:10.112px"><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">Seems all is fine It removes headers in all packets except 200 OK on BYE....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">After debugging script I does not seen in which route this 200 Ok goes..</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">But if I adding next to</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">route[RELAY] {</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">....</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">        if (is_method("BYE")) {</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">                xlog("L_INFO","route RELAY method BYE \n");</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">                if(!t_is_set("onreply_route"))</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">t_on_reply("MANAGE_REPLY_ON_</span><wbr style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">BYE");</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">        }</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">.......</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">}</span><br style="font-family:sans-serif;font-size:10.112px"><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">and adding route</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">onreply_route[MANAGE_REPLY_ON_</span><wbr style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">BYE] {</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">        route(RemoveHeader);</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">        xlog("L_INFO","route MANAGE_REPLY_ON_BYE entered \n");</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">}</span><br style="font-family:sans-serif;font-size:10.112px"><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">this 200 Ok successfully goes to MANAGE_REPLY_ON_BYE route and headers</span><br style="font-family:sans-serif;font-size:10.112px"><span style="font-family:sans-serif;font-size:10.112px">are removed.</span><br></div><div dir="auto"><br></div><br><div class="gmail_extra"><br><div class="gmail_quote">13 янв. 2017 г. 4:59 PM пользователь "Diego Nadares" <<a href="mailto:dnadares@gmail.com">dnadares@gmail.com</a>> написал:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>If you need any additional data please let me know.</div><div><br></div><div>Cheers,</div><div><br></div><div>Diego</div></div><div class="elided-text"><div class="gmail_extra"><br><div class="gmail_quote">2017-01-12 15:04 GMT-03:00 Diego Nadares <span dir="ltr"><<a href="mailto:dnadares@gmail.com" target="_blank">dnadares@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi Daniel!<div><br></div><div>Thanks for your answer.  The idea is to show only a few headers. In BYE works great. I'm removing and adding the following hdrs:</div><div><div><b><br></b></div><div><b>User-Agent: Kamailio. <---I will try what you said</b></div><div><b>Supported:.</b></div><div><b>Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, NOTIFY, INFO.</b></div><div><b>Accept: application/sdp, application/gtd.</b></div></div><div><br></div><div>For example in following messages ( Kamailio is 172.16.213.38)</div><div><br></div><div><div>#</div><div>U 2017/01/12 14:51:10.593782 <a href="http://172.16.200.159:57270" target="_blank">172.16.200.159:57270</a> -> <a href="http://172.16.213.38:5060" target="_blank">172.16.213.38:5060</a></div></div><div><div>BYE sip:127.0.0.8:5060;line=sr-987<wbr>9879879798** SIP/2.0.</div><div>Via: SIP/2.0/UDP  172.16.200.159:5060;branch=z9<wbr>hG4bK12B9605ED.</div><div>From: xx <<a href="mailto:sip%3Axx@172.16.213.38" target="_blank">sip:xx@172.16.213.38</a>>;tag=95E<wbr>7E4A4-23F2.</div><div>To: xxx <<a href="mailto:sip%3Axxx@172.16.213.38" target="_blank">sip:xxx@172.16.213.38</a>>;tag=SD<wbr>mmb7201-as0518eb07.</div><div>Date: Thu, 12 Jan 2017 17:51:05 GMT.</div><div>Call-ID: SDmmb7201-f5ded6cf4cd5d84736b0<wbr>88e39277e8db-c540dl1.</div><div>User-Agent: Cisco-SIPGateway/IOS-12.x.</div><div>Max-Forwards: 15.</div><div>Route: <sip:172.16.213.38;lr;ftag=SDm<wbr>mb7201-as0518eb07;did=bf.cab>.</div><div>Timestamp: 1484243470.</div><div>CSeq: 101 BYE.</div><div>Reason: Q.850;cause=16.</div><div>Content-Disposition: signal;handling=optional.</div><div>Content-Type: application/gtd.</div><div>Content-Length: 26.</div><div>.</div><div>.....</div><div>.</div><div><br></div><div>#</div><div>U 2017/01/12 14:51:10.647164 <a href="http://172.16.213.38:5060" target="_blank">172.16.213.38:5060</a> -> <a href="http://172.16.50.41:5060" target="_blank">172.16.50.41:5060</a></div><div>BYE <a href="http://sip:xxx@172.16.50.41:5060" target="_blank">sip:xxx@172.16.50.41:5060</a>;tran<wbr>sport=udp SIP/2.0.</div><div>Via: SIP/2.0/UDP 172.16.213.38;branch=z9hG4bKdc<wbr>f6.f898feef02d601e36a22d26bf3a<wbr>e5e4a.0.</div><div>Via: SIP/2.0/UDP 127.0.0.8;branch=z9hG4bKsr-asd<wbr>fasdfF.</div><div>From: xx <<a href="mailto:sip%3Axx@172.16.213.38" target="_blank">sip:xx@172.16.213.38</a>>;tag=95E<wbr>7E4A4-23F2.</div><div>To: xxx <<a href="mailto:sip%3Axxx@172.16.50.41" target="_blank">sip:xxx@172.16.50.41</a>>;tag=SDm<wbr>mb7201-as0518eb07.</div><div>Call-ID: SDmmb7201-f5ded6cf4cd5d84736b0<wbr>88e39277e8db-c540dl1.</div><div>Max-Forwards: 14.</div><div>CSeq: 101 BYE.</div><div>Content-Type: application/gtd.</div></div><div><div>Content-Length: 26.</div><div><b>User-Agent: Kamailio.</b></div><div><b>Supported:.</b></div><div><b>Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, NOTIFY, INFO.</b></div><div><b>Accept: application/sdp, application/gtd.</b></div><div>.</div><div>......</div></div><div><br></div><div>But in ok I can't</div><div><br></div><div><div>#</div><div>U 2017/01/12 14:51:10.653701 <a href="http://172.16.50.41:5060" target="_blank">172.16.50.41:5060</a> -> <a href="http://172.16.213.38:5060" target="_blank">172.16.213.38:5060</a></div><div>SIP/2.0 200 OK.</div><div>Via: SIP/2.0/UDP 172.16.213.38;branch=z9hG4bKdc<wbr>f6.f898feef02d601e36a22d26bf3a<wbr>e5e4a.0.</div><div>Via: SIP/2.0/UDP 127.0.0.8;branch=z9hG4bKsr-sad<wbr>fasdf.</div><div>From: xx <<a href="mailto:sip%3Axx@172.16.213.38" target="_blank">sip:xx@172.16.213.38</a>>;tag=95E<wbr>7E4A4-23F2.</div><div>To: xxx <<a href="mailto:sip%3Axxx@172.16.50.41" target="_blank">sip:xxx@172.16.50.41</a>>;tag=SDm<wbr>mb7201-as0518eb07.</div><div>Call-ID: SDmmb7201-f5ded6cf4cd5d84736b0<wbr>88e39277e8db-c540dl1.</div><div>CSeq: 101 BYE.</div><div>Server: Asterisk PBX 11.17.0.</div><div>Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE.</div><div>Supported: replaces, timer.</div><div>Content-Length: 0.</div><div>.</div><div>FY, INFO.</div><div>Accept</div><div>#</div><div>U 2017/01/12 14:51:10.669460 <a href="http://172.16.213.38:5060" target="_blank">172.16.213.38:5060</a> -> <a href="http://172.16.200.159:5060" target="_blank">172.16.200.159:5060</a></div><div>SIP/2.0 200 OK.</div><div>Via: SIP/2.0/UDP  172.16.200.159:5060;branch=z9<wbr>hG4bK12B9605ED.</div><div>From: xx <<a href="mailto:sip%3Axx@172.16.213.38" target="_blank">sip:xx@172.16.213.38</a>>;tag=95E<wbr>7E4A4-23F2.</div><div>To: xxx <<a href="mailto:sip%3Axxx@172.16.213.38" target="_blank">sip:xxx@172.16.213.38</a>>;tag=SD<wbr>mmb7201-as0518eb07.</div><div>Call-ID: SDmmb7201-f5ded6cf4cd5d84736b0<wbr>88e39277e8db-c540dl1.</div><div>CSeq: 101 BYE.</div><div><b>Server: Asterisk PBX 11.17.0.</b></div><div><b>Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE.</b></div><div><b>Supported: replaces, timer.</b></div><div>Content-Length: 0.</div><div>.</div></div><div><br></div><div><br></div></div><div class="m_-532204234115859028HOEnZb"><div class="m_-532204234115859028h5"><div class="gmail_extra"><br><div class="gmail_quote">2017-01-12 13:23 GMT-03:00 Daniel-Constantin Mierla <span dir="ltr"><<a href="mailto:miconda@gmail.com" target="_blank">miconda@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <p>Hello,</p>
    <p>if you are looking to remove the server header (server
      signature), that can be controlled via global parameters:</p>
    <p>  -
      <a class="m_-532204234115859028m_-409734095957794762m_-1776178681903754250moz-txt-link-freetext" href="https://www.kamailio.org/wiki/cookbooks/4.4.x/core#server_header" target="_blank">https://www.kamailio.org/wiki/<wbr>cookbooks/4.4.x/core#server_he<wbr>ader</a></p>
    <p>Note that there is another header, User-Agent, that may be added
      by Kamailio in local generate request. There is a global parameter
      to control it as well.<br>
    </p>
    If you want more than that, can you add a bit more details, because
    CANCEL and BYE are processed differently. With which one you get
    issues?<br>
    <br>
    Cheers,<br>
    Daniel<div><div class="m_-532204234115859028m_-409734095957794762h5"><br>
    <br>
    <div class="m_-532204234115859028m_-409734095957794762m_-1776178681903754250moz-cite-prefix">On 12/01/2017 17:00, Diego Nadares
      wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="m_-532204234115859028m_-409734095957794762h5">
      <div dir="ltr">Hi List,
        <div><br>
        </div>
        <div>I'm trying to add and remove some headers in 200 canceling
          and 200 ok to BYEs with no success.</div>
        <div><br>
        </div>
        <div>I don't know in which route to add my remove_hf and
          append_hf. It seems that I can't catch it on reply either on
          request route.</div>
        <div><br>
        </div>
        <div>I tried adding it in </div>
        <div><br>
        </div>
        <div>
          <div>event_route[tm:local-response] {</div>
          <div>        xlog("L_ERR", "TM LOCAL REPONSE!");</div>
          <div>        route(MANAGE_HEADERS);</div>
          <div>}</div>
        </div>
        <div><br>
        </div>
        <div>This is my route to manage hdrs:</div>
        <div><br>
        </div>
        <div>
          <div>route[MANAGE_HEADERS]{</div>
          <div><br>
          </div>
          <div>        xlog("L_ERR", "MANAGE HDRS !");</div>
          <div><br>
          </div>
          <div>        keep_hf("TH"); # for topoh</div>
        </div>
        <div><br>
        </div>
        <div>        append("AHDR1:asdf\r\n");</div>
        <div><br>
        </div>
        <div>        return;</div>
        <div>}</div>
        <div><br>
        </div>
        <div>I suppose SERVER HDR should be removed but:</div>
        <div><br>
        </div>
        <div>
          <div>U 2017/01/12 12:45:41.566733 <a href="http://172.16.213.38:5060" target="_blank">172.16.213.38:5060</a>
            -> <a href="http://172.16.50.41:5060" target="_blank">172.16.50.41:5060</a></div>
          <div>SIP/2.0 200 canceling.</div>
          <div>Via: SIP/2.0/UDP 172.16.50.41:5060;branch=z9hG4<wbr>bKgg8ekd3080braugkm700.1.</div>
          <div>CSeq: 102 CANCEL.</div>
          <div>From: <<a href="mailto:sip%3Axx@172.16.50.41" target="_blank">sip:xx@172.16.50.41</a>>;tag=SD7b<wbr>10b01-as5ba5e269.</div>
          <div>To: <<a href="mailto:sip%3Axxx@172.16.213.38" target="_blank">sip:xxx@172.16.213.38</a>>;tag=4a<wbr>86e96addfb27a943bc86e1872032b6<wbr>-0a8b.</div>
          <div>Call-ID: SD7b10b01-6a7d1089793bda79481f<wbr>25cf88c023ed-c540dl1.</div>
          <div>Server: kamailio (4.4.4 (x86_64/linux)).</div>
          <div>Content-Length: 0.</div>
        </div>
        <div><br>
        </div>
        <div><br>
        </div>
        <div>Any help will be very appreciated.<br>
        </div>
        <div><br>
        </div>
        <div>Thanks in advance!</div>
        <div><br>
        </div>
        <div>Diego</div>
      </div>
      <br>
      <fieldset class="m_-532204234115859028m_-409734095957794762m_-1776178681903754250mimeAttachmentHeader"></fieldset>
      <br>
      </div></div><pre>______________________________<wbr>_________________
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
<a class="m_-532204234115859028m_-409734095957794762m_-1776178681903754250moz-txt-link-abbreviated" href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a>
<a class="m_-532204234115859028m_-409734095957794762m_-1776178681903754250moz-txt-link-freetext" href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/cg<wbr>i-bin/mailman/listinfo/sr-user<wbr>s</a><span class="m_-532204234115859028m_-409734095957794762HOEnZb"><font color="#888888">
</font></span></pre><span class="m_-532204234115859028m_-409734095957794762HOEnZb"><font color="#888888">
    </font></span></blockquote><span class="m_-532204234115859028m_-409734095957794762HOEnZb"><font color="#888888">
    <br>
    <pre class="m_-532204234115859028m_-409734095957794762m_-1776178681903754250moz-signature" cols="72">-- 
Daniel-Constantin Mierla
<a class="m_-532204234115859028m_-409734095957794762m_-1776178681903754250moz-txt-link-abbreviated" href="http://www.twitter.com/miconda" target="_blank">www.twitter.com/miconda</a> -- <a class="m_-532204234115859028m_-409734095957794762m_-1776178681903754250moz-txt-link-abbreviated" href="http://www.linkedin.com/in/miconda" target="_blank">www.linkedin.com/in/miconda</a>
Kamailio World Conference - May 8-10, 2017 - <a class="m_-532204234115859028m_-409734095957794762m_-1776178681903754250moz-txt-link-abbreviated" href="http://www.kamailioworld.com" target="_blank">www.kamailioworld.com</a></pre>
  </font></span></div>

<br>______________________________<wbr>_________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/cg<wbr>i-bin/mailman/listinfo/sr-user<wbr>s</a><br>
<br></blockquote></div><br></div>
</div></div></blockquote></div><br></div>
</div><br>______________________________<wbr>_________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" rel="noreferrer" target="_blank">http://lists.sip-router.org/<wbr>cgi-bin/mailman/listinfo/sr-<wbr>users</a><br>
<br></blockquote></div><br></div></div></div>