<div dir="ltr">i put the remove_hf() below<div><br></div><div>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<br><div><br></div><div><div style="color:rgb(248,248,242);background-color:rgb(39,40,34);font-family:"Courier New",Consolas,"Courier New",monospace;font-size:14px;line-height:19px;white-space:pre"><div>route[RELAY] {</div><br><div> remove_hf(<span style="color:rgb(230,219,116)">"Route"</span>)<span style="color:rgb(136,132,111)">;</span></div><div> remove_hf(<span style="color:rgb(230,219,116)">"Contact"</span>)<span style="color:rgb(136,132,111)">;</span></div><div> remove_hf(<span style="color:rgb(230,219,116)">"User-Agent"</span>)<span style="color:rgb(136,132,111)">;</span></div><div> append_hf(<span style="color:rgb(230,219,116)">"User-Agent: New Agent"</span>)<span style="color:rgb(136,132,111)">;</span></div><div> </div><br><div> if (!t_relay()) {</div><div> sl_reply_error()<span style="color:rgb(136,132,111)">;</span></div><div> }</div><div> </div><div> exit<span style="color:rgb(136,132,111)">;</span></div><div> }</div></div></div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Jun 2, 2023 at 6:13 AM Răzvan Crainea <<a href="mailto:razvan@opensips.org">razvan@opensips.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi, Morris!<br>
<br>
The code you are trying to run removes the Route header for the outgoing <br>
message, but the inbound/received INVITE still has the Route header, <br>
hence loose_route() sees it and denies it.<br>
Do note that loose_route() itself removes the route, if its preloaded, <br>
so if you do want to accept preloaded routes, simply don't drop them :) <br>
(i.e. comment the send_reply(403...))<br>
<br>
Best regards,<br>
<br>
Răzvan Crainea<br>
OpenSIPS Core Developer<br>
<a href="http://www.opensips-solutions.com" rel="noreferrer" target="_blank">http://www.opensips-solutions.com</a><br>
<br>
On 6/1/23 20:06, morris edery wrote:<br>
> Hello Team,<br>
> I am trying to remove Route Header (seems like preloaded) <br>
> remove_hf("Route") but it's not being removed.<br>
> <br>
> i tried to put it in several places on the code but no success<br>
> <br>
> if (is_method("INVITE"))<br>
> {<br>
> if (is_present_hf("Route"))<br>
> {<br>
> xlog("removing Route Header: $(hdr(Route)[0])\n");<br>
> <br>
> remove_hf("Route");<br>
> xlog ( "Route Header still present?: <br>
> $(hdr(Route)[0])\n");<br>
> }<br>
> route(RELAY);<br>
> }<br>
> <br>
> <br>
> instead of it goes to<br>
> <br>
> <br>
> if (loose_route())<br>
> {<br>
> xlog("L_ERR","Attempt to route with preloaded Route's <br>
> [$fu/$tu/$ru/$ci]")<br>
> if (!is_method("ACK")){<br>
> send_reply("403","Preload Route denied");<br>
> exit;<br>
> }<br>
> }<br>
> <br>
> <br>
> <br>
> opensips 2.4.8<br>
> <br>
> <br>
> what i am doing wrong ?<br>
> <br>
> <br>
> <br>
> _______________________________________________<br>
> Users mailing list<br>
> <a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
> <a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br>
_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org" target="_blank">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
</blockquote></div>