1 / 122

SIP Tutorial Introduction to SIP

SIP Tutorial Introduction to SIP. Original Slides by Alan Johnston and Henry Sinnreich, MCI ( at VON’03 ). Contents. SIP Overview SIP in detail SIP Call Flow Scenarios SIP Security SIP Programming Some Related Works. SIP Overview.

mignon
Download Presentation

SIP Tutorial Introduction to SIP

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. SIP TutorialIntroduction to SIP Original Slides by Alan Johnston and Henry Sinnreich, MCI (at VON’03)

  2. Contents • SIP Overview • SIP in detail • SIP Call Flow Scenarios • SIP Security • SIP Programming • Some Related Works

  3. SIP Overview What SIP is, Multimedia Protocol Stack, Short Historyand Related Protocolsare included.

  4. Why packet switching? Why SIP? Technology evolution of PSTN

  5. Session Initiation Protocol Overview • Application Layer Signaling Protocol • Used to establish, modify, and terminate multimedia sessions • Part of Internet Multimedia Architecture • Can use UDP, TCP, TLS, SCTP, etc. • Based on HTTP (Web) • Similar text-based structure • Uses URIs (Uniform Resource Indicators) • Applications include (but not limited to): • Voice, video, gaming, instant messaging, presence, call control, etc.

  6. Security & Privacy • SIP Authentication • Challenge/Response based on shared secret - SIP Digest • Mechanism also used by HTTP • Used for client devices • Encryption using private/public keys • Used between servers • Privacy and security • SIP signaling can be encrypted • S/MIME (Secure/Multipurpose Internet Mail Extensions) • Defined in RFC 2633 • SIP can be transported over • IPSec • Defined in RFC 2401 • TLS (Transport Layer Security) • Defined in RFC 2246

  7. Internet Multimedia Protocols RTSP

  8. A Short History of SIP • Internet Engineering Task Force (IETF) protocol • Inventors: M. Handley, H. Schulzrinne, E. Schooler, and J. Rosenberg • Became “Proposed Standard” and RFC 2543 in March 1999 in MMUSIC WG. • Separate SIP WG established in September 1999. • Now new SIPPING (applications) and SIMPLE (presence and instant messaging) WGs using SIP. • RFC2543bis-09 I-D became RFC 3261 in June 2002 • Added four new authors: G. Camarillo, A. Johnston, J. Peterson, and R. Sparks. • Entire spec rewritten for clarity, but some new features • Mostly backwards compatible with RFC 2543

  9. SIP Responses use a numerical code and a “reason phrase” Classes: 1xx Informational 2xx Final 3xx Redirection 4xx Client Error 5xx Server Error 6xx Global Failure SIP Requests and Responses SIP Request types are called “methods” Methods in base spec: INVITE ACK OPTIONS CANCEL BYE REGISTER Example: 404 Not Found

  10. SIP carries (encapsulates) SDP messages SDP specifies codecs and media termination points Only one of many possible MIME attachments carried by SIP SDP – Session Description Protocol Used to describe media session. Carried as a message body in SIP messages. Is a text-based protocol Uses RTP/AVP Profiles for common media types Defined by RFC 2327 E.g. RFC 3551 “RTP Profile for Audio and Video Conferences with Minimal Control” Related Protocols: SDP

  11. Related Protocol: RTP • RTP – Real-time Transport Protocol • Used to transport media packets over IP • RTP adds a bit-oriented header containing: • name of media source • timestamp • codec type • sequence number • Defined by H. Schulzrinne et al, RFC 1889. • Profiles defined by RFC 1890. • RTCP for exchange of participant and quality reports.

  12. SIP Uniform Resource Indicators (URIs) • Same form as email addresses: user@domain • Two URI schemes: • sip:henry@siptest.mci.com is a SIP URI • Most common form introduced in RFC 2543 • sips:henry@siptest.mci.com is a Secure SIP URI • New scheme introduced in RFC 3261 • Requires TLS over TCP as transport for security • Two types of SIP URIs: • Address of Record (AOR) (identifies a user) • sip:henry@mci.com (Needs DNS SRV records to locate SIP Servers for mci.com domain) • Contact (identifies a device and is usually a Fully Qualified Domain Name, FQDN) • sip:henry@127.24.45.4 or sip:henry@cube43.lab.mci.com (Which needs no resolution for routing)

  13. SIP “Trapezoid” DNS Server Location Server DNS SIP Inbound Proxy Server Outbound Proxy Server SIP SIP SIP Media (RTP) User Agent A User Agent B

  14. SIP Elements – User Agents Capable of sending and receiving SIP requests. • UAC – User Agent Client • UAS – User Agent Server End Devices • SIP phone • PC/laptop with SIP Client • PDA • mobile phone PSTN Gateways are a type of User Agent DNS Server Location Server DNS SIP Inbound Proxy Server Outbound Proxy Server SIP SIP SIP Media (RTP) User Agent A User Agent B

  15. SIP Elements – Proxy Servers DNS Server Location Server Forward or “proxy” requests on behalf of User Agents Consult databases: • DNS • Location Server Types: • Stateless • Transaction Stateful • Call Stateful No media capabilities • Ignore SDP. Normally bypassed once dialog established, but can Record-Route to stay in path. DNS SIP Inbound Proxy Server Outbound Proxy Server SIP SIP SIP Media (RTP) User Agent A User Agent B

  16. SIP Elements – Other Servers Location Server Database of locations of SIP User Agents Queried by Proxies in routing Updated by User Agents by Registration DNS Server SRV (Service) Records used to locate Inbound Proxy Servers DNS Server Location Server DNS SIP Inbound Proxy Server Outbound Proxy Server SIP SIP SIP Media (RTP) User Agent A User Agent B

  17. SIP Client and Server • SIP Elements are either • User Agents (end devices that initiate and terminate media sessions) • Servers (that assist in session setup) • Proxies • Registrars • Redirect servers • A User Agent acts as a • Client when it initiates a request (UAC) • Server when it responds to a request (UAS)

  18. SIP Registrar, 1 • SIP server that can receive and process REGISTER requests • A user has an account created which allows them to REGISTER contacts with a particular server • The account specifies a SIP “Address of Record (AOR)”

  19. SIP Registrar, 2 • SIP Registrars store the location of SIP endpoints • Each SIP endpoint Registers • with a Registrar using it’s Address of Record and Contact address • Address of Record for John Smith in From: header From: John Smith <sip:jsmith@zultys.com • Contact: header tells Registrar where to send messages Contact: John Smith <sip:jsmith@192.168.1.100> • SIP Proxies • query SIP Registrars for routing information • Incoming calls addressed to sip:jsmith@zultys.com • now routed by the Proxy to the Contact: header URL sip:jsmith@192.168.1.100

  20. Proxy Server • SIP Proxy servers route SIP messages • Stateless Proxies use stateless protocols like UDP to talk to endpoints • Low Proxy overhead • Ephemeral connections, dropped as soon as message is forwarded • Stateful Proxies use TCP or other stateful protocols to set up a permanent connection • High Proxy overhead • Endpoint connection must be set up, maintained and torn down for the duration of the session

  21. SIP Proxy Server • SIP Server which acts on behalf of User Agents • Receives a SIP request • Adds some headers • Modifies some of the headers • Forwards request to next hop server or client

  22. Stateless vs. Stateful Proxy • Stateless Proxy • Forwards every request downstream and response upstream • Keeps no state (does not have any notion of a transaction) • Never performs message retransmissions • Stateless proxies scale very well • can be very fast • good for network cores • Stateful Proxy • Maintains state information for the duration of either the: • Transaction (request) • Transaction Stateful • Dialogue (from INVITE to BYE) • Dialogue Stateful • Performs message retransmission

  23. SIP Redirect Server • Receives a request and returns a redirection response (3xx) • Contact header in response indicates where request should be retried • Similar to database query • All Server types are logical NOT Physical

  24. Locating SIP Servers • Manual provisioning • DHCP SIP Option 120 • RFC 3361 • Multicast (deprecated) • DNS SRV method • Get local domain name automatically from DHCP server • Perform SRV record query through DNS on that domain for _sip._udp.<domain name> • Send SIP REGISTER message to resolved server • phone is up and running without user intervention

  25. SIP in detail Now, we are going to study SIP in detail including SIP Request, SIP Response and SIP Header

  26. SIP Request Methods, 1 • SIP used for Peer-to-Peer Communication though it uses a Client-Server model • Requests are called “methods” • Six methods are defined in base RFC 3261: • INVITE • ACK • OPTIONS • BYE • CANCEL • REGISTER

  27. SIP Request Methods, 2 • REGISTER • Register contact with Registrar • INVITE/ACK/BYE/CANCEL/UPDATE • Creates, negotiates and tears down a call (dialogue) • MESSAGE • Creates an Instant Messaging session • SUBSCRIBE • Subscribe to a service (like message waiting indication) • NOTIFY • Notify a change in service state (new Voicemail)

  28. SIP Methods - INVITE, 1 • INVITE requests the establishment of a session • Carried in Message Body (SDP) • Type of session • IP Address • Port • Codec

  29. SIP Methods - INVITE, 2 • An INVITE during an existing session (dialogue) is called a re-INVITE • re-INVITEs can be used to • Place calls on or remove calls from hold • Change session parameters and codecs • The SIP UPDATE method is the proposed replacement for this technique

  30. SIP Methods - ACK • ACK completes the three way session setup handshake (INVITE, final response, ACK) • Only used for INVITE • If INVITE did not contain media information • ACK must contain the media information

  31. SIP Methods - OPTIONS • OPTIONS requests the capabilities of another User Agent • Response lists supported methods, extensions, codecs, etc. • User Agent responds to OPTIONS the same as if an INVITE (e.g. if Busy, returns 486 Busy Here) • Very basic presence information

  32. SIP Methods – BYE and CANCEL • BYE terminates an established session • User Agents stop sending media packets (RTP) • CANCEL terminates a pending session. • INVITE sent but no final response (non-1xx) yet received. • User Agents and Proxies stop processing INVITE • Can be sent by a proxy or User Agent • Useful for “forking proxy” • Parallel search using multiple registration Contacts. • First successful wins, rest are cancelled.

  33. SIP Methods - REGISTER • Registration allows a User Agent to upload current location and URLs to a Registrar • Registrar can upload into Location Service • Incoming requests can then be proxied or redirected to that location • Built in SIP support of mobility • UAs do not need static IP addresses • Obtain IP address via DHCP, REGISTER indicating new IP Address as contact

  34. SIP Request URI • The Request-URI indicates the destination address of the request • Proxies and other servers route requests based on Request-URI. • The Request-URI is modified by proxies as the address is resolved.

  35. SIP From and To Tags • Tags are pseudo-random numbers inserted in To or From headers to uniquely identify a call leg • INVITE request From header contains a tag • Any User Agent or Server generating a response adds a tag to the To header in the response • To: sip:john@company.com;tag=123456

  36. SIP Method - INFO • Used to transport mid-call signaling information • Only one pending INFO at a time • Typical use - PSTN signaling message carried as MIME attachment • E.g. ISDN User-to-User information • Defined in RFC 2976

  37. SIP Method - REFER • Indicates that recipient (identified by the Request-URI) should contact a third party using the contact information provided in the request • Typical Use: Call Transfer features • Allowed outside an established dialogue

  38. SIP Method - PRACK • Provisional Response ACKnowlegement • Used to acknowledge receipt of provisional response • 183 Session Progress • Does not apply to 100 Trying responses • Only provisional responses 101-199 may be sent reliably and acknowledged with PRACK • If no PRACK sent, response retransmitted • Defined in RFC 3262

  39. SIP Methods – SUBSCRIBE and NOTIFY • SUBSCRIBE requests notification of when a particular event occurs • Use Expires=0 to unsubscribe • A NOTIFY message is sent to indicate the event status • Sample Applications • Presence • Message waiting indication for voicemail • Defined in RFC 3265

  40. SIP Method - MESSAGE • Extension to SIP for Instant Messaging (IM) • MESSAGE requests • carry the content in the form of MIME body parts • use the standard MIME headers to identify the content

  41. SIP Responses • SIP Requests generate Responses with codes borrowed from HTTP • Classes: • 1xx Informational • 2xx Final • 3xx Redirection • 4xx Client Error • 5xx Server Error • 6xx Global Failure • Response example “404 Not Found”

  42. SIP Responses: 1xx-3xx

  43. SIP Responses: 4xx

  44. SIP Responses: 5xx-6xx

  45. SIP Message Details INVITE sip:wh@200.201.202.203 SIP/2.0 Via: SIP/2.0/UDP proxy.munich.de:5060;branch=z9hG4bK8542.1 Via: SIP/2.0/UDP 100.101.102.103:5060;branch=z9hG4bK45a35h76 Max-Forwards: 69 To: Heisenberg <sip:w.heisenberg@munich.de> From: E. Schroedinger <sip:schroed5244@aol.com>;tag=312345 Call-ID: 105637921@100.101.102.103 CSeq: 1 INVITE Contact: sip:schroed5244@100.101.102.103 Content-Type: application/sdp Content-Length: 159 • First line of a SIP message is Start Line which contains: • the method or Request type: INVITE (session setup request). • the Request-URI which indicates who the request is for sip:wh@200.201.202.203 • Note: Request-URI can be either an AOR or Contact (FQDN) • This Request-URI is a FQDN, but the initial Request-URI was an AOR (same as To URI) • the SIP version number SIP/2.0

  46. SIP Headers • SIP Requests and Responses contain Headers (similar to Email headers) • Required Headers • To • From • Via • Call-ID • CSeq • Max-Forwards • Optional Headers: • Subject, Date, Authentication (and many others)

  47. SIP Message Details INVITE sip:w.h@200.201.202.203 SIP/2.0 Via: SIP/2.0/UDP proxy.munich.de:5060;branch=z9hG4bK8542.1 Via: SIP/2.0/UDP 100.101.102.103:5060;branch=z9hG4bK45a35h76 Max-Forwards: 69 To: Heisenberg <sip:w.heisenberg@munich.de> From: E. Schroedinger <sip:schroed5244@aol.com>;tag=312345 Call-ID: 105637921@100.101.102.103 CSeq: 1 INVITE Contact: sip:schroed5244@100.101.102.103 Content-Type: application/sdp Content-Length: 159 • Via headers show the path the request has taken • The bottom Viaheader is inserted by the User Agent which initiated the request • Additional Via headers are inserted by each proxy in the path • The Via headers are used to route responses back the same way • Required branch parameter contains a “cookie” (z9hG4bK) then a transaction-ID.

  48. SIP Message Details INVITE sip:w.h@200.201.202.203 SIP/2.0 Via: SIP/2.0/UDP proxy.munich.de:5060;branch=z9hG4bK8542.1 Via: SIP/2.0/UDP 100.101.102.103:5060;branch=z9hG4bK45a35h76 Max-Forwards: 69 To: Heisenberg <sip:w.heisenberg@munich.de> From: E. Schroedinger <sip:schroed5244@aol.com>;tag=312345 Call-ID: 105637921@100.101.102.103 CSeq: 1 INVITE Contact: sip:schroed5244@100.101.102.103 Content-Type: application/sdp Content-Length: 159 • Max-Forwards is a count decremented by each proxy that forwards the request. • When count goes to zero, request is discarded and 483 Too Many Hops response is sent. • Used for stateless loop detection.

  49. SIP Message Details INVITE sip:w.h@200.201.202.203 SIP/2.0 Via: SIP/2.0/UDP proxy.munich.de:5060;branch=z9hG4bK8542.1 Via: SIP/2.0/UDP 100.101.102.103:5060;branch=z9hG4bK45a35h76 Max-Forwards: 69 To: Heisenberg <sip:w.heisenberg@munich.de> From: E. Schroedinger <sip:schroed5244@aol.com>;tag=312345 Call-ID: 105637921@100.101.102.103 CSeq: 1 INVITE Contact: sip:schroed5244@100.101.102.103 Content-Type: application/sdp Content-Length: 159 • Dialog (formerly called call leg) information is in headers: • To tag, From tag, and Call-ID (Note: Not URIs) • To and From URIs usually contain AOR URIs. • All requests and responses in this call will use this same Dialog information. • Call-ID is unique identifier usually composed of • pseudo-random string “@” hostname or IP Address

  50. SIP Message Details INVITE sip:w.h@200.201.202.203 SIP/2.0 Via: SIP/2.0/UDP proxy.munich.de:5060;branch=z9hG4bK8542.1 Via: SIP/2.0/UDP 100.101.102.103:5060;branch=z9hG4bK45a35h76 Max-Forwards: 69 To: Heisenberg <sip:w.heisenberg@munich.de> From: E. Schroedinger <sip:schroed5244@aol.com>;tag=312345 Call-ID: 105637921@100.101.102.103 CSeq: 1 INVITE Contact: sip:schroed5244@100.101.102.103 Content-Type: application/sdp Content-Length: 159 • CSeq Command Sequence Number • Initialized at start of call (1 in this example) • Incremented for each subsequent request • Used to distinguish a retransmission from a new request • Also contains the request type (method) - INVITE

More Related