// integration · asterisk

Asterisk SIP trunk setup for non-CLI termination

A working Asterisk SIP trunk against non-cli.site in under 10 minutes. Copy the two config blocks below, swap in your credentials, reload PJSIP, and you're passing calls.

Before you start

  • • Asterisk 18+ with chan_pjsip enabled.
  • • A funded balance on non-cli.site and an ordered trunk (you'll get user/secret + host).
  • • Your softswitch's public IP whitelisted on the order form.

1. pjsip.conf

; /etc/asterisk/pjsip.conf — non-cli.site trunk
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060

[noncli-trunk]
type=endpoint
context=from-noncli
disallow=all
allow=alaw
allow=ulaw
allow=g729
direct_media=no
rtp_symmetric=yes
force_rport=yes
from_user=YOUR_TRUNK_USER
from_domain=sip.non-cli.site
aors=noncli-trunk
outbound_auth=noncli-auth

[noncli-auth]
type=auth
auth_type=userpass
username=YOUR_TRUNK_USER
password=YOUR_TRUNK_SECRET

[noncli-trunk]
type=aor
contact=sip:sip.non-cli.site:5060

[noncli-identify]
type=identify
endpoint=noncli-trunk
match=sip.non-cli.site

2. extensions.conf

Randomise the CLI per call — standard practice on non-CLI routes to avoid duplicate-CLI filters upstream.

; /etc/asterisk/extensions.conf
[from-internal]
exten => _X.,1,NoOp(Outbound via non-cli.site)
 same => n,Set(CALLERID(num)=${RAND(1000000000,9999999999)})
 same => n,Dial(PJSIP/${EXTEN}@noncli-trunk,60,tT)
 same => n,Hangup()

3. Reload and test

asterisk -rx "pjsip reload"
asterisk -rx "pjsip show endpoint noncli-trunk"
asterisk -rx "channel originate PJSIP/14155551212@noncli-trunk application Echo"

Common issues

  • 403 Forbidden — your public IP isn't whitelisted on the trunk. Update the order and wait 60s.
  • One-way audio — NAT. Set rtp_symmetric=yes, force_rport=yes, direct_media=no (already in the config above).
  • Codec mismatch — some destinations only accept alaw. Keep both G711 codecs enabled.

Need FreeSWITCH or a different softswitch?

Same trunk credentials work everywhere SIP does. Full guides in the knowledge base.