SIP Cheat Sheet

Jim Ungar
 
Taken from SIP understanding the Session Initiation Protocol, 2nd edition by Alan B. Johnston.  Also from IETF RFC3551.  Also from Nortel VoIP Technologies.  Also from Cisco Authorized Self-Study Guide: Cisco Voice over IP (CVOICE)

Default ports

Components

Cisco Notes

Reqs and Responses

Reqs

Taken from Table 6-4 in Nortel VoIP Technologies
SIP Request Description
INVITE  
ACK
CANCEL Cancels pending searches, but does not terminate call already accepted
OPTIONS Queries caps of servers
REFER Notify party of outcome of ref'ed request.  (e.g. used for call xfer)
UPDATE Allows cliet to update params of session (SDP).  Like a re-INVITE, but can be sent before initial INVITE has been complted.
INFO Carriers session-relatd ctrl info during session
PRACK Reliable provisional response msgs.
SUBSCRIBE/NOTIFY (e.g. presence)

Taken from Table 6-5 in Nortel VoIP Technologies
SIP Resp
Category
Type
SIP 1xx Info
SIP 2xx Success
SIP 3xx Redirect
SIP 4xx Client Failure
SIP 5xx Server Failure
SIP 6xx Global Failure

SIP Network Elements

Basic Sessions

Simple SIP Session SIP Call w/ Proxy Svr
  JSmith              JUngar
zetamachine        gammamachine
beta-org.com       alpha-org.com
      ------INVITE------>
      <---180 Ringing----
      <-----200 OK-------
      -------ACK-------->
      <--Media Session-->
      <------BYE---------
      ------200 OK------>
   JSmith            ProxySvr             JUngar
zetamachine          SIPproxy          gammamachine
beta-org.com       alpha-org.com       alpha-org.com
      ------INVITE------>|------INVITE ------>
      <---180 Ringing----|<---180 Ringing ----
      <-----200 OK-------|<-----200 OK-------
      ------------------ACK----------------->
      <------------Media Session------------>
      <-----------------BYE------------------
      -----------------200 OK--------------->

Registration Example Presence and Instance Message Example

  JUngar           Registrar Svr
      ----Register--->
Contact: sip:jungar@200.201.202.203  

      <----200 OK-----

JSmith               JUngar
---Subscribe-->
<---200 OK-----
<----NOTIFY----
----200 0K---->
.
.
.
<---NOTIFY-----
----200 OK---->

----MESSAGE--->
<---200 OK-----

<---MESSAGE----
----200 OK---->

Conference Call - SDP and SAP


Message Transport RFCs
Here's a short list...

Notes



