Routing DID numbers to your SIP trunk or IP-PBX (3CX, FreePBX, Asterisk)

If you already run an IP-PBX such as 3CX, FreePBX or Asterisk, DID numbers slot straight in. The provider delivers each call over SIP, and your PBX decides which extension, queue or IVR answers. Here’s the setup in practice.

Two ways to connect

IP authentication (peering). The provider sends calls to your PBX’s public IP address, and your PBX accepts traffic from the provider’s signalling IPs. This is simple and reliable for PBXs with a static IP.

Registration. Your PBX registers to the provider with a username and password, like a phone registers to a PBX. This works well when your PBX has a dynamic IP or sits behind NAT.

Step by step

  1. Set the destination. In the number portal, point the DID at your SIP trunk or PBX address.
  2. Create the trunk on the PBX. Add the provider’s SIP server, credentials or IP allow-list, and the codecs you support (G.711 is the safe default; G.729 or Opus if agreed).
  3. Build inbound routes. Match the called number, the DID, and send it to the right extension, ring group, queue or IVR. Most PBXs let you match on the full E.164 number.
  4. Open the firewall carefully. Allow SIP signalling and the RTP media port range only from the provider’s IP ranges.
  5. Test. Call each DID from a mobile and from abroad, and check two-way audio.

Common pitfalls

  • One-way or no audio. Usually NAT: set the PBX’s external IP correctly and make sure the RTP ports are open.
  • Calls hit the wrong extension. The number arrives in a different format than your route expects. Check whether the provider sends +44…, 44… or 020… and match it. See E.164 explained.
  • Calls drop after about 30 seconds. A classic sign of SIP ACK or NAT problems, often fixed by disabling SIP ALG on the router.
  • Too many simultaneous calls. Check the concurrent call capacity on your account. See planning channels for a contact centre.

Many numbers, one trunk

You don’t need a trunk per number. Dozens or thousands of DIDs across many countries can terminate on the same trunk, with the PBX splitting them by called number.

Frequently asked questions

Does 3CX work with any SIP provider?

3CX supports generic SIP trunks, so any standards-compliant provider works. A provider template simply pre-fills the settings.

Which codec should I use?

G.711 (a-law in Europe, Β΅-law in North America) gives the best compatibility and quality. Use compressed codecs only if bandwidth is tight.

Get numbers for your PBX