Real-time / Web

WebRTC (Web Real-Time Communications)

WebRTC is a browser-native API and protocol stack for peer-to-peer audio, video, and data transfer. It runs in every modern browser without plugins and is the foundation for browser-based softphones and voice agents.

Stack overview

WebRTC bundles four protocol families:

Browser API

const pc = new RTCPeerConnection({
  iceServers: [
    { urls: "stun:stun.didhub.io:3478" },
    { urls: "turn:turn.didhub.io:443?transport=tcp", username: "u", credential: "p" },
  ],
});
const stream = await navigator.mediaDevices.getUserMedia({ audio: true });
stream.getTracks().forEach(t => pc.addTrack(t, stream));
const offer = await pc.createOffer();
await pc.setLocalDescription(offer);
// Send offer.sdp to your signaling server (SIP WSS or custom)

WebRTC to PSTN interop

WebRTC alone cannot reach the PSTN — you need a SIP gateway that bridges WebRTC media (DTLS-SRTP, Opus) to traditional SIP/RTP (G.711). DIDHub provides this bridge as part of every SIP trunk: just send your INVITE over WSS and the carrier handles transcoding.

Related terms

Ready to get a number?

Pick a DID in 130+ countries from $1.99/month. Activates instantly on most numbers.