Skip to content

rtpengine metrics ​

rtpengine relays the media of every call that goes through it — and in setups where it forces SRTP or anchors media for NAT, it is part of every call's audio path. Neither FreeSWITCH nor the tester can see inside it. With the rtpengine source switched on in the profile (one pbxsight-agent URL per rtpengine host — set up in rtpengine and the agent), every run records rtpengine's statistics and shows them in an rtpengine card.

These are host totals: rtpengine relays every call, not only the test's. Keep that in mind when other traffic runs at the same time.

First step: install pbxsight-agent on each rtpengine host and add it to the profile (setup); every following run gets the rtpengine card.

rtpengine card of a run
The rtpengine card: sessions, timeouts, errors, forwarding, MOS, offer time, one-way sessions, CPU, ports, restarts and coverage.

What is polled ​

rtpengine has no access control on its control port, so it stays on localhost; the pbxsight-agent on each rtpengine host reads it and serves a small, read-only HTTP API with a token. PBXsight polls each agent:

EndpointAgent APIWhat
/v1/health1agent version and API level, whether rtpengine's control (ng) port is configured (on connect and every 5 min)
/v1/rtpengine/metrics1rtpengine's Prometheus metrics (counters and levels)
/v1/rtpengine/sessions2per-call summary: per session (SIP Call-ID) its creation time and per side the last packet, kernel/userspace state — only during runs, when rtpengine.calls is on (default) and the agent has the ng port configured
/v1/host3host CPU ticks, load, rtpengine's process and per-thread CPU ticks from /proc
SettingDefault
rtpengine.poll_interval (during runs)5 s
rtpengine.idle_poll_interval30 s
rtpengine.timeout (per request; above the agent's own 5 s request timeout)8 s

All agents are polled in parallel and summed (ports, CPU: the highest host). A poll older than twice the poll interval plus 5 s counts as no data. An agent older than API 2 gives totals only (a warning on the Dashboard and the card); without API 3 there is no CPU.

Counters, deltas, restarts ​

  • A metric is a counter when its name ends in _total (plus a few rtpengine metrics that count up but are labelled otherwise: packets_lost, rtp_duplicates, rtp_skips, rtp_seq_resets, rtp_reordered, interface_packets, interface_bytes, interface_errors, …). Counters become deltas between polls; everything else is a level, used as it is.
  • Deltas are taken against the last value ever seen of each series, so a series missing from one reply doesn't later count its whole lifetime.
  • The agent's own control commands are left out: rtpengine counts ping, statistics, list and query like any other control request; those rows are excluded from the request counts and times.
  • Restart: uptime went back, rtpengine's start time moved by more than 30 s, or its session total went down. The interval across a restart gives no delta; totals continue.
  • Run totals are the sums of the deltas of every poll interval inside the run.

Sessions: one per SIP leg, counted when they end ​

rtpengine keeps one session per SIP Call-ID, i.e. per SIP leg: a call through FreeSWITCH between two phones (phone → FreeSWITCH → phone) is two sessions, an echo test call one.

  • Sessions (tile): the peak number of current sessions (rtpengine_sessions{type="own"}), and sessions ended in the run.
  • Ended: rtpengine's rtpengine_sessions_total counts a session when it ends, so it rises after the hangups, not at call start. With per-call data, the number of distinct sessions seen (started) in the run is shown too.
  • delete-delay: rtpengine keeps an ended session for its delete-delay (30 s by default), so the current count lags the calls by about that much, and the peak includes calls that just ended.
Worked example

A call test to test extensions: 100 calls, each relayed twice (caller → FreeSWITCH, FreeSWITCH → callee). Expect about 200 ended sessions for the run. The current count peaks at 2 × the concurrent calls plus the calls that ended in the last ~30 s.

The card, number by number ​

TileMeaningFrom
Sessionspeak at once · ended in the runrtpengine_sessions{type="own"}, rtpengine_sessions_total
Closed by timeoutsessions rtpengine closed because media stopped without a hangup (a device that vanished, a lost BYE, a dead path); normal hangups (delete from the proxy) count as terminatedrtpengine_closed_sessions_total{reason="timeout"} + {reason="silent_timeout"}
Packet errorsrelayed packets rtpengine couldn't forward (SRTP that doesn't decrypt, plain RTP where SRTP is required, an unexpected source), % of relayed packetsrtpengine_packet_errors_total ÷ rtpengine_packets_total
Forwardingpackets forwarded in the kernel module (cheap) vs userspace (rtpengine CPU per packet); "no kernel support" = rtpengine would use the kernel but the module isn't loadedrtpengine_packets_total{type=…}, per-call stream state
MOS (RTCP)average MOS rtpengine computed from the endpoints' RTCP reports, all calls, and the number of samples (also jitter, round trip and loss from RTCP)rtpengine_mos_total ÷ rtpengine_mos_samples_total, etc.
Offer processingaverage time rtpengine took per offer (plus answer, delete) — the proxy waits for it before passing the INVITE onrtpengine_request_seconds_total ÷ rtpengine_requests_total per request type
One-way now (peak)from the per-call data: most sessions at once where one side sends and the other doesn't (below); the first 20 Call-IDsper-call poll
CPU peakbusiest rtpengine thread (% of one core, with its name) · host CPU (% of all cores)/v1/host
Ports in usemedia ports used, % of the fullest port rangertpengine_ports_used ÷ (used + free) per interface
Restartsrestarts during the run and when
Data coverageseconds with data from at least one rtpengine

