A SIP client library using Web Worker architecture to handle SIP signaling separately from the UI thread. Supports multiple tabs sharing a single SIP session.
- ✅ Multi-tab Support: Multiple tabs can share a single SIP session
- ✅ Web Worker Architecture: SIP signaling runs in SharedWorker
- ✅ WebRTC Media: Handle audio/video calls with WebRTC
- ✅ Call Control: Hold/unhold, mute/unmute, call transfer
- ✅ DTMF Support: Send DTMF tones during calls
- ✅ Tab Coordination: Automatically select tab to handle media
- ✅ State Synchronization: Synchronize state between tabs
npm install sip-worker.js# Build client library
npm run build
# Build worker
npm run build:worker
# Build both
npm run build:allimport { SipWorkerClient } from 'sip-worker.js';
const sipClient = new SipWorkerClient();sipClient.register({
uri: 'sip:username@domain.com',
username: 'username',
password: 'password',
displayName: 'Display Name'
}, {
server: 'wss://domain.com:443',
secure: true
});sipClient.on('sip_registered', () => {
console.log('SIP registered successfully');
});
sipClient.on('call_incoming', (message) => {
const callInfo = message.data;
console.log(`Incoming call from: ${callInfo.remoteUri}`);
// Accept call
sipClient.answerCall(callInfo.id);
// Or reject
// sipClient.rejectCall(callInfo.id);
});
sipClient.on('call_progress', (message) => {
const callInfo = message.data;
console.log(`Call state: ${callInfo.state}`);
});sipClient.makeCall('sip:target@domain.com');// Mute/unmute
sipClient.muteCall(callId);
sipClient.unmuteCall(callId);
// Hold/unhold
sipClient.holdCall(callId);
sipClient.unholdCall(callId);
// DTMF
sipClient.sendDtmf(callId, '123');
// Transfer
sipClient.transferCall(callId, 'sip:target@domain.com', 'blind');- SipCore: Handle SIP signaling with SIP.js
- TabManager: Manage tabs and select tab for media handling
- MessageBroker: Handle messaging between worker and tabs
- WorkerSessionDescriptionHandler: Custom SDP handler for worker
- SipWorkerClient: Main client API
- MediaHandler: Handle WebRTC media, getUserMedia, ICE
Tab A ←→ MessageBroker ←→ SipCore ←→ SIP Server
Tab B ←→ ↑
Tab C ←→ TabManager
Open index.html in browser to see full demo with:
- SIP registration
- Incoming/outgoing calls
- Call controls (hold, mute, transfer)
- DTMF keypad
- Multi-tab coordination
Or run dev server:
npm run devinterface SipConfig {
uri: string; // SIP URI
username?: string; // Username
password?: string; // Password
displayName?: string; // Display name
registerExpires?: number; // Registration expiry (seconds)
}interface TransportConfig {
server: string; // WebSocket server URL
secure?: boolean; // Use TLS
iceServers?: IceServer[]; // STUN/TURN servers
}| Event | Description |
|---|---|
worker_ready |
Worker is ready |
sip_registered |
SIP registration successful |
sip_unregistered |
SIP unregistered |
sip_registration_failed |
SIP registration failed |
call_incoming |
Incoming call |
call_progress |
Call progress |
call_terminated |
Call terminated |
call_muted |
Call muted |
call_held |
Call held |
- Chrome/Chromium 80+
- Firefox 74+
- Safari 13+
- Edge 80+
This project is licensed under a Custom License. See LICENSE file for details.
- Free for Omicx: This software is free to use for the Omicx product (https://omicx.vn)
- Other Commercial Use: For all other commercial applications, please contact luongld.it@gmail.com for licensing terms
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
For support and questions:
- Email: luongld.it@gmail.com
- Issues: GitHub Issues