Use WebRTC when people talk to a voice agent from a web page or app, and SIP or a carrier when they dial a phone number. WebRTC carries the audio from browsers, and SIP sets up calls on the phone network. Dograh, the open-source AI voice agent platform, takes both kinds of call.
Key Takeaways
- SIP sets up and ends calls, and WebRTC moves encrypted audio from browsers and apps.
- Reaching a phone number needs the phone network, so a carrier or SIP sits somewhere.
- Browsers send wideband Opus, while most phone calls still arrive as 8 kHz G.711.
Picking a transport looks like plumbing. In practice it decides who can reach your agent and how it sounds. We compare WebRTC and SIP on transport, audio, reach, setup and security, give the case each side makes, then show how Dograh handles web and phone calls.
What WebRTC and SIP each do on a call
WebRTC and SIP solve different problems, which is why comparing them confuses people. SIP, the Session Initiation Protocol, is a signaling protocol. RFC 3261 defines it as a control protocol for creating, modifying and ending sessions such as phone calls. SIP handles the ringing and the hang-up. The voice itself travels in a separate RTP stream that the SIP messages point at.
WebRTC is a full media stack built into every major browser and many mobile apps. It finds a network path between two ends, encrypts the audio and deals with echo, jitter and lost packets by itself. What it leaves open is how a call gets set up. Each app picks its own signaling, and that signaling can even be SIP over WebSocket, as RFC 7118 describes. Our WebRTC vs WebSocket comparison looks at that other pairing, from setup time and relays to where the audio travels.
So the two often sit in the same call. A browser can speak SIP to a phone system while WebRTC carries the sound. The useful question for a voice agent is where your callers start, in a browser or on a phone, and what path their audio takes to the agent. Our Telephony 101 for Voice AI post covers numbers and carriers, and our explainer on what SIP trunking is covers the trunk itself.
WebRTC vs SIP side by side
The table puts the two next to each other on the points that matter when a voice agent answers.
| WebRTC | SIP | |
|---|---|---|
| Main job | Moves live media between browsers, apps and servers | Sets up, changes and ends calls between phone systems |
| Media transport | UDP first, with its own path finding (ICE, STUN, TURN) | RTP, usually over UDP, set up by the SIP messages |
| Audio codecs | Opus and G.711 are required in every endpoint | Agreed per call, G.711 on most carrier trunks |
| Who can reach the agent | Anyone on your web page or in your app | Any phone, through a carrier or a PBX |
| Setup | HTTPS page, a signaling server, TURN for strict networks | Carrier account or trunk, numbers, IP allow list or credentials |
| Encryption | Required on every media channel (DTLS-SRTP) | Optional, TLS for signaling and SRTP for audio when both ends support them |
| Typical agent use | Website talk button, in-app voice, browser testing | Inbound numbers, outbound campaigns, transfers to staff |
Neither column wins outright. WebRTC brings better audio and encryption you cannot switch off, but only for people already on your page or app. SIP reaches any phone number, at phone audio quality, with security you have to turn on.
Audio quality and codecs on each path
Audio quality comes down to the codec and the sample rate at each end. RFC 7874 requires every WebRTC endpoint to implement Opus and G.711. Opus is the one browsers prefer, and RFC 6716 says it scales from 6 kbit/s narrowband speech up to 510 kbit/s fullband stereo music. That range lets it adapt to a weak connection and still sound clear.
The phone network still runs on G.711, which samples at 8 kHz and sends 64 kbit/s. Most carrier trunks use it by default, and Twilio, for example, offers Opus on its trunks only as limited availability that is not supported end to end. So a call that starts in a browser and ends on a phone is transcoded from Opus to G.711 at the gateway, and the wider audio is gone from that point on.
For a voice agent, this sets the ceiling on what speech recognition hears. Most phone calls still reach the agent as 8 kHz audio, while a browser demo runs at 16 kHz. An agent that catches every word in a browser test can miss names and numbers on a real call. Test on the path your callers will actually use.
Open Source Alternative to Vapi / Retell
Self-hosted voice agent platform — no per-minute fees
dograh-hq/dograh
Star on GitHub
Who can reach the agent, browsers or phones
Reach is usually the deciding question. WebRTC on its own connects people who are already in your browser page or your app. That covers a talk button on your website, voice inside a mobile app and internal tools where every user has a laptop. Nobody can dial into it from a phone, because there is no phone number on that path.
Anyone who dials a number reaches you through the phone network, so a carrier and SIP sit somewhere on that call. You do not always see the SIP part. Carriers such as Twilio, Plivo and Telnyx answer the phone call on their side and stream the audio to your server over a WebSocket, so your code never touches SIP. If you run your own phone system or buy a trunk, SIP arrives at your door directly. Our comparison of SIP trunk providers covers which carriers to look at.
The two worlds also meet. A WebRTC to SIP gateway turns a browser call into a phone call and back, which is how a website caller can be handed to a person on a desk phone. If the website side is your first step, our guide to adding a voice widget to your website walks through it.
Setup and security for each
WebRTC setup lives mostly in the browser and the network. Browsers give a page the microphone only over HTTPS or on localhost, so a live site needs a real certificate. You also need a signaling server to start each session. Then comes the network path. Most calls find a direct route, but behind a VPN, a corporate firewall or strict NAT the direct path fails, and a TURN server has to relay the audio. Plan for TURN before launch, because these failures show up as a call that connects with no sound.

