By Sagar Shankaran, Founder of CallSphere
SDP munging is a footgun. But for AI voice agents it is sometimes the only way to control codecs, strip private candidates, or pin Opus DTX. Here is the 2026 playbook.
Key takeaways
SDP munging — editing the SDP string between createOffer and setLocalDescription — is officially discouraged. In practice every serious AI voice deployment does it for at least one specific reason. Knowing which reasons are legitimate is the difference between a stable agent and a broken one.
The WebRTC Working Group's official position is that anything you can do by editing SDP you should do via `RTCRtpSender.setParameters()`, transceiver direction, or codec preferences. That has been true since 2022 — except for a small list of behaviors that the API still does not expose:
For AI voice in 2026 these tweaks really matter. Forcing FEC and DTX on Opus shaves 30% off bitrate at no quality cost; stripping VPC candidates shaves 4–6 seconds off failed connection times because the browser stops trying to reach 10.x.x.x addresses it can never see.
```mermaid flowchart LR Offer[createOffer] --> Edit[Munger - regex on SDP] Edit --> SetLocal[setLocalDescription] SetLocal --> Send[send to peer] ```
The munger sits between offer creation and local description set. Always edit before `setLocalDescription`; editing after is a guaranteed bug because DTLS fingerprints and BUNDLE groups are already locked.
CallSphere uses two specific munges:
Hear it before you finish reading
Talk to a live CallSphere AI voice agent in your browser — 60 seconds, no signup.
We run the same munges in Real Estate (OneRoof, /industries/real-estate), healthcare, behavioral health, legal, salon, and insurance. Across 90+ tools and 115+ DB tables, the munge code is one shared library audited under SOC 2 + HIPAA controls. Pricing $149/$499/$1499 with the 14-day trial; affiliates 22% — see /affiliate.
```ts function tuneOpus(sdp: string): string { return sdp.replace(/a=fmtp:111 .*/, [ "a=fmtp:111 minptime=10", "useinbandfec=1", "usedtx=1", "stereo=0", "maxaveragebitrate=24000", ].join(";")); }
function stripNonRelay(sdp: string): string { return sdp.split("\n") .filter((l) => !l.startsWith("a=candidate:") || l.includes("typ relay")) .join("\n"); }
const offer = await pc.createOffer(); offer.sdp = tuneOpus(offer.sdp!); await pc.setLocalDescription(offer); ```
Is munging unsafe? Done before setLocalDescription, no. Done after, you will break DTLS and ICE state.
Will the spec ever expose Opus options? Probably not — the WG's stance is that `setParameters` is the right place. Munging will continue to be needed for a while.
Does it break with E2EE? No — munging touches the signaling layer, SFrame touches the media layer; they are independent.
What about `a=mid`? Never edit. Editing mids breaks BUNDLE.
Still reading? Stop comparing — try CallSphere live.
CallSphere ships complete AI voice agents per industry — 14 tools for healthcare, 10 agents for real estate, 4 specialists for salons. See how it actually handles a call before you book a demo.
Should I write a parser? For complex munges, yes — sdp-transform is the canonical npm library.
Does `setCodecPreferences` work in Pion? Yes, partially — Pion exposes APIs for many of these without munging. Use them when you can.
Will my munge survive Chromium's next refactor? Maybe. Test on Canary continuously; Chromium has reorganized SDP attribute ordering twice in the last two years.
Does the SFU need to know I munged? Generally no — Opus tuning is browser-side; SDP is only between the two peers.
Three rules from shipping munges in production:
OpenAI's split-relay refactor in 2025 was a great test of this discipline: teams who had centralized munges flipped the kill switch in five minutes. Teams who had not lost a weekend.
A final caution: SDP munging is a trailing indicator that the WebRTC API surface is incomplete for your use case. Every munge you keep is technical debt against a future browser change. We tag each one with an issue link to the relevant W3C feature request so we know when to delete it. The Opus DTX/FEC munge has been on our list for three years; the candidate-stripping munge will probably outlive most of our infrastructure.
See the optimized voice path on /demo, pricing in /pricing, or start a /trial.
Written by
Sagar Shankaran· Founder, CallSphere
Sagar Shankaran is the founder of CallSphere, where he builds production AI voice and chat agents deployed across healthcare, hospitality, real estate, and home services. He writes about agentic AI, LLM engineering, and shipping voice agents that handle real calls in production.
See how AI voice agents work for your industry. Live demo available -- no signup required.
A founder's guide to texto a voz (text-to-speech in Spanish): LATAM vs Castilian voices, free options, and how CallSphere ships Spanish agents.
A founder's guide to the female voice generator landscape: AI female voices, Japanese voices, robot voices, and how CallSphere ships 57+ voices live.
A founder's guide to the Siri voice generator landscape: how AI voice cloning works, what is legal, and how CallSphere uses 57+ voices in production.
A founder's guide to AI voice assistants for ecommerce: customer service, order lookup, and how CallSphere fits in versus virtual receptionists.
Robot text to speech in 2026: how I pick TTS APIs, when robotic voices help, and how CallSphere ships 57+ language voice agents. Hands-on guide.
The customer support specialist role in 2026 is half human, half AI. Here is what the job looks like, the AI tools that pair with it, and how we ship it.
© 2026 CallSphere LLC. All rights reserved.