Below: charts of Sessions (sessions, one-way, ended, kept (delete-delay), ended and timeouts per second — per minute when the rates are low), CPU (busiest thread, rtpengine process, host) and Media & control (packets/s, errors/s, offer ms); a table per rtpengine (agent version, data coverage, forwarding, thread CPU, restarts); Sessions closed by reason; Streams & quality (streams without packets — normal with forked ringing, every device that rings but doesn't answer gets one — rtpengine's own one-way stream total, jitter, loss and RTT from RTCP, deletes).

One-way and "ended, kept" ​

From each per-call poll, per session:

  • a side is active if its last packet is at most 5 s old, silent if it sent nothing for 10 s or more — or never sent at all in a session at least 60 s old (before that the call may still be ringing);
  • one-way = at least one side active and one silent: one-way audio right now;
  • ended, kept = every side silent: normally a call that ended and waits out the delete-delay — counted apart, not a problem.

Not answered. A run's legs where no side ever sent media are offers that were never answered — busy, rejected, cancelled. The Media path card counts them apart (n not answered), not as silent sides: no media is expected there, so they are not one-way audio and not stuck calls. Silent sides counts only legs where the other side did send.

rtpengine's own one-way streams total is counted when a session ends, so it also covers short calls the poll can't judge.

CPU (agent API 3) ​

The agent returns /proc tick counters; PBXsight computes percentages between two polls:

host %    = Δ busy ticks ÷ Δ total ticks × 100   (busy = total − idle − iowait; 100 % = every core busy)
process % = Δ rtpengine ticks ÷ (seconds × ticks per second) × 100   (% of ONE core, may exceed 100)
thread %  = the same per thread; the busiest one is shown

With userspace forwarding every packet costs rtpengine CPU in a few threads: a thread near 100 % is what limits the calls the host can relay, even when the host as a whole looks idle. A new process id (restart) skips the process values for that interval.

This run's legs (Media path card) ​

In call tests with ESL, rtpengine's per-call data is joined with the run's own legs by SIP Call-ID: packets rtpengine received from the tester and forwarded to FreeSWITCH, and back. That shows whether audio got lost before the relay, in it or after it. The tester's side is recognized by its media IP; behind NAT only totals of both sides are shown. See Audio quality.

Per step and per window ​

Find-the-limit steps and trend windows keep: sessions ended, timeouts, errors and error %, peak sessions, RTCP MOS, offer time, most one-way, fullest ports, restarts and CPU peaks — the Components per step table of the Steps card. Setup time rising while the offer time stays flat says rtpengine isn't the cause.

Criteria ​

All optional, off by default, for call, busy-hour, limit and watch runs:

CheckKeyForm suggestsValue
rtpengine restartsmax_rtpengine_restarts0restarts of any rtpengine
rtpengine packet errorsmax_rtpengine_error_pct1 %packet errors ÷ relayed packets × 100
rtpengine timeoutsmax_rtpengine_timeouts0sessions closed because media stopped
rtpengine ports in usemax_rtpengine_ports_pct80 %fullest port range at any second

Skipped when the source is off or had no data. All are host totals. See Pass / fail verdict.

Limits ​

  • Totals of the whole host, not of this run's calls (except the Media path join).
  • Per-poll rates (5 s during runs) average out short spikes.
  • RTCP-based quality depends on what the endpoints report: a device that sends no RTCP contributes nothing, and without RTCP from both sides there is no round-trip time and no MOS.
  • The per-call poll can be cut short by the agent (its list limit or time budget); the card notes such polls, and one-way and stuck-call data then under-count.
  • Stuck calls that use rtpengine's per-call data: Stuck calls.

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