WebRTC has been designed to be compatible with traditional Voice over IP (VoIP) networks while still leaving room for innovation. As a result WebRTC specifies the use of audio and video coders and decoders that are common among VoIP devices such as H.264 for video and OPUS and G.711 for audio. This allows the communication of media between WebRTC browsers and VoIP endpoints without the need to transcode the streams.
Even with media coder compatibility, WebRTC is not completely interoperable with VoIP devices; WebRTC defines the use of WebSockets as a transport for the Session Initiation Protocol (SIP) used to signal calls. VoIP devices tend to use User Datagram Protocol (UDP) and Transmission Control Protocol (TCP) as transports for SIP in the signaling layer.
There is also some discrepancy with the way that WebRTC applications establish the media stream. The WebRTC standard defines the use of Interactive Connectivity Establishment (ICE) for NAT traversal and Datagram Transport Layer Security (DTLS) as a keying establishment method for securing the media stream. There are two possible ways to overcome these incompatibilities and enable communications between WebRTC and VoIP endpoints:
One possible way to enable communications between WebRTC and VoIP endpoints is through the use of gateways. Gateways can be placed between the endpoints in both the signaling path and the media path. The signaling gateway is used to convert the SIP over WebSockets to a signaling protocol that the VoIP device can understand such as SIP over UDP. The gateway in media layer will connect to the WebRTC endpoint using ICE and DTLS and connect to the VoIP endpoint using a keying mechanism that it understands such as negotiating keys through the Session Description Protocol (SDP) and then all media will be routed through the gateway when going between the endpoints.
Gateways allow WebRTC and VoIP endpoints to communicate but it comes with some major drawbacks. Gateways require extra equipment and resources that need to be allocated for the duration of any calls going through them, they will increase the amount of time that is needed for call setup, increase latency of the media, and the call signaling and media will need to be decoded at the gateways before being sent to the peer which means that the gateways can eavesdrop on the call and remove any guarantees of call security. It is clear that another solution may be desired.
VOIP Endpoints with WebRTC Support
Another solution to enabling communications between WebRTC and VoIP endpoints is to incorporate the WebRTC standards into the VoIP endpoint. If the VoIP endpoint supports the ability to use SIP over WebSockets for signaling, ICE for NAT traversal, and DTLS for secure media keying establishment then it will be able to communicate with WebRTC endpoints directly. This will increase overall call security because the streams do not need to be unencrypted by an intermediary. It will also remove the need for extra equipment and decrease the time needed to setup the call.
Call quality can also benefit from this solution because there will be decreased latency for the media stream and there is a lower chance for packet loss as the stream can travel directly to the peer rather than being routed through the gateway. It is clear that using a VoIP endpoint with built in WebRTC support is a better solution than relying on gateways for compatibility between WebRTC and VoIP endpoints.