By Stan Reshetnyk, CTO, Trembit · Last updated: 4 December 2026 · Sources read on 4 December 2026
JsSIP vs SIP.js is a choice between two open-source JavaScript SIP stacks that let a browser register and place calls as a SIP endpoint over WebSocket (RFC 7118). A SIP gateway is the other architecture: SIP stays on your server, and the browser or mobile app speaks plain WebRTC plus your own signalling. Our rule of thumb: run SIP in the browser when you control the SIP server and can issue per-user, short-lived credentials; put a gateway in front when the SIP identity, trunk access, recording, transcoding or an AI tap must stay on the server.
Which side holds the SIP identity (the account that registers and places calls, and whose credentials can run up your trunk bill) decides your security model, your mobile story and where you can record, and neither library answers that.
Key takeaways
- Two architectures first, two libraries second.
- “No gateway” never means “no server”. WebRTC media must be DTLS-SRTP, so something on your side terminates it before a plain-RTP or SDES-SRTP trunk.
- Maintenance differs sharply. As of December 2026, JsSIP’s latest release is 3.14.0, from 1 December 2026; SIP.js’s latest npm release is 0.21.2 from October 2022, though its repository still merges changes.
- Mobile: SIP.js documents React Native support; JsSIP’s docs don’t cover it. Incoming calls on mobile need push, which favours a server-side SIP identity.
- Credentials: a browser SIP stack puts a SIP credential in client JavaScript, where a leaked one can dial out on your trunk.
- Many products end up with both: a browser stack for staff softphones, a gateway for customer-facing calls.
CTO or VP Eng? Jump to when a gateway beats a browser SIP stack and the decision table. Engineers: start with the library comparison.
What is the difference between a browser SIP stack and a SIP gateway?