INVITE msg
INVITE sip:jungar@alpha-org.com SIP/2.0 *method, Request-URI, SIP version #
Via: SIP/2.0/UDP zetamachine.beta-org.com:5060;branch=as82je8ei4kr (Path taken by request)
*SIP version #/transport hostname-or-addr:portnum;branchparam branch parameter is transaction ID - responses can be correlated with this transaction ID
Max-Forwards: 70 *initialized to large # and decremented by each SIP server which receives and forwards request. Provides simple loop detection
To: J. Ungar <sip:jungar@alpha-org.com> *shows destination of SIP request.  If optional name label is in, then URI is in brackets (used for routing the request.  Responder will create unique Tag in To: field
From: J. Smith <sip:jsmith@beta-org.com>;tag=13456 *shows origination of SIP request.  If optional name label is in, then URI is in brackets (used for routing the request.  Tag is combined with Call-ID to create unique conversation.
Call-ID:123456789@zetamachine.beta-org.com *keeps track of particular SIP session.  Originator of request creates locally unique string, adds an @, and its host name to make it globally unique.  Local tag, remote tag, and Call-ID ids established session, known as a "dialog".
CSeq: 1 INVITE *Starting integer (incremented with each new request sent), method
Subject: Let's talk Optional.  Could be displayed during alerting.
Contact: <sip:jsmith@zetamachine.beta-org.com> SIP URI of J. Smith's communication device.  Called User Agent (UA).  This URI can be used to route messages directly to J. Smith.
Content-Type: application/sdp message body is SDP
Content-Length: 158 message body has 158 bytes (including CR/LFs)


v=0 SDP protocol version #
o=Smith 2890844526 2890844526 IN IP4 zetamachine.alpha-org.com Originator info: username, session-ID(NTP or random#) version(recommended to be NTP, # increased for each change in session) network-type address-type address
s=Phone Call name of session
c=IN IP4 100.101.102.103 Connection Data-Addr that will be sending media packets: network-type address-type connection-address(if multicast connection-address field will be: base-multicast-addr/ttl/num-of-addresses)
t=0 0 start/stop time of session.  NTP  Stop time of 0 indicates sesion goes on insdefinitely.  If both start and stop time are 0, indicates that session is permanent. 
m=audio 49170 RTP/AVP 0 Media info: media(audio,video,application,data,telephone-event,or control) port transport(RTP/AVP or udp) format-list(multiple alternate codecs can be listed)
a=rtpmap:0 PCMU/8000 attributes of preceding session (RTP/AVP or UDP), multiple media types get separate attribute lines

*required

180 Ringing
SIP/20.0 180 Ringing copied from invite
Via: SIP/2.0/UDP zetamachine.beta-org.com:5060;branch=as82je8ei4kr;received=100.101.102.103 copied from invite; received parameter contains literal IP addr that req was recieved from
To: J. Ungar <sip:jungar@alpha-org.com>;tag=643a33 copied from invite (same order);tag added
From: J. Smith <sip:jsmith@beta-org.com>;tag=13456 copied from invite (same order)
Call-ID:123456789@zetamachine.beta-org.com copied from invite
CSeq: 1 INVITE copied from invite
Contact: <sip:jungar@gammamachine.alpha-org.com> contact where to can be contacted once session is established
Content-Length:0 no content...

200 OK
SIP/2.0 200 OK copied
Via: SIP/2.0/UDP zetamachine.beta-org.com:5060;branch=as82je8ei4kr;received=100.101.102.103 copied
To: J. Ungar <sip:jungar@alpha-org.com>;tag=643a33 copied
From: J. Smith <sip:jsmith@beta-org.com>;tag=13456 copied
Call-ID:123456789@zetamachine.beta-org.com copied
CSeq: 1 INVITE copied
Contact: <sip:jungar@gammamachine.alpha-org.com> same as 180 Ringing
Content-Length:155  

 
v=0 version 0
o=Ungar 2890844528 2890844528 IN IP4 gammamachine.alpha-org.com originator info coming back at Smith
s=Phone Call subject
c=IN IP4 200.201.203 Connection Data Addr that will be sending media packets
t=0 0 start/stop time of session
m=audio 60000 RTP/AVP 0 Media info: media port transport format-list 
a=rtpmap:0 PCMU/8000 attributes of preceding session

ACK
ACK sip:jungar@gammamachine.alpha-org.com SIP/2.0  
Via: SIP/2.0/UDP zetamachine.beta-org.com:5060;branch=bt234s342343 new branch id, ACK sent to 200 OK is considered separate transaction
Max-Forwards: 70  
To: J. Ungar <sip:jungar@alpha-org.com>;tag=643a33  
From: J. Smith <sip:jsmith@beta-org.com>;tag=13456  
Call-ID:123456789@zetamachine.beta-org.com  
CSeq: 1 ACK  
Content-Length: 0  

<---(RTP SESSION)--->

BYE
BYE sip:jsmith@zetamachine.beta-org.com SIP/2.0  
Via: SIP/2.0/UDP gammamachine.alpha-org.com:5060;branch=bt234s394594

SIP version #/transport hostname-or-addr:portnum;branchparam

New branch id because separate transaction from invite or ack shownpreviously.

Max-Forwards: 70  
To: J. Smith <sip:jsmith@beta-org.com>;tag=13456 To and from swapped as teardown request is coming from Ungar
From: J. Ungar <sip:jungar@alpha-org.com>;tag=643a33  To and from swapped as teardown request is coming from Ungar
Call-ID:123456789@zetamachine.beta-org.com  
CSeq: 1 BYE  
Content-Length: 0  

200 OK
SIP/2.0 200 OK  
Via: SIP/2.0/UDP gammamachine.alpha-org.com:5060;branch=bt234s394594 SIP version #/transport hostname-or-addr:portnum;branchparam
To: J. Smith <sip:jsmith@beta-org.com>;tag=13456
From: J. Ungar <sip:jungar@alpha-org.com>;tag=643a33   
Call-ID:123456789@zetamachine.beta-org.com  
CSeq: 1 BYE  
Content-Length: 0  


INVITE msg - Proxy(address-of-record)->ProxiedContact(device/endpoint URI)
INVITE sip:jungar@alpha-org.com SIP/2.0 *method, Request-URI, SIP version #
Via: SIP/2.0/UDP proxy.alpha-org.com:5060;branch=as82je8ei4kr
Via: SIP/2.0/UDP 100.101.102.103:5060
*proxy VIA pre-pends original VIA
100.101.102.103 is numeric addr of end device that invite came from
SIP version #/transport hostname-or-addr:portnum;branchparam
Max-Forwards: 69 decremented as it went through proxy
To: J. Ungar <sip:jungar@alpha-org.com> *shows destination of SIP request. 
From: J. Smith <sip:jsmith@beta-org.com>;tag=13456 *shows origination of SIP request.  Tag is combined with Call-ID to create unique conversation.
Call-ID:123456789@100.101.102.103 *keeps track of particular SIP session. 
CSeq: 1 INVITE *Starting integer (incremented with each new request sent), method
Subject: Let's talk Optional.  Could be displayed during alerting.
Contact: <sip:jsmith@zetamachine.beta-org.com> SIP URI of J. Smith's communication device. 
Content-Type: application/sdp message body is SDP
Content-Length: 158 message body has 158 bytes (including CR/LFs)


v=0 SDP protocol version #
o=Smith 2890844526 2890844526 IN IP4 100.101.102.103 Originator info: username, sess-ID ver net-type addr-type address
s=Phone Call name of session
c=IN IP4 100.101.102.103 Connection Data-Addr that will be sending media packets: network-type address-type connection-address
t=0 0 start/stop time of session. 
m=audio 49170 RTP/AVP 0 Media info: media port transport format-list
a=rtpmap:0 PCMU/8000 attributes of preceding session (RTP/AVP or UDP)

*required

180 Ringing ProxiedContact->Proxy
SIP/20.0 180 Ringing copied from invite
Via:SIP/2.0/UDPproxy.alpha-org.com:5060;branch=as82je8ei4kr;received=100.101.102.105
Via: SIP/2.0/UDP 100.101.102.103:5060
copied from invite; recived parameter contains literal IP addr that req was recieved from; First VIA will be stripped by Proxy on way to smith
To: J. Ungar <sip:jungar@alpha-org.com>;tag=643a33 copied from invite (same order);tag added
From: J. Smith <sip:jsmith@beta-org.com>;tag=13456 copied from invite (same order)
Call-ID:123456789@100.101.102.103 copied from invite
CSeq: 1 INVITE copied from invite
Contact: <sip:jungar@200.201.202.203> contact where to can be contacted once session is established
Content-Length:0 no content...

200 Ringing ProxiedContact->Proxy
SIP/20.0 180 OK copied from invite
Via:SIP/2.0/UDPproxy.alpha-org.com:5060;branch=as82je8ei4kr;received=100.101.102.105
Via: SIP/2.0/UDP 100.101.102.103:5060
copied from invite; recived parameter contains literal IP addr that req was recieved from; First VIA will be stripped by Proxy on way to smith
To: J. Ungar <sip:jungar@alpha-org.com>;tag=643a33 copied from invite (same order);tag added
From: J. Smith <sip:jsmith@beta-org.com>;tag=13456 copied from invite (same order)
Call-ID:123456789@100.101.102.103 copied from invite
CSeq: 1 INVITE copied from invite
Contact: <sip:jungar@200.201.202.203> contact where to can be contacted once session is established
Content-Length:0 no content...

 
v=0  
o=ungar 2890844528 2890844528 IN IP4 200.201.202.203  
s=Phone Call
c=IN IP4 200.201.202.203
t=0 0  
m=audio 49172 RTP/AVP 0  
a=rtpmap:0 PCMU/8000  


RTP packet header

 0                   1                   2                   3
 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|V=2|P|X|  CC   |M|     PT      |        sequence number        |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|                            timestamp                          |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|            synchronization source (SSRC) identifier           |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
|             contributing source (CSRC) identifiers            |
|                               ....                            |
+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
RTP/AVP Audio and Video Payload types
Payload Codec Clock Description bps bps w/ overhead
0 PCMU 8000 ITU G7.11 PCM mu-law Audio 64 kbps  
1 1016 8000 CELP Audio 4.8 kbps  
2 G721 8000 ITU G721 ADPCM Audio 32 kbps  
3 GSM 8000 European GSM Audio 13 kbps  
5 DVI4 8000 DVI ADPCM Audio 32 kbps  
6 DVI4 16000 DVI ADPCM 64kbs 64 kbps  
7 LPC 8000 Experimental LPC Audio    
8 PCMA 8000 ITU G711 PCM A-Law Audio 64 kbps  
9 G722 8000 ITU G722 Audio    
10 L16 44100 Linear 16-bit Audio 705.6 kbps  
11 L16 44100 Linear 16-bit Stereo Audio 1411.2 kbps  
14 MPA 90000 MPEG-I or MPEG-II Audio Only    
15 G728 8000 ITU G728 Audio 16 kbps  
25 CELB 90000 CelB Video    
26 JBEG 90000 JBEG Video    
28 NV 90000 nv Video    
31 H261 90000 ITU H.261 Video    
32 MPV 90000 MPEG-I and MPEG-II Video    
33 MP2T 90000 MPEG-II transport stream Video    
dynamic iLBC
Internet low bit rate 15 kbps  
dynamic AMR
Adaptive Multirate Codec