Appearance
ESL access
PBXsight reads FreeSWITCH's Event Socket (ESL) to see the PBX side of every test: registrations, channels, hangup causes, FreeSWITCH's own MOS, CPU idle, setup timing inside FreeSWITCH. This page shows how to let the tester in — and only the tester — and how to read the error hints when it doesn't connect. ESL is optional: everything here can wait until your first registration test works.
First step: open event_socket.conf.xml on the FreeSWITCH server (step 1).
What PBXsight does over ESL
It opens one TCP connection per PBX profile to FreeSWITCH (directly, not through Kamailio or an SBC), authenticates with the ESL password and then:
- polls
show calls count,show channels count,show registrations countandstatusevery Poll interval (during runs) (default 1 s) and every Poll interval (idle) (default 5 s) otherwise; during call tests and watches with the stuck-call check alsoshow channels as jsonevery 5 s; - subscribes to
CHANNEL_CREATE,CHANNEL_ANSWER,CHANNEL_HANGUP_COMPLETE,HEARTBEATand the custom eventssofia::register,sofia::unregister,sofia::expire,sofia::register_failure.
It never runs a command that changes anything (no originate, no uuid_kill; the stuck-call card only shows a uuid_kill line for you to copy). The ESL password itself still allows full control, though, which is why access must be locked down as below.
When the connection fails, it retries with exponential backoff from 1 s up to 30 s (±20 % jitter, so a restarted FreeSWITCH isn't hit by every client at once). A connect attempt times out after 5 s.
1. Let ESL listen: event_socket.conf.xml
On the FreeSWITCH host, autoload_configs/event_socket.conf.xml (Debian package installs: /etc/freeswitch/autoload_configs/):
xml
<configuration name="event_socket.conf" description="Socket Client">
<settings>
<param name="nat-map" value="false"/>
<param name="listen-ip" value="0.0.0.0"/> <!-- or the LAN/VPN-facing IP; not 127.0.0.1 -->
<param name="listen-port" value="8021"/>
<param name="password" value="use-a-long-secret"/> <!-- not ClueCon -->
<param name="apply-inbound-acl" value="pbxsight"/>
</settings>
</configuration>listen-ip: many installs listen on127.0.0.1only, which refuses every remote client. Use the address of the interface the tester reaches (or0.0.0.0/::together with the ACL and firewall below).password: change the defaultClueCon. Other local tools that use ESL (for example a management GUI on the same host) need the new password too.apply-inbound-acl: the name of an ACL list (next step). Without it, any address that reaches the port may try passwords.
2. Allow only the tester: the ACL list
Edit autoload_configs/acl.conf.xml (or the access-control page of your management GUI, if it writes that file) and add a list:
xml
<list name="pbxsight" default="deny">
<node type="allow" cidr="127.0.0.1/32"/> <!-- keep: fs_cli and local tools use ESL -->
<node type="allow" cidr="10.8.0.0/24"/> <!-- the network the tester connects from -->
</list>Keep 127.0.0.1/32: fs_cli and other local tools talk to ESL locally, and a list without it locks them out.
VPN address pools
Many VPN clients get a different address on every connection (.5 today, .2 tomorrow). Allow the VPN's whole client pool (the /24 or whatever range it hands out), not the address you have right now — otherwise ESL works today and fails tomorrow with closed the connection before authentication. Find your current VPN address (ip addr, or ifconfig | grep -A3 utun on macOS) and compare it with what FreeSWITCH logs for a rejected connection.
3. Apply the change
sh
fs_cli -x 'reloadacl' # ACL changes
fs_cli -x 'reload mod_event_socket' # listen-ip / listen-port / password changesReloading mod_event_socket drops every ESL connection, including the fs_cli session you typed it in (reconnect) and those of other local tools; they reconnect by themselves. PBXsight reconnects within its backoff.
4. Open the firewall
On the FreeSWITCH host, allow TCP 8021 from the tester's network only:
sh
ufw allow from 10.8.0.0/24 to any port 8021 proto tcp # ufw
nft add rule inet filter input ip saddr 10.8.0.0/24 tcp dport 8021 accept # nftables (adapt names)
iptables -A INPUT -p tcp -s 10.8.0.0/24 --dport 8021 -j ACCEPT # iptablesNever expose ESL to the internet
Whoever authenticates to ESL controls FreeSWITCH completely: originate calls, run shell-backed API commands, read every call. Keep it on a LAN or VPN, behind the ACL and a firewall rule, with a long password.
5. Add ESL to the PBX profile
In the profile's FreeSWITCH event socket (ESL) section: tick collect PBX-side metrics, set Host (FreeSWITCH's LAN/VPN address — not the SIP proxy), Port (8021) and Password. The password is write-only: the field shows unchanged (set) afterwards and the API never returns it. Save: the profile's ESL connection restarts with the new settings and its state shows in the page header and on the Dashboard within seconds. See PBX profiles.
Check the connection on the Dashboard
The FreeSWITCH ESL card shows connected, connecting, disabled or disconnected, the address, when it connected or when it retries next, and the last error translated into a cause:
| Message | Meaning | Fix |
|---|---|---|
| ESL password rejected (check esl.password vs. password in event_socket.conf.xml) | the connection and ACL are fine, the password isn't | set the same password in the profile and the file |
| FreeSWITCH closed the connection before authentication: this machine's IP is probably not allowed by apply-inbound-acl in event_socket.conf.xml | the ACL rejected the tester's address | add the tester's network (or VPN pool), reloadacl |
| connection refused by HOST:8021: check listen-ip/listen-port in event_socket.conf.xml (listen-ip must not be 127.0.0.1 or ::1 for remote access) | nothing listens on that address and port | listen-ip / listen-port, reload mod_event_socket |
| no response from HOST:8021: host unreachable or a firewall drops the ESL port | packets get no answer | routing / VPN, host firewall, wrong host |
| cannot resolve ESL host: … | the host name doesn't resolve | use an IP address or fix DNS |
| connection closed by FreeSWITCH | an established connection dropped (FreeSWITCH restart, reload mod_event_socket) | nothing; it reconnects |
Test without ESL
Untick collect PBX-side metrics in the profile (the Dashboard then shows ESL is off in this profile; PBX-side metrics are not collected). Registration, call, busy hour and find-the-limit tests still run and measure everything the tester sees: SIP responses and timing, answer rate, setup time, round-trip or one-way audio quality. You lose:
- PBX watch — it needs ESL and is refused without it;
- PBX-side numbers on every run: Registered on PBX, channels, hangup causes, FreeSWITCH's MOS (the
min_moscriterion is skipped), FreeSWITCH CPU idle; - the setup time breakdown inside FreeSWITCH (dialplan, callee leg) and the per-call "before FreeSWITCH" split;
- the stuck-call check;
- the hints that depend on FreeSWITCH CPU.
A criterion without data is shown as skipped, not failed. See Pass / fail verdict.