The 200ok for CANCEL generated by Kamailio doesn't get inside the onreply_route -- this block is only for SIP replies received by kamailio.
However, the 200ok for CANCEL should have limited (minimal) number of headers. Which ones besides the Server do you want to remove?
Cheers,
Daniel
Thanks Sergey! It works like a charm for BYEs.
Is it working for you on 200cancelling generated by Kamailio?
I tried the same work around with no success.
if (is_method("CANCEL")) {if (t_check_trans()) {if(!t_is_set("onreply_route"))t_on_reply("MANAGE_REPLY_ON_CANCEL");route(RELAY);}exit;}
Thanks again,
Diego
2017-01-13 13:27 GMT-03:00 Sergey Basov <sergey.v.basov@gmail.com>:
______________________________Hi All.
I have similar task. But i have to remove server and user-agent headers from all request an replyes.
You can try:
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.
13 янв. 2017 г. 4:59 PM пользователь "Diego Nadares" <dnadares@gmail.com> написал:
If you need any additional data please let me know.
Cheers,
Diego______________________________
2017-01-12 15:04 GMT-03:00 Diego Nadares <dnadares@gmail.com>:
Hi Daniel!
Thanks for your answer. The idea is to show only a few headers. In BYE works great. I'm removing and adding the following hdrs:
User-Agent: Kamailio. <---I will try what you saidSupported:.Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, NOTIFY, INFO.Accept: application/sdp, application/gtd.
For example in following messages ( Kamailio is 172.16.213.38)
#U 2017/01/12 14:51:10.593782 172.16.200.159:57270 -> 172.16.213.38:5060BYE sip:127.0.0.8:5060;line=sr-9879879879798** SIP/2.0. Via: SIP/2.0/UDP 172.16.200.159:5060;branch=z9hG4bK12B9605ED. From: xx <sip:xx@172.16.213.38>;tag=95E7E4A4-23F2. To: xxx <sip:xxx@172.16.213.38>;tag=SDmmb7201-as0518eb07. Date: Thu, 12 Jan 2017 17:51:05 GMT.Call-ID: SDmmb7201-f5ded6cf4cd5d84736b088e39277e8db-c540dl1. User-Agent: Cisco-SIPGateway/IOS-12.x.Max-Forwards: 15.Route: <sip:172.16.213.38;lr;ftag=SDmmb7201-as0518eb07;did=bf.cab>. Timestamp: 1484243470.CSeq: 101 BYE.Reason: Q.850;cause=16.Content-Disposition: signal;handling=optional.Content-Type: application/gtd.Content-Length: 26........
#U 2017/01/12 14:51:10.647164 172.16.213.38:5060 -> 172.16.50.41:5060BYE sip:xxx@172.16.50.41:5060;transport=udp SIP/2.0. Via: SIP/2.0/UDP 172.16.213.38;branch=z9hG4bKdcf6.f898feef02d601e36a22d26bf3a e5e4a.0. Via: SIP/2.0/UDP 127.0.0.8;branch=z9hG4bKsr-asdfasdfF. From: xx <sip:xx@172.16.213.38>;tag=95E7E4A4-23F2. To: xxx <sip:xxx@172.16.50.41>;tag=SDmmb7201-as0518eb07. Call-ID: SDmmb7201-f5ded6cf4cd5d84736b088e39277e8db-c540dl1. Max-Forwards: 14.CSeq: 101 BYE.Content-Type: application/gtd.Content-Length: 26.User-Agent: Kamailio.Supported:.Allow: INVITE, OPTIONS, BYE, CANCEL, ACK, NOTIFY, INFO.Accept: application/sdp, application/gtd........
But in ok I can't
#U 2017/01/12 14:51:10.653701 172.16.50.41:5060 -> 172.16.213.38:5060SIP/2.0 200 OK.Via: SIP/2.0/UDP 172.16.213.38;branch=z9hG4bKdcf6.f898feef02d601e36a22d26bf3a e5e4a.0. Via: SIP/2.0/UDP 127.0.0.8;branch=z9hG4bKsr-sadfasdf. From: xx <sip:xx@172.16.213.38>;tag=95E7E4A4-23F2. To: xxx <sip:xxx@172.16.50.41>;tag=SDmmb7201-as0518eb07. Call-ID: SDmmb7201-f5ded6cf4cd5d84736b088e39277e8db-c540dl1. CSeq: 101 BYE.Server: Asterisk PBX 11.17.0.Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE.Supported: replaces, timer.Content-Length: 0..FY, INFO.Accept#U 2017/01/12 14:51:10.669460 172.16.213.38:5060 -> 172.16.200.159:5060SIP/2.0 200 OK.Via: SIP/2.0/UDP 172.16.200.159:5060;branch=z9hG4bK12B9605ED. From: xx <sip:xx@172.16.213.38>;tag=95E7E4A4-23F2. To: xxx <sip:xxx@172.16.213.38>;tag=SDmmb7201-as0518eb07. Call-ID: SDmmb7201-f5ded6cf4cd5d84736b088e39277e8db-c540dl1. CSeq: 101 BYE.Server: Asterisk PBX 11.17.0.Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE.Supported: replaces, timer.Content-Length: 0..
2017-01-12 13:23 GMT-03:00 Daniel-Constantin Mierla <miconda@gmail.com>:
______________________________Hello,
if you are looking to remove the server header (server signature), that can be controlled via global parameters:
- https://www.kamailio.org/wiki/
cookbooks/4.4.x/core#server_he ader Note that there is another header, User-Agent, that may be added by Kamailio in local generate request. There is a global parameter to control it as well.
If you want more than that, can you add a bit more details, because CANCEL and BYE are processed differently. With which one you get issues?
Cheers,
Daniel
On 12/01/2017 17:00, Diego Nadares wrote:
Hi List,
I'm trying to add and remove some headers in 200 canceling and 200 ok to BYEs with no success.
I don't know in which route to add my remove_hf and append_hf. It seems that I can't catch it on reply either on request route.
I tried adding it in
event_route[tm:local-response] {xlog("L_ERR", "TM LOCAL REPONSE!");route(MANAGE_HEADERS);}
This is my route to manage hdrs:
route[MANAGE_HEADERS]{
xlog("L_ERR", "MANAGE HDRS !");
keep_hf("TH"); # for topoh
append("AHDR1:asdf\r\n");
return;}
I suppose SERVER HDR should be removed but:
U 2017/01/12 12:45:41.566733 172.16.213.38:5060 -> 172.16.50.41:5060SIP/2.0 200 canceling.Via: SIP/2.0/UDP 172.16.50.41:5060;branch=z9hG4bKgg8ekd3080braugkm700.1. CSeq: 102 CANCEL.From: <sip:xx@172.16.50.41>;tag=SD7b10b01-as5ba5e269. To: <sip:xxx@172.16.213.38>;tag=4a86e96addfb27a943bc86e1872032b6 -0a8b. Call-ID: SD7b10b01-6a7d1089793bda79481f25cf88c023ed-c540dl1. Server: kamailio (4.4.4 (x86_64/linux)).Content-Length: 0.
Any help will be very appreciated.
Thanks in advance!
Diego
_______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cg i-bin/mailman/listinfo/sr-user s -- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com_________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cg i-bin/mailman/listinfo/sr-user s _________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cg i-bin/mailman/listinfo/sr-user s _________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/ cgi-bin/mailman/listinfo/sr- users _______________________________________________ SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
-- Daniel-Constantin Mierla www.twitter.com/miconda -- www.linkedin.com/in/miconda Kamailio World Conference - May 8-10, 2017 - www.kamailioworld.com