[OpenSIPS-Users] Remove Route Header!
morris edery
morrisedery at gmail.com
Fri Jun 2 20:19:36 UTC 2023
i put the remove_hf() below
it will remove from the header Contact and User-Agent and will rename the
new User-Agent but Route won't remove and still appear on the outgoing
invite message
route[RELAY] {
remove_hf("Route");
remove_hf("Contact");
remove_hf("User-Agent");
append_hf("User-Agent: New Agent");
if (!t_relay()) {
sl_reply_error();
}
exit;
}
On Fri, Jun 2, 2023 at 6:13 AM Răzvan Crainea <razvan at opensips.org> wrote:
> Hi, Morris!
>
> The code you are trying to run removes the Route header for the outgoing
> message, but the inbound/received INVITE still has the Route header,
> hence loose_route() sees it and denies it.
> Do note that loose_route() itself removes the route, if its preloaded,
> so if you do want to accept preloaded routes, simply don't drop them :)
> (i.e. comment the send_reply(403...))
>
> Best regards,
>
> Răzvan Crainea
> OpenSIPS Core Developer
> http://www.opensips-solutions.com
>
> On 6/1/23 20:06, morris edery wrote:
> > Hello Team,
> > I am trying to remove Route Header (seems like preloaded)
> > remove_hf("Route") but it's not being removed.
> >
> > i tried to put it in several places on the code but no success
> >
> > if (is_method("INVITE"))
> > {
> > if (is_present_hf("Route"))
> > {
> > xlog("removing Route Header: $(hdr(Route)[0])\n");
> >
> > remove_hf("Route");
> > xlog ( "Route Header still present?:
> > $(hdr(Route)[0])\n");
> > }
> > route(RELAY);
> > }
> >
> >
> > instead of it goes to
> >
> >
> > if (loose_route())
> > {
> > xlog("L_ERR","Attempt to route with preloaded Route's
> > [$fu/$tu/$ru/$ci]")
> > if (!is_method("ACK")){
> > send_reply("403","Preload Route denied");
> > exit;
> > }
> > }
> >
> >
> >
> > opensips 2.4.8
> >
> >
> > what i am doing wrong ?
> >
> >
> >
> > _______________________________________________
> > Users mailing list
> > Users at lists.opensips.org
> > http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20230602/b6735848/attachment.html>
More information about the Users
mailing list