Greetings,
When NAT is detected in my Kamailio, the proxy add the parameter "received" to the Via header which includes the source IP.
What is the mechanic or function responsible for this behaviour? Does it come from the NATHELPER module?
Best Regards,
Received parameter is always added to via, and is part of the core sip RFC. This is how responses are routed.
To get nat traversal on kamailio, you generally need the following in addition:
- Received only handles address masquerading, for port translation you also need to look at rport. - A way to perform nat traversal for subsequent in dialog requests, and additionally for initial requests involving location lookup. This is where nathelper or similar must be involved. - Prevent UDP Connection Tracking Timeout on NAT boxes (keeping nat alive). This can be achieved in many ways, including configuration on NATed devices (low registration expiration, keepalives) but it's better to employ keepalive functionality by kamailio modules (nathelper or usrloc ka, for example).
The actual way to perform these tasks is a bit more involved, and I'd suggest looking at the kamailio sample configuration file which should work for most cases.
On Mon, 28 Sep 2020, 19:36 Duarte Rocha, duarterocha91@gmail.com wrote:
Greetings,
When NAT is detected in my Kamailio, the proxy add the parameter "received" to the Via header which includes the source IP.
What is the mechanic or function responsible for this behaviour? Does it come from the NATHELPER module?
Best Regards, _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Reading your question again, I realize you weren't looking for nat advice in general, you only wanted to know how the received parameter is added. Well there's no special function to do this, since it's core SIP, received is added any time a request is relayed or a local response is generated. It is always added if different from host addr in via, regardless of nat detection or loading of nat modules in kamailio.
On Tue, 29 Sep 2020, 03:48 George Diamantopoulos, georgediam@gmail.com wrote:
Received parameter is always added to via, and is part of the core sip RFC. This is how responses are routed.
To get nat traversal on kamailio, you generally need the following in addition:
- Received only handles address masquerading, for port translation you
also need to look at rport.
- A way to perform nat traversal for subsequent in dialog requests, and
additionally for initial requests involving location lookup. This is where nathelper or similar must be involved.
- Prevent UDP Connection Tracking Timeout on NAT boxes (keeping nat
alive). This can be achieved in many ways, including configuration on NATed devices (low registration expiration, keepalives) but it's better to employ keepalive functionality by kamailio modules (nathelper or usrloc ka, for example).
The actual way to perform these tasks is a bit more involved, and I'd suggest looking at the kamailio sample configuration file which should work for most cases.
On Mon, 28 Sep 2020, 19:36 Duarte Rocha, duarterocha91@gmail.com wrote:
Greetings,
When NAT is detected in my Kamailio, the proxy add the parameter "received" to the Via header which includes the source IP.
What is the mechanic or function responsible for this behaviour? Does it come from the NATHELPER module?
Best Regards, _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
There’s a good write up from Alex Balashov on NAT, Kamailio, and the sorcerers stone.
http://www.evaristesys.com/blog/server-side-nat-traversal-with-kamailio-the-...
-- Fred
On Sep 28, 2020, at 9:00 PM, George Diamantopoulos georgediam@gmail.com wrote:
Received parameter is always added to via, and is part of the core sip RFC. This is how responses are routed.
To get nat traversal on kamailio, you generally need the following in addition:
- Received only handles address masquerading, for port translation you also need to look at rport.
- A way to perform nat traversal for subsequent in dialog requests, and additionally for initial requests involving location lookup. This is where nathelper or similar must be involved.
- Prevent UDP Connection Tracking Timeout on NAT boxes (keeping nat alive). This can be achieved in many ways, including configuration on NATed devices (low registration expiration, keepalives) but it's better to employ keepalive functionality by kamailio modules (nathelper or usrloc ka, for example).
The actual way to perform these tasks is a bit more involved, and I'd suggest looking at the kamailio sample configuration file which should work for most cases.
On Mon, 28 Sep 2020, 19:36 Duarte Rocha, duarterocha91@gmail.com wrote: Greetings,
When NAT is detected in my Kamailio, the proxy add the parameter "received" to the Via header which includes the source IP.
What is the mechanic or function responsible for this behaviour? Does it come from the NATHELPER module?
Best Regards, _______________________________________________ Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
Thank you for your answers.
I have a old SBC with opensips and it always adds received to Via. However, in my Kamailio it only adds in NAT scenarios. I would like to understand why that happens.
A segunda, 28/09/2020, 17:35, Duarte Rocha duarterocha91@gmail.com escreveu:
Greetings,
When NAT is detected in my Kamailio, the proxy add the parameter "received" to the Via header which includes the source IP.
What is the mechanic or function responsible for this behaviour? Does it come from the NATHELPER module?
Best Regards,
Typically received parameter to Via is added when the IP address in that header is different than the source IP of the request.
Cheers, Daniel
On 29.09.20 12:06, Duarte Rocha wrote:
Thank you for your answers.
I have a old SBC with opensips and it always adds received to Via. However, in my Kamailio it only adds in NAT scenarios. I would like to understand why that happens.
A segunda, 28/09/2020, 17:35, Duarte Rocha <duarterocha91@gmail.com mailto:duarterocha91@gmail.com> escreveu:
Greetings, When NAT is detected in my Kamailio, the proxy add the parameter "received" to the Via header which includes the source IP. What is the mechanic or function responsible for this behaviour? Does it come from the NATHELPER module? Best Regards,
Kamailio (SER) - Users Mailing List sr-users@lists.kamailio.org https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users