Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Next »

Here we can add some examples of working configuration for Asterisk's SIP channel driver behind NAT (Network Address Translation).

Asterisk and Phones Connecting Through NAT to an ITSP

This example should apply for most simple NAT scenarios that meet the following criteria:

  • Asterisk and the phones are on a private network.
  • There is a router interfacing the private and public networks. Where the public network is the Internet.
  • The router is performing Network Address Translation and Firewall functions.
  • The router is configured for port-forwarding, where it is mapping the necessary ranges of SIP and RTP traffic to your internal Asterisk server.
    In this example the router is port-forwarding WAN inbound TCP/UDP 5060 and UDP 10000-20000 to LAN

This example was based on a configuration for the ITSP SIP.US and assuming you swap out the addresses and credentials for real ones, it should work for a SIP.US SIP account.

Devices Involved in the Example

DeviceIP in example
VOIP Phone
ITSP SIP gateway

Other Information in the Example:

ITSP Account number:  1112223333

DID number provided by ITSP:  19998887777

Example pjsip.conf Configuration

We are assuming you have already read the Configuring res_pjsip page and have a basic understanding of Asterisk. The important config options to note are local_net, external_media_address and external_signaling_address in the transport type context.


This is the IP network that we want to consider our local network. For communication to addresses within this range, we won't apply any NAT-related settings.


This is the external IP address to use in RTP handling. When a request or response is sent out from Asterisk, if the destination of the message is outside the IP network defined in the option 'local_net', and the media address in the SDP is within the localnet network, then the media address in the SDP will be rewritten to the value defined for 'external_media_address'.


This is the external IP address to use for SIP signaling.


 Click to see example pjsip.conf




  • No labels