How to connect two asterisk server which behind nat

I have two asterisk server, both can connect when two server at some local network. How can connect if two server at different network, both behind nat.


You can try forwarding port 5060 (and maybe 5061) on each router to the internal IP of the asterisk server, setting external ip and localnet in sip.conf and setting nat=yes for the entry for the other server

if you have 2 servers each behind differnt NATs with the internet in between then the easiest and most efficient way to connect them is through an iax2 connection. Just forward the IAX2 port to each server and you are good to go. SIP will work also but if they are both asterisk, it will be easier and less chance of issues to simply trunk them with IAX2.


Comming from the land of SIP I totally forgot about IAX2, That will be your best soulution, although my SIP example should work also, just not as well (or easy, most likely)

through an iax2, both asterisk server connected.

thank you very much.