[OpenSIPS-Users] Route Header removal

Louis Rochon Louis.Rochon at comtechtel.com
Tue Aug 31 20:43:36 EST 2021


Mr. Burke,

Yes indeed, I looked into how I was using loose_route and that was the problem!

Thanks for the great find!

regards,

Louis Rochon
________________________________
From: Users <users-bounces at lists.opensips.org> on behalf of John Burke via Users <users at lists.opensips.org>
Sent: August 27, 2021 3:45 PM
To: users at lists.opensips.org <users at lists.opensips.org>
Subject: Re: [OpenSIPS-Users] Route Header removal




WARNING: External Email: Exercise Caution

Hey Louis,

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].

[1] https://opensips.org/html/docs/modules/devel/rr.html#func_loose_route<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fopensips.org%2Fhtml%2Fdocs%2Fmodules%2Fdevel%2Frr.html%23func_loose_route&data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cfa785681107c4848338c08d969934aa7%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637656903637083313%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=6VQl33o3LiPX%2Bf%2Buzk1Vh9JYTiLgnJfUHcVuUcnt1%2Bo%3D&reserved=0>
[2] https://opensips.org/html/docs/modules/devel/path.html<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fopensips.org%2Fhtml%2Fdocs%2Fmodules%2Fdevel%2Fpath.html&data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cfa785681107c4848338c08d969934aa7%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637656903637093269%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=qvZvtxuyAjEYdQhdvEFLj8zReoo3wHEpnC1%2BAfi6sK4%3D&reserved=0>

Example:
route {
    ...
    #sequential routing
    ...
    #process preloaded routes
    if (is_present_hf("Route")) {
            if (...) { # honor routes
                    loose_route();
                    t_relay();
                    exit;
            } else {   # don't process and strip routes
                    remove_hf("Route");
            }
    }
    ...
}


Thanks,
John Burke

On 8/27/21 9:01 AM, Louis Rochon wrote:

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 <users-bounces at lists.opensips.org><mailto:users-bounces at lists.opensips.org> On Behalf Of Razvan Crainea
Sent: August 25, 2021 6:04 AM
To: users at lists.opensips.org<mailto:users at lists.opensips.org>
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
https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.opensips-solutions.com%2F&data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cac163de2930d4203b8b508d967afbbdb%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637654826786421255%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=9Fz%2FcUnMykh6fP8LgaDgVSF%2FKEbdKIaXA%2FEkACXvTKQ%3D&reserved=0<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.opensips-solutions.com%2F&data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cfa785681107c4848338c08d969934aa7%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637656903637093269%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=%2F1leryLAZUa5VH97%2BoHFQFhYfp%2B6dsQ%2F1hxsLT8FMSU%3D&reserved=0>

On 8/24/21 10:34 PM, Louis Rochon wrote:


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
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists
.opensips.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fusers&data=04%7C01%
7CLouis.Rochon%40comtechtel.com%7Cac163de2930d4203b8b508d967afbbdb%7Ca
9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637654826786421255%7CUnknown
%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
XVCI6Mn0%3D%7C1000&sdata=SQ6Z9NSskYelktXtqBTHCBy73ryDA0FdRdSdhmJXI
yc%3D&reserved=0




_______________________________________________
Users mailing list
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.opensips.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fusers&data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cac163de2930d4203b8b508d967afbbdb%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637654826786421255%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=SQ6Z9NSskYelktXtqBTHCBy73ryDA0FdRdSdhmJXIyc%3D&reserved=0<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.opensips.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fusers&data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cfa785681107c4848338c08d969934aa7%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637656903637093269%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=6fhr7Rovr7dKqRmXWuziuMlsvIvdoi5Dt%2F8JylZGJXk%3D&reserved=0>
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
Users at lists.opensips.org<mailto:Users at lists.opensips.org>
http://lists.opensips.org/cgi-bin/mailman/listinfo/users<https://gcc02.safelinks.protection.outlook.com/?url=http%3A%2F%2Flists.opensips.org%2Fcgi-bin%2Fmailman%2Flistinfo%2Fusers&data=04%7C01%7CLouis.Rochon%40comtechtel.com%7Cfa785681107c4848338c08d969934aa7%7Ca9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637656903637103219%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=NCOpfsMk%2BPKlnkiPHEuAd5FgcPqiusPQstBUcmWsaAc%3D&reserved=0>


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20210831/e42b0677/attachment-0001.html>


More information about the Users mailing list