<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body>
    Hey Louis,<br>
    <br>
    I thought I might jump in here about your point (2).  If you are
    referring to preloaded Route header(s) in the initial request, then
    you just need to take care when calling the loose_route [1] method. 
    If you don't trust, or want to disregard, any preloaded Routes then
    don't call loose_route and remove the header via remove_hf to
    prevent downstream proxies from potentially mis-routing the
    request.  There are cases when you may want to allow loose routing
    of preloaded sets, such as in the case of a mid-registrar with Path
    support [2]. <br>
    <br>
    [1]
    <a class="moz-txt-link-freetext" href="https://opensips.org/html/docs/modules/devel/rr.html#func_loose_route">https://opensips.org/html/docs/modules/devel/rr.html#func_loose_route</a><br>
    [2] <a class="moz-txt-link-freetext" href="https://opensips.org/html/docs/modules/devel/path.html">https://opensips.org/html/docs/modules/devel/path.html</a><br>
    <br>
    <u>Example:</u><br>
    route {<br>
        ...<br>
        #sequential routing<br>
        ...<br>
        #process preloaded routes<br>
        if (is_present_hf("Route")) {<br>
                if (...) { # honor routes<br>
                        loose_route();<br>
                        t_relay();<br>
                        exit;<br>
                } else {   # don't process and strip routes<br>
                        remove_hf("Route");<br>
                }<br>
        }<br>
        ...<br>
    }<br>
    <br>
    <br>
    Thanks,<br>
    John Burke<br>
    <span data-mce-style="color: #808080; font-family:
      arial,helvetica,sans-serif; font-size: 11pt;" style="color:
      rgb(128, 128, 128); font-family: arial, helvetica, sans-serif;
      font-size: 11pt;"><strong></strong></span>
    <div class="moz-signature">
      <div><span data-mce-style="color: #808080; font-family:
          arial,helvetica,sans-serif; font-size: 11pt;" style="color:
          rgb(128, 128, 128); font-family: arial, helvetica, sans-serif;
          font-size: 11pt;"><strong><br>
          </strong></span></div>
    </div>
    <div class="moz-cite-prefix">On 8/27/21 9:01 AM, Louis Rochon wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:BLAPR09MB63401E25E245B245D65DBE5DE6C89@BLAPR09MB6340.namprd09.prod.outlook.com">
      <pre class="moz-quote-pre" wrap="">Răzvan,

Thank you for the quick response. 2 Notes:

1. I saw another post about the visibility of header changes post manipulation. I now understand the subtleties of that mechanism. Thanks!

2. I am trying to remove the "Route" header, and not the "Record-Route" header. From my understanding, the Route header as the ability or override the R-URI. OpenSIPS does exactly that (as per spec.), which is why I want to remove it.

However, even " remove_hf("Route");" OpenSIPS still attempts to route based on the contents of the "Route" header.

Louis

-----Original Message-----
From: Users <a class="moz-txt-link-rfc2396E" href="mailto:users-bounces@lists.opensips.org"><users-bounces@lists.opensips.org></a> On Behalf Of Razvan Crainea
Sent: August 25, 2021 6:04 AM
To: <a class="moz-txt-link-abbreviated" href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>
Subject: Re: [OpenSIPS-Users] Route Header removal


WARNING: External Email: Exercise Caution

Hi, Louis!

Almost all changes (perhaps the only exception is the R-URI and parts of the Contact header) performed on the SIP message will only be visible in the outgoing message, but *NOT* reflected in the script. This means that whatever change you perform to the message will not be visible by the functions used - this is the intended behavior.
If you don't want to route according the the Record-Route algorithm, you'll have to catch the request in the local_route and force sending it to whatever other destination you want.

Best regards,

Răzvan Crainea
OpenSIPS Core Developer
<a class="moz-txt-link-freetext" href="https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.opensips-solutions.com%2F&amp;data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cac163de2930d4203b8b508d967afbbdb%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637654826786421255%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=9Fz%2FcUnMykh6fP8LgaDgVSF%2FKEbdKIaXA%2FEkACXvTKQ%3D&amp;reserved=0">https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.opensips-solutions.com%2F&amp;data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cac163de2930d4203b8b508d967afbbdb%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637654826786421255%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=9Fz%2FcUnMykh6fP8LgaDgVSF%2FKEbdKIaXA%2FEkACXvTKQ%3D&amp;reserved=0</a>

On 8/24/21 10:34 PM, Louis Rochon wrote:
</pre>
      <blockquote type="cite">
        <pre class="moz-quote-pre" wrap="">We are trying to remove the Route header from an incoming Invite.

Even with remove_hf, Opensips still routes towards the content of the
Route header.

Opensips.cfg:

------------------

route {

if ( is_method("INVITE") ) {

.

.

.

xlog("removing Route Header: $(hdr(Route)[0])\n");

remove_hf("Route");

xlog( "Route Header still present?: $(hdr(Route)[0])\n");

};

.

.

.

And then we send the call to a b2b_init_request line.

Both xlogs show the route header still there. And indeed, the opensips
attempts to route according to the contents of the route header.

Suggestions?

**

**

*Louis*

NOTICE TO RECIPIENT: This email, including attachments, may contain
information which is confidential, proprietary, attorney-client
privileged and / or controlled under U.S. export laws and regulations
and may be restricted from disclosure by applicable State and Federal
law. Nothing in this email shall create any legal binding agreement
between the parties unless expressly stated herein and provided by an
authorized representative of Comtech Telecommunications Corp. or its
subsidiaries. If you are not the intended recipient of this message,
be advised that any dissemination, distribution, or use of the
contents of this message is strictly prohibited. If you received this
message in error, please notify us immediately by return email and
permanently delete all copies of the original email and any attached
documentation from any computer or other media.

_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists">https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists</a>
.opensips.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fusers&amp;data=04%7C01%
7CLouis.Rochon%40comtechtel.com%7Cac163de2930d4203b8b508d967afbbdb%7Ca
9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637654826786421255%7CUnknown
%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
XVCI6Mn0%3D%7C1000&amp;sdata=SQ6Z9NSskYelktXtqBTHCBy73ryDA0FdRdSdhmJXI
yc%3D&amp;reserved=0

</pre>
      </blockquote>
      <pre class="moz-quote-pre" wrap="">
_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.opensips.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fusers&amp;data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cac163de2930d4203b8b508d967afbbdb%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637654826786421255%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=SQ6Z9NSskYelktXtqBTHCBy73ryDA0FdRdSdhmJXIyc%3D&amp;reserved=0">https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.opensips.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fusers&amp;data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cac163de2930d4203b8b508d967afbbdb%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637654826786421255%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=SQ6Z9NSskYelktXtqBTHCBy73ryDA0FdRdSdhmJXIyc%3D&amp;reserved=0</a>
NOTICE TO RECIPIENT: This email, including attachments, may contain information which is confidential, proprietary, attorney-client privileged and / or controlled under U.S. export laws and regulations and may be restricted from disclosure by applicable State and Federal law. Nothing in this email shall create any legal binding agreement between the parties unless expressly stated herein and provided by an authorized representative of Comtech Telecommunications Corp. or its subsidiaries. If you are not the intended recipient of this message, be advised that any dissemination, distribution, or use of the contents of this message is strictly prohibited. If you received this message in error, please notify us immediately by return email and permanently delete all copies of the original email and any attached documentation from any computer or other media.

_______________________________________________
Users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a>
<a class="moz-txt-link-freetext" href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>