AARNet Copyright 2011 SIP Deep Dive Network Operations Bill Efthimiou APAN33 SIP workshop February 2012 AARNet Copyright 2011 Agenda 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 2 SIP Basics SIP Components and SIP Addressing SIP Messaging Syntax SIP Transaction and Dialog SIP Call Flows DNS NAPTR and SRV SIP Header SIP Mobility SIP and B2BUA – Back to Back User Agent SIP Peering AARNet Copyright 2011 The Basics of SIP • 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 3 AARNet Copyright 2011 Where does SIP fit in? 4 AARNet Copyright 2011 SIP User Agents • User Agent Client (UAC) – An entity initiates a call • User Agent Server (UAS) – An entity receives a call 5 AARNet Copyright 2011 SIP Servers • 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 6 •Proxy Servers – next slide AARNet Copyright 2011 SIP Proxy Server •Proxy Servers – forwarding requests, rewrite message, forking, etc Stateful – remembers all requests Stateless – forgets requests after forwarded 7 AARNet Copyright 2011 SIP Addressing 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:61262112650@aarnet.edu.au is a conference service on the MCU (bridge) • Devices – URI represents a single device/application, sip:sydfax1@aarnet.edu.au is a fax machine • Users – URI represents a user’s contact detail, sip:leon.li@aarnet.edu.au 8 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:bob@biloxi.com) 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 • 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 13 AARNet Copyright 2011 SIP Responses • Response Code (detailed list at http://en.wikipedia.org/wiki/List_of_SIP_response_codes) 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 Request 401 Unauthorized 404 Not Found 408 Timeout 483 Too Many Hops Server Errors 5XX 500 Internal Server Error 503 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 Source: sipschool.com 18 AARNet Copyright 2011 SIP call Routing- Fixed (How does a proxy server know where to forward the INVITE?) Hard coding/Fixed Dial plan example 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 _service._proto.name TTL class SRV priority weight port target _sip._udp.example.com 86400 IN SRV 0 5 5060 1.1.1.1 _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. AARNet Copyright 2011 DNS NAPTR and SRV (Cont’d) AARNet Copyright 2011 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 22 AARNet Copyright 2011 Example DNS SERVER Source: sipschool.com 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-Route Added 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". • Tag Random 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 • 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 26 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 • 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 29 AARNet Copyright 2011 SIP Trunking • 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. 30 AARNet Copyright 2011 SIP Peering • What is SIP peering? A “logical” connection between two organizations • Benefit • lower cost • trusted relationship • AARNet’s use case 31 AARNet Copyright 2011 Thanks 32 Comments ?