The difference is where the SIP user agent lives: in the page, or on your server.
Option A, a browser SIP stack. The browser runs JsSIP or SIP.js, opens a WebSocket (normally WSS) to a SIP server and registers as a SIP endpoint with its own SIP identity. Calls are SIP dialogs that start in the page. The server at the other end must speak SIP over WebSocket: Kamailio has a websocket module, Asterisk a PJSIP WebSocket transport, FreeSWITCH a wss-binding on its Sofia profile. If FreeSWITCH is your server, our guide to connecting FreeSWITCH to WebRTC covers the WSS profile and TURN placement.
Option B, a SIP gateway. The browser or app talks to your backend over your own signalling (see running a signalling server in production) and sends media as ordinary WebRTC. A server-side component holds the SIP identity: it registers to the PBX or trunk, places and receives SIP calls, and bridges them to the WebRTC session.
Option A still needs media infrastructure. RFC 8827 says WebRTC media “MUST NOT be sent over plain (unencrypted) RTP or RTCP”, that DTLS-SRTP must be offered on every media channel, and that implementations must not offer SDES. If your trunk or PBX speaks plain RTP or SDES-SRTP, something on your side terminates DTLS-SRTP and ICE in both options. The real question is not gateway or no gateway; it is whether the SIP signalling, and with it the SIP identity, sits in the client or on your server.
How does SIP over WebSocket (RFC 7118) work?
RFC 7118 “specifies a WebSocket subprotocol as a reliable transport mechanism between Session Initiation Protocol (SIP) entities to enable use of SIP in web-oriented deployments.” The browser sends ordinary SIP messages as WebSocket frames.
Two details in the RFC shape every deployment. First, “the JavaScript stack in a browser has no way to determine the local address from which the WebSocket connection was made”, so the RFC has the clients and the registrar implement the Outbound (RFC 5626) and Path (RFC 3327) extensions. Second, the RFC’s examples state that “the SIP UAs are only reachable through the proxy to which they are connected.” In practice, every incoming call to a browser must route back through the exact proxy node that holds its WebSocket. That one sentence drives the routing and scaling points later in this guide.
Keep-alive is the failure you’ll meet first. RFC 7118 notes that the browser WebSocket API gives a page no control over whether WebSocket Ping frames are sent, and that SIP’s CRLF keep-alive (RFC 5626) is usable over the transport. In our view, assume an idle socket can die silently at a load balancer or NAT: send keep-alives from the server or as CRLF, keep registration expiry short, and re-REGISTER on every reconnect. Otherwise the registrar keeps a flow that no longer exists and incoming calls go nowhere.
How do JsSIP and SIP.js compare?
JsSIP is the actively released, lower-level stack with a single user-agent-and-events API. SIP.js offers a higher-level SimpleUser on top of a full API and documents React Native, but has not published to npm since October 2022. In our view, JsSIP is the safer default when you want a maintained npm release for a web client; SIP.js is the documented path for React Native, if you accept owning its release gap.
Our own production telephony work sits on the server side of this decision (see below). We haven’t published a project built on JsSIP or SIP.js, so the comparison below is from the repos, docs, changelogs and RFCs, read on 4 December 2026; we ran no benchmark.
| Criterion | JsSIP | SIP.js |
|---|---|---|
| Origin | Written by the authors of RFC 7118 (and of mediasoup) | Grew out of JsSIP and credits it |
| Latest npm release | 3.14.0, 1 December 2026 | 0.21.2, 27 October 2022 |
| Repository activity | Commits every day from 1 to 4 December 2026 | Last push 15 June 2026; tag 0.21.3 never published to npm |
| Licence | MIT | MIT |
| TypeScript | Migration in progress; type definitions ship in the package | Written in TypeScript |
| API style | One UA object configured up front, event handlers per call | SimpleUser (high level) or the full API (UserAgent, Inviter, SessionState) |
| Runtimes | Browser and Node.js | Browser; React Native documented for the full API |
| Token auth | authorization_jwt in the released package | JWT on main only, not in npm 0.21.2 |
| DTMF | SIP INFO by default, or RFC 2833 via the browser’s RTCDTMFSender | RFC 2833 or SIP INFO |
| Transfer | refer(); 3.14.0 fixed Replaces on the Refer-To header | refer(); passing a Session sends REFER with Replaces (attended) |
| Servers named in docs | Tested list includes Kamailio and Asterisk (a list of what was tested, not of what works) | README names Asterisk and FreeSWITCH |
| Best fit (our view) | Web softphones and Node.js tooling that need a moving, released codebase | React Native clients; quick prototypes on SimpleUser, with a plan to pin or build from source |
Both are MIT, both handle REFER-based transfer and both send DTMF either way, so features rarely decide it. Release cadence, API level, mobile support and token auth usually do. Two defaults are worth testing either way: JsSIP sends DTMF as SIP INFO unless told otherwise, which an IVR expecting RFC 2833 may never see, and JsSIP 3.14.0 changed how Replaces is generated on the Refer-To header, so test attended transfer on the exact version you pin.
Which one is easier to start with?
SIP.js, for a first call. Its README offers two routes: the high-level SimpleUser class, or the full API. JsSIP’s “Getting Started” goes straight to the lower level: you create new JsSIP.UA(configuration), call ua.call(), and attach handlers for progress, failed, ended and confirmed.
Once you outgrow SimpleUser, you work with SIP.js’s full API, a lower-level layer like JsSIP’s. Pick on release cadence, mobile support and token auth, not on the demo.
One thing to unlearn from the quick-starts: JsSIP’s README example puts password : 'superpassword' in the UA configuration. That is fine on a laptop and the first thing to design out in production; see where SIP credentials should live.
Which one is still maintained, and how do you check?
As of December 2026, the two projects are in very different states.
JsSIP published 3.14.0 on 1 December 2026, its 13th npm release of the year (the others came between January and May, and in October). The repository had commits every day from 1 to 4 December, including TypeScript ports of the dialog, UA and RTCSession code, and the 3.14.0 changelog adds a registrationRefreshed event and fixes GRUU handling and the Replaces header in transfers.
SIP.js‘s latest npm release is 0.21.2, published on 27 October 2022. A 0.21.3 tag (on a March 2025 commit) exists in the repository but was never published to npm. JWT authentication was merged into main in April 2026, and the last push was a documentation fix on 15 June 2026. The repository’s SECURITY.md still lists 0.19.x as the supported version, which is older than the release npm installs. We found no maintainer statement about the project’s future.
Both are widely used: each is downloaded about a million times a month on npm (4 November to 3 December 2026). Usage is not upkeep, though. For SIP.js, the practical consequence is that npm install gives you 2022 code and fixes reach main without a release, so plan to pin, vendor or build from a commit you have reviewed.
These facts will age. Before you commit, run the check yourself:
- Registry. Open
registry.npmjs.org/<package>and read thelatestdist-tag and its publish time. - Unreleased code. Compare the repo’s tags and default branch with npm. Is there a tag or a feature on
mainthat was never published? - Security policy. Read SECURITY.md. Does the supported version match the one npm installs?
- Activity. Read the last three months of commits, merged pull requests and maintainer replies on issues. Releases tell you whether code ships; merges and replies tell you whether your bug report will be heard.
Can you use JsSIP or SIP.js in React Native or a mobile app?
SIP.js documents it; JsSIP doesn’t. The SIP.js React Native guide says “The SimpleUser class will not work with React Native (it depends on the DOM).” The full API works if you “include the react-native-webrtc dependency” and “call the exposed registerGlobals() function before creating a new UserAgent instance”, and “The Core library works with React Native out of the box.” JsSIP’s documentation has no React Native page, so treat JsSIP on React Native as something to test, not assume.
The harder mobile problem is not the library; it is incoming calls. A SIP-over-WebSocket client is reachable only through the connection it holds (RFC 7118). In our view, a backgrounded or closed mobile app can’t be relied on to keep that socket open, so an incoming call needs a server that knows the user and sends a push (PushKit with CallKit on iOS, a high-priority FCM message on Android) to wake the app, which must then reconnect and re-REGISTER before the call times out. Once you run that server, it is a short step to letting it hold the SIP identity too. That is the strongest argument for a gateway on mobile, though a SIP proxy with its own push service is a legitimate design too.
When does a SIP gateway beat running SIP in the browser?
When something has to stay on the server: a credential, a media tap, a wake-up path for mobile, or operational control.
Where should SIP credentials live?
With a browser SIP stack, the credential the page uses to register reaches client JavaScript. Anyone who can open developer tools on that page can read it. A static SIP password is then a reusable credential against your SIP edge and, if that account can dial out, against your trunk bill.
If you run SIP in the browser, in our view the minimum is:
- Per-user SIP accounts, never one shared account baked into the bundle.
- Short-lived credentials instead of static passwords. Time-limited digest credentials work with any library. JsSIP’s released package also accepts
authorization_jwt, useful only if your edge validates the token; SIP.js has JWT auth onmainbut not in npm 0.21.2. - Authenticate the WebSocket at the proxy against your application session, before any SIP is accepted.
- A restricted dial plan for browser accounts, plus rate limits on registrations and call attempts.
A gateway keeps the SIP identity and the trunk credentials on the server; the client holds only an application session. That doesn’t remove the risk; it moves it. The gateway’s own API becomes the target: a stolen session or a loosely checked “place call” endpoint is toll fraud by another route. Enforce per-user dial rules and rate limits in your API, not only in SIP. Hardening the SIP server itself (ACLs, default passwords, exposed ports) is a separate job in both options.
Does a gateway change NAT traversal and the media path?
Not on the client side. In both options the browser leg is WebRTC, so it needs the same ICE set-up and TURN relays for restrictive networks. Our FreeSWITCH WebRTC guide covers where TURN sits.
What changes is who terminates DTLS-SRTP and where media can be forked. In Option A that is the media anchor in your SIP tier: Asterisk with webrtc=yes, FreeSWITCH, or rtpengine behind Kamailio. In Option B it is the gateway, which is part of your application.
Do you still need transcoding?
Often not, if your trunk speaks G.711. RFC 7874 requires WebRTC endpoints to implement Opus and G.711 (PCMA and PCMU), and states that this “will ensure, at a minimum, voice interoperability capabilities between WebRTC endpoints and legacy phone systems that support G.711.” A G.711 trunk needs no transcoding; a trunk limited to codecs outside the browser’s set (G.729 is the usual case) does, and that work happens in your media tier (rtpengine, for example, documents transcoding) or in the gateway. Choosing a browser SIP stack does not remove that job; it only changes which box does it.
Where can you record, fork audio to AI, or play prompts?
Only on a leg your server is in. With a gateway, the server-side leg belongs to your application: it knows which user and which call it is handling, so recording, forking audio to speech-to-text or a voice agent, and inserting a recording notice or an AI disclosure prompt are application features.
With a browser SIP stack, you can tap only where your media anchor is in the path. rtpengine documents call recording, and a PBX can record what it bridges. But the call context (which customer, which case) lives in your app, not in SIP, so you have to join the two.
If the plan includes a voice agent, read how audio moves between FreeSWITCH and an STT→LLM→TTS pipeline before you choose; it is far easier when the SIP leg is already on your server.
How do scale and operations differ?
With a browser stack, every open tab and every logged-in device holds a WebSocket and, usually, its own registration, even when nobody is calling. Your proxy tier grows with signed-in users; your media tier grows with concurrent calls. Those are different curves, and they belong on different machines: a SIP-and-WebSocket tier that routes back to the node holding each connection (RFC 7118 again), and a media tier that does the heavy work.
A gateway can collapse the registration count. Janus’s SIP plugin, for example, lets several web pages of the same user attach “and yet just do a SIP REGISTER once”. In exchange, you run the signalling tier yourself. For the media side, see scaling a FreeSWITCH tier.
What are the gateway and server options?
These are building blocks, not finished gateways: in Option B you still write the signalling bridge between your app and the SIP leg. We don’t rank them.
- Asterisk (PBX). Browsers register over a PJSIP WebSocket transport;
webrtc=yesturns on DTLS media encryption, ICE, AVPF and rtcp-mux. Serves as Option A’s server and media anchor, or as the SIP side of Option B. Compared in FreeSWITCH vs Asterisk. - FreeSWITCH (softswitch). A Sofia profile with
ws-binding/wss-bindingaccepts WebRTC clients; it can equally be the server-side SIP leg of a gateway. - Kamailio + rtpengine (proxy plus media proxy). Kamailio’s websocket module handles WS and WSS for SIP per RFC 7118, including connection keep-alive. rtpengine bridges ICE and non-ICE endpoints and DTLS-SRTP or SDES to plain RTP, with transcoding and call recording documented. This is Option A with separate proxy and media tiers.
- Janus SIP plugin (WebRTC gateway). The plugin is for “allowing WebRTC peers to register at a SIP server (e.g., Asterisk) and call SIP user agents through a Janus instance”; on the SIP side, calls “can do plain RTP or SDES-SRTP”.
- LiveKit telephony (room platform). Trunks and dispatch rules place phone callers into LiveKit rooms as participants.
- A CPaaS voice SDK, where the provider runs the gateway for you.
How do you decide between a browser SIP stack and a gateway?

