Sip Tutorial
Sip Tutorial
Dorgham Sisalem
Jiri Kuthan
Mobile Integrated Services
GMD Fokus
Sisalem,kuthan@fokus.gmd.de
Attention!
Update Notice
Authors are committed to ongoing improvement of this tutorial.
Thus, this version may include updates and differ slightly from
printed version. You can get the updated version at the following
address:
http://www.fokus.gmd.de/mobis/siptutorial/
Frequent Misunderstandings
There are numerous issues that turned out to be difficult to
understand. Such issues are labeled with the symbol bellow. Please,
pay special attention to them.
Frequently
Misunderstood
Issue
Outline
etc.
IP Service Model
Split of Transport and Application Services
these are different businesses run on top of different
technologies
service promiscuity: anyone can access services brought by any
providers
anyone with IP connectivity can become a provider
setting up a signaling service as easy setting up a web server
service market is completely open
Applications Are Split As Well
Example:
IP operated by UUNET
SIP signaling by WCOM
PSTN call termination by mypstn.com and another-pstn.xy
least-cost PSTN termination routing by yet another company
Example: Trial Site
Provides just signaling services
gives users a unique globally reachable address
resembles Web-hosting in IP world or NetCentrex in PSTN world
no media transport -- only signaling relayed, media does not hit the
server at all
To set it up, we needed
PC
Freely available software
IP access
one part-time undergraduate student
Users need
IP phone (either in SW or HW)
Complimentary services may be easily provided by other parties,
users just need to set up their signaling preferences:
bridging to PSTN, voicemail--2-email, etc.
IP Design Concepts
#3 SIP/2.0 200 OK
SIP Registrar
(domain iptel.org)
SIP Operation in Proxy
Mode
Location Server
#0
jiri@195.37.78.173
DNS SRV Query ? iptel.org #2 #3
Reply: IP Address of iptel.org SIP Server
INVITE sip:jiri@195.37.78.173
jiri
INVITE sip:jiri@iptel.org From: sip:Caller@sip.com
From: sip:Caller@sip.com To: sip: jiri@iptel.org #4
To: sip: jiri@iptel.org #1 Call-ID: 345678@sip.com
Call-ID: 345678@sip.com
OK 200 OK 200
#6
From: sip:Caller@sip.com From: sip:Caller@sip.com #5
To: sip: jiri@iptel.org Proxy To: sip: jiri@iptel.org
Call-ID: 345678@sip.com Call-ID: 345678@sip.com
#7 ACK sip:jiri@iptel.org
Caller@sip.com sip:jiri@195.37.78.173
Media streams #8
Proxy Server Functionality
#2 #3 #4
#1
BYE takes
direct path
Frequently
Misunderstood
Issue
SIP Operation in Redirect
Mode
Location Server
#2
Callee@home.com
Callee
#3
Caller@sip.com
#1 INVITE Callee@example.com
Callee@home.com
#6 INVITE Callee@home.com
#7 OK 200
#8 ACK Callee@home.com
SIP Server -- Proxy versus
Redirection
v=0 v=0
o=UserA 2890844526 2890844526 IN IP4 here.com o=UserB 2890844527 2890844527 IN IP4 there.com
s=Session SDP s=Session SDP
c=IN IP4 100.101.102.103 c=IN IP4 110.111.112.113
t=0 0 t=0 0
m=audio 49172 RTP/AVP 0
Payload m=audio 3456 RTP/AVP 0
a=rtpmap:0 PCMU/8000 a=rtpmap:0 PCMU/8000
v=0
o=sisalem 28908044538 289080890 IN IP4 193.175.132.118
s=SIP Tutorial
e=sisalem@fokus.gmd.de
c=IN IP4 126.16.69.4
t=28908044900 28908045000
m=audio 49170 RTP/AVP 0 98
a=rtpmap:98 L16/11025/2
Address Header Fields
From: message originator
To: final recipient
Request-URI: current destination; may change along signaling path
Contact: appears in INVITE / OPTIONS / ACK / REGISTER requests and in
responses. It indicates direct response address to which subsequent
transactions are sent.
A UA may send subsequent BYE or ACK to Contact: address (unless configured
to use an outbound proxy).
It includes redirection address in 3xx and 485 responses.
It includes additional error information in 4xx, 5xx, and 6xx responses.
It may include preference weights.
It includes current location in REGISTER requests.
Multiple Contact: header fields may be included.
SIP Protocol Design
Infrastructure follows IP state model
Most intelligence and state in the end-devices
Network core maintains at most transactional state
Network edge may maintain session state
Benefits: memory and CPU consumption low in
servers, reliability and scalability high (no single point
of failure)
UDP Support
faster set-up, less state
Idempotent INVITEs (no collection of data spanning
multiple requests)
Extensibility
Range of future services unknown -> make signaling
service-independent.
History lesson: HTTP is not about hypertext transport any more.
It also provides e-mails, e-commerce, pc-banking, movies, etc.
Programmability adds numerous applications, the protocol
remains almost the same.
SIP designers took lesson from HTTP
Self-identifying Attribute-Value-Pairs (AVPs) followed by
separators (EoL)
best-effort: receivers ignore unknown AVPs and skip to next
separator
SDP support compulsory, arbitrary MIME payloads may be
included (JPEG, ISUP, charging info, Multipart, ...)
transparent proxying
Extensibility (cont.)
SIP designers took lesson from HTTP (cont.)
Require, Proxy-require, Supported Header Fields
classes of status codes (1xx in-progress, 2xx success, 3xx
forwarding, ...)
guidance on designing new extensions provided (draft-ietf-sip-
guidelines)
capability inquiry with OPTION -- returns supported methods
(Allow), media types (Accept), compression methods (Accepted-
Encoding), Supported (supported features)
Multimedia
Communication
IP Based Multimedia
Communication
Payload
RTP: Functions
Payload
RTP: Header
RTP version
VV P X M Payload Sequence number
Timestamp
Synchronization Source Identifier (SSRC)
Payload
RTP: Header
Payload
RTP: Header
Extension bit
X M Payload
V P X Sequence number
Timestamp
Synchronization Source Identifier (SSRC)
Payload
RTP: Header
Payload
RTP: Header
Number of packet increased
by one for each new packet
Payload
RTP: Header
Different fixed value for each
compression type
(160 for 20 ms at 8000 Hz)
V P X M Payload Sequence number
Timestamp
Timestamp
Synchronization Source Identifier (SSRC)
Payload
RTP: Header
V P X MAPayload Sequence
random number numberthe source
identifying
(unique per source)
Timestamp
Synchronization Source
Synchronization sourceIdentifier
identifier(SSRC)
(SSRC)
Payload
Real time Transport
Control Protocol (RTCP)
# 1 INVITE media
sales@xyz.com
#4 INVITE
Legend alice@home.zx
#2 INVITE
media jku@xyz.au
SIP signaling
IP hop #3 INVITE
secretary@xyz.com
Frequently
Misunderstood
Proxy servers
Issue
SIP Proxies Have NO
Notion of Media Path...
SIP
media media
a@a.com b@b.com
a@a.com b@b.com
SIP & QoS
QoS: SIP and QoS Control
183 Progress
#4 183 Progress #3
m=audio 49170 RTP/AVP 0 m=audio 49170 RTP/AVP 0
a=qos:mandatory send confirm Proxy a=qos:mandatory send confirm
#5 PRACK
#10 ACK
#9 200 OK (INVITE)
#8 200 OK (COMET)
#7 COMET
#6 Reserve
#11 Media stream
SIP and Mobility
SIP and Mobility
Home Network
HP
#2
REGISTER
Cell 2
Signalling
REGISTER
FP #1
Cell 1
Visited Network
SIP and Terminal Mobility
Home Network
#1
INVITE
HP
#4
#2 INVITE
Cell 2
Signalling
Data
FP INVITE
Cell 1
#3
Visited Network
SIP and Terminal Mobility
Home Network
HP
reINVITE #3
#1 #4
#3
REGISTER
Cell 2
Signalling
Data REGISTER
FP #2
Cell 1
Visited Network
SIP and Terminal Mobility
Home Network
HP
reINVITE #3
#4
#3
REGISTER
Cell 2
Signalling
Data REGISTER
FP #2
Cell 1
Visited Network
SIP and Personal Mobility
Home Network
HA
Registration #2
Cell 1
Registration
FA Cell 2
#1
Visited Network
Mobile-IP (Communication)
Home Network
#1
HA
#4
#2
#7 #5
Cell 1
Signalling
#3
Data
FA Cell 2
#6
Visited Network
SIP and Mobile-IPv6
M AP
M AP Mh
A pplications
& Services H SS R -SG W
Signallin g Interfa ce
Signallin g a nd D ata T ransfer Interfa ce
3GPP: Proxy CSCF
Home B Home A
Proxy CSCF:
HSS
HSS HSS
HSS Provides
emergency
8 7 4 3 service
breakout,
9 6 5
S-CSCF
S-CSCF I-CSCF
I-CSCF S-CSCF
S-CSCF I-CSCF
I-CSCF triggers for
14 15 16 locally-provided
10 13 17 2 services, and
Visited B Visited A number
P-SCSF
P-SCSF P-CSCF
P-CSCF
normalizing
11 12 18 1 (per local
GGSN
GGSN GGSN
GGSN
SGSN
SGSN SGSN
SGSN
dialing plan)
Radio Access
Radio Access Network
Network Radio Access
Radio Access Network
Network
B A
3GPP: Interrogating CSCF
Home B Home A
Interrogating
HSS HSS
HSS HSS
CSCF:
8 7 4 3
Queries the
HSS to find
9 6 5
S-CSCF
S-CSCF I-CSCF
I-CSCF S-CSCF
S-CSCF I-CSCF
I-CSCF the correct
14 15 16 S-CSCF.
10 13 17 2
First point of
P-SCSF
P-SCSF
Visited B Visited A
P-CSCF
P-CSCF
contact for
11 12 18 1
incoming
GGSN
GGSN GGSN
GGSN call
SGSN
SGSN SGSN
SGSN
Radio Access
Radio Access Network
Network Radio Access
Radio Access Network
Network signalling.
B A
3GPP: Serving CSCFs
Home B Home A
HSS
HSS HSS
HSS
8 7 4 3 Serving
9 6 5
CSCF:
S-CSCF
S-CSCF I-CSCF
I-CSCF S-CSCF
S-CSCF I-CSCF
I-CSCF Provides
14 15 16
10 13 17 2
subscriber
services.
Visited B Visited A
P-SCSF
P-SCSF P-CSCF
P-CSCF
11 12 18 1
GGSN
GGSN GGSN
GGSN
SGSN
SGSN SGSN
SGSN
Radio Access
Radio Access Network
Network Radio Access
Radio Access Network
Network
B A
SIP vs H.323
Outline
H.323 overview
H.323/SIP comparision
Functionality
Quality of Service
Scalability
Flexibility / Extensibility
Implementation
Summary
H.323 overview
Gatekeeper
Terminal
Gateway
Router Terminal
Packet-Switched
Networks
(IP Networks) Terminal
Circuit-Switched
Networks
(PSTN or ISDN)
H.323/SIP Comparison
H.323 SIP
H.323 SIP
Interaction between SIP and SDP are less
many sub-protocols complicated
make it very complex Servers can be stateless
Stateful servers in
Version 1+2
H.323v3 more complex
H.323 vs. SIP Extensibility of functionality
H.323 SIP
Only NonStandardParm Hierarchical namespace of
field useful (consists of features
vendor codes) Hierarchical error codes
New features could be New features can be
supported using H.450.1 registered with IANA
generic functions Transparent proxying
Arbitrary MIME Types
SUPPORTED, REQUIRED,
OPTIONS protocol
elements
H.323 vs. SIP Ease of customization
H.323 SIP
Interaction between Handled by simple header
protocols makes field
customization complicated
Unknown header fields can
Full compatibility with all be ignored
version must be
guaranteed (more code)
H.323 vs. SIP Transport Protocol neutral
H.323 SIP
Not before Version3 Can use any transport
protocol
Support for TCP/UDP in
H.323v3
H.323 vs. SIP Ease of Implementation
H.323 SIP
H.323 messages are SIP messages are text-
binary based (unicode supported)
Encoded using ASN.1 Easy implemented in Perl,
Special parsers needed to Tcl, Java
map into readable form Easy debugging: tcpdump,
and vice versa ngrep, netcat, ...
Implementation and
debugging complicated
Summary: SIP versus H.323
H.323 SIP
Deployment started Scalability
earlier Extensibility
Shorter messages Less Complexity
Ease of Implementation
Customization
Call forking
Third-party call control
Internet is open
anyone with Internet access may try to
attack anyone else
increasing complexity and programmability
results in lots of easily exploitable bugs
packets can be dumped anywhere in the
middle of packet path
Security of both users and providers
inherently suboptimal
Security Services
Availability
subject to Denial of Service Attacks: burdening
servers with enormous load, uploading hostile
applications, physical violence
difficult to beat: self vs. non-self problem
Privacy
prevents unauthorized persons from inspection of
both signaling and media
can be solved using encryption
problems: encryption computationally expensive; key
exchange protocols needed; no PKI available
Security Services
Message Integrity
prevents unauthorized users from changing packets
can be solved using Message Authentication Checks
User Authenticity
prevents unauthorized users from using someone’s
else identity to fool other users or accounting &
charging systems
Anonymity
prevents other call parties from knowing who is
calling
Disclaimers & Problems
200 OK w/JPEG
SIP/2.0 200 OK
Via: SIP/2.0/UDP here.com:5060
From: BigGuy <sip:UserA@here.com>
To: LittleGuy <sip:UserB@there.com>
Call-ID: 12345601@here.com...
Signaling Security
End-2-End Security
cannot cover entire signaling -- fields needed for routing have to
be visible
no intermediate proxies can corrupt security
mechanisms: basic and digest authentication, PGP
Hop-by-Hop Signaling Security
requires belief in transitive trust
immense computational stress on servers if public-key used
can deal with firewalls/NATs
may cover entire signaling
mechanisms: ipsec, TLS
Combination of both may be used
Keying: no established solution
SIP Authentication
Proxy
Media Security
SIP
FCP
media streams
FCP Benefits
Mobility
Firewall Traversal
Inter-domain Aspects
Advanced Services (transfer,
conferencing, instant messaging)
Compatibility with existing H.323 base
Emergency services
Conclusions
Internet telephony
opens telephony to unlimited competition
integrates voice with arbitrary services (cf. ISDN)
The core tool: Session Initiation Protocol
explores Internet legacy: textual protocol, stateless design,
extensibility
enables end-2-end services (service portfolio not limited by a
control protocol)
Commercial SIP products and services available
References
References
jku@195.37.78.237
192.168.99.2 Decision tree diagram courtesy of
Alan Johnston, MCI WorldCom.
(See reference to Alan’s SIP book.)
Frequent Misconceptions
Avoiding SIP Duplication
Home
1. IAM 2. INVITE 3. INVITE
T-SGW
T-SGW MGCF
MGCF T-ICG
T-ICG HSS
HSS
11. 200 4. 302
12. ANM
10. 200
PSTN 5. INVITE
MGW
MGW CI
CI
6. INVITE 9. 200
Visited
proxy
proxy
7. INVITE 8. 200
GGSN
GGSN
SGSN
SGSN
Radio Access Network
Radio Access Network
QoS
QoS: Issues to Consider
encoding
packetization decoding
OS Route OS
lookup
QoS: End-System Solutions