Skip to content

How it works ​

This page explains what PBXsight is made of and what happens, step by step, when you start a test: who opens which connection, what goes on the wire, how audio is sent and measured, where the PBX-side numbers come from, and what ends up on disk. Read it once before your first real test — most surprises in results (a missing MOS, a setup time that looks too high, calls that don't show up as test traffic) are explained here.

First step: nothing to do here — read it once before your first real test, or come back when a result surprises you.

PBXsight architecture PBXsight is one program with a web UI and API, a runner, a caller engine, virtual phones, a media engine, collectors and SQLite. It sends SIP to the SIP entry point, which passes it to FreeSWITCH; audio flows through the media relay. The collectors read FreeSWITCH over ESL, Kamailio over JSON-RPC and rtpengine through pbxsight-agent. Browser usersadmin · operator · viewerHTTP(S) + WebSocketPBXsight — one binaryWeb UI + APIREST · WS tick 1 sRunnerplan + validatesafety limitsone run at a timeregister phonespace callscollect every 1 strend windowsverdict + hintsSQLite+ runs/<id>/ logsCaller engineINVITE · digest · CANCEL · BYEVirtual phonesREGISTER · keepalive · answerKamailio pollercounters every 5 sESL collectorevents + polls every 1 sMedia enginetest tone · loss · jitter · MOSrtpengine pollervia the agent every 5 sSIP entry pointKamailio / SBC (optional)or FreeSWITCH itselfFreeSWITCHregistrar · dialplan · ESLMedia relay hostrtpengine (optional)+ pbxsight-agentSIPSIPSIPRTP/SRTPRTPJSON-RPCESLHTTP
Blue: SIP signaling · green: audio · dashed: read-only monitoring (pull only, nothing is changed on the PBX side). Kamailio and rtpengine are optional; without a proxy the SIP entry point is FreeSWITCH itself.

One program ​

PBXsight is a single Go binary. Everything runs in one process:

PartWhat it does
Web UI + APIThe Vue UI is embedded in the binary and served by the same HTTP server as the REST API (default 127.0.0.1:8080, HTTPS optional). REST is used for actions and for loading data; a WebSocket (/ws) pushes one tick per second with the live PBX state and the run in progress. Every request needs a login — see Users and roles.
RunnerPlans and validates a test, enforces the safety limits, allows one run at a time (the always-on watch runs beside it), registers the phones, starts the caller engine, collects numbers every second and computes the verdict at the end.
Caller enginePlaces the SIP traffic of load tests: calls (INVITE, digest authentication, CANCEL, BYE) and registrations, at a controlled rate.
Virtual phonesTest extensions that PBXsight registers like real phones: the callers of every call test, and the callees of calls between test extensions and busy hour.
Media engineSends a test tone over RTP or SRTP for every answered call and measures the audio that comes back.
CollectorsRead the PBX side: FreeSWITCH over the Event Socket (ESL), Kamailio over JSON-RPC, rtpengine through the small pbxsight-agent. One set per PBX profile, all connected at once.
StorageSQLite (one file, default ./pbxsight.db) for runs, per-second samples, profiles, extension sets, schedules and users; a folder runs/<run id>/ per run for its logs.

Why one process: nothing to install besides the binary, no external SIP tool, and the caller engine, the media engine and the collectors share one clock. That shared clock is what makes per-call joins (the tester's setup time against FreeSWITCH's timestamps) and one-way audio delay possible.

The caller engine and virtual phones ​

Callers are phones ​

Real phones register first and then place calls over the connection they registered on. PBXsight does the same:

  1. Before the first call, every caller extension registers as a virtual phone (REGISTER, then the digest round on 401/407). Phones register at min(10, safety.max_registration_rate) per second, so 200 callers take about 20 s. The Dashboard and New test page show a Test starting card with the progress and a Stop button meanwhile.
  2. Each call is then sent over its caller's registration connection — the same TCP/TLS connection, or UDP socket, the phone registered on. The connection is already up, so the setup time measures the call, not a TLS handshake.
  3. Calls are spread round-robin over the callers. With a fixed number of calls smaller than the number of callers, only as many callers register as there are calls.
  4. A caller whose phone didn't register places no calls; if none registered, the start is refused with the most common reason (e.g. REGISTER: 403 Forbidden).

What a virtual phone does while it is registered:

BehaviourValueWhy
ConnectionsOne per phone (its own user agent): TCP/TLS connection or UDP socketLike a real device; the SIP entry point sees one connection per extension.
Requested expiryCallers 3600 s; callees 300 s (busy hour: the form's Registration expires, default 300 s)Callers re-register rarely, so they add next to no load during a run.
Re-REGISTERAt a random 60–90 % of the granted expiryPhones that registered together don't re-register in waves.
KeepaliveCRLF every 25 s on TCP/TLSProxies close idle connections; real phones send these too.
Lost connectionChecked every second; reconnect and re-register (retry after 10 s on failure)A dropped connection doesn't silently end the test for that phone.
TLSThe server certificate is not verified, no client certificateTest PBXes often use self-signed certificates.
Other requestsOPTIONS, NOTIFY, INFO, MESSAGE answered 200 OKKeeps the PBX's qualify/keepalive checks happy.
After the runREGISTER Expires: 0 for every phone, 50 at a time, all within 2 minutesLeaves the registrar clean.

Registration tests are the exception: there the extensions are the load. Each extension gets its own user agent and connection (with the same CRLF keepalive), registers at the test's rate, re-registers on its interval, and un-registers at the end — see Registration.

All traffic goes to one address ​

The profile's SIP host is resolved to its IPv4 addresses at the start of a run. With several addresses (for example two proxies behind one name) the run uses one of them — the one you pick in the New test form, or a random one. Every request of the run, including CANCEL, ACK and in-dialog requests, is sent to that address; the tester never resolves tenant domains in Request-URIs. The address used is stored with the run.

The tester's own address in Via, Contact and SDP is the profile's local IP, or, when empty, the address of the interface that routes to the SIP host. The media IP defaults to the local IP.

A call on the wire ​

One test call to the echo test Sequence of one test call: the caller phone registered earlier; it sends INVITE, gets 100 and 407, sends ACK and the INVITE with credentials, gets 100, 180 and 200 OK, sends ACK, audio flows both ways for the hold time, then BYE and 200 OK. Setup time runs from the first INVITE to the 200 OK. PBXsight caller phonecaller engine + media enginePBXentry point → FreeSWITCH echoearlier, before the first call:REGISTER → 401 → REGISTER + auth → 200INVITE (SDP offer, X-PBXsight-Call)100 Trying407 Proxy Authentication RequiredACKINVITE + Proxy-Authorization100 Trying180 Ringing / 183 (if sent)200 OK (SDP answer)ACKBYE (after the hold)200 OKRTP / SRTP test tone (50 packets/s)echo comes back → loss, jitter, round trip, MOSsetup timefirst INVITE →200 OK, digestround included8 s per response→ timeout30 s to answer→ CANCEL(no_answer)hold time(default 30 s)
One call to the echo test. Grey arrows are provisional responses. The 407 challenge may come from the SIP entry point or from FreeSWITCH — either way its round trip is part of the setup time.
  1. INVITE with an SDP offer: one codec (G.722 by default, or PCMA/PCMU) plus telephone-event, ptime 20; RTP/SAVP with an SDES a=crypto key when the profile's media mode is srtp, otherwise RTP/AVP. Only one codec is offered so the audio the engine sends always matches what was negotiated.
  2. The PBX challenges (401 or 407); the engine answers with ACK and repeats the INVITE with credentials.
  3. Provisional responses (100, 180, 183), then 200 OK with the SDP answer, then ACK.
  4. Audio flows for the hold time, then the tester sends BYE and expects 200 OK.

Setup time runs from sending the first INVITE to receiving the 200 OK, the challenge round trip included — that is what a user experiences between dialling and the call being connected (for the echo test, which answers at once). It is broken down further on Setup time and its breakdown.

Timers. Until the authenticated INVITE is sent (or ringing starts when there is no challenge), every response must arrive within 8 s; otherwise the call counts as timeout (an INVITE that got a 100 Trying is then CANCELled; one with no response at all is not, as SIP requires). From then on the PBX has 30 s to answer; after that the engine sends CANCEL and counts no_answer. A BYE that gets no final response within 8 s counts as BYE failed. Over UDP, retransmissions follow the SIP transaction timers.

During the hold. A BYE from the PBX is answered 200 OK and counted as hung up by PBX. A re-INVITE inside the call (session timer, hold) is answered with the original SDP. A new INVITE to a caller phone is refused (480 — callers take no calls).

Failures are counted by their final response code (486, 503, 404, …), or as timeout, no_answer, connect_error, transport_error, or aborted (the run was stopped while the call was ringing).

Pacing ​

The engine starts each call 1 ÷ rate seconds after the previous one (at 4 CPS, every 250 ms). Once a second the runner sets the current rate: a ramp rises linearly, Find the limit follows its steps, busy hour follows its traffic model. A rate change applies at once.

Max concurrent calls caps the calls in progress. When the cap is full, the next call waits for a free slot; there is no catch-up burst afterwards (a call due more than 200 ms ago starts now instead of bunching up). So at a steady rate:

calls up ≈ CPS × (setup time + hold) ≈ CPS × hold

and a cap below that silently lowers the achieved rate — the New test form warns, and the Call rate chart shows placed below target.

Worked example: how much is "2 CPS, 30 s hold"?
  • New calls: 2 per second → 120 per minute.
  • Calls up at a steady rate: 2 × 30 = 60, plus a few in setup.
  • Media: 60 streams × 50 packets/s = 3000 packets/s sent by the tester and about as many coming back.
  • For calls between test extensions the PBX carries 60 A-legs and 60 B-legs: 120 channels.

Calls between test extensions ​

A call between test extensions The caller phone in PBXsight sends an INVITE with X-PBXsight-Call through the SIP entry point to FreeSWITCH (A-leg). FreeSWITCH's dialplan bridges it to a B-leg towards the callee extension, copying the X- header; the B-leg reaches the callee virtual phone, also in PBXsight, over its registration connection. Audio flows both ways; both media engines run in the same process, so the one-way delay of each direction is measured against the sender's clock. PBXsightCaller phonecaller engine places the callcallers' media engineCallee virtual phoneanswers 200 OKphones' media enginesame process,same clocksend times sharedPBXvia the SIP entry pointA-leg (inbound)caller → dialplanB-leg (outbound)to the callee's contactbridge;X- headers copiedto the B-legINVITE · X-PBXsight-Call: c1INVITE · X-PBXsight-Call: c1over the phone's registration connectionaudio both ways (RTP/SRTP)audio both ways (RTP/SRTP)one-way delay per direction= arrival time − the otherengine's send time of that frame
A call between test extensions: both ends are PBXsight, so each direction is measured separately (loss, jitter, one-way delay, MOS). c1 is the caller's Call-ID; FreeSWITCH passes the header on, which pairs the two legs' streams.

In this mode (and in busy hour) PBXsight also plays the callee. The callee extensions register as virtual phones before the first call; the caller dials the callee's extension number, FreeSWITCH runs its dialplan and bridges the call to a B-leg towards the callee's registered contact, and the B-leg reaches the virtual phone over its own registration connection (the phone never listens on a port, like a phone behind NAT).

The callee phone:

  • accepts only test traffic: an INVITE carrying this run's X-PBXsight-Run header, or from one of this run's caller extensions. Anything else gets 603 Decline — a real call that happens to reach a test extension is not answered.
  • answers 200 OK with one codec, preferring the run's codec when it was offered, so the call stays free of transcoding. The offer's media profile must match the profile's media mode (SRTP with a=crypto, or plain RTP/AVP); otherwise it answers 488.
  • sends audio from a second media engine (the phones' engine, on its own ports) for the hold time, and hangs up itself 30 s after the caller's hold if the caller's BYE never arrives. In busy hour the phone draws a random hold per call and hangs up itself.

The caller's INVITE carries X-PBXsight-Call: <caller's Call-ID>. FreeSWITCH copies X- headers to the B-leg, so the callee sees the same value. That value links the two media streams of one call: each side knows when the other sent each frame, and since both engines run in one process with one clock, the one-way delay per direction is simply arrival time minus the other side's send time.

The media engine ​

Media mode is a profile setting:

ModeWhat flows during the hold
noneNothing: SDP only. Signaling tests; FreeSWITCH may end long holds with MEDIA_TIMEOUT. No MOS.
rtpPlain RTP from the media engine.
srtpSRTP with SDES keys (AES_CM_128_HMAC_SHA1_80), a random key per run. Use it when the path requires SRTP (e.g. rtpengine forcing RTP/SAVP for TLS clients).

Calls between test extensions and busy hour need rtp or srtp.

The signal. A tone at 400.5 Hz, 1 s on / 1 s off, encoded in the call's codec (G.722, PCMA or PCMU), sent in 20 ms frames: 50 packets per second per call, each frame sent at its exact time relative to the stream's start (no drift). The odd 400.5 Hz makes every tone frame of the 2-second loop unique, so a frame that comes back can be recognised and matched to the moment it was sent.

When a stream starts. The caller engine writes the PBX's SDP answer of each answered call to the run's media.log; the runner reads that file every 100 ms and starts a stream towards the address and port in the answer (with the PBX's SRTP key for decrypting its audio). The stream sends for the hold time and keeps listening 1 s longer for late echo.

Sockets. The engine binds tester.media_sockets UDP sockets (default 4): RTP on tester.media_port, +2, +4, +6 (default 16000, 16002, 16004, 16006), RTCP on each port + 1. A call's socket is chosen from a hash of its Call-ID, so the INVITE can name its port before the stream exists. Each socket has its own receive loop and send worker, because one UDP socket is serialized by the operating system — more sockets carry more streams. The virtual phones' engine uses the ports right after (default 16008–16015). All port numbers and firewall rules are on Ports and firewall.

RTCP (tester.rtcp, on by default). Every 5 s each stream sends a compound RTCP packet — a sender report with a reception report of the audio coming back, plus the CNAME — from its RTP port + 1 to the remote's RTP port + 1 (the offer has no rtcp-mux); SRTCP in srtp mode. Media relays such as rtpengine compute their per-call MOS from these reports.

What is measured (per call, when it ends):

MeasurementEcho test (calls to a number)Calls between test extensions
LossRound trip: frames that didn't come back, from the returning stream's sequence numbersPer direction
JitterRFC 3550 interarrival jitter of the returning streamPer direction
DelayRound trip: arrival − send time of the same frameOne way: arrival − the other engine's send time
MOSE-model estimate from round trip, jitter and lossPer direction, from 2 × one-way delay
Late framesFrames the engine sent ≥ 60 ms after their time (or never) — the tester fell behindBoth engines

The MOS estimate is a simplified E-model:

effective delay = round trip ÷ 2 + 2 × jitter + 10 ms R = 93.2 − effective ÷ 40 (effective < 160 ms) R = 93.2 − (effective − 120) ÷ 10 (otherwise) R = R − 2.5 × loss % MOS = 1 + 0.035 R + 0.000007 R (R − 60)(100 − R), capped to 1 … 4.5

Delay matching needs the payload to come back unchanged. If the PBX transcodes (a different codec on the way back), loss and jitter are still measured, but the round-trip check is skipped. Details and worked examples: Audio quality and MOS.

The data sources ​

The tester measures the whole call from the outside. The PBX-side sources each see one component from the inside.

What each data source sees The call path runs from the tester over the network through the SIP entry point and FreeSWITCH, with media through the relay. The tester measures the whole path end to end but can't tell where time or packets were lost. FreeSWITCH ESL sees only FreeSWITCH, Kamailio JSON-RPC only Kamailio's counters, and the rtpengine agent only the media relay. TesterPBXsightNetworkLAN / VPNSIP entryKamailio / SBCFreeSWITCHdialplan, legsMedia relayrtpengineTestercaller + media engineend to end: setup time, SIP codes, loss, jitter, round trip / one-way delay, MOSper call, but not where the time or packets wentESLFreeSWITCHevents + pollslegs, CPU, audioKamailioJSON-RPCcountershow many, not whortpenginepbxsight-agentstatisticshost + per call
The tester sees everything end to end but not where a problem sits; each PBX-side source sees only its own component. Together they narrow a slow or failing call down to one place.

FreeSWITCH (ESL) ​

A persistent connection to the Event Socket (default port 8021), reconnecting with backoff.

  • Polls — show calls count, show channels count, show registrations count and status (sessions, sessions per second, idle CPU where the FreeSWITCH version reports it): every 1 s while a run is active, every 5 s otherwise (esl.poll_interval, esl.idle_poll_interval).
  • Events — CHANNEL_CREATE, CHANNEL_ANSWER, CHANNEL_HANGUP_COMPLETE (with hangup cause, SIP status and the rtp_audio_in_* statistics of the leg) and the sofia registration events register, unregister, expire, register_failure.
  • Channel list — show channels as json every 5 s during call tests and watches when the stuck-call check is on.

From these come: calls and channels on the PBX, registrations, hangup causes, FreeSWITCH's MOS of the audio it received on each leg, FreeSWITCH's idle CPU, the A/B-leg timestamps behind the setup breakdown, and stuck calls.

Kamailio (JSON-RPC, optional) ​

One URL per Kamailio, polled every 5 s during a run (30 s otherwise): core.uptime, stats.fetch all, tls.info when available and core.version on connect. The counters of all Kamailios are summed. PBXsight's own polls are subtracted (Kamailio counts them like SIP requests). Restarts are detected from the uptime.

rtpengine (via pbxsight-agent, optional) ​

rtpengine's control interface has no access control, so PBXsight doesn't talk to it over the network. A small read-only pbxsight-agent runs on each rtpengine host, reads rtpengine's Prometheus metrics and its ng interface locally (ping, statistics, list, query — nothing else is possible), plus CPU from /proc, and serves them over HTTP with a token and an allow-list. PBXsight polls each agent every 5 s during a run (30 s otherwise) and, during runs, fetches a per-call summary that it joins to the run's calls by SIP Call-ID.

What each source sees — and doesn't ​

SourceSeesDoesn't see
Tester (caller + media engine)Every SIP response and its timing, setup time per call, failures by code, audio loss/jitter/delay/MOS per call, its own CPUWhere time or packets were lost between it and FreeSWITCH; anything about other traffic
FreeSWITCH ESLChannels, calls, registrations, hangup causes, leg timestamps (dialplan, callee leg), FreeSWITCH's inbound audio quality, CPU, all traffic on the PBXRequests Kamailio rejected or dropped (they never reach FreeSWITCH), what happens before the INVITE arrives, the relay's view of the media, audio quality in the direction FreeSWITCH sends
KamailioRequests received, transactions, replies it sent itself (its own 403/404/503), drops, TCP/TLS connections, shared memory, restartsWho was rejected (counters only, no per-call data), anything inside FreeSWITCH, media
rtpengineSessions, timeouts (media stopped without a hangup), packet errors, offer processing time, ports in use, kernel vs. userspace forwarding, MOS from RTCP, host and rtpengine CPU; per call: packets each way, one-way mediaSIP signaling beyond its offer/answer/delete, FreeSWITCH, calls that bypass the relay. Its numbers are host totals: all calls, not only the test's

That is why the diagnosis combines them: a setup time that grows while FreeSWITCH's idle CPU falls points at FreeSWITCH; one that grows while Kamailio's open transactions climb but rtpengine's offer time stays flat means Kamailio is waiting for something behind it. The rules are on What to look at.

Every source except the tester is optional. Without ESL, load tests still run and give the tester's view; the PBX-side cards, the FreeSWITCH MOS check, the setup breakdown and stuck calls are missing, and a PBX watch can't start. Cards and hints for a missing source are simply left out.

Test traffic tagging ​

A PBX under test usually carries other traffic too, and it all arrives from the same proxy address. To tell its own traffic apart, PBXsight tags every request:

TagWhereUsed for
X-PBXsight-Run: <run id>Every REGISTER and INVITEFreeSWITCH exposes it as variable_sip_h_X-PBXsight-Run on the channel events: the call belongs to this run. Callee phones accept only INVITEs with it (or from a run caller).
User-Agent: pbxsight/<run id>Every requestRegistration events carry no X- headers, so they are matched by the user agent.
X-PBXsight-Call: <Call-ID>Every INVITEJoins the tester's setup time of a call with FreeSWITCH's A-leg (per-call before FreeSWITCH), and links the two media streams of a call between test extensions.
Extension + domainThe run's extension setAn event of a test extension (caller, registering user, or the B-leg towards a callee) in exactly that domain also counts, even when a header got lost. The domain must match: the same extension number in another tenant is not test traffic.

A run's ESL counters (test view) contain only matching events; the Dashboard's global counters contain everything. The filter is set before the phones register, so their first REGISTERs count. A PBX watch has no filter: it records all traffic.

Run ids look like 20261127-142305-k3fz (start time plus four random characters).

A run, from start to finish ​

  1. Plan and validate. The request is checked against the extension set and the profile's safety limits (allowed destinations, max CPS, concurrency, registration rate, number of virtual phones, estimated duration) and the criteria. All problems come back together (422). Without a valid licence the start is refused (402); while another run is active or starting, 409.
  2. Prepare. Pick the target address, determine the local and media IP, open the media engine's sockets, set the ESL test filter and switch the collectors to their fast poll interval.
  3. Register phones. Callees first, then callers, at up to 10 per second. Stop works in this phase: no more REGISTERs, the phones registered so far un-register, and the run is recorded as stopped.
  4. Run. The caller engine places calls (or registrations); the media engine starts a stream per answered call. Once a second the runner sets the rate, collects the counters of the engine, the media engine, the phones, ESL, Kamailio, rtpengine and the tester's CPU into one sample, stores it, and pushes it to the browsers. For busy hour and find the limit the samples also fill trend windows (one per step in find the limit, which may end the run early after failed steps).
  5. Stop. The run ends when its calls are done (a number of calls), its calling period is over (a duration), the limit rule ends it, or someone presses Stop. Calls in progress finish their hold; whatever is still up hold + 15 s later is hung up (CANCEL while ringing, BYE when answered). The runner also enforces a deadline of estimated duration + hold + 15 s + 30 s, capped at safety.max_duration. Shutting PBXsight down hangs up at once.
  6. Finish. With ESL, wait 1.5 s for late events; then un-register the phones, take a last sample, compute the summary (totals, percentiles, audio, setup breakdown, components, windows, limit) and the verdict, and store them. Status is completed, or stopped when stopped by a user or the deadline.

A PBX watch has the same frame without steps 3 and 4's traffic: it needs ESL to be connected at the start, records all traffic (no test filter) every second for its duration, and ends with the same kind of summary, trend windows and verdict. See PBX watch.

What is stored ​

WhereWhat
test_runs (SQLite)One row per run: type, profile, extension set, who started it, status, times, the parameters with the resolved plan, the effective criteria, the target address used, and the summary with the verdict (JSON). A free-text label for comparisons.
samplesOne JSON document per second of the run: rates, counters, active calls, setup times, audio, PBX, Kamailio, rtpengine and CPU fields. Missing data is stored as null, so charts show gaps, not zeros.
countersSIP response codes and hangup causes of the run.
runs/<run id>/ (tester.work_dir)caller.log (the run's log and the SIP stack's warnings; no passwords), media.log (the SDP answer per answered call, hangups), phones.log (the virtual phones), watch.log (a watch's failures, at most 2000 lines).

Deleting a run removes its rows and its folder. The HTML report and exports are produced from this stored data at any time. Secrets in the database (ESL passwords, agent tokens, SIP passwords) are encrypted with a key file next to it — see Secrets at rest and backups.

PBX profiles ​

A profile is one system under test: its SIP entry point and transport, media mode and IPs, ESL, Kamailio and rtpengine sources, stuck-call thresholds, safety limits and default pass/fail criteria. One installation can hold several (dev, QA, a staging copy); all profiles' collectors stay connected, so the Dashboard shows each one live, and the profile picker in the top bar decides which one you work with. Extension sets, runs and schedules belong to a profile. Only one run at a time still applies across all profiles; the always-on watch is the exception and runs beside load tests. See PBX profiles.

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