Skip to content

Session Description Protocol (SDP)

Overview

Session Description Protocol (SDP) is used to describe multimedia sessions for session announcement, invitation, and other forms of session initiation.

SDP Structure

SDP messages consist of lines of text in the format:

<type>=<value>

Session-level Description

  • v= Protocol version
  • o= Origin/creator and session ID
  • s= Session name
  • c= Connection information
  • t= Time session is active

Media-level Description

  • m= Media type, port, protocol
  • a= Attributes
  • b= Bandwidth information

Example SDP Message

v=0
o=alice 2890844526 2890844526 IN IP4 host.atlanta.com
s=Session Description
c=IN IP4 host.atlanta.com
t=0 0
m=audio 49170 RTP/AVP 0
a=rtpmap:0 PCMU/8000
m=video 51372 RTP/AVP 31
a=rtpmap:31 H261/90000

SDP in SIP

Offer/Answer Model

  1. Offer - Initial SDP in INVITE
  2. Answer - Response SDP in 200 OK
  3. Negotiation - Codec and parameter agreement

Common Attributes

Media Attributes

  • sendrecv - Send and receive media
  • sendonly - Only send media
  • recvonly - Only receive media
  • inactive - No media flow

Codec Attributes

  • rtpmap - RTP payload mapping
  • fmtp - Format parameters
  • ptime - Packetization time

Advanced Features

ICE Candidates

a=candidate:1 1 UDP 2130706431 192.168.1.100 54400 typ host

DTLS Fingerprint

a=fingerprint:SHA-256 12:34:56:78:90:AB:CD:EF...

Best Practices

  • Validate SDP syntax
  • Handle multiple media streams
  • Support codec negotiation
  • Implement proper error handling
  • Consider bandwidth constraints