WebRTC and SIP are both real-time communications protocols but they speak different dialects. Bridging them requires converting between ICE and NAT traversal methods, DTLS-SRTP and SDES-SRTP encryption, and Opus and G.711 codecs. Here is how to do it right.
WebRTC and SIP were developed independently for different environments. Understanding the differences explains why bridging them is non-trivial:
| Feature | WebRTC | SIP |
|---|---|---|
| Transport signaling | WebSocket (WS/WSS) | UDP, TCP, TLS |
| NAT traversal | ICE (STUN/TURN) — mandatory | SBC, STUN — optional |
| Media encryption | DTLS-SRTP — mandatory | SDES-SRTP — optional, plain RTP common |
| Multiplexing | BUNDLE — single port for all media | Separate ports per stream |
| Default audio codec | Opus (mandatory in spec) | G.711 (most common) |
| RTCP | rtcp-mux (same port as RTP) | Separate port (N+1) |
| SDP complexity | High (ICE candidates, fingerprint, extmap) | Low (c= line, m= line) |
A WebRTC-to-SIP gateway must handle all of these differences simultaneously. Missing any one conversion layer causes the call to fail or have no media.
WebRTC browsers typically use SIP over WebSocket (RFC 7118) or a proprietary signaling protocol (like Janus API). The gateway must convert this to standard SIP over UDP/TCP/TLS.
The browser sends SIP messages over a WebSocket connection to the SIP proxy or SBC. The proxy terminates the WebSocket and converts to standard SIP transport. Kamailio supports WebSocket via the WebSocket module. Asterisk supports it via PJSIP WebSocket transport.
WebRTC mandates DTLS-SRTP. Most SIP endpoints use SDES-SRTP (keys in SDP) or plain RTP. The gateway must:
WebRTC clients default to Opus. Most PSTN-connected SIP endpoints use G.711. Transcoding is required unless the SIP endpoint also supports Opus.
WebRTC uses BUNDLE to multiplex all media streams on a single port and rtcp-mux to share RTP and RTCP on the same port. SIP endpoints use separate ports. The gateway must un-bundle for the SIP side and handle separate RTCP ports.
ICE (Interactive Connectivity Establishment) is mandatory in WebRTC but unknown to SIP. The gateway's role in NAT/ICE:
WebRTC uses WebSocket for signaling, mandatory ICE for NAT traversal, mandatory DTLS-SRTP for media encryption, BUNDLE for multiplexing, and Opus as the default codec. SIP uses UDP/TCP/TLS for signaling, optional SBC or STUN for NAT, optional SRTP or plain RTP, separate media ports, and G.711 as the most common codec. Bridging them requires converting between all these differences simultaneously.
Bridge WebRTC to SIP using a media gateway (FreeSWITCH, Asterisk, or a certified SBC). The gateway terminates the WebRTC leg with DTLS-SRTP and ICE, then originates a new SIP leg with SDES-SRTP or plain RTP and a standard c= line address. It transcodes Opus to G.711 and strips ICE candidates from the SDP before forwarding to SIP endpoints.
No audio in WebRTC to SIP bridging is usually caused by ICE candidates not being stripped from the SIP-side SDP (488 or silent failure), DTLS handshake not completing on the WebRTC side, or the gateway not performing codec transcoding between Opus and G.711. Check the SDP on the SIP leg — it should contain only a simple c= line with no ICE attributes.
Paste your SIP trace into SIPSymposium. The analyzer checks for ICE stripping, DTLS negotiation, codec compatibility between WebRTC and SIP legs, and SDP format issues.