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:
Session-level Description¶
v=Protocol versiono=Origin/creator and session IDs=Session namec=Connection informationt=Time session is active
Media-level Description¶
m=Media type, port, protocola=Attributesb=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¶
- Offer - Initial SDP in INVITE
- Answer - Response SDP in 200 OK
- Negotiation - Codec and parameter agreement
Common Attributes¶
Media Attributes¶
sendrecv- Send and receive mediasendonly- Only send mediarecvonly- Only receive mediainactive- No media flow
Codec Attributes¶
rtpmap- RTP payload mappingfmtp- Format parametersptime- Packetization time
Advanced Features¶
ICE Candidates¶
DTLS Fingerprint¶
Best Practices¶
- Validate SDP syntax
- Handle multiple media streams
- Support codec negotiation
- Implement proper error handling
- Consider bandwidth constraints