A production-ready SIP-over-WebSocket (WSS) provider model that enables users to connect from browsers or web applications using their own SIP credentials.
This project provides a universal SIP WebSocket gateway that allows web-based SIP clients (like Browser-Phone, JsSIP, SIP.js) to connect to any backend SIP server without being locked into a specific PBX.
- User visits your web app (e.g.,
https://phone.yourdomain.com) - They enter their SIP credentials:
- SIP domain:
sip.mycompany.com - Username:
user123 - Password:
secret
- SIP domain:
- Browser connects via
wss://sipproxy.yourdomain.com:443 - Kamailio proxy accepts WSS β converts to standard SIP UDP/TCP β forwards to their SIP server
- Media flows through rtpengine for WebRTC compatibility
| Component | Role | Notes |
|---|---|---|
| Kamailio | WSS proxy + TLS terminator | Handles SIP over WebSocket |
| rtpengine | Media relay | Converts SRTP β RTP for WebRTC |
| Let's Encrypt | TLS certificates | Auto-renew for secure WSS |
| Browser Phone UI | Web client (optional) | JsSIP or SIP.js based |
| Any SIP server | Backend destination | Receives REGISTER, INVITE |
- Ubuntu 22.04 or 24.04 LTS
- Domain name pointing to your server (e.g.,
sipproxy.yourdomain.com) - Root or sudo access
- Ports: 80, 443, 8080, 5060-5061 (UDP/TCP), 10000-20000 (UDP for RTP)
git clone https://github.com/jishanalibd/universal-sip-websocket-proxy.git
cd universal-sip-websocket-proxysudo bash scripts/install.shThis will:
- Install Kamailio and rtpengine
- Configure firewall rules
- Set up systemd services
- Install required dependencies
Edit /etc/kamailio/kamailio.cfg and update:
#!define DOMAIN "sipproxy.yourdomain.com"
sudo bash scripts/setup-ssl.sh sipproxy.yourdomain.com [email protected]sudo systemctl start kamailio
sudo systemctl start rtpengineSee docs/INSTALLATION.md for step-by-step installation instructions.
For quick command reference, see docs/QUICK-REFERENCE.md.
The main Kamailio configuration is located at:
/etc/kamailio/kamailio.cfg- Main configuration/etc/kamailio/tls.cfg- TLS settings
Configuration file: /etc/rtpengine/rtpengine.conf
Key settings:
- Interface for RTP relay
- Port ranges
- Kernel forwarding
var config = {
websocket_proxy_url: 'wss://sipproxy.yourdomain.com:443',
domain: 'sip.mycompany.com', // User's actual SIP domain
username: 'user123',
password: 'secret',
display_name: 'John Doe'
};var socket = new JsSIP.WebSocketInterface('wss://sipproxy.yourdomain.com:443');
var configuration = {
sockets: [socket],
uri: 'sip:[email protected]',
password: 'secret'
};
var ua = new JsSIP.UA(configuration);
ua.start();See docs/CLIENT-EXAMPLES.md for more examples.
- TLS 1.2+ required for WSS connections
- Automatic certificate renewal via Let's Encrypt
- SIP digest authentication
- Rate limiting and anti-flood protection
- IP-based access control (optional)
See docs/TROUBLESHOOTING.md for common issues and solutions.
# Check Kamailio logs
sudo tail -f /var/log/syslog | grep kamailio
# Check rtpengine logs
sudo journalctl -u rtpengine -f
# Test WebSocket connection
wscat -c wss://sipproxy.yourdomain.com:443A ready-to-use web-based test client is included in the examples/ directory:
# Serve the test client
cd examples
python3 -m http.server 8000
# Open http://localhost:8000/test-client.html in your browserThe test client allows you to:
- Connect to your WebSocket proxy
- Register with any SIP server
- Make and receive calls
- View real-time logs
See examples/README.md for more details.
.
βββ config/
β βββ kamailio/ # Kamailio configuration files
β βββ rtpengine/ # rtpengine configuration
β βββ systemd/ # systemd service files
βββ scripts/
β βββ install.sh # Main installation script
β βββ setup-ssl.sh # SSL certificate setup
β βββ firewall.sh # Firewall configuration
βββ docs/
β βββ INSTALLATION.md # Detailed installation guide
β βββ CLIENT-EXAMPLES.md # Client configuration examples
β βββ TROUBLESHOOTING.md # Troubleshooting guide
βββ examples/
β βββ test-client.html # Web-based test client
β βββ README.md # Examples documentation
βββ README.md
Contributions are welcome! Please feel free to submit a Pull Request.
MIT License - see LICENSE file for details.
- Kamailio - SIP server
- rtpengine - RTP/media proxy
- Browser-Phone - WebRTC phone UI
- JsSIP - JavaScript SIP library
For issues and questions:
- Create an issue on GitHub
- Check the documentation
- Review troubleshooting guide
- Use UDP for SIP signaling when possible
- Configure kernel RTP forwarding in rtpengine
- Enable Kamailio's shared memory optimizations
- Use SSD storage for better I/O performance
- Consider using multiple rtpengine instances for load balancing
βββββββββββββββ WSS (443) ββββββββββββββββ
β Browser ββββββββββββββββββββββββββββΊβ Kamailio β
β (JsSIP) β β WSS Proxy β
βββββββββββββββ ββββββββ¬ββββββββ
β² β
β β SIP UDP/TCP
β SRTP β
β βΌ
βββββββ΄ββββββββ ββββββββββββββββ
β rtpengine ββββββββββββββββββββββββββββΊβ Backend SIP β
β Media Relay β RTP β Server β
βββββββββββββββ ββββββββββββββββ
The proxy acts as a transparent gateway, forwarding SIP messages to any backend SIP server while handling WebSocket/TLS on the client side and RTP/SRTP media conversion.