Skip to content

Ports and firewall ​

This page lists every connection PBXsight makes or accepts: the web UI, SIP, the tester's audio, and the optional metric sources. Read it before you open a firewall, and when a test shows timeouts or "no audio back" that look like a network problem. All defaults below come from the code (internal/config, internal/media, internal/agent) and the shipped config files.

First step: open the ports in the full table on the firewall between the tester and the PBX before your first test.

The full table ​

"Tester" is the machine PBXsight runs on. "Entry point" is the profile's pbx.sip_host: a proxy or SBC such as Kamailio, or FreeSWITCH itself.

From → toProtocolPort (default)Configured byNeeded when
Browser → tester (web UI, API, WebSocket /ws)TCP, HTTP or HTTPS8080server.listen; HTTPS on the same port with server.tls.enabledalways
Tester → entry point (SIP)UDP, TCP or TLS5060 (pbx.sip_port default); 5061 is usual for TLSprofile: pbx.sip_port, pbx.transportevery load test
Entry point → tester (SIP requests to a test phone over UDP)UDPthe phone's own local port (random, one per test extension)nothing to set: the port in the phone's ContactUDP transport only (see SIP)
Tester → media relay / FreeSWITCH (audio out)UDP (RTP/SRTP + RTCP)the remote's port from the SDP answerthe relay's own port rangemedia mode rtp or srtp
Relay / FreeSWITCH → tester (audio back)UDP (RTP/SRTP + RTCP)16000–16015tester.media_port, tester.media_sockets, tester.rtcpmedia mode rtp or srtp
Tester → WebSocket listener (web clients' SIP)TCP, WS or WSSthe port in each webrtc.ws_urls entry (no default; 443 / 80 when the URL has none)profile: webrtc.ws_urlsweb clients
Relay ↔ tester (web clients' audio: ICE, DTLS, SRTP + RTCP muxed)UDPone random ephemeral port per web-client call leg, on the tester's media IPnothing to setweb clients
Tester → STUN serverUDPthe port in webrtc.stun (usually 3478)profile: webrtc.stunSTUN set
Tester → FreeSWITCH (Event Socket)TCP8021profile: esl.host, esl.portESL enabled (default on)
Tester → each Kamailio (JSON-RPC over HTTP)TCP, HTTP(S)your choice: a Kamailio TCP listener, e.g. http://10.0.0.5:5060/RPCprofile: kamailio.urlsKamailio source enabled
Tester → each pbxsight-agentTCP, HTTP(S)no built-in default; the example config uses 9310agent: listen; app: rtpengine.urlsrtpengine source enabled
pbxsight-agent → rtpengine listen-ngUDP, on the same hostno built-in default; the example uses 127.0.0.1:2223agent: rtpengine.ng (must equal rtpengine's listen-ng)agent installed
pbxsight-agent → rtpengine listen-httpTCP, on the same hostno built-in default; the example uses localhost:2225agent: rtpengine.httpagent installed (for /metrics)
Tester → SMTP server (e-mail alerts)TCP587 (STARTTLS), 465 (implicit TLS) or 25 (plain)Settings → E-mail alertse-mail alerts set up
Tester → licence server (licence.pbxsight.com)TCP, HTTPS443license.server_url; a proxy via HTTPS_PROXY / NO_PROXYonline licence keys: at start, then once a day (see Licence)
Tester → DNSUDP/TCP 53system resolverOSwhen pbx.sip_host is a host name

Nothing listens for SIP on a fixed port

The tester is a SIP client only. It never binds 5060 or 5061 locally; each test extension (each virtual phone) opens its own socket from a random local port. That is why two PBXsight instances on one machine don't clash over SIP, only over the web port and the media ports.

Web UI ​

Installserver.listenReachable from
Plain binary (archive, macOS), no config127.0.0.1:8080this machine only
.deb / .rpm package (/etc/pbxsight/config.yaml)0.0.0.0:8080the network
Docker image (uses the package's config, host networking)0.0.0.0:8080the network
  • HTTP and HTTPS share the one port. There is no second port and no redirect from HTTP to HTTPS: with server.tls.enabled: true the port speaks HTTPS only.
  • The WebSocket /ws (live updates every second) is on the same port. A reverse proxy must pass WebSocket upgrades.
  • Everyone logs in, also on 127.0.0.1. Listening on the network without HTTPS makes the app log a warning, because passwords and session cookies then cross the network as plain text. See HTTPS and remote access.
  • The UI answers only under localhost, an IP address, or a name in server.allowed_hosts (a guard against DNS rebinding). Opening it under another host name gives host … not allowed (add it to server.allowed_hosts).

SIP ​

The tester sends SIP to one address and port per run: pbx.sip_host resolved to IPv4 addresses when the test starts, one of them picked (random, or the one chosen in the New test form), and pbx.sip_port.

  • TLS and TCP: every test extension holds one connection for the whole run, opened by the tester, like a desk phone. All SIP for that extension, including INVITEs from the PBX to a virtual phone, BYEs and OPTIONS pings, travels inside that connection. No inbound rule is needed on the tester. The entry point sees one connection per registered test extension: raise its connection limits for large tests (Kamailio: tcp_max_connections, tls_max_connections). CRLF keepalives every 25 s keep idle connections open.
  • UDP: every test extension has its own UDP socket (random local port), advertised in its Contact. Responses to the tester's requests come back to that port, which any stateful firewall allows. But the PBX also sends new requests to that port: INVITEs to the callee phones (calls between test extensions, busy hour), OPTIONS pings, BYEs from the far end. Over UDP the virtual phones send no keepalives and re-register only at about 90 % of the expiry (callee phones: 300 s; caller phones: 3600 s), so a firewall's UDP state (Linux conntrack: typically 30–180 s) can expire between REGISTERs and the next INVITE is dropped. When you test over UDP, allow UDP from the entry point's address to the tester (any port), or use TCP/TLS.
  • The TLS server certificate is not verified and no client certificate is sent.

Web clients (WebSocket) ​

Web clients send SIP over WebSocket to webrtc.ws_urls (round-robin over several): one TCP (WS) or TLS (WSS) connection per web client, opened by the tester and kept for the whole run with CRLF keepalives. INVITEs to a web client come back inside its connection, so, as for TLS, no inbound rule is needed for their SIP. The WSS certificate is not verified.

Tester media ports (RTP, SRTP, RTCP) ​

The media engine runs only when the profile's media mode is rtp or srtp (none sends no audio and binds no media port). There are up to two engines per run:

  • the callers' engine, used by every call test with audio, and
  • the phones' engine, used only when the tester also answers calls: calls between test extensions, busy hour, and find the limit with test extensions.

Each engine opens tester.media_sockets UDP sockets (default 4, maximum 32). Socket i uses RTP port base + 2i and, with tester.rtcp: true (default), RTCP on the next port up. Each call is put on one socket (a hash of its Call-ID).

callers' engine: RTP = media_port + 2i, RTCP = media_port + 2i + 1, for i = 0 … n − 1
phones' engine: first RTP port = media_port + 2n (then the same pattern)
whole range: media_port … media_port + 4n − 1   (n = media_sockets)
Worked example: the defaults (media_port 16000, media_sockets 4, rtcp on)
EngineRTPRTCP
Callers16000, 16002, 16004, 1600616001, 16003, 16005, 16007
Phones16008, 16010, 16012, 1601416009, 16011, 16013, 16015

Open UDP 16000–16015 inbound. With media_sockets: 1 it shrinks to 16000–16003 (callers 16000/16001, phones 16002/16003). With media_port: 20000 and media_sockets: 8 it is 20000–20031.

  • These ports must accept the audio coming back from the media relay (rtpengine) or from FreeSWITCH. Most firewalls let it through as "related" traffic once the tester has sent the first packet, because the tester sends from the same port it receives on (symmetric RTP). An explicit rule is still safer: the far end may start sending before the tester's first packet arrives, and the virtual phones receive audio from ports they never sent to first.
  • The tester sends RTCP from RTP port + 1 to the remote's RTP port + 1; it does not offer rtcp-mux.
  • The audio leaves for the port the remote put in its SDP answer: the relay's or FreeSWITCH's own RTP range (FreeSWITCH's default in switch.conf.xml is 16384–32768; rtpengine uses its port-min/port-max). Outbound UDP to that range must be allowed.
  • Web clients don't use these ports. Each web-client call leg has its own ICE agent on one random ephemeral UDP port of the media IP (ICE checks, DTLS, SRTP and RTCP all on that one port, rtcp-mux). The relay sends ICE checks to the candidates in the tester's SDP, and the tester's checks open the way back through a stateful firewall. When the tester has a strict default-deny input policy, allow UDP from the media relay's address to the ephemeral range (Linux: net.ipv4.ip_local_port_range, typically 32768–60999).
  • bind media socket … address already in use at start means another program holds one of these ports: change tester.media_port.
  • The packaged config (/etc/pbxsight/config.yaml) carries a reminder: media_port: 16000 # RTP/RTCP ports 16000-16015 (UDP): open them in a host firewall.

Event Socket (ESL) ​

The tester connects to FreeSWITCH's mod_event_socket on esl.host:esl.port (default port 8021, password default ClueCon — change both on the FreeSWITCH side). Directly, never through Kamailio. FreeSWITCH must listen on an address the tester reaches (listen-ip not 127.0.0.1) and allow the tester in apply-inbound-acl; see ESL access.

Never expose ESL to the internet

ESL gives full control over FreeSWITCH (originate calls, run commands). Allow TCP 8021 from the tester's address or VPN pool only.

Kamailio JSON-RPC ​

Optional. Each URL in kamailio.urls is polled over HTTP (stats.fetch, core.uptime, core.version, tls.info). Kamailio's xhttp module answers HTTP on Kamailio's own TCP SIP listeners, so the port is one of those (for example listen=tcp:10.0.0.5:5060 → http://10.0.0.5:5060/RPC). Use a listener on a private or VPN address and restrict the RPC route to the tester's network in the routing script; see Kamailio.

pbxsight-agent and rtpengine ​

Optional. One pbxsight-agent runs on each rtpengine host and serves rtpengine's statistics read-only over HTTP:

  • App → agent: TCP to the agent's listen address (required in its config; the example uses 10.0.0.10:9310). Requests need Authorization: Bearer <token>; addresses outside the agent's allow list get 403 before the token is checked. Put the agent on a private address — don't use 0.0.0.0 on a host with a public interface.
  • Agent → rtpengine: rtpengine.ng (UDP, rtpengine's listen-ng, example 127.0.0.1:2223) and rtpengine.http (TCP, rtpengine's listen-http, example localhost:2225). Both stay on localhost: the tester never talks to rtpengine directly, and the agent only ever sends the ng commands ping, statistics, list and query.

See rtpengine and the agent.

Firewall examples ​

Replace the example addresses: tester 10.0.0.50, team network 10.8.0.0/24, SIP entry point 203.0.113.10, media relay 203.0.113.20. Rules assume a default-deny input policy with established/related traffic already allowed (the distributions' defaults do that).

Tester host ​

sh
# /etc/nftables.conf, inside: table inet filter { chain input { ... } }
ip saddr 10.8.0.0/24 tcp dport 8080 accept                 # web UI for the team
ip saddr 203.0.113.20 udp dport 16000-16015 accept         # audio back from the relay
ip saddr 203.0.113.10 udp accept                           # only when testing over UDP SIP
sh
sudo ufw allow from 10.8.0.0/24 to any port 8080 proto tcp
sudo ufw allow from 203.0.113.20 to any port 16000:16015 proto udp
sudo ufw allow from 203.0.113.10 proto udp                 # only when testing over UDP SIP
sh
sudo firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=10.8.0.0/24 port port=8080 protocol=tcp accept'
sudo firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=203.0.113.20 port port=16000-16015 protocol=udp accept'
sudo firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=203.0.113.10 protocol value=udp accept'   # UDP SIP only
sudo firewall-cmd --reload

If FreeSWITCH sends the audio itself (no relay), use FreeSWITCH's media address instead of the relay's. If you don't know which addresses send audio, the run page's Media path card shows the relay address the PBX answered with.

FreeSWITCH host (ESL) ​

sh
ip saddr 10.0.0.50 tcp dport 8021 accept
sh
sudo ufw allow from 10.0.0.50 to any port 8021 proto tcp
sh
sudo firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=10.0.0.50 port port=8021 protocol=tcp accept'
sudo firewall-cmd --reload

The firewall and FreeSWITCH's apply-inbound-acl are two separate gates; both must allow the tester. If the tester connects over a VPN whose client addresses change, allow the VPN's client pool, not one address.

rtpengine host (agent) ​

sh
ip saddr 10.0.0.50 tcp dport 9310 accept
sh
sudo ufw allow from 10.0.0.50 to any port 9310 proto tcp
sh
sudo firewall-cmd --permanent --add-rich-rule='rule family=ipv4 source address=10.0.0.50 port port=9310 protocol=tcp accept'
sudo firewall-cmd --reload

rtpengine's listen-ng and listen-http need no rule: keep them on 127.0.0.1. For Kamailio, allow the tester to the TCP listener used in kamailio.urls in the same way.

NAT ​

  • Tester behind NAT, TLS or TCP: fine for signaling — all SIP rides on connections the tester opened. The Via/Contact carry the tester's local address (tester.local_ip, or the interface that routes to the entry point); a proxy that does NAT handling uses the connection instead.
  • Tester behind NAT, UDP: replies work, but requests from the PBX to the virtual phones need the NAT mapping to stay open (see SIP). Prefer TLS/TCP, or test from a host without NAT.
  • Audio through NAT: the SDP c= line carries tester.media_ip (else the SIP address). A relay such as rtpengine that learns the real address from the first packets it receives (symmetric RTP / latching) works through NAT. A media server that strictly sends to the SDP address needs the tester's reachable address in media from (tester.media_ip), or a port forward for the media range.
  • SIP and media on different paths (SIP to a public proxy, RTP over a VPN): set media from to the VPN address.
  • Docker: run the image with host networking (the shipped compose.yaml does). Published ports put NAT between the tester and the PBX: wrong addresses in SIP and SDP, unreachable phones, and a changed audio delay. Docker Desktop on macOS/Windows always has a VM's NAT in between; use the native binary there.

PBXsight — load testing and monitoring for FreeSWITCH PBXes. Only test systems you own or may test.