I have running Asterisk on a root-server at the Internet. Nearly everything is working perfectly but there is still one thing I don’t like with that configuration:
A local call from one local sip-client to another (same NAT) produces two streams on my Internet connection, although the clients are connected directly to each other via LAN.
I have tried to enable reinvite for the clients in the sip.conf but it only seems to work if both, the clients and the Asterisk, are in the same NAT. I think it’s because the NAT-Router (my Internet gateway) manipulates the IPs of the clients and so Asterisk dose not know the correct addresses for reinvite the clients - correct?
Maybe there is a way to tell asterisk the local IPs of the clients, or any other ideas.
Thank you for any suggestions.
To specify an ip address for each client you can put host=(IP address) instead of host=dynamic. See if that helps.
Also, you can try using DYNDNS.COM (if you have dynamic external IP) with your router and set your externip=(your dynamic address or your static ip address). This is what I had to do to get asterisk to work w/ client on the outside of the NAT.
I’ve got the identical question / issue. An internet hosted asterisk instance serving an office with 10 users. Obviously, I would like the user to user traffic to stay on the lan, with signaling or similar going through Asterisk.
[quote=“sip.conf.sample”]; By default, Asterisk tries to re-invite the audio to an optimal path. If there’s
; no reason for Asterisk to stay in the media path, the media will be redirected.
; This does not really work with in the case where Asterisk is outside and have
; clients on the inside of a NAT. In that case, you want to set canreinvite=nonat
;canreinvite=yes ; Asterisk by default tries to redirect the
; RTP media stream (audio) to go directly from
; the caller to the callee. Some devices do not
; support this (especially if one of them is behind a NAT).
…
;canreinvite=nonat ; An additional option is to allow media path redirection
; (reinvite) but only when the peer where the media is being
; sent is known to not be behind a NAT (as the RTP core can
; determine it based on the apparent IP address the media
; arrives from).
[/quote]
Asterisk is too “smart” to allow any devices behind (even the same) NAT to talk directly. Come to think about it, what IP address Asterisk has for those devices? I doubt if it will know the addresses behind NAT.