AARNet Copyright 2011
Network Operations
SIP Deep Dive
Bill Efthimiou
APAN33 SIP workshop
February 2012
AARNet Copyright 2011
Agenda
2
1. SIP Basics2. SIP Components and SIP Addressing3. SIP Messaging Syntax4. SIP Transaction and Dialog5. SIP Call Flows6. DNS NAPTR and SRV7. SIP Header 8. SIP Mobility9. SIP and B2BUA – Back to Back User Agent10. SIP Peering
AARNet Copyright 2011
The Basics of SIP
3
• RFC3261• Session Initiation Protocol• Application-layer Signalling protocol• Setup, Modify and Tear down sessions• Invite participants to existing sessions• Add/remove media to/from existing sessions • Establish user Presence• Personal mobility – single identity• IPv4 and IPv6 support
AARNet Copyright 2011
Where does SIP fit in?
4
AARNet Copyright 2011
SIP User Agents
5
• User Agent Client (UAC) – An entity initiates a call• User Agent Server (UAS) – An entity receives a call
AARNet Copyright 2011
SIP Servers
6
• Registrar Servers – users/services registration• Location Servers – maintaining users locations• Redirect Servers
Accept request, map the requested address to new addresses, and return to the client
No initial requests Do not accept calls
• Proxy Servers – next slide
AARNet Copyright 2011
SIP Proxy Server
7
• Proxy Servers – forwarding requests, rewrite message, forking, etc Stateful – remembers all requests Stateless – forgets requests after forwarded
AARNet Copyright 2011
SIP Addressing
8
SIP Addresses are URIs with the same format as an email address i.e. user@domain or user@host. They can refer to Services, Devices and Users.
• Service – URI points to conference, sip:[email protected] is a conference service on the MCU (bridge)• Devices – URI represents a single device/application,
sip:[email protected] is a fax machine• Users – URI represents a user’s contact detail,
AARNet Copyright 2011
SIP Registration
• A Common operation in SIP. Registration is a common way for a server to learn the current location of a user.• REGISTER messages associate a users SIP or SIPS URI (eg,
sip:[email protected]) with the machine/phone/etc into which he/she is currently logged in.• The registrar writes this association, also called a binding, to a
database, called the location service, where it can be used by the proxy in the domain. Often, a registrar server for a domain is co-located with the proxy for that domain.• A user “Bob” is not limited to registering from a single device. For
example, both his SIP phone at home and the one in the office could send registrations. This information is stored together in the location service and allows a proxy to perform various types of searches to locate Bob.
AARNet Copyright 2011
SIP Messages
There are two types of SIP Messages
Requests Responses
AARNet Copyright 2011
SIP Messages – Request-Line, example
AARNet Copyright 2011
SIP Messages – Status-Line, example
AARNet Copyright 2011
SIP Requests
13
• INVITE – to initiate a session• ACK – to indicate the receipt of the corresponding msg• BYE – to terminate a session• CANCEL – to cease a previous request• REGISTER – to send registration details to a Registrar• OPTIONS – to query another UA or a proxy server as to its capabilities• INFO – to carry session related control information• REFER – to direct the recipient to contact a 3rd party, e.g. call transfer• PRACK – provisional ACK (to 1XX only except 100 Trying)• PUBLISH – to advertise event state, like presence• SUBSCRIBE – to request the status of a session/UA etc• for a detailed list,
http://en.wikipedia.org/wiki/List_of_SIP_request_methods
AARNet Copyright 2011
• Response Code (detailed list at http://en.wikipedia.org/wiki/List_of_SIP_response_codes)
SIP Responses
Description Code Example
Informational 1XX 100 Trying 180 Ringing
Success 2XX 200 OK
Redirect 3XX 300 Multi Choices 301 Move permanently
Clients Errors 4XX 400 Bad Request401 Unauthorized404 Not Found408 Timeout483 Too Many Hops
Server Errors 5XX 500 Internal Server Error503 Service Unavailable
Global Errors 6XX 600 Busy Everywhere
AARNet Copyright 2011
301 Moved Permanently
The user can no longer be found at the address in the Request-URI, and the requesting client SHOULD retry at the new address given by the Contact header field. The requestor SHOULD update any local directories, address books, and user location caches with this new value and redirect future requests to the address(es) listed.
Source: RFC3261
AARNet Copyright 2011
302 Moved Temporarily
The requesting client SHOULD retry the request at the new address(es) given by the Contact header field. The Request-URI of the new request uses the value of the Contact header field in the response. The duration of the validity of the Contact URI can be indicated through an Expires header field or an expires parameter in the Contact header field. Both proxies and UAs MAY cache this URI for the duration of the expiration time. If there is no explicit expiration time, the address is only valid once for recursing, and MUST NOT be cached for future transactions.
Source: RFC3261
AARNet Copyright 2011
SIP Transactions and Dialogs
• Transaction: from the first request to the final response
• Dialog: starts with an INVITE transaction and ends with a BYE transaction
• DialogID = Call-ID + local tag + remote tag.
Note, From/To/Call-ID never changed in a dialog.
Source: Building Telephony Systems with OpenSER, by Flavio E. Goncalves
AARNet Copyright 2011
SIP Call Flow
18
Source: sipschool.com
AARNet Copyright 2011
SIP call Routing- Fixed (How does a proxy server know where to forward the INVITE?)
Hard coding/Fixed Dial planexample in the lab,Dialled Number Destination
1XXX 192.168.1.21
2XXX 192.168.1.22
3XXX 192.168.1.23
4XXX 192.168.1.24
AARNet Copyright 2011
SIP call Routing- SRV RR
SRV Record, RFC 2782– A specification of data in the DNS defining the location
_sip._tcp.example.com. 86400 IN SRV 10 60 5060 bigbox.example.com. _sip._tcp.example.com. 86400 IN SRV 10 20 5060 smallbox1.example.com. _sip._tcp.example.com. 86400 IN SRV 10 10 5060 smallbox2.example.com. _sip._tcp.example.com. 86400 IN SRV 10 10 5066 smallbox2.example.com. _sip._tcp.example.com. 86400 IN SRV 20 0 5060 backupbox.example.com.
_service._proto.name TTL class SRV priority weight port target
_sip._udp.example.com 86400 IN SRV 0 5 5060 1.1.1.1
AARNet Copyright 2011
DNS NAPTR and SRV (Cont’d)
AARNet Copyright 2011
22
SIP call Routing- NAPTR (using ENUM)
The example NAPTR records below show a translation from the number range +123456* to sip:123456*@sample.edu in the SIP case. For H.323 the NAPTR records map h323:123456* to h323:123456*@sample.edu.
Source: NRENUM.net:https://confluence.terena.org/display/NRENum/How+to+use+NAPTR+and+SRV+records+for+H.323+or+SIP+with+nrenum.net
AARNet Copyright 2011
Example
Source: sipschool.com
DNS SERVER
AARNet Copyright 2011
SIP Headers
SIP Header is HTTP like and contains important information.
Examples
– Registration
– Invite• Next hop?
– Record-route– Via– Contact
AARNet Copyright 2011
SIP Header Reminder
• Record-RouteAdded by the proxy so that it can stay in the messaging path between the endpoints for the duration of the session
• Branch– To identify the transaction– MUST always begin with the characters "z9hG4bK".
• TagRandom string added by the UA for identification purpose
• Remember in the Reply header– Via– From– To– Call-ID
are copied exactly from Request.
AARNet Copyright 2011
SIP Mobility
26
• Proxying and redirecting requests to a user’s current location• Device/network independent
PC, Smartphone, IP phone etc LAN, WiFi, 3G etc
• User must register
AARNet Copyright 2011
SIP Call Forking - Parallel
27 Source: sipschool.com
AARNet Copyright 2011
SIP Call Forking - Sequential
Source: sipschool.com
AARNet Copyright 2011
SIP B2BUA
29
• Back to Back User Agent (for example, SBC)A logical network element operates between both end points of a phone call or communications session and divides the communication channel into two call legs and mediates all SIP signalling between both ends of the call, from call establishment to termination. As all control messages for each call flow through the B2BUA, a service provider may implement value-added features available during the call.• Benefit
Centralise call management Billing Network topology hiding H.323 and SIP inter-working QoS enforcement NAT traversal
AARNet Copyright 2011
SIP Trunking
30
• What is SIP trunking? A “logical” connection from a PBX from a customer site to an Internet Telephony Service Provider (ITSP) network.• Benefit• replace existing E1/T1• flexible with number of channels• number porting• single existence for multiple regions (for example, SIP lines
for Sydney and Melbourne can co-located in Sydney)• Rich Media can be enabled, such as rich callerID, video,
presence, etc.
AARNet Copyright 2011
SIP Peering
31
• What is SIP peering? A “logical” connection between two organizations• Benefit• lower cost• trusted relationship
• AARNet’s use case
AARNet Copyright 2011
32
Thanks
Comments ?