JsSIP is a robust and lightweight JavaScript SIP library that enables real-time communication capabilities in both browser and Node.js environments. It currently maintains version 3.13.6, with a steady release cadence indicating active development and timely updates. The library facilitates SIP over WebSocket (RFC 7118, co-authored by JsSIP's creators), supporting audio/video calls via WebRTC, and instant messaging. Its key differentiators include its dual-environment compatibility, a user-friendly yet powerful API, and demonstrated interoperability with popular SIP servers like Kamailio, Asterisk, and Mobicents. JsSIP provides a flexible foundation for integrating SIP functionality directly into web applications, abstracting the complexities of WebRTC and WebSocket signaling for developers.
npm install jssipVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate a JsSIP User Agent, configure a WebSocket transport, register event handlers for the call lifecycle, and initiate an audio/video SIP call. It showcases the fundamental setup required for WebRTC-based communication using JsSIP in a modern JavaScript/TypeScript environment, including proper import syntax and basic error handling.
Migrate your media handling logic to explicitly manage `MediaStream` objects obtained from `RTCSession` events and attach them to `<video>` or `<audio>` elements in the DOM. Consult `JsSIP.RTCSession` documentation for details.
Ensure your SIP over WebSocket server is configured with a publicly trusted SSL/TLS certificate from a recognized Certificate Authority (CA) for production. For development, you may need to explicitly trust self-signed certificates in your browser or OS, or temporarily use non-secure `ws://` if appropriate.
Implement robust UI/UX to proactively prompt users for media permissions. Gracefully handle permission denials by informing the user and guiding them on how to grant permissions via browser or operating system settings. Always check `navigator.mediaDevices.getUserMedia` promises for rejection.
Verify that your SIP server (e.g., Kamailio, Asterisk, Mobicents) has a WebSocket listener enabled and properly configured for the correct path and port, with TLS/SSL correctly set up if using WSS. Check server logs and network activity in browser developer tools for connection errors.
Upgrade to JsSIP 3.2.17 or later, which includes changes to switch to `MediaStreamTrack` from the deprecated `MediaStream` API. If using older versions, ensure `webrtc-adapter` is properly included and up-to-date in your application.
Inspect your browser's developer console for more specific WebSocket errors. Verify your SIP server's SSL/TLS certificate is valid and trusted. Confirm the WebSocket server is running and accessible on the specified URL and port, and that firewalls are not blocking the connection.
Guide the user to grant media permissions. Advise them to check their browser's site settings (e.g., camera and microphone permissions) and operating system privacy settings. Consider providing a UI element to trigger the permission prompt again.
Ensure the `UA` instance is correctly configured and `ua.start()` is called and has had time to establish its connection before `ua.call()` is invoked. Check for errors during `ua.start()` and related event handlers (`registered`, `unregistered`, `registrationFailed`).
Review the SIP URI string (`sip:bob@example.com` in the quickstart) to ensure it adheres to the correct SIP URI syntax (e.g., `sip:user@host` or `sips:user@host`). Avoid common typos or missing components.
No dependency data recorded yet.