Module 1: Foundations

Codec Negotiation and Media Interworking

Learn about codec negotiation and media interworking

Duration: 6 minutes
Level: Advanced
Lesson: 51

The Negotiation Problem

Two endpoints need to agree on a common language before they can exchange audio. If Alice's phone speaks G.711 and G.729, and Bob's phone speaks G.711 and Opus, they need to converge on G.711. This convergence happens through SDP offer/answer negotiation (Lesson 48). But what happens when there's no common codec? Or when a B2BUA sits in the middle?


Codec Preference and Selection

The Offer: Preference Order Matters

The payload type numbers in the m= line are listed in preference order:

m=audio 10000 RTP/AVP 8 0 18 101

This says: "I prefer G.711 A-law (8), then G.711 μ-law (0), then G.729 (18), and I support DTMF events (101)."

The first codec listed is the offerer's most preferred. A well-behaved answerer should respect this preference when possible, but the spec allows the answerer to select any offered codec.

The Answer: Selection

The answerer responds with the codecs it supports from the offer:

m=audio 20000 RTP/AVP 8 101

"I selected G.711 A-law and DTMF events." The first codec in the answer is what will actually be used for media.

What If There's No Common Codec?

If the answerer supports none of the offered codecs, it responds with 488 Not Acceptable Here:

SIP/2.0 488 Not Acceptable Here
Warning: 304 "Media type not available"

This is a definitive rejection — the call cannot proceed without codec compatibility.

💡 NOC Tip: en you see 488 responses, compare the codec list in the INVITE's SDP offer against the far end's supported codecs. Common mismatches:

  • Customer offers only G.729, carrier requires G.711
  • Customer offers only Opus, PSTN gateway only supports G.711/G.729
  • DTMF telephone-event is missing from the offer but required by the far end slug: "codec-negotiation"

Transcoding: When the B2BUA Bridges Codecs


🔒 Full Course Content Available

This is a preview of the Telephony Mastery Course. The complete lesson includes:

  • ✅ Detailed technical explanations
  • ✅ Advanced configuration examples
  • ✅ Hands-on lab exercises
  • ✅ Real-world troubleshooting scenarios
  • ✅ Practice quizzes and assessments

🚀 Unlock Full Course Access


Preview shows approximately 25% of the full lesson content.