The Session Description Protocol (SDP) specifies the syntax for messages that describe media sessions running on IP networks. These messages are made available to endpoints during the negotiation of media sessions. They contain information about the media session such as a general description, what codecs to use, what transport protocols to use and what IP addresses and ports to use. Codecs, transport protocols, and other enumerated fields are specified using standard numbers and strings that are registered with IANA. The internet standards RFC for SDP is 8866.
SDP messages use a recognizable format. Every line must begin with a single letter followed by an equal sign, and every line must end with CRLF. The contents after the equal sign varies depending on the letter. When read from top to bottom, the lines are divided into sections: session, timing and media. The following is an example SDP message:
o=foo 35368 29623 IN IP4 [email protected]
c=IN IP4 10.1.27.68
m=audio 1316 RTP/AVP 0 8
m=video 1318 RTP/AVP 115
This SDP is suitable for an offer to start a video call. The v line specifies the SDP version which is always zero. The o line establishes a unique ID for the session, and the s line is a user-friendly name for the session. The c line specifies the address of the SDP sender. In this case, it’s a session-level address so the receiver should send both media streams to this address. The t line sets the session timing. If both values are zero, the session is considered permanent.
The two m lines each specify a type of media that will be used during the session. In this case, there is one for audio and one for video. The m lines also specify the media port, transport protocol and supported codecs. An SDP offer may contain multiple codecs for one media stream, but an answer should always narrow that down to one. The audio codecs in this example are ULAW and ALAW, as specified in the audio video profile (RTP/AVP from RFC 3551). The a lines are attributes that provide more information about the media session. Attributes allow SDP to be extensible, with different attributes supported for each codec. There are also some standard attributes. In this example, rtpmap is used to specify the H264 video codec, and sendrecv is used to specify that the media should flow both ways.