Skip to content

Web clients (WebRTC) ​

Many PBXs also serve a browser app — a softphone built on sip.js, JsSIP or similar. Those clients don't speak SIP over UDP/TCP/TLS: they send SIP over a WebSocket (WSS, RFC 7118) and carry their audio as ICE + DTLS-SRTP (UDP/TLS/RTP/SAVPF, rtcp-mux). That path runs through different parts of the PBX: the proxy's WebSocket listener (e.g. Kamailio's websocket module), the media relay's ICE and DTLS towards web clients (e.g. rtpengine with WebRTC flags) and the bridge to SIP devices.

PBXsight's web clients are virtual browser clients that behave like a sip.js app, emulated in Go (no browser runs). They answer: does the WebRTC path work under load — registration over WSS, ICE, DTLS, audio quality, and calls between web clients and desk phones in both directions?

First step: add your web app's WebSocket URL to the PBX profile and press Test connection — see Connect the web clients below. Then follow the steps in order.

Connect the web clients ​

  1. Profiles → your profile → Web clients (WebRTC) → WebSocket URL of each entry point: the wss:// URL your web app's sip.js configuration uses, e.g. wss://sip.example.com:7443/ws (one per WebSocket entry point, e.g. per Kamailio; webrtc.ws_urls). Optional: STUN servers (webrtc.stun) when the relay can't reach the tester's own address.
  2. Set the profile's media mode to SRTP — web clients use DTLS-SRTP, any other mode refuses the start.
  3. Press Test connection in the Web clients block, first without an extension set (resolve → connect → WebSocket upgrade → OPTIONS), then with one picked (a test REGISTER and un-REGISTER). Fix what it names — see Test connection below.
  4. Save the profile. Callers are / Callees are on New test now offer Web clients (WebRTC).

Run a web-client call load ​

  1. New test → Call load, the extension set, Destination: the echo test (e.g. 9196).
  2. Callers are: Web clients (WebRTC). Start small: Callers 2, Target CPS 1, Total calls 5.
  3. Codec offered: G.722 or PCMA (PCMU is refused for web clients). Start call test.
  4. On the run page check the Media path card's Web clients: ICE + DTLS-SRTP block: every leg connected, no ICE failed, DTLS failed or Not WebRTC. Then raise the rate, or switch to Test extensions (virtual phones answer) to test web ↔ desk phone calls in both directions (next table).
Run page of a call load with 30 % web clients: the Device mix card
A call load with 30 % web clients and 70 % SIP phones: the Device mix card, one row per pairing.

Where they are available ​

Web clients are a per-run choice in Call load and Find the limit (New test → Callers are / Callees are: SIP phones | Web clients (WebRTC) | Mixed (web clients + SIP phones)):

CallersCalleesDestinationWhat it tests
Web clients—a number (e.g. the echo test)WSS registration + ICE / DTLS to the relay, round-trip audio
Web clientsWeb clientstest extensionsweb ↔ web: both legs WebRTC
Web clientsSIP phonestest extensionsweb → desk phone: DTLS-SRTP bridged to SIP media
SIP phonesWeb clientstest extensionsdesk phone → web: the PBX offers WebRTC to the callee

A Registration load test can also use web clients (Clients: Web clients): it holds N WebSocket registrations for a long time (soak) and can drop all their connections at once (storm) to measure how long until every client is registered again.

Any extension of the extension set can register as a web client — the choice is per run, not per extension. Busy hour takes Phones are: Web clients or Mixed; IVR tests use SIP phones only. A side can also be Mixed — see Device mix.

Requirements ​

RequirementWhy
The profile's WebSocket URL of each entry point (webrtc.ws_urls, Profiles → Web clients (WebRTC))where the web clients connect, e.g. wss://sip.example.com:7443/ws; several (e.g. one per Kamailio): the run spreads its web clients over them round-robin, each client stays on its URL (phones.log shows how many registered per URL)
Profile media mode SRTPweb clients use DTLS-SRTP; with RTP or None the start is refused (media must be srtp for web clients)
Codec G.722 or PCMAPCMU is refused for web clients; no Opus
Web callees: test extensionsa number is answered by the PBX, not by a callee

The New test form disables the choice, with the reason (Web clients unavailable: …), when the profile lacks the URL or SRTP.

What happens on the wire ​

Registration ​

Each web client opens its own WebSocket connection to the URL (TLS for wss://, HTTP upgrade with subprotocol sip, the URL's path and Host header) and registers over it like sip.js:

REGISTER sip:example.com SIP/2.0
Via: SIP/2.0/WSS k3j2h1g0.invalid;branch=…
Contact: <sip:1001@k3j2h1g0.invalid;transport=ws;ob>;+sip.ice;reg-id=1;+sip.instance="<urn:uuid:…>"
Supported: outbound, path

Digest authentication works as for SIP phones. The connection stays open for the whole run with CRLF keepalives; re-registrations, the calls the client places and the INVITEs it receives all travel inside it (the .invalid Contact host means "reach me over my connection", which the proxy handles). The URL's host is resolved once per run; the WSS certificate is not verified (as for the TLS transport).

Media: ICE + DTLS-SRTP ​

  • Offer (a web caller): one audio m-line UDP/TLS/RTP/SAVPF with the run's codec (G722/8000 or PCMA/8000) and telephone-event, a=ice-ufrag / a=ice-pwd, host candidates on the tester's media IP (plus server-reflexive ones with webrtc.stun), a=fingerprint:sha-256, a=setup:actpass, a=rtcp-mux. No BUNDLE groups, no video, no data channel.
  • Answer (a web callee): a=setup:active, as browsers answer.
  • After the SDP answer, ICE runs (controlling as the offerer, controlled as the answerer), then the DTLS handshake on the selected pair. The peer's certificate must match its a=fingerprint. The SRTP keys come from DTLS (SRTP_AES128_CM_SHA1_80); RTP and RTCP share the one port.
  • Then the same 20 ms test signal flows as for SIP phones, and loss, jitter, MOS, round trip (echo) and one-way delay (calls between test extensions) are measured the same way.
  • A peer that answers without a fingerprint or ICE (the PBX didn't treat the client as WebRTC) fails that call's media with a note — there is no fallback to SDES.
  • ICE and DTLS each have 10 s to finish (a browser waits longer; a load test wants a verdict).

Setup time is unchanged: from the INVITE to the 200 OK. The WebRTC media connect time (answer → SRTP ready) is reported separately.

Read the result ​

The run page, the results list, the HTML report and the exports show the client kinds, e.g. Callers: web clients (WSS) · Callees: SIP phones. The Media path card gets a Web clients: ICE + DTLS-SRTP block:

FieldMeaning
Legsweb-client call legs whose stream ended (callers and callee web clients), and how many connected
ICE failedno candidate pair connected: UDP between the relay and the tester's media IP, ICE on the relay
DTLS failedthe handshake failed or timed out: role, certificate vs a=fingerprint, no SRTP profile
Not WebRTCthe PBX answered / offered plain RTP or SDES-SRTP to a web client
ConnectSDP answer → SRTP ready (ICE checks + DTLS handshake), p50 / p95

A call answered in SIP whose ICE or DTLS failed still counts as answered — it carries no audio. When at least 1 % of the web-client legs had no WebRTC media, What to look at shows Web-client calls were answered but carried no audio, naming the step that failed and what to check. In the API and JSON export these are summary.call.media.webrtc (legs, connected, ice_failed, dtls_failed, not_webrtc, connect_p50_ms, connect_p95_ms).

Test connection ​

With a WebSocket URL set, the profile page's Web clients block has its own Test connection:

  1. Resolve the URL's host.
  2. Connect: TCP, and the TLS handshake for wss:// (certificate details shown, not verified).
  3. WebSocket: the HTTP upgrade with subprotocol sip. A 404 means a wrong path; another HTTP answer means a web server rather than a SIP WebSocket listener; an upgrade without the sip subprotocol is a warning (sip.js refuses it).
  4. OPTIONS over the WebSocket.
  5. With an extension set picked: one test REGISTER and un-REGISTER.

The PBX side ​

For web clients to work, the PBX side typically needs (generic, for a Kamailio + rtpengine + FreeSWITCH setup):

  • Kamailio: the websocket (and xhttp) module, a TLS listener for WSS that upgrades on the web app's path, nathelper / add_contact_alias or outbound so requests to .invalid Contacts go back over the WebSocket, and Path towards the registrar when it isn't Kamailio itself.
  • rtpengine: offers / answers towards web clients with ICE=force, DTLS (UDP/TLS/RTP/SAVPF), rtcp-mux-offer / require, SDES off; and the reverse (plain RTP / SDES-SRTP) towards SIP devices and FreeSWITCH.
  • FreeSWITCH: accepts the registrations relayed by Kamailio (Path / Contact) and bridges web and SIP extensions like any other; the WebRTC media is terminated by the relay.

Ports ​

Web clients use the WebSocket URL's TCP port (outbound) and, for audio, one random ephemeral UDP port per web-client call leg on the tester's media IP — not tester.media_port. See Ports and firewall.

Device mix ​

Real users are rarely all on one kind of device. One run can mix web clients and SIP phones in the share your users have, e.g. 30 % on the web app and 70 % on desk phones.

Run a mixed device test ​

  1. New test → Find the limit (or Call load, Busy hour), the extension set and destination.
  2. Callers are and / or Callees are: Mixed (web clients + SIP phones) — for Busy hour, Phones are: Mixed. Callees can be web or mixed only with Test extensions (virtual phones answer) as the destination.
  3. Web clients %: the share of web clients on every mixed side (web_pct, 1–99, default 30; one value for every mixed side). A mixed side needs at least 2 extensions (one of each kind).
  4. Start. phones.log lists how many of each kind registered, e.g. callers 3 web clients + 7 SIP phones.

API: call.caller_client / call.callee_client (and the same in limit.*) = sip | webrtc | mixed, busy_hour.client = sip | webrtc | mixed, plus web_pct.

Read the Device mix card ​

The run page's Device mix card has one row per pairing Caller → callee: web → web, web → SIP, SIP → web, SIP → SIP (to a number: web → number, SIP → number). Per row: Calls, Answer, Failed, Setup avg, Setup p95, MOS per direction and WebRTC failed (web legs without WebRTC media). The rows add up to the run's calls. Compare the rows: when only the web rows lose answer rate or setup time, look at the WebSocket listener and the relay's ICE / DTLS work; when all rows degrade alike, the limit is elsewhere (typically FreeSWITCH CPU). Find the limit adds Device mix per step to its Steps card for the same comparison at every step.

How the mix is built ​

  • Who is a web client is fixed per extension for the whole run: round(n × % / 100) of a mixed side's n extensions (at least one of each kind, so a mixed side needs 2 or more), spread evenly over the list, so every ramp or limit step has the mix from its first second. The assignment is repeatable — the same set and % give the same result, so runs compare. Mixed callees are offset against mixed callers, so all four pairings (web → web, web → SIP, SIP → web, SIP → SIP) occur.
  • A web client registers over its WebSocket URL and offers WebRTC; a SIP phone registers over the profile's SIP target and offers SDES-SRTP. The media checks (e.g. the PBX answered the web client with SDES) are judged per call from that call's own offer, so SIP-phone calls don't raise WebRTC warnings and vice versa.
  • Results: the run page's Device mix card has one row per pairing caller → callee (to a number: web → number, SIP → number) with calls, answer rate, failed, setup avg / p95, MOS per direction and failed WebRTC legs; Find the limit adds Device mix per step (answer rate · setup p95 per pairing), so you see whether web-client or SIP-phone calls degrade first as the rate rises. Results shows a chip mixed 30 % web; the HTML report, JSON (summary.call.mix, mix per window) and the runs CSV (web_pct) carry it.
  • The verdict stays over all calls of a step or run — there are no criteria per device kind; the breakdown is diagnostic.

Limits ​

  • Audio only: G.722 or PCMA; no Opus, no video, no BUNDLE of several m-lines, no data channels, no TURN.
  • The client is emulated in Go and shaped like sip.js; browser-specific behaviour (getUserMedia, echo cancellation) is not reproduced.
  • Not in IVR tests. A mix has two kinds only (web clients and SIP phones over the profile's transport), one share per run; the kind is per run, not stored per extension.
  • A page reload is reproduced only as a registration storm (Page reload mode), not in call tests.

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