[SR-Users] help with string modification

Sergey Basov sergey.v.basov at gmail.com
Thu Dec 1 11:45:02 CET 2016


Hi, All.

One more question related to remove_hf...

I have added route:
# Fix user-agent and server
route[RemoveHeader] {
        remove_hf("server");
        remove_hf("user-agent");
        return;
}


I use it form
request_route {
....
route(RemoveHeader);
.....
}

failure_route[--- all what i have ---] {
....
route(RemoveHeader);
.....
}

branch_route[MANAGE_BRANCH]{
....
route(RemoveHeader);
.....
}

onreply_route[MANAGE_REPLY] {
....
route(RemoveHeader);
.....
}

failure_route[MANAGE_FAILURE] {
....
route(RemoveHeader);
.....
}

Seems all is fine It removes headers in all packets except 200 OK on BYE....
After debugging script I does not seen in which route this 200 Ok goes..
But if I adding next to
route[RELAY] {
....
        if (is_method("BYE")) {
                xlog("L_INFO","route RELAY method BYE \n");
                if(!t_is_set("onreply_route"))
t_on_reply("MANAGE_REPLY_ON_BYE");
        }
.......
}

and adding route
onreply_route[MANAGE_REPLY_ON_BYE] {
        route(RemoveHeader);
        xlog("L_INFO","route MANAGE_REPLY_ON_BYE entered \n");
}

this 200 Ok successfully goes to MANAGE_REPLY_ON_BYE route and headers
are removed.

Is this configuration correct?
I can not find any info regarding parsing 200 OK on BYE in google.

Sorry for long question...

--
Best regards,
Sergey Basov                     e-mail: sergey.v.basov at gmail.com

tel: (+38067) 403-62-54


2016-11-28 11:32 GMT+02:00 Daniel Tryba <d.tryba at pocos.nl>:
> On Fri, Nov 25, 2016 at 06:55:34PM +0200, Sergey Basov wrote:
>> Is it safe to use remove_hf("User-Agent") without check if this header
>> exist?
>> or better use if(is_present_hf("User-Agent")) { remove_hf("User-Agent"); } ?
>
> Just remove_hf is enough. is_present_hf/remove_hf might be more readable
> though.
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users



More information about the sr-users mailing list