Security is built in. RFC 8827 requires every WebRTC media channel to be secured with SRTP, forbids sending media over plain RTP and requires DTLS-SRTP to be offered on every channel. You cannot ship an unencrypted WebRTC call by mistake.
SIP setup sits with your carrier and your phone system. You open a carrier account or trunk, buy numbers, and prove the traffic is yours with an IP allow list or a username and password. Your firewall has to pass the signaling and the RTP audio ports. Encryption is optional on SIP. TLS protects the signaling and SRTP protects the audio, but both ends must support them, so check what your carrier offers and switch them on.
Where the two camps disagree
Vendors on each side argue their layer matters most, and both have a point. IDT Express, which sells SIP trunks, says the two are layers rather than rivals and that most production voice stacks use both. Its case for SIP is reach, since WebRTC cannot call a phone number on its own. It also estimates that each conversion from Opus to G.711 adds about 5 to 20 ms per leg, on top of the 200 to 500 ms that speech recognition and the language model already take. Its advice is to negotiate G.711 on both sides where you can.
WebRTC.ventures, a consultancy that builds WebRTC systems, argues that WebRTC is the best transport for real-time voice AI. Its point is how lost packets are handled. WebRTC drops a lost packet and keeps the audio moving, while a stream over TCP stops to resend it, which it says can cause robotic voice and extra delay on a bad network. It adds that echo cancellation and noise suppression come built in.
Our view is that each camp is right about its own layer and that the starting point of the call settles the choice. SIP trunking is the most reliable path for production phone traffic, and WebRTC is the right path for browser callers. The transport is also rarely what makes an agent feel slow. End-to-end response under about 800 ms is the bar for natural conversation, and speech recognition usually eats more of that budget than the network does.
Join the Dograh Community
Dograh is an OSS alternative to Vapi. Join our Slack community for queries, releases, best practices & community interactions.
When to use WebRTC, SIP or both
Use WebRTC alone when every caller is already on your site or in your app. A talk button on a pricing page fits, and so does a voice assistant inside a mobile app or agent testing in the browser. You skip numbers and carrier bills entirely, and the audio is as good as the caller's connection allows.
Use SIP or a carrier when callers dial a number. Inbound support lines and outbound reminder campaigns start on the phone network, and handing a call to staff on desk phones ends there. If you already run a PBX, SIP lets the agent sit next to it as one more destination.
Use both when the same agent should answer in either place, which is where most production agents end up. A customer can press a talk button on your site in the evening and dial your number the next morning, and the same agent with the same prompt answers both. Build and test in the browser first, then prove the agent on the phone path before real callers reach it.
Web calls and phone calls in Dograh
In Dograh, one agent takes both kinds of call. Web calls run over WebRTC, from Test Agent in the agent editor or from a voice widget on your site, at 16 kHz, the most the call pipeline uses. Phone calls on Twilio, Plivo and Telnyx arrive as an audio stream over a WebSocket, and SIP calls come in through your own Cloudonix account or Asterisk ARI, on Dograh Cloud or on a self-hosted install. The telephony overview lists every provider.
The phone path carries narrower audio than a web call, so after browser testing, place a real call with Phone Call in the editor. Transfers run on the phone path too. Transfer Call to a person works on Twilio, Telnyx, Plivo, Cloudonix and Asterisk ARI, and Dograh calls the destination first and connects the caller only when someone answers.
The code is BSD 2-Clause open source, so you can self-host Dograh, and Enterprise plans add on-prem deployment with custom SLAs. Self-hosting means no per-minute platform fee, but servers, model keys and phone minutes still cost money, and your team looks after the database, upgrades and, for web callers on strict networks, a TURN server. Our guide to putting a self-hosted voice agent on your own domain covers the HTTPS part. Dograh Cloud runs the same platform for a 1¢-a-minute platform fee instead.
Glossary
- TURN server
- A relay that carries WebRTC audio when the browser and server cannot reach each other directly, such as behind a VPN, a corporate firewall or strict NAT.
- DTLS-SRTP
- The key exchange and encryption WebRTC must offer on every media channel, so browser call audio is always encrypted in transit.
- Transcoding
- Converting audio from one codec to another, such as Opus from a browser to G.711 for the phone network. It adds a little delay and drops the wider audio.
- SIP over WebSocket
- A way to carry SIP signaling inside a WebSocket, defined in RFC 7118, so a browser can act as a SIP phone while WebRTC carries the audio.

