320 likes | 504 Vues
SIP Deep Dive. Bill Efthimiou APAN33 SIP workshop February 2012. Network Operations. Agenda. 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
E N D
SIP Deep Dive Bill Efthimiou APAN33 SIP workshop February 2012 Network Operations
Agenda • 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 2
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
SIP User Agents • User Agent Client (UAC) – An entity initiates a call • User Agent Server (UAS) – An entity receives a call 5
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 • Proxy Servers – next slide 6
SIP Proxy Server • Proxy Servers – forwarding requests, rewrite message, forking, etc • Stateful – remembers all requests • Stateless – forgets requests after forwarded 7
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:syd-fax1@aarnet.edu.au is a fax machine • Users – URI represents a user’s contact detail, sip:leon.li@aarnet.edu.au 8
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.
SIP Messages • There are two types of SIP Messages • Requests • Responses
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
SIP Responses • Response Code (detailed list at http://en.wikipedia.org/wiki/List_of_SIP_response_codes)
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
302 Moved Temporarily The requesting client SHOULD retry the request at the new address(es) given by the Contact header field. The Request-URIof 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
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
SIP Call Flow Source: sipschool.com 18
SIP call Routing- Fixed (How does a proxy server know where to forward the INVITE?) Hard coding/Fixed Dial plan example in the lab,
SIP call Routing- SRV RR SRVRecord, 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.
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
Example DNS SERVER Source: sipschool.com
SIP Headers SIP Header is HTTP like and contains important information. Examples • Registration • Invite • Next hop? • Record-route • Via • Contact
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.
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
SIP Call Forking - Parallel Source: sipschool.com 27
SIP Call Forking - Sequential Source: sipschool.com
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
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
SIP Peering • What is SIP peering? A “logical” connection between two organizations • Benefit • lower cost • trusted relationship • AARNet’s use case 31
Thanks Comments ?