PJSIP is the modern SIP channel driver for Asterisk, replacing the legacy chan_sip. This guide explains every PJSIP object type with practical configuration examples.
Unlike the legacy chan_sip which used a single configuration block per peer, PJSIP uses a modular design with multiple object types that work together. This can seem complex at first, but it provides much more flexibility and clarity.
PJSIP uses six main object types:
Transport
Defines how SIP messages are sent (UDP, TCP, TLS, WebSocket)
Endpoint
Represents a SIP device or trunk - the core configuration object
AOR
Address of Record - where a device can be reached
Auth
Authentication credentials (username/password)
Identify
Matches inbound traffic to an endpoint by IP
Registration
Registers Asterisk to an external SIP server
Transports
Transports define the network protocol and port for SIP communication. You need at least one, and most systems define UDP and optionally TLS:
pjsip.conf - Transports
; UDP transport (standard SIP)
[transport-udp]
type=transport
protocol=udp
bind=0.0.0.0:5060
; NAT settings - set to your public IP
external_media_address=YOUR_PUBLIC_IP
external_signaling_address=YOUR_PUBLIC_IP
local_net=10.0.0.0/8
local_net=172.16.0.0/12
local_net=192.168.0.0/16
; TLS transport (encrypted SIP)
[transport-tls]
type=transport
protocol=tls
bind=0.0.0.0:5061
cert_file=/etc/asterisk/keys/asterisk.crt
priv_key_file=/etc/asterisk/keys/asterisk.key
method=tlsv1_2
Endpoints
Endpoints are the central PJSIP object. Every SIP phone, softphone, or trunk is an endpoint. They reference other objects (AOR, auth) and define media settings:
AORs define where a device can be reached and how many simultaneous registrations are allowed:
pjsip.conf - AOR for phone
; AOR for extension 100 (phone registers to Asterisk)
[100]
type=aor
max_contacts=1
remove_existing=yes
qualify_frequency=60
; AOR for a trunk (static contact, no registration)
[ipcomms]
type=aor
contact=sip:sip.ipcomms.net:5060
qualify_frequency=60
max_contacts - How many devices can register with this AOR simultaneously
remove_existing - Remove old registrations when max is exceeded (avoids ghost registrations)
qualify_frequency - Send OPTIONS pings every N seconds to check if the device is reachable
contact - Static contact URI for trunks that do not register to your system
Authentication
Auth objects store credentials for inbound authentication (phones registering to Asterisk) and outbound authentication (Asterisk registering to a trunk provider):
Identify objects match inbound SIP traffic to an endpoint based on the source IP address. This is essential for trunks using IP authentication where there is no REGISTER to identify the source:
pjsip.conf - Identify
; Match inbound calls from IPComms to the ipcomms endpoint
[ipcomms-identify]
type=identify
endpoint=ipcomms
match=34.23.59.14
Without an identify section, Asterisk will not know which endpoint to associate with inbound INVITE requests from your SIP trunk provider. The call will be rejected.
Registration
Registration objects tell Asterisk to register with an external SIP server. This is needed when your trunk provider uses digest authentication:
; Show all endpoints and their status
pjsip show endpoints
; Show specific endpoint details
pjsip show endpoint 100
; Show all registrations
pjsip show registrations
; Show AOR contacts (who is registered)
pjsip show aors
; Show transport status
pjsip show transports
; Enable SIP debugging
pjsip set logger on
; Reload PJSIP config (NOT transports)
pjsip reload
Need a SIP Trunk for Your Asterisk System?
IPComms provides reliable SIP trunking optimized for Asterisk PJSIP. IP authentication, no contracts, and VoIP engineers on support.