# JsSIP browser softphone library

JsSIP is the JavaScript library that turns a browser tab into a phone. Connect's softphone uses it to register a person's SIP endpoint with the carrier over secure WebSocket and to carry the call's audio over WebRTC. It is vendored as one self-contained file with a recorded checksum, and it is loaded only when the phone connects.

- **Status:** Reference
- **Audience:** both, developer
- **Last verified:** 2026-11-02
- **Canonical:** https://connectbyjbrh.com/docs/technology/jssip/

## What it is

JsSIP is an open-source SIP stack for browsers, maintained by Versatica. It implements SIP over WebSocket (RFC 7118) for signalling and uses the browser's WebRTC for media.

npm publishes JsSIP as CommonJS, which a browser cannot import directly, and CDN builds tried earlier still imported their dependencies from absolute paths. Connect bundles version 3.13.8 once with esbuild into a single ES module with no imports, and records how, so the build is reproducible byte for byte.

**Category** — SIP over WebSocket (browser)
**Version** — 3.13.8, bundled with esbuild
**File** — `webapp/vendor/jssip.esm.js`, with `jssip.esm.js.sha256`
**Official site** — [jssip.net](https://jssip.net/)

## Where Connect uses it

| Place in Connect | What it does there |
|---|---|
| `softphone.js` | Loads JsSIP dynamically inside `connect()` and registers the endpoint |
| Carrier registrar | Secure WebSocket to the carrier ([Vobiz](/docs/technology/vobiz/)) |
| `tools/test_softphone_ui_v1.py` | Asserts the file has no imports: the check that would have caught the outage |

## How it connects

1. A person opens the phone; `softphone.js` imports JsSIP
2. JsSIP opens a secure WebSocket to the registrar
3. REGISTER with the person's own SIP endpoint
4. An INVITE sets up the call, and WebRTC carries the audio
5. Hang-up sends BYE; the call record is written by the server from the carrier's events

## Benefits and limits

What it gives Connect:

- A full phone in the browser without a plugin or desk handset.
- Per-person endpoints can be revoked individually.
- Loaded lazily, so a phone failure stays inside the phone.

Where it stops, and what Connect does about it:

- A registered phone that never rings fails silently. Upgrades need a real registration test, not only the suite.
- Browsers need microphone permission and a secure origin.
- Network address translation can block media. Calls depend on the carrier's media relay.

## Security and privacy

- SIP over TLS WebSocket (`wss://`), never plain `ws://`.
- Endpoint credentials are issued per person and kept out of the page source.
- The sha256 record makes any change to the vendored bundle visible in review.

## Licence, cost and versions

| Question | Answer |
|---|---|
| Licence | MIT |
| Cost | None. Call charges are the carrier's |
| Version | 3.13.8 (vendored) |
| Compatibility | Current browsers with WebRTC; built with `--target=es2020` |

## Troubleshooting

**The whole app fails to load after an upgrade** — The new bundle has an import. It must have none.
**Registered but no incoming calls** — The registrar address or the endpoint is wrong. Use the carrier SDK's working address.
**One-way audio** — A NAT or firewall is blocking media. Test from another network.

## Official references

- [JsSIP documentation](https://jssip.net/documentation/)
- [JsSIP on GitHub](https://github.com/versatica/JsSIP)
- [RFC 7118: SIP over WebSocket](https://www.rfc-editor.org/rfc/rfc7118)

## Questions

### Why not load JsSIP from a CDN?

Every CDN build tried still imported dependencies from absolute paths that resolved against Connect's own origin and 404'd. That broke the module graph for the entire app. A single self-contained vendored file removes the risk.

### Does the softphone record calls in the browser?

No. Call records come from the server and the carrier's events, under the workspace's settings.

## Related

- [SIP over WebSocket](https://connectbyjbrh.com/docs/technology/sip-over-websocket/)
- [WebRTC](https://connectbyjbrh.com/docs/technology/webrtc/)
- [Vobiz telephony carrier](https://connectbyjbrh.com/docs/technology/vobiz/)
- [The no-build browser frontend](https://connectbyjbrh.com/docs/technology/browser-modules/)

## What this page is based on

- `webapp/vendor/README.md`
- `docs/agents/9a-phone-system.md`
- `tools/test_softphone_ui_v1.py`
