Pjsip Ip Acl

Security -- Last reviewed 2026-08-22 security pjsip acl beginner Found this useful? Upvote it. ×

PJSIP IP ACL

Restrict which IP addresses can register or send calls through your Asterisk system using PJSIPThe modern SIP channel driver in Asterisk (chan_pjsip), replacing the older chan_sip. Configured in pjsip.conf using endpoints, AORs, auths, and transports. ACLs. This is a first line of defence against SIPSession Initiation Protocol, the standard signaling protocol used to set up, manage, and tear down VoIP calls between Asterisk and phones or carriers. scanning and brute-force registration attacks.

Requirements

Configuration

acl.conf

[trusted-networks]
deny=0.0.0.0/0.0.0.0
permit=10.0.0.0/255.0.0.0
permit=172.16.0.0/255.240.0.0
permit=192.168.0.0/255.255.0.0
; Add your SIP trunk provider IPs here
permit=203.0.113.50/255.255.255.255

pjsip.conf: apply the ACL to a transport or endpoint

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

[my-endpoint]
type=endpoint
; ... other endpoint settings ...
acl=trusted-networks

How it works

  1. Deny all: The deny=0.0.0.0/0.0.0.0 rule blocks every source IP by default.
  2. Permit trusted ranges: Subsequent permit lines whitelist your LAN subnets and SIP trunkA connection between Asterisk and another PBX or an ITSP/carrier, used to send and receive external calls. provider addresses.
  3. ACL binding: Setting acl=trusted-networks on an endpointIn PJSIP configuration, the SIP entity Asterisk communicates with: a phone, trunk, or other user agent. Defined by an endpoint section in pjsip.conf. (or transport) causes Asterisk to drop SIP packets from non-permitted sources before authentication is even attempted.

Tips

User Notes

Know a tip or gotcha for this topic? Share it below and help others.

Contribute a note

Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.

Moderated before publishing. Email never shown.
Related Snippets