Hi guys,
I'm using Kamailio 5.3.1 in the AWS cloud. For this purpose I'm setting up a 'nat_public_ipaddr' in the 'advertise' feature:
listen=tls:<%= @ipaddr %>:5061 advertise <%= node['hpbx'][ 'nat_public_ipaddr'] %>:5061 listen=tcp:<%= @ipaddr %>:5060 advertise <%= node['hpbx'][ 'nat_public_ipaddr'] %>:5060 listen=udp:<%= @ipaddr %>:5060 advertise <%= node['hpbx'][ 'nat_public_ipaddr'] %>:5060
When I need relaying an incoming message to one of our internal services (for example B2BUA, VMAIL etc) I'm setting up an internal address '@ipaddr' in the Via header instead of 'nat_public_ipaddr' :
set_advertised_address("<%= @ipaddr %>"); set_advertised_port(5060);
All works fine, but Kamailio adds a 'Record-Route' header containing 'nat_public_ipaddr' automatically into such messages. How can I remove this header or insert my internal address instead before relaying the message? Is it possible?
Thanks, Andrey
Hello,
not know the details of your cfg, but did you tried already to deactivate this parameter:
https://kamailio.org/docs/modules/devel/modules/rr.html#rr.p.enable_double_r...
Another option could be not not use record_route() but this function instead:
https://kamailio.org/docs/modules/devel/modules/rr.html#rr.f.record_route_ad...
Cheers,
Henning
-- Henning Westerholt – https://skalatan.de/blog/ Kamailio services – https://gilawa.comhttps://gilawa.com/
From: sr-dev sr-dev-bounces@lists.kamailio.org On Behalf Of Andrey Deykunov Sent: Friday, June 5, 2020 2:33 PM To: Kamailio (SER) - Development Mailing List sr-dev@lists.kamailio.org Subject: [sr-dev] Removing Record-Route header
Hi guys,
I'm using Kamailio 5.3.1 in the AWS cloud. For this purpose I'm setting up a 'nat_public_ipaddr' in the 'advertise' feature:
listen=tls:<%= @ipaddr %>:5061 advertise <%= node['hpbx']['nat_public_ipaddr'] %>:5061 listen=tcp:<%= @ipaddr %>:5060 advertise <%= node['hpbx']['nat_public_ipaddr'] %>:5060 listen=udp:<%= @ipaddr %>:5060 advertise <%= node['hpbx']['nat_public_ipaddr'] %>:5060
When I need relaying an incoming message to one of our internal services (for example B2BUA, VMAIL etc) I'm setting up an internal address '@ipaddr' in the Via header instead of 'nat_public_ipaddr' :
set_advertised_address("<%= @ipaddr %>"); set_advertised_port(5060);
All works fine, but Kamailio adds a 'Record-Route' header containing 'nat_public_ipaddr' automatically into such messages. How can I remove this header or insert my internal address instead before relaying the message? Is it possible?
Thanks, Andrey
Hi Henning,
Here is an example where I call set_advertised_address() and set_advertised_port() before relaying to the B2BUA:
route { ...
...
t_on_reply("REPLY_FROM_B2BUA");
if (!add_contact_alias()) { xlog("L_ERR", "sip_call_id=$ci; Failed aliasing contact $ct "); send_reply("400", "Bad request"); exit; }
rewritehostport("<%= @ipaddr %>:1024");
set_advertised_address("<%= @ipaddr %>"); set_advertised_port(5060);
if (!t_relay_to_udp("<%= @ipaddr %>", "1024")) { xlog("L_ERR", "sip_call_id=$ci; Failed relaying $rm to b2bua"); sl_reply_error(); } }
The SIP message sent from kamailio to B2BUA after that looks like:
IP (tos 0x10, ttl 64, id 53886, offset 0, flags [none], proto UDP (17), length 1509) 10.99.8.107.5060 > 10.99.8.107.1024: [bad udp cksum 0x2b7e -> 0xf867!] UDP, length 1481 E....~..@.|. c.k c.k......+~INVITE sip:301@10.99.8.107:1024 SIP/2.0 Record-Route: sip:18.156.22.8;lr=on;ftag=51c5ba2b8447498798a4e630dca6c17a Via: SIP/2.0/UDP 10.99.8.107:5060 ;branch=z9hG4bKa09f.30a09da6e92bdfa999ccb517ecba6f97.0 Via: SIP/2.0/UDP 10.9.18.77:50342 ;received=37.202.8.10;rport=50342;branch=z9hG4bKPj888cd8a8501547fc851e5724ef3f7b1a Max-Forwards: 69 From: sip:74807310@18.156.22.8;tag=51c5ba2b8447498798a4e630dca6c17a To: sip:301@18.156.22.8 Contact: sip:74807310@10.9.18.77:50342 ;alias=37.202.8.10~50342~1;alias=37.202.8.10~50342~1;ob Call-ID: f92450e6fad14d59bfea70100358bd05 CSeq: 232 INVITE Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS Supported: replaces, 100rel, timer, norefersub Session-Expires: 1800 Min-SE: 90 User-Agent: MicroSIP/3.19.28 Authorization: Digest username="74807310", realm=" hpbx200-1.euc1.telecomsvc.com", nonce="Xt3p017d6KfFSpRngRjuDCInFYIAVnPB", uri="sip:301@18.156.22.8", response="5e8f6a54064aba0d703c62dcbc746807" Content-Type: application/sdp Content-Length: 386 P-Debug-header: advertized local
where 18.156.22.8 in the *'Record-Route'* header is an external IP set by the '*advertise*' setting in the '*listen*' block:
listen=udp:<%= @ipaddr %>:5060 advertise <%= node['hpbx'][ 'nat_public_ipaddr'] %>:5060
and 10.99.8.107:5060 in the *'Via'* header is an internal IP:port replaced by *set_advertised_address*() and *set_advertised_port*() functions before relaying to B2BUA. So, I need '*Record-Route*' to be having internal IP just as in the '*Via*' header.
The functions such enable_double_rr() and record_route_advertised_address() did not help here. Any ideas?
Thanks, Andrey
вс, 7 июн. 2020 г. в 12:35, Henning Westerholt hw@skalatan.de:
Hello,
not know the details of your cfg, but did you tried already to deactivate this parameter:
https://kamailio.org/docs/modules/devel/modules/rr.html#rr.p.enable_double_r...
Another option could be not not use record_route() but this function instead:
https://kamailio.org/docs/modules/devel/modules/rr.html#rr.f.record_route_ad...
Cheers,
Henning
--
Henning Westerholt – https://skalatan.de/blog/
Kamailio services – https://gilawa.com
*From:* sr-dev sr-dev-bounces@lists.kamailio.org *On Behalf Of *Andrey Deykunov *Sent:* Friday, June 5, 2020 2:33 PM *To:* Kamailio (SER) - Development Mailing List <sr-dev@lists.kamailio.org
*Subject:* [sr-dev] Removing Record-Route header
Hi guys,
I'm using Kamailio 5.3.1 in the AWS cloud. For this purpose I'm setting up a 'nat_public_ipaddr' in the 'advertise' feature:
listen=tls:<%= @ipaddr %>:5061 advertise <%= node['hpbx'][ 'nat_public_ipaddr'] %>:5061
listen=tcp:<%= @ipaddr %>:5060 advertise <%= node['hpbx'][ 'nat_public_ipaddr'] %>:5060
listen=udp:<%= @ipaddr %>:5060 advertise <%= node['hpbx'][ 'nat_public_ipaddr'] %>:5060
When I need relaying an incoming message to one of our internal services (for example B2BUA, VMAIL etc) I'm setting up an internal address '@ipaddr' in the Via header instead of 'nat_public_ipaddr' :
set_advertised_address("<%= @ipaddr %>");
set_advertised_port(5060);
All works fine, but Kamailio adds a 'Record-Route' header containing 'nat_public_ipaddr' automatically into such messages. How can I remove this header or insert my internal address instead before relaying the message? Is it possible?
Thanks,
Andrey