How to route SIP to SIP calls via Asterisk?


I’m attempting to find a workable solution for the everlasting NAT issue and I’ve come to this idea.

Normally if you make a call via Asterisk the server will function as a bridge between the two different protocols. So if you place a SIP to IAX2 call the Asterisk server will ‘translate’ everything between the two protocols. Same for ISDN to SIP, etc. etc.

However for a SIP to SIP call the RTP traffic is done on a point to point basis between the two clients. And this is where all the NAT firewalling trouble starts.

What if I can place my Asterisk server on a public IP address (I can) and force ALL SIP and RTP related traffic from my SIP phone (registered at my Asterisk server) via this server to the rest of the world ?

As far as my SIP/RTP knowledge goes this should work … if I know how to convince Asterisk to do it that way.

So my question to you is:
Assume I have a SIP client (A) and I want to call another SIP client (B) who is either registered at the same Asterisk server (S) or at some other server somewhere on this planet. What must I set in Asterisk to ensure that every single SIP call I make is routed via this Asterisk server ?

Niels Basjes

in sip.conf canreinvite=no. set it in [general] to globally define it (can be overridden) or set it in each peer definition to define it per-peer.

Thanks !!!