I know there have been several code examples of using avpops to
accomplish this. Note that fix_nated_register will NOT change the
contact to the public address, but store received info. This means the
ruri may contain a private address when calling t_relay()
g-)
Arek Bekiersz wrote:
Hi,
Not sure if such issue was discussed before.
Is this possible to detect that two phones are behind the same NAT, to
avoid forcing rtpproxy in SER?
This way we let the phones to send media directly to each other in
private network behind NAT. Imagine two SIP phones connected to WAN
using router with NAT. Both phones are in the same private network.
Both phones have accounts on SER proxy, that in turn runs nathelper and
rtpproxy.
Phone_1 <-->
NAT <--> SER,nathelper,rtpproxy
Phone_2 <-->
Normally when we make call between Phone_1 and Phone_2 using SER, RTP
media will flow from Phone_1 to rtpproxy and back to Phone_2. Well, this
is basically what we expect from rtpproxy & nathelper :-)
Now somehow we could be able to detect in SER that both phones are
behind the SAME NAT. When such situation is confirmed, we do not use
nathelper and rtpproxy. As a result the phones send RTP media directly
between them in private network, not using (and probably saturating) the
poor internet link.
I was thinking about:
1) Standard detection of NAT-ed situation, and then
2) comparing source IP of INVITE from Phone_1 with Contact IP stored for
Phone_2 in "location" table. If they match, both phones MAY be in the
same private network and we do not use nathelper functions.
Of course it would work only if there is no other NAT before the primary
NAT (i.e. we do not have the double NAT situation or similar)