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
[2] https://opensips.org/html/docs/modules/devel/path.html

_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-boun...@lists.opensips.org> On Behalf Of Razvan Crainea
Sent: August 25, 2021 6:04 AM
To: users@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&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

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@lists.opensips.org
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%7Ca
9a26e696ae040c1bd801ca6cc677828%7C0%7C0%7C637654826786421255%7CUnknown
%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJ
XVCI6Mn0%3D%7C1000&amp;sdata=SQ6Z9NSskYelktXtqBTHCBy73ryDA0FdRdSdhmJXI
yc%3D&amp;reserved=0

_______________________________________________
Users mailing list
Users@lists.opensips.org
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
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@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

_______________________________________________
Users mailing list
Users@lists.opensips.org
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to