The solution for NAT is a little complex and requires several steps. We will split the solution into three pieces and a few steps for each segment in order to simplify the understanding:
Installing STUN
Solving the SIP signaling
Using a media relay server
Engaging a media relay server
Simple traversal of UDP over NAT, or simply STUN, is the most common method for near-end NAT traversal. The IETF standardized STUN in three RFCs: 3489, 5389, and 7350. STUN is a near-end NAT traversal solution. STUN's biggest advantage is to fix addresses in the client side. Clients using STUN appear to the proxy as a client using a valid IP address. You do not require any extra configuration on the server. On the other hand, STUN does not work with symmetric NAT. The STUN protocol enables IP endpoints behind NAT to discover their external IP addresses, ports, and NAT type. Use STUN to discover if the client is in any of the following situations:
In an open Internet
Behind a firewall...