Asterisk SIP Trunking

Configure your Asterisk PBX to connect with IPComms SIP trunking services using PJSIP or chan_sip.

On This Page

1 Connection Details

Use the following settings to configure your Asterisk trunk. Find your credentials in the IPComms Portal under SIP Trunking.

Setting Standard SIP TLS/SRTP
SIP Server [subdomain].s1.ipcomms.net [subdomain].s1.ipcomms.net
Port 5060 (UDP) 5061 (TCP/TLS)
Username [Your Trunk Username]
Password [Your Trunk Password]
Auth Username [Same as Username]
Outbound Proxy [subdomain].s1.ipcomms.net
Codecs G.711 (ulaw/alaw), G.729
DTMF Mode RFC 2833

Note: Replace [subdomain] with your assigned subdomain from the portal (e.g., abc1234.s1.ipcomms.net).

2 PJSIP Configuration

PJSIP is the recommended SIP channel driver for Asterisk 13+. Add the following to your pjsip.conf file:

Standard SIP (UDP Port 5060)

; ============================================
; IPComms SIP Trunk - PJSIP Configuration
; File: /etc/asterisk/pjsip.conf
; ============================================

; Transport for standard SIP
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060

; IPComms Trunk Registration
[ipcomms]
type=registration
transport=transport-udp
outbound_auth=ipcomms-auth
server_uri=sip:YOUR_SUBDOMAIN.s1.ipcomms.net
client_uri=sip:YOUR_USERNAME@YOUR_SUBDOMAIN.s1.ipcomms.net
contact_user=YOUR_USERNAME
retry_interval=60
forbidden_retry_interval=600
expiration=3600

; Authentication
[ipcomms-auth]
type=auth
auth_type=userpass
username=YOUR_USERNAME
password=YOUR_PASSWORD

; AOR (Address of Record)
[ipcomms-aor]
type=aor
contact=sip:YOUR_SUBDOMAIN.s1.ipcomms.net:5060
qualify_frequency=60
qualify_timeout=5.0

; Endpoint Configuration
[ipcomms-endpoint]
type=endpoint
transport=transport-udp
context=from-ipcomms
disallow=all
allow=ulaw
allow=alaw
allow=g729
outbound_auth=ipcomms-auth
aors=ipcomms-aor
direct_media=no
dtmf_mode=rfc4733
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
from_domain=YOUR_SUBDOMAIN.s1.ipcomms.net
from_user=YOUR_USERNAME

; Identify incoming calls from IPComms
[ipcomms-identify]
type=identify
endpoint=ipcomms-endpoint
match=YOUR_SUBDOMAIN.s1.ipcomms.net

Replace the following values:
YOUR_SUBDOMAIN - Your IPComms subdomain (e.g., abc1234)
YOUR_USERNAME - Your trunk username from the portal
YOUR_PASSWORD - Your trunk password from the portal

3 chan_sip Configuration (Legacy)

Note: chan_sip is deprecated in newer versions of Asterisk. We recommend using PJSIP for new installations. This configuration is provided for legacy systems.

Add the following to your sip.conf file:

Standard SIP (UDP Port 5060)

; ============================================
; IPComms SIP Trunk - chan_sip Configuration
; File: /etc/asterisk/sip.conf
; ============================================

; General Settings (add to [general] section)
[general]
register => YOUR_USERNAME:YOUR_PASSWORD@YOUR_SUBDOMAIN.s1.ipcomms.net/YOUR_USERNAME

; IPComms Trunk Definition
[ipcomms]
type=peer
host=YOUR_SUBDOMAIN.s1.ipcomms.net
port=5060
username=YOUR_USERNAME
secret=YOUR_PASSWORD
fromuser=YOUR_USERNAME
fromdomain=YOUR_SUBDOMAIN.s1.ipcomms.net
context=from-ipcomms
insecure=port,invite
qualify=yes
qualifyfreq=60
disallow=all
allow=ulaw
allow=alaw
allow=g729
dtmfmode=rfc2833
nat=force_rport,comedia
canreinvite=no
directmedia=no
trustrpid=yes
sendrpid=yes

4 TLS/SRTP Secure Configuration

For encrypted calls, use TLS for signaling and SRTP for media encryption.

PJSIP with TLS (Port 5061)

; ============================================
; IPComms SIP Trunk - PJSIP TLS Configuration
; File: /etc/asterisk/pjsip.conf
; ============================================

