Skip to main content
Let browser clients built with SIP.js or JsSIP register with Routr and call regular SIP phones, PBXs, and the PSTN.

What browsers need

A WebRTC client differs from a desk phone in two ways, and Routr handles each one separately:
  • Signaling over WebSocket. Browsers can’t send SIP over UDP or TCP. They use SIP over WebSocket, and a page served over HTTPS can only open secure WebSockets (wss://) to a server with a certificate the browser trusts. The EdgePort listens for WS on port 5062 and WSS on port 5063.
  • Different media. WebRTC requires ICE and DTLS-SRTP, which most SIP phones and PBXs don’t speak. The RTPRelay middleware drives an RTPEngine instance that rewrites the SDP and relays media between the two sides. Routr itself never touches media.
If every endpoint in a call is a WebRTC client, you need WSS but can skip RTPRelay.

Prerequisites

Enable WebRTC

1

Open the WebSocket transports

The routr-one image already listens on 5062 (WS) and 5063 (WSS). Publish the ports you need in compose.yaml.
compose.yaml
For WSS, mount a trusted certificate as described in Secure the server. The EdgePort serves WSS with the same keystore it uses for TLS.
2

Run RTPEngine

RTPEngine needs a public IP and a UDP range for media, plus its control port (22222/udp by default). The following service uses the fonoster/rtpengine image from the Routr examples.
compose.yaml
On Kubernetes, deploy RTPEngine yourself. The Routr chart doesn’t include it.
3

Enable RTPRelay

RTPRelay runs as a post-processor middleware: the Message Dispatcher calls it after the Connect processor, so it can rewrite the SDP of INVITEs, responses, and ACKs, and release media sessions on BYE.
Set RTPENGINE_HOST. When it is set, routr-one starts RTPRelay and registers it as a middleware automatically. Set RTPENGINE_PORT if RTPEngine doesn’t use 22222.
compose.yaml
4

Tune Agents for browsers

Browsers create a new SIP contact on every page load, and an old contact stays in the location table until its registration expires. If an Agent’s maxContacts is low, new registrations fail with 403 Forbidden and the reason exceeds maximum of N allowed contacts.
  • Leave maxContacts empty in rctl (stored as -1, no limit), or set it high enough for the tabs and devices you expect.
  • Register with a short expiry in the client and unregister when the page closes. The registration lifetime comes from the client’s REGISTER request.
5

Point the client at Routr

Configure SIP.js or JsSIP with the WSS URL, the Agent’s SIP URI, and its credentials, for example:

Verify

Register a browser client, then call a desk softphone or a PBX Peer.
The call connects with two-way audio in both directions: browser to phone and phone to browser.

Troubleshooting

  • The browser can’t open the WebSocket. The page is served over HTTPS and you used ws://, or the certificate isn’t trusted. Use wss:// with a CA-issued certificate.
  • The call connects with no audio. RTPEngine’s PUBLIC_IP is wrong, or its UDP port range isn’t reachable from the internet.
  • RTPRelay never runs. On a split deployment, the middleware isn’t listed in dispatcher.yaml, or the EdgePort points directly at the Connect processor.
  • Registrations start failing after a few reloads. The Agent hit maxContacts. See the previous step.

Ephemeral agents in the browser

Register browser users with signed tokens instead of stored Agents.

RTPRelay reference

Environment variables and protocol.

EdgePort reference

Transports and the security context.

Helm values

The rtprelay and dispatcher values.