Browser softphone
Put the rep’s phone in your web app with @rydhm/web. Online status, outbound calls, callbacks that ring in the browser, mute and hang up.
The softphone is the rep’s side of a rep call. It’s headless: @rydhm/web handles the audio, the connection and the events, and your app draws the buttons. It runs in current Chrome, Edge, Firefox and Safari, desktop and mobile.
Without a build step, the script tag gives you the same class as window.Rydhm.Softphone (no data-key needed for the softphone alone):
engine.js is a small loader; when the softphone goes online it loads engine-livekit.js from the same directory. A Content Security Policy must allow both files: see Browser support, size and CSP. With npm, livekit-client is a chunk your bundler splits out instead.
1. Mint a token on your server
The softphone needs a token for one rep, from your server (it takes your secret key). It’s valid for 12 hours.
Express
Python
2. Go online in the browser
The softphone connects right away (pass autoConnect: false to wait for phone.connect()). Being connected is being online: Rydhm marks the rep online and rings their callbacks here. It reconnects by itself with backoff, refreshing the token when it expired. phone.disconnect() goes offline.
3. Make a call
Your server starts the call (rydhm.repCalls.create) and hands its reply to the browser, which joins it:
The microphone is asked for on the first join: call it from a click. Join straight away: a call’s join token is valid for 15 minutes, a callback’s for 2. To hand a call to the AI for the voicemail, have your server call leaveVoicemail (a button in your UI that posts to your server): the rep is released at once and can dial the next one. See AI voicemail.
4. Take callbacks
When a prospect calls back one of your pool numbers, it rings the rep’s browser first:
phone.incoming lists the calls ringing now; phone.answer() and phone.decline() act on the newest. A callback that isn’t answered within ringSeconds stops ringing here and moves to the next step of the routing.
Members
How it works
- The softphone token joins the rep’s presence room,
rep_presence_<rep id>, with permission to listen and receive data only, and no AI in it. Being in that room is being online. - A callback arrives there as a
call.incomingevent on therydhm.eventsdata topic, withdata.join, a short-lived token for the call’s own room, anddata.ringSeconds. Answering is joining that room and publishing the microphone. - In a call, the
call.*events arrive on the same topic, so the transcript and suggestions reach the browser directly. - Decline and hang up call
POST /v1/rep-calls/{id}/declineand/hangupwith the softphone token as the bearer, for that rep’s own calls only. Those two routes answer requests from any website (the token is the credential, and no cookie is ever read), so they work from your own app’s pages. If Rydhm can’t be reached,hangup()still leaves the call in the browser, then rejects (and emitserror) saying the other side may still be on: end it from your server withPOST /v1/rep-calls/{id}/hangup.
To try it without writing a page, open demo/softphone.html from the @rydhm/web package, paste the token reply your server got, and choose Go online. The examples/sdr-node folder has the whole flow, server and page.
See the Browser SDK reference for every option and event.