AiPBX
Features Install Videos Mobile Docs Live demo Contact Sponsor on GitHub UpCloud ($250 Free Credit) YouTube GitHub
ODOO Connect AiPBX with Odoo CRM & ERP — manage calls & customers in one place. Try Odoo Free →
Home / Documentation / AiPBX Network Ports & Firewall Matrix

AiPBX Network Ports & Firewall Matrix

This document details all network ports, protocols, and access scopes required by AiPBX for VoIP signaling, RTP media, WebRTC, administration, and provisioning.


1. Complete Port Matrix

Port RangeProtocolService / PurposeDefault ScopeReverse Proxy BypassNotes
5060UDP / TCPSIP SignalingPublic / LANYESDesk phones, external trunks, softphones.
5061TCPSIP-TLS SignalingPublic / LANYESEncrypted SIP signaling over TLS.
10000–20000UDPRTP / SRTP Media StreamsPublic / LANYES2-way audio & video RTP packets. Must route directly.
80TCPHTTP Web & ProvisioningPublic / LANNOWeb portal, phone auto-provisioning, ACME HTTP-01.
443TCPHTTPS Web Portal & APIPublic / LANNOSecure web interface, REST API, WebRTC WSS upgrade, TURNS, and SIP over TLS for phone regions that use it (phones).
8089TCPAsterisk WSSLocalhost (127.0.0.1)NONot used by clients and never opened: browsers and the mobile apps use 443 /ws.
8088TCPAsterisk HTTP / WSLocalhost (127.0.0.1)NOBehind /ws of the portal. A reverse proxy connects to the portal, not to this port.
3478UDP / TCPSTUN / TURN (coturn)PublicYESNAT traversal candidate discovery & media relay.
5349TCPTURNS TLS (coturn)PublicYESEncrypted TLS TURN relay for strict networks.
51820 / 1194UDP (OpenVPN also TCP)VPN server, default ports, off by default (VPN)Public WANYESOpened only while the VPN server is on, on the port chosen on the page
69UDPTFTP Phone ProvisioningLAN onlyYESLegacy desk phone configuration and firmware.
389 / 636TCPLDAP phonebook for desk phones (StartTLS on 389, LDAPS on 636), off by default (Phonebook)LAN onlyYESRead-only. Open on the Firewall page only for the phones' network.
9061UDPHEP / Homer SIP CaptureInternal / LANYESEncapsulated SIP packet capture for monitoring.
5038TCPAMI (Asterisk Manager)Localhost (127.0.0.1)YESInternal PBX daemon management. Never expose.
3306TCPMariaDB DatabaseLocalhost (127.0.0.1)YESInternal PBX relational database. Never expose.

2. Traffic Classification & Security Zones

A. Public WAN (Internet-Facing)

If you provide remote softphone access, remote mobile app calling, or SIP trunks over the public internet:

  • Allow Inbound: 80/tcp, 443/tcp, 5060/udp,tcp, 5061/tcp, 10000:20000/udp, 3478/udp,tcp, 5349/tcp.
  • Behind Reverse Proxy: Only 80/tcp and 443/tcp go through the reverse proxy. All SIP and RTP ports (5060, 5061, 10000-20000/udp) MUST route directly to the server host.
  • Fail2ban Protection: AiPBX automatically monitors authentication attempts on SIP and Web with built-in jails.

B. Internal LAN Only

  • 69/udp (TFTP): Desk phones fetching initial bootstrap firmware. Restrict to internal voice VLANs (e.g., 192.168.10.0/24).
  • 9061/udp (HEP): Homer or Sipcapture monitoring collector. Restrict to your private monitoring subnet.

C. Localhost Only (127.0.0.1)

  • 5038/tcp (AMI): Asterisk Manager Interface credentials allow administrative execution. Bound strictly to 127.0.0.1.
  • 3306/tcp (MariaDB): Core database. Bound strictly to 127.0.0.1.

3. VoIP & NAT Routing Guidelines

1. Disable SIP ALG (Application Layer Gateway)

Router and firewall SIP ALG implementations frequently corrupt SIP packet headers, SDP payloads, and Via branches.

IMPORTANT: Disable SIP ALG, SIP Inspection, or SIP Fixup on all edge routers and firewalls.

2. RTP Port Forwarding

Ensure your edge firewall or NAT gateway forwards the entire UDP port range 10000:20000 to the AiPBX host. Asymmetrical or missing UDP forwarding causes "one-way audio" or dropped calls after 30 seconds.

3. External IP & Local Networks

On the PBX portal at PBX Settings → PJSIP & Net:

  • Set External IP Address to your public WAN IP or dynamic DNS hostname.
  • Set Local Network & VPN Subnets to your internal subnets (e.g., 192.168.1.0/24, 10.0.0.0/8). This ensures Asterisk rewrites SDP addresses correctly for public versus internal callers.

4. The Firewall page

Security → Firewall holds these rules in the portal, common to every card or per card; see Security → Firewall. The recipes below are for servers without it.


5. Production Firewall Recipes

A. UFW (Ubuntu / Debian)

# Set default policies
sudo ufw default deny incoming
sudo ufw default allow outgoing

# Management & Web
sudo ufw allow 22/tcp comment 'SSH'
sudo ufw allow 80/tcp comment 'HTTP / ACME'
sudo ufw allow 443/tcp comment 'HTTPS Portal'

# SIP Signaling
sudo ufw allow 5060/udp comment 'SIP UDP'
sudo ufw allow 5060/tcp comment 'SIP TCP'
sudo ufw allow 5061/tcp comment 'SIP-TLS'

# RTP Audio / Video Media Range
sudo ufw allow 10000:20000/udp comment 'RTP Audio Media'

# WebRTC STUN / TURNS
sudo ufw allow 3478/udp comment 'STUN / TURN UDP'
sudo ufw allow 3478/tcp comment 'STUN / TURN TCP'
sudo ufw allow 5349/tcp comment 'TURNS TLS'

# Enable firewall
sudo ufw enable

B. firewalld (RHEL / Rocky / AlmaLinux)

sudo firewall-cmd --permanent --add-service=ssh
sudo firewall-cmd --permanent --add-service=http
sudo firewall-cmd --permanent --add-service=https

sudo firewall-cmd --permanent --add-port=5060/udp
sudo firewall-cmd --permanent --add-port=5060/tcp
sudo firewall-cmd --permanent --add-port=5061/tcp
sudo firewall-cmd --permanent --add-port=10000-20000/udp
sudo firewall-cmd --permanent --add-port=3478/udp
sudo firewall-cmd --permanent --add-port=3478/tcp
sudo firewall-cmd --permanent --add-port=5349/tcp

sudo firewall-cmd --reload

C. AWS / Cloud Security Group Rules

TypeProtocolPort RangeSourceDescription
SSHTCP22Admin IP / BastionManagement
HTTPTCP800.0.0.0/0Portal & Auto-Provisioning
HTTPSTCP4430.0.0.0/0Encrypted Web Portal
Custom UDPUDP50600.0.0.0/0 or Trunk IPSIP Signaling
Custom TCPTCP5060–50610.0.0.0/0 or Trunk IPSIP / SIP-TLS
Custom UDPUDP10000–200000.0.0.0/0RTP Two-Way Voice Streams
Custom UDP/TCPUDP/TCP34780.0.0.0/0STUN / TURN NAT Relay
Custom TCPTCP53490.0.0.0/0TURNS TLS Relay

View or edit this page on GitHub

On This Page