; TLS Transport
[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0:5061
cert_file=/etc/asterisk/keys/asterisk.pem
ca_list_file=/etc/asterisk/keys/ca.crt
method=tlsv1_2
verify_server=no

; IPComms TLS Trunk Registration
[ipcomms-tls]
type=registration
transport=transport-tls
outbound_auth=ipcomms-auth
server_uri=sips:YOUR_SUBDOMAIN.s1.ipcomms.net:5061
client_uri=sips:YOUR_USERNAME@YOUR_SUBDOMAIN.s1.ipcomms.net:5061
contact_user=YOUR_USERNAME
retry_interval=60
expiration=3600

; Authentication (same as standard)
[ipcomms-auth]
type=auth
auth_type=userpass
username=YOUR_USERNAME
password=YOUR_PASSWORD

; TLS AOR
[ipcomms-aor-tls]
type=aor
contact=sips:YOUR_SUBDOMAIN.s1.ipcomms.net:5061
qualify_frequency=60
qualify_timeout=5.0

; TLS Endpoint with SRTP
[ipcomms-endpoint-tls]
type=endpoint
transport=transport-tls
context=from-ipcomms
disallow=all
allow=ulaw
allow=alaw
allow=g729
outbound_auth=ipcomms-auth
aors=ipcomms-aor-tls
direct_media=no
dtmf_mode=rfc4733
rtp_symmetric=yes
force_rport=yes
rewrite_contact=yes
from_domain=YOUR_SUBDOMAIN.s1.ipcomms.net
from_user=YOUR_USERNAME
media_encryption=sdes
media_encryption_optimistic=yes

; Identify for TLS
[ipcomms-identify-tls]
type=identify
endpoint=ipcomms-endpoint-tls
match=YOUR_SUBDOMAIN.s1.ipcomms.net

chan_sip with TLS (Port 5061)

; ============================================
; IPComms SIP Trunk - chan_sip TLS Configuration
; File: /etc/asterisk/sip.conf
; ============================================

; General Settings (add to [general] section)
[general]
tlsenable=yes
tlsbindaddr=0.0.0.0:5061
tlscertfile=/etc/asterisk/keys/asterisk.pem
tlscafile=/etc/asterisk/keys/ca.crt
tlscipher=ALL
tlsclientmethod=tlsv1_2

register => tls://YOUR_USERNAME:YOUR_PASSWORD@YOUR_SUBDOMAIN.s1.ipcomms.net:5061/YOUR_USERNAME

; IPComms TLS Trunk Definition
[ipcomms-tls]
type=peer
host=YOUR_SUBDOMAIN.s1.ipcomms.net
port=5061
transport=tls
username=YOUR_USERNAME
secret=YOUR_PASSWORD
fromuser=YOUR_USERNAME
fromdomain=YOUR_SUBDOMAIN.s1.ipcomms.net
context=from-ipcomms
insecure=port,invite
qualify=yes
disallow=all
allow=ulaw
allow=alaw
dtmfmode=rfc2833
nat=force_rport,comedia
directmedia=no
encryption=yes

5 Dialplan Examples (E.164 Format)

IPComms uses E.164 format for phone numbers. Outbound calls should be sent as +1NPANXXXXXX (e.g., +14045551234).

Outbound Dialplan (extensions.conf)

; ============================================
; IPComms Dialplan - Outbound Calls
; File: /etc/asterisk/extensions.conf
; ============================================

[outbound-ipcomms]
; North American Dialing (NANP) - 10/11 digit calls
; Converts to E.164 format (+1NPANXXXXXX)

; 11-digit dialing (1NPANXXXXXX -> +1NPANXXXXXX)
exten => _1NXXNXXXXXX,1,NoOp(Outbound call to ${EXTEN})
same => n,Set(CALLERID(num)=+1YOUR_DID_NUMBER)
same => n,Dial(PJSIP/+${EXTEN}@ipcomms-endpoint,60)
same => n,Hangup()

; 10-digit dialing (NPANXXXXXX -> +1NPANXXXXXX)
exten => _NXXNXXXXXX,1,NoOp(Outbound call to ${EXTEN})
same => n,Set(CALLERID(num)=+1YOUR_DID_NUMBER)
same => n,Dial(PJSIP/+1${EXTEN}@ipcomms-endpoint,60)
same => n,Hangup()

; 7-digit local dialing (NXXXXXX -> +1AREACODENXXXXXX)
; Replace AREACODE with your local area code
exten => _NXXXXXX,1,NoOp(Local call to ${EXTEN})
same => n,Set(CALLERID(num)=+1YOUR_DID_NUMBER)
same => n,Dial(PJSIP/+1AREACODE${EXTEN}@ipcomms-endpoint,60)
same => n,Hangup()

; Toll-Free Numbers (800, 888, 877, 866, 855, 844, 833)
exten => _1800NXXXXXX,1,Dial(PJSIP/+${EXTEN}@ipcomms-endpoint,60)
exten => _1888NXXXXXX,1,Dial(PJSIP/+${EXTEN}@ipcomms-endpoint,60)
exten => _1877NXXXXXX,1,Dial(PJSIP/+${EXTEN}@ipcomms-endpoint,60)
exten => _1866NXXXXXX,1,Dial(PJSIP/+${EXTEN}@ipcomms-endpoint,60)
exten => _1855NXXXXXX,1,Dial(PJSIP/+${EXTEN}@ipcomms-endpoint,60)
exten => _1844NXXXXXX,1,Dial(PJSIP/+${EXTEN}@ipcomms-endpoint,60)
exten => _1833NXXXXXX,1,Dial(PJSIP/+${EXTEN}@ipcomms-endpoint,60)

; Emergency Services (911)
; IMPORTANT: Ensure E911 is properly configured!
exten => 911,1,NoOp(Emergency Call)
same => n,Dial(PJSIP/911@ipcomms-endpoint,60)
same => n,Hangup()

; International Dialing (011 + Country Code + Number)
exten => _011.,1,NoOp(International call to ${EXTEN})
same => n,Set(INTL_NUM=${EXTEN:3})
same => n,Dial(PJSIP/+${INTL_NUM}@ipcomms-endpoint,120)
same => n,Hangup()

Inbound Dialplan

; ============================================
; IPComms Dialplan - Inbound Calls
; File: /etc/asterisk/extensions.conf
; ============================================

[from-ipcomms]
; Context for incoming calls from IPComms trunk

; Handle incoming calls to your DID
; Replace +1YOURDIDNUMBER with your actual DID in E.164 format
exten => +14045551234,1,NoOp(Incoming call from ${CALLERID(num)})
same => n,Set(CDR(accountcode)=ipcomms-inbound)
same => n,Goto(ivr-main,s,1)

; Alternative: Route all incoming to a default extension
exten => _+1NXXNXXXXXX,1,NoOp(Incoming call to ${EXTEN})
same => n,Answer()
same => n,Dial(PJSIP/100,30)
same => n,Voicemail(100@default,u)
same => n,Hangup()

; Catch-all for any unmatched inbound
exten => _.,1,NoOp(Unmatched inbound: ${EXTEN})
same => n,Answer()
same => n,Playback(invalid)
same => n,Hangup()

chan_sip Dialplan Alternative

; For chan_sip users, replace PJSIP with SIP:

; Outbound
exten => _1NXXNXXXXXX,1,Dial(SIP/+${EXTEN}@ipcomms,60)
exten => _NXXNXXXXXX,1,Dial(SIP/+1${EXTEN}@ipcomms,60)

; For TLS trunk
exten => _1NXXNXXXXXX,1,Dial(SIP/+${EXTEN}@ipcomms-tls,60)

E.164 Format Reference

User Dials Sent to IPComms Description
4045551234 +14045551234 10-digit NANP
14045551234 +14045551234 11-digit with leading 1
5551234 +14045551234 7-digit local (prepend +1+areacode)
18005551234 +18005551234 Toll-Free
01144207946xxxx +44207946xxxx International (UK)

6 Troubleshooting

Registration Failed

  • Verify username and password are correct
  • Check that the subdomain matches your portal assignment
  • Ensure UDP port 5060 (or TCP 5061 for TLS) is not blocked
  • Check asterisk -rx "pjsip show registrations"

No Audio (One-Way or No Audio)

  • Ensure direct_media=no is set
  • Enable rtp_symmetric=yes and force_rport=yes
  • Check RTP port range is open (10000-20000 UDP typically)
  • Verify NAT settings if behind a firewall

TLS Connection Issues

  • Ensure certificate files exist and are readable
  • Check tlsv1_2 is supported
  • Verify port 5061 TCP is open
  • Test with openssl s_client -connect YOUR_SUBDOMAIN.s1.ipcomms.net:5061

Calls Not Going Through

  • Check dialplan syntax with asterisk -rx "dialplan show outbound-ipcomms"
  • Verify E.164 format (+1NPANXXXXXX) is being sent
  • Check /var/log/asterisk/full for SIP errors
  • Ensure your account has sufficient balance

Useful CLI Commands

# Check PJSIP registration status
asterisk -rx "pjsip show registrations"

# Check endpoint status
asterisk -rx "pjsip show endpoint ipcomms-endpoint"

# Enable SIP debugging
asterisk -rx "pjsip set logger on"

# Check active channels
asterisk -rx "core show channels"

# Reload PJSIP configuration
asterisk -rx "pjsip reload"

# Reload dialplan
asterisk -rx "dialplan reload"

Related Documentation

Need Help?

Our technical support team can assist with trunk configuration and troubleshooting.