What is SDP? How SDP looks like in terms of SIP?

Farhan Fuad Ronok
4 min readNov 24, 2021

--

In this article, we will discuss what is SIP, what is SDP, How an SDP packet looks like in a VOIP system.

First, let's get a high-Level overview of SIP

  • The Full form of SIP is Session Initiation Protocol.
  • It is a text-based signaling protocol.
  • SIP is used for initiating, maintaining, terminating real-time sessions
    that include voice, video, and messaging applications.

Now, we need to know what is SDP

  • The Full form of SDP is Session Description Protocol.
  • SDP Contains information about media(Audio, Video) establishment between endpoints over a network.
  • SDP is carried as a payload in SIP packets.
  • SDP does not deliver any media streams by itself,
    but it is used between endpoints to negotiate media types and other associated properties 👀.

SDP is Generally found in the SIP invite packet and SIP 200 ok packet.

In general, what SDP does is,

  • Tell the endpoint to use a specific codec format,
  • It also tells things like the port number on which audio will be sent from another endpoint,
    also what protocol to use or what is the current priority of the packet.

Let us take a look at an actual SDP packet 🕶

v=0
o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5
s=SDP Seminar
i=A Seminar on the session description protocol
u=
http://www.example.com/seminars/sdp.pdf
e=j.doe@example.com (Jane Doe)
c=IN IP4 224.2.17.12/127
t=2873397496 2873404696
a=recvonly
m=audio 49170 RTP/AVP 0
m=video 51372 RTP/AVP 99
a=rt
pmap:99 h263-1998/90000

Now we will go through each and every field

v=0

v means the protocol version and the value here is Zero. And It’s a mandatory field in SDP.

o=jdoe 2890844526 2890842807 IN IP4 10.47.16.5

o is the originator and session identifier. And It’s a mandatory field in SDP.

Here,
username → jdoe
id → 2890844526
version number → 2890842807
the network address of the originator is → 10.47.16.5

s=SDP Seminar

s is the session name. And It’s also a mandatory field in SDP.

Here,
session name → SDP Seminar

i=A Seminar on the session description protocol

i is short session information. This is an optional property.

Here,
short session information → A Seminar on the session description protocol

u=http://www.example.com/seminars/sdp.pdf

u is an URL where we can go to know more about the Session. This is an optional property.

Here,
URL is → http://www.example.com/seminars/sdp.pdf

e=j.doe@example.com (Jane Doe)

e is Contact Information. This is an optional property.

Here,
the Contact information → j.doe@example.com (Jane Doe)

c=IN IP4 224.2.17.12/127

c is connection information. This is an optional property but a very important one.

This property indicates the IP of the receiver.

Here,
Receiver network address→ 224.2.17.12/127
and from the o property above we know that
the network address of the originator is → 10.47.16.5

From the two IP addresses, we can say that SIP packets are going to flow from IP 10.47.16.5 → To → 224.2.17.12/127

t=2873397496 2873404696

t is a timestamp for the particular Session in which it will be active. And It’s also a mandatory field in SDP.

Here,
the timestamp is → 2873397496 2873404696

If we convert 2873397496 to human-readable format then it shows
January 19, 2061 9:58:16 PM

and 2873404696 this becomes
January 19, 2061 11:58:16 PM

So, the Active session time is 2 HOURs.

a=recvonly

a indicates the means of media being set up. It usually means, how the endpoint is going to process the media.

An endpoint can send media to another endpoint, or it can only receive media from another endpoint also, the endpoint can do both.
By setting the ‘a’ field value we can control what the endpoint can will behave in terms of media.

Let’s discuss more,

Here,
a → recvonly
means, the endpoint wishes to only receive media (audio/video)

There are THREE more options (4 in total) that we can use,

  • sendrecv → means, the endpoint wishes to SEND and RECEIVE media (audio/video)
  • sendonly → means, the endpoint wishes to SEND media (audio/video)
  • inactive → means, the endpoint does NOT wish to SEND or RECEIVE media (audio/video)

m=audio 49170 RTP/AVP 0

m is Options for establishing media. Let’s Understand what each of the options means

  • audio → means the media type is audio
  • 49170 → means port 49170 will receive AUDIO packets
  • RTP/AVP means RTP protocol is used for audio communication
  • 0 → means the type of the Payload is 0. which also indicates that the payload type is Audio.

m=video 51372 RTP/AVP 99

let’s look at another m options.

  • video → means the media type is video
  • 51372 → means port 51372 will receive VIDEO packets
  • RTP/AVP means RTP protocol is used for video communication
  • 99 → means the type of the Payload is 99. which also indicates that the payload type is dynamic. (more on RTP PAYLOAD)

a=rtpmap:99 h263-1998/90000

a indicates the options of the protocol which are available to establish.

Let's look at each and every option of a

  • rtpmap:99 → maps the RTP/AVP payload (from the previous m)of type 99 to format h263–1998 with a 90 kHz clock rate.

This is all about SDP in terms of the SIP packet.

In this article, we have discussed how an SDP packet looks like and what each of the fields means.

Thanks for reading and you can let me know if you have any questions or suggestions. 🙏

Connect with me via
Linkedin
Twitter

Reference Links 🔗🔗

--

--

Farhan Fuad Ronok
Farhan Fuad Ronok

Written by Farhan Fuad Ronok

Software Engineer | write about backend, VOIP and DevOps Stuff.

Responses (1)