DEV Community

Cover image for 📦 What’s in the SIP Envelope? (A Peek at SDP)
SIP GAMES
SIP GAMES

Posted on

📦 What’s in the SIP Envelope? (A Peek at SDP)

“SDP: The tiny contract that decides how we talk.”


Remember that SIP message we saw last time? It was polite. It said “Hi, want to talk?” But it also had a little payload, tucked inside like a secret note in a game invitation. That note was SDPSession Description Protocol.

Let’s unpack it, casually.


🧠 What Is SDP?

SDP is not a protocol that sends media — it’s just a description.

It tells the other side things like:

  • What IP and port to send media to
  • What kind of media we support (audio, video, fax, etc.)
  • Which codecs we can use
  • How many media streams we want

Think of SDP as the cheat sheet you give your opponent before a Squid Game round. It says:

“We’ll play audio only. You send it to this IP, this port. Here are the rules (codecs) I speak.”


📃 A Sample SDP Offer

Here’s a simplified version of what might be inside the body of an INVITE:

v=0
o=alice 2890844526 2890844526 IN IP4 192.168.1.10
s=-
c=IN IP4 192.168.1.10
t=0 0
m=audio 49170 RTP/AVP 0 96
a=rtpmap:0 PCMU/8000
a=rtpmap:96 opus/48000/2

Let’s decode this bit by bit.


✏️ Mandatory Fields in SDP

Field What It Means
v= Version — always 0
o= Origin — username, session ID, IP of sender
s= Session Name — can be - if not used
c= Connection Info — IP address to send media
t= Timing — start and stop time (0 0 = forever)
m= Media Description — media type, port, transport, codecs
a= Attributes — like codec details, encryption, etc.

🎙 What Are Codecs?

A codec (short for coder-decoder) compresses and decompresses media like voice or video. In VoIP, we use codecs to:

  • Save bandwidth (fewer bits = faster calls)
  • Improve audio quality
  • Handle different devices and network conditions

🔊 Common Audio Codecs

Codec Description Bandwidth Notes
PCMU (G.711 µ-law) Classic PSTN quality ~64 kbps Good quality, high bandwidth
PCMA (G.711 A-law) EU version of µ-law ~64 kbps Similar to PCMU
G.729 Compressed voice ~8 kbps Low bandwidth, licensed
Opus Modern, flexible 6–510 kbps Great quality, dynamic bitrate
G.722 HD voice ~64 kbps Wideband audio

📹 Common Video Codecs

Codec Description Use Case
H.264 Standard for video calls Widely used
VP8 / VP9 Open-source codecs Used in WebRTC
H.265 (HEVC) Next-gen, better compression Not always supported

🎮 SIP + SDP: Setting the Game Rules

Let’s update our SIP message to imagine it has the voice rules included:

INVITE sip:bob@example.com SIP/2.0
...
Content-Type: application/sdp
Content-Length: 151

v=0
o=alice 2890844526 2890844526 IN IP4 192.168.1.10
s=-
c=IN IP4 192.168.1.10
t=0 0
m=audio 49170 RTP/AVP 0 96
a=rtpmap:0 PCMU/8000
a=rtpmap:96 opus/48000/2

It’s saying:

“Hey Bob, send me voice on 192.168.1.10:49170. I speak PCMU and Opus. You pick.”

Bob can then reply with:

  • “Cool, I speak Opus too” (and use a=rtpmap:96 opus/48000/2)
  • Or “Let’s just stick with PCMU.”

📦 TL;DR

  • SDP is metadata — it tells the other side how to stream media
  • SIP uses SDP to offer codecs, IPs, and ports
  • Audio codecs like PCMU, Opus, G.729 define voice quality + size
  • Video codecs like H.264 and VP8 make video calls possible
  • SDP doesn’t send media — it just describes it

🧠 Up Next in SIP GAMES:

“The Real MVP — RTP: The Voice Inside the Wires”

Now that SIP + SDP agreed on how we’ll talk, it’s time to learn how your voice actually hops across the internet in real time.

Stay tuned for packet magic!

🎮 Follow @sip_games for more VoIP fun with less RFC-induced stress.

Top comments (0)