When a SIP based VoIP call is established, the audio or video sent between two SIP entities or more is streamed. Since many different codecs are supported by different devices or software, and each individual SIP entity taking part in the call does not know the IP address of the other SIP entity or to which port the stream should be sent to, SDP is used to advertise such details about the media stream during the VoIP call initialization process.

SDP at work in a SIP based VoIP call

During a SIP based VoIP call initialization, when a caller dials a number on a SIP phone, a SDP message is attached to the SIP INVITE message which is sent to the IP PBX the SIP phone is registered to. In the SDP message, connection details, media details and DTMF event types are advertised.

Typically, such information is sent from the caller’s SIP phone to the IP PBX, which is then relayed to the other SIP phone which is receiving the call. The SIP phone receiving the call which at this stage it is still being established, also sends SDP data back to the IP PBX which is relayed to the SIP phone making the call. Because of such process, if the call is established the SIP phones taking part in this SIP based VoIP call know to where the media stream should be sent and what type of media and codec to use. They also now know what media type and codec they will be receiving.

Codec priority

Since SIP phones normally support more than one codec, as we will see in the capture below, supported codecs are sent in a particular order in the SDP message; depending on the priority which can be set by the user in the phone set’s settings. Example:

  • SIP phone A has the following codec priority; 1: PCMU, 2: PCMA, 3: GSM
  • SIP phone B has the following codec priority; 1: Speex, 2: G729, 3: PCMA

In such scenario, PCMA will be the codec chosen from the SIP phones to be used for encoding and decoding streamed media, as it is the first matched codec between the 2 SIP phones. Note that different codecs use different amount of bandwidth and have other different properties from each other, therefore depending on the user’s needs and available bandwidth, codec priority can be set.

SDP Capture in an INVITE SIP message

Below is a capture of a SDP message sent from a SIP phone to an IP PBX it is registered to when trying to make a call:

v=0
o=root 42852867 42852867 IN IP4 10.130.130.114
s=call
c=IN IP4 10.130.130.114
t=0 0
m=audio 61896 RTP 0 8 3 101
a=rtpmap:0 pcmu/8000
a=rtpmap:8 pcma/8000
a=rtpmap:3 gsm/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

From the above capture’s we can see that:

Session Description section

Version - V=0

  • SDP Protocol Version. Up to now there are no minor versions.

Owner or Originator Information - o=root 42852867 42852867 IN IP4 10.172.0.114

  • root = username of originator.
  • 42852867 = Session ID which is randomly generated from the SIP phone.
  • 42852867 = Session Version which is also randomly generated from the SIP phone.
  • IN = Owner’s network type, in this case “IN” for Internet.
  • IP4 = Owner’s address type, in this case IP version 4.
  • 10.130.130.114 = Owner’s IP address.

Session Name - s=call

  • call = Session name using human readable characters.

Connection Information - c=IN IP4 10.130.130.114

  • IN = Owner’s network type, in this case “IN” for Internet.
  • IP4 = Owner’s address type, in this case IP version 4.
  • 10.130.130.114 = Caller’s SIP phone’s IP address.

Time Description section

Active time - t=0 0

  • 0 = Session start time
  • 0 = Session stop time

Since this is a SIP based VoIP call and the media stream is started on initiation of the call (i.e. when the callee picks up the phone) and not on a specific time, no time is specified. The length of call is also determined by the caller or callee therefore no end time can be specified.

Media Description section

Media name and Transport address - m=audio 61896 RTP 0 8 3 101

  • audio = Media type of stream. This can also be video, message, audio etc.
  • 61896 = The port number on which the media stream will be transmitted.
  • RTP = The protocol which will be used to stream the media, in this case Real Time Protocol.
  • 0 = The code specifying the codec, in this case codec 0 = G.711 PCMU.
  • 8 = The code specifying the codec, in this case codec 8 = G.711 PCMA.
  • 3 = The code specifying the codec, in this case codec 3 = GSM.
  • 101 = DTMF payload type number the SIP phone supports.

Session attribute lines

  • a=rtpmap:0 pcmu/8000
  • a=rtpmap:8 pcma/8000
  • a=rtpmap:3 gsm/8000

For each Codec being advertised in the above SDP capture, details about Media Attributes Fieldname, Media format and Media type is given separately. Note that the codec’s are listed depending on priority set by the user from the phone set’s configuration options.

  • a=rtpmap:101 telephone-event/8000
  • a=fmtp:101 0-16

The above fields describe the DTMF the phone supports (telephone-events). Such phone supports DTMF payload type number 101, and DTMF tones events from 0 to 16 with a sample rate of 8000 Hertz. Note that as a DTMF standard, all SIP entities should at least support DTMF events from 0 to 15, which are 0-9 (numbers), 10 = *, 11 = # and 12 -15 are A-D.

  • a=ptime:20

Samples per packet / packetization time. Field is optional but it is recommended for the encoding / packetization of audio or video stream. If no ptime is specified, it means that the remote SIP entity uses whatever packetization time it prefers.

  • a=sendrecv

sendrecv = Session is send and receive, therefore the SIP phone is ready to send media streams and receive also. This can be also be sendonly or recvonly, for example when a phone is placed on hold and will only receive media streams, i.e. music on hold from an IP PBX or VoIP provider.

As seen above, SDP plays a very important role in a SIP based VoIP call as it is used for describing multimedia sessions for session announcement, session invitation and other types of multimedia sessions initiation. SDP is also used in other VoIP signalling protocols apart from SIP, such as H.323.

Further information about SIP, SDP