Before you start
- Your trunk details: SIP server address, and either credentials or confirmation that your public IP is allowed
- The codecs agreed with your provider
- Your PBX's public IP address and the private network it sits on
- Firewall access to change SIP and RTP port rules
1. Create the trunk
In FreePBX, add a PJSIP trunk under Connectivity > Trunks. On plain Asterisk, define an endpoint, an AOR and, for registration, an auth and registration section in pjsip.conf. Use the authentication method agreed with your provider: registration with username and password, or IP authentication where the provider matches your source address.
2. Set NAT correctly
If the PBX sits behind a router, tell it its public address and its local networks (in FreePBX: Settings > Asterisk SIP Settings, External Address and Local Networks). Getting this wrong is the most common cause of one-way or no audio, because the PBX advertises a private address the provider cannot reach.
3. Open the right ports, to the right people
Signalling usually uses UDP or TCP port 5060, and audio uses an RTP port range (Asterisk's default is 10000 to 20000). Allow SIP only from your provider's addresses, never from the whole internet. An open SIP port is scanned within minutes and is the most common route to toll fraud.
4. Inbound and outbound routes
Create an inbound route for each DID number pointing to the right extension, queue or IVR. Create an outbound route with dial patterns for the destinations you call, set the caller ID you are entitled to present, and block premium and international ranges you never use.
5. Test before go-live
- Inbound call to every number: does it ring the right place?
- Outbound call to a mobile and a landline: two-way audio for at least a minute?
- DTMF: can you navigate an IVR menu?
- Caller ID: does the called phone show the number you expect?
- Failover: what happens when the PBX is unreachable?