SIP trunk setup: Asterisk and FreePBX

Ready-to-use sip.conf, pjsip.conf and extensions.conf examples. Copy, fill in your details, done.

What you need before you start

This page is a technical configuration guide: copy-paste config blocks for anyone connecting their own Asterisk or FreePBX system to CheapConnect. No marketing copy, no pricing, just the settings.

Looking for more background on pricing, why the trunk account is free, or the basic trunk FAQ? Check our VoIP Trunk page. This guide assumes you already have an account.

What you need

• A free CheapConnect trunk account
• Your phone number (username)
• The password from your portal
• Asterisk 13+ or FreePBX

Create a trunk account

Option A: chan_sip (sip.conf)

Still running the classic chan_sip channel? Add this block to sip.conf. Replace 31851234567 with your own phone number in international format, and jouwwachtwoord with the password from your portal.

[cheapconnect]
type=friend
host=sip.cheapconnect.net
port=5060
context=from-trunk
insecure=port,invite
qualify=yes
disallow=all
allow=ulaw
allow=alaw
allow=g729
allow=g722
username=31851234567
secret=yourpassword
fromuser=31851234567
fromdomain=sip.cheapconnect.net
nat=force_rport,comedia
dtmfmode=rfc2833

register => 31851234567:yourpassword@sip.cheapconnect.net/31851234567

The register => line is required. Without registration, CheapConnect doesn't know where to route incoming calls, even though outbound calling may still work.

Option B: PJSIP (pjsip.conf)

Running a more recent Asterisk version, or starting fresh? PJSIP has been the recommended stack since Asterisk 12 and is the default in new FreePBX installs. PJSIP needs several sections: an endpoint, an aor, an auth block, and a separate registration.

[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060

[cheapconnect]
type=endpoint
transport=transport-udp
context=from-trunk
disallow=all
allow=ulaw,alaw,g729,g722
outbound_auth=cheapconnect-auth
aors=cheapconnect-aor
from_user=31851234567
from_domain=sip.cheapconnect.net

[cheapconnect-auth]
type=auth
auth_type=userpass
username=31851234567
password=yourpassword

[cheapconnect-aor]
type=aor
contact=sip:sip.cheapconnect.net:5060
qualify_frequency=60

[cheapconnect-identify]
type=identify
endpoint=cheapconnect
match=sip.cheapconnect.net

[cheapconnect-reg]
type=registration
outbound_auth=cheapconnect-auth
server_uri=sip:sip.cheapconnect.net
client_uri=sip:31851234567@sip.cheapconnect.net
retry_interval=60

The identify block makes Asterisk recognize incoming calls from sip.cheapconnect.net as coming from this trunk, even before the incoming message is authenticated.

extensions.conf: routing inbound and outbound

The trunk is up, but nothing happens without a dialplan. This example catches incoming calls in the from-trunk context (must match the context= above) and routes outgoing 0031 numbers through the trunk.

; --- Inbound: a call from CheapConnect arrives on your number ---
[from-trunk]
exten => 31851234567,1,NoOp(Incoming call from CheapConnect)
 same => n,Goto(from-internal,600,1)
; 600 = ring group, IVR or extension that handles incoming calls

; --- Outbound: numbers starting with 0031 go out via the trunk ---
[from-internal]
exten => _0031Z.,1,NoOp(Outgoing call to ${EXTEN})
 same => n,Set(CALLERID(num)=31851234567)
; chan_sip:
 same => n,Dial(SIP/cheapconnect/${EXTEN:2})
; PJSIP (use this line instead of the chan_sip line above):
; same => n,Dial(PJSIP/${EXTEN:2}@cheapconnect)
 same => n,Hangup()

Always use the international format (0031 or +31, not 06 or a leading 0) in your dial patterns. CheapConnect expects outbound call-outs in that format.

FreePBX: setting up the trunk via the admin UI

Prefer working through the FreePBX web interface instead of config files? Here's how to set up the trunk:

  1. Go to Connectivity > Trunks > Add Trunk and choose Add SIP (chan_pjsip) Trunk.
  2. Give the trunk a Trunk Name, for example cheapconnect.
  3. On the pjsip Settings tab, enter your phone number and portal password under Username and Secret.
  4. For SIP Server, enter: sip.cheapconnect.net, port 5060.
  5. Enable Register String and let FreePBX build it automatically from the details above.
  1. Save the trunk with Submit, then Apply Config.
  2. Go to Connectivity > Outbound Routes and create a route with a Dial Pattern that sends 0031 numbers to this trunk (for example 0031.).
  3. Go to Connectivity > Inbound Routes and link your CheapConnect number to the destination (ring group, IVR or extension) where incoming calls should land.
  4. Test with an outgoing call to your own mobile, then call your CheapConnect number to test incoming.

Common mistakes

Using "asterisk" as the useragent

The name asterisk is reserved on our platform. If your useragent is still set to the default useragent=asterisk in sip.conf, change it to something unique, for example useragent=yournamePBX.

Registration looks fine, but incoming doesn't work

A common cause: STUN is enabled and registration isn't fully correct as a result, even though it looks registered in the logs. Check with sip show registry (chan_sip) or pjsip show registrations (PJSIP) whether the status is really "Registered", not just "Request Sent".

Firewall blocking RTP traffic

Port 5060 (UDP) needs to be open for signalling, plus an RTP port range (10000-20000 by default) for the audio itself. Allow both in your firewall and, if applicable, in your router's port forwarding.

Number not in international format

Use 31851234567, not 0851234567, as the username, fromuser, and in the register command. CheapConnect expects the international format without a plus sign.

Don't have a trunk account yet?

Create a free account. No subscription, no connection fee, you only pay call costs.

Create an account

More about the VoIP Trunk, pricing and FAQ →  |  View call costs →

Want to know more about CheapConnect?

Browse our frequently asked questions or contact us directly.