The table is our engineering reasoning, not a sourced benchmark.
| Factor | Browser SIP stack (A) | SIP gateway (B) |
|---|---|---|
| SIP credentials | In client JavaScript; needs per-user, short-lived tokens | On the server; client holds an app session |
| NAT / media path | Browser to your SIP tier’s media anchor; TURN needed | Browser to the gateway; TURN needed |
| Codecs / transcoding | Same job, in your media tier | Same job, in the gateway |
| Recording | Only where your media anchor is in the path | On the gateway leg, with user and call context |
| AI / voice-agent tap | Possible at the media tier; context must be joined from your app | Native to your application |
| Mobile push | Built beside SIP registration, reconciling stale registrations | The gateway already knows the user |
| Scale / ops | Registrations grow with tabs and devices; route back to the connected proxy | Registrations per server identity; you run signalling |
| Time to first call | Fastest if you already run a WSS-capable PBX | Slower: signalling and bridge logic to build |
| Interop with existing SIP | Native: the browser is a SIP endpoint, PBX features reach it | Only what the gateway exposes |
Put these five yes/no questions to your team; they settle most cases:
- Will a credential with dial-out rights reach a device you don’t control? Yes: gateway, or a browser stack only with per-user tokens and a restricted dial plan.
- Do you need to record, transcribe, or put an AI agent on calls? Yes: gateway, or a media tier you run in the path of every call.
- Is a mobile app with incoming calls in scope? Yes: lean to a gateway, or budget for a push service beside your SIP proxy.
- Are the users staff at desks, using extensions and transfer on a PBX you run? Yes: browser stack.
- Do you need a first call soon, on an Asterisk or FreeSWITCH you already operate? Yes: browser stack, at least for now.
It can be both. The split we’d default to for most products is a browser SIP stack for internal staff softphones registered to your own proxy, and a gateway for customer-facing calling, where credentials, recording and mobile matter most.
If you’re making this call for a product, our WebRTC architecture review is built for it: bring your SIP edge diagram, or just who calls whom, from where and on which devices.
What does this look like in a production phone integration?
Trembit runs FreeSWITCH in production as a SIP proxy and PSTN bridge inside a HIPAA/GDPR-compliant healthcare video platform, connecting web and mobile clients with phone users and with hospitals’ corporate SIP conferencing infrastructure. More on that pattern in FreeSWITCH in production.
Our engineering reading of it: the web and mobile clients are one leg of the call, and the bridge toward the PSTN and the hospitals’ SIP systems lives on the server. That is why we’d enforce who may call whom, and hold trunk credentials, on the server side. Whichever client stack you choose, decide that server boundary first.
FAQ
Is SIP.js still maintained? Its repository still merges changes, but as of December 2026 its latest npm release is 0.21.2 from October 2022. Run the four-step check above before you depend on it.
What is the difference between JsSIP and SIP.js? Both are MIT-licensed JavaScript SIP stacks over WebSocket, and SIP.js grew out of JsSIP. JsSIP has one lower-level UA API and regular releases; SIP.js adds a higher-level SimpleUser, is written in TypeScript and documents React Native.
Do I need a SIP gateway to connect WebRTC to the PSTN? You need something on your side that terminates DTLS-SRTP and ICE whenever the trunk doesn’t speak them, because WebRTC media must be DTLS-SRTP. A signalling gateway is a separate choice: it moves the SIP identity off the client.
Is it safe to put SIP credentials in the browser? Only with per-user, short-lived tokens, an authenticated WebSocket and a restricted dial plan. A shared static password in client code is a toll-fraud risk.
Can I use JsSIP or SIP.js in React Native? SIP.js documents it for the full API with react-native-webrtc; SimpleUser won’t work. JsSIP’s docs don’t cover React Native, so test it. Either way, incoming calls on mobile need push.
Adding phone calls to a web or mobile app? Book a free 30-minute call with a Trembit engineer. Bring your SIP edge diagram or the decision you’re stuck on (browser stack or gateway, JsSIP or SIP.js), and we’ll pressure-test it. No deck, no pitch. Trembit has delivered 50+ video and voice projects over 15+ years.