logo资料库

rfc4271_中文版.pdf

第1页 / 共253页
第2页 / 共253页
第3页 / 共253页
第4页 / 共253页
第5页 / 共253页
第6页 / 共253页
第7页 / 共253页
第8页 / 共253页
资料共253页,剩余部分请下载后查看
SIP RFC (3261) explained, LIGHT 3.3 (2/2012) - www.sipknowledge.com /*============================================================================*\ Note: The original contents of the RFC 3261 was left intact. We only added elaborative footnotes (and links in the ms-word version). Copyright(C) for original content - The Internet Society (2002). \*============================================================================*/ /*============================================================================*\ /////////////// SIP RFC (3261) navigator and clarifier Light /////////////// By sipknowledge, Feb/2012, SIP Research & Training (www.sipknowledge.com) You can (e)Learn more about SIP/VoIP/IMS for a discounted price (30% OFF) at http://www.sipknowledge.com/Buy30off.htm Original content and format of the RFC is intact except for the addition of footnotes, hyper links and formatting 273 footnotes; ~1500 links/cross-references /*============================================================================*\ Network Working Group J. Rosenberg Request for Comments: 3261 dynamicsoft Obsoletes: 2543 H. Schulzrinne Category: Standards Track Columbia U. G. Camarillo Ericsson A. Johnston WorldCom J. Peterson Neustar R. Sparks dynamicsoft M. Handley ICIR E. Schooler AT&T June 2002 SIP: Session Initiation Protocol Status of this Memo This document specifies an Internet standards track protocol for the Internet community, and requests discussion and suggestions for improvements. Please refer to the current edition of the "Internet Official Protocol Standards" (STD 1) for the standardization state and status of this protocol. Distribution of this memo is unlimited. Copyright Notice Copyright (C) The Internet Society (2002). All Rights Reserved. Copyright(Footnotes/colors/links ONLY)(C), SIPKnowledge(2009). Copyright(Footnotes/colors/links ONLY)(C), SIPKnowledge(2012) P. 1
SIP RFC (3261) explained, LIGHT 3.3 (2/2012) - www.sipknowledge.com Abstract This document describes Session Initiation Protocol (SIP), an application-layer control (signaling) protocol for creating, modifying, and terminating sessions with one or more participants1. These sessions include Internet telephone calls, multimedia distribution, and multimedia conferences. SIP invitations2 used to create sessions carry session descriptions that allow participants to agree on a set of compatible media types. SIP makes use of elements called proxy servers to help route requests to the user's current location, authenticate and authorize users for services, implement provider call-routing policies, and provide features to users. SIP also provides a registration function that allows users to upload their current locations for use by proxy servers. SIP runs on top of several different transport protocols. Table of Contents 1 Introduction ........................................ 9 2 Overview of SIP Functionality ....................... 9 3 Terminology ......................................... 11 4 Overview of Operation ............................... 11 5 Structure of the Protocol ........................... 20 6 Definitions ......................................... 22 7 SIP Messages ........................................ 29 7.1 Requests ............................................ 30 7.2 Responses ........................................... 31 7.3 Header Fields ....................................... 32 7.3.1 Header Field Format ................................. 33 7.3.2 Header Field Classification ......................... 35 7.3.3 Compact Form ........................................ 35 7.4 Bodies .............................................. 35 7.4.1 Message Body Type ................................... 36 7.4.2 Message Body Length ................................. 36 7.5 Framing SIP Messages ................................ 36 8 General User Agent Behavior ......................... 37 8.1 UAC Behavior ........................................ 38 8.1.1 Generating the Request .............................. 38 1 Participants are the calling party (caller) and the called party (callee). Recall that in the VoIP world one may establish a session with a group of callees. In such a case we may have more than two participants. (Other common cases for SIP sessions with multi participants could be the addition of participants to an existing session either by calling them (dial out) or by have them dial in or by merging separate sessions to one (See (mainly) RFC 3911 and RFC 4579 (Conf- ID;isfocus;Join))) 2 Invitation is just the SIP fancy way to say “call setup”. Copyright(Footnotes/colors/links ONLY)(C), SIPKnowledge(2012) P. 2
SIP RFC (3261) explained, LIGHT 3.3 (2/2012) - www.sipknowledge.com 8.1.1.1 Request-URI ......................................... 38 8.1.1.2 To .................................................. 38 8.1.1.3 From ................................................ 40 8.1.1.4 Call-ID ............................................. 40 8.1.1.5 CSeq ................................................ 41 8.1.1.6 Max-Forwards ........................................ 42 8.1.1.7 Via ................................................. 42 8.1.1.8 Contact ............................................. 43 8.1.1.9 Supported and Require ............................... 44 8.1.1.10 Additional Message Components ....................... 44 8.1.2 Sending the Request ................................. 44 8.1.3 Processing Responses ................................ 45 8.1.3.1 Transaction Layer Errors ............................ 46 8.1.3.2 Unrecognized Responses .............................. 46 8.1.3.3 Vias ................................................ 46 8.1.3.4 Processing 3xx Responses ............................ 46 8.1.3.5 Processing 4xx Responses ............................ 48 8.2 UAS Behavior ........................................ 49 8.2.1 Method Inspection ................................... 50 8.2.2 Header Inspection ................................... 50 8.2.2.1 To and Request-URI .................................. 50 8.2.2.2 Merged Requests ..................................... 52 8.2.2.3 Require ............................................. 52 8.2.3 Content Processing .................................. 53 8.2.4 Applying Extensions ................................. 53 8.2.5 Processing the Request .............................. 54 8.2.6 Generating the Response ............................. 54 8.2.6.1 Sending a Provisional Response ...................... 54 8.2.6.2 Headers and Tags .................................... 55 8.2.7 Stateless UAS Behavior .............................. 55 8.3 Redirect Servers .................................... 56 9 Canceling a Request ................................. 59 9.1 Client Behavior ..................................... 59 9.2 Server Behavior ..................................... 61 10 Registrations ....................................... 62 10.1 Overview ............................................ 62 10.2 Constructing the REGISTER Request ................... 63 10.2.1 Adding Bindings ..................................... 65 10.2.1.1 Setting the Expiration Interval of Contact Addresses 66 10.2.1.2 Preferences among Contact Addresses ................. 67 10.2.2 Removing Bindings ................................... 67 10.2.3 Fetching Bindings ................................... 67 10.2.4 Refreshing Bindings ................................. 67 10.2.5 Setting the Internal Clock .......................... 68 10.2.6 Discovering a Registrar ............................. 68 10.2.7 Transmitting a Request .............................. 69 10.2.8 Error Responses ..................................... 69 10.3 Processing REGISTER Requests ........................ 69 11 Querying for Capabilities ........................... 72 11.1 Construction of OPTIONS Request ..................... 73 11.2 Processing of OPTIONS Request ....................... 74 12 Dialogs ............................................. 75 12.1 Creation of a Dialog ................................ 75 12.1.1 UAS behavior ........................................ 76 12.1.2 UAC Behavior ........................................ 77 12.2 Requests within a Dialog ............................ 78 12.2.1 UAC Behavior ........................................ 78 Copyright(Footnotes/colors/links ONLY)(C), SIPKnowledge(2012) P. 3
SIP RFC (3261) explained, LIGHT 3.3 (2/2012) - www.sipknowledge.com 12.2.1.1 Generating the Request .............................. 78 12.2.1.2 Processing the Responses ............................ 80 12.2.2 UAS Behavior ........................................ 81 12.3 Termination of a Dialog ............................. 82 13 Initiating a Session ................................ 83 13.1 Overview ............................................ 83 13.2 UAC Processing ...................................... 83 13.2.1 Creating the Initial INVITE ......................... 83 13.2.2 Processing INVITE Responses ......................... 86 13.2.2.1 1xx Responses ....................................... 86 13.2.2.2 3xx Responses ....................................... 86 13.2.2.3 4xx, 5xx and 6xx Responses .......................... 86 13.2.2.4 2xx Responses ....................................... 86 13.3 UAS Processing ...................................... 88 13.3.1 Processing of the INVITE ............................ 88 13.3.1.1 Progress ............................................ 89 13.3.1.2 The INVITE is Redirected ............................ 89 13.3.1.3 The INVITE is Rejected .............................. 89 13.3.1.4 The INVITE is Accepted .............................. 90 14 Modifying an Existing Session ....................... 91 14.1 UAC Behavior ........................................ 91 14.2 UAS Behavior ........................................ 93 15 Terminating a Session ............................... 94 15.1 Terminating a Session with a BYE Request ............ 95 15.1.1 UAC Behavior ........................................ 95 15.1.2 UAS Behavior ........................................ 95 16 Proxy Behavior ...................................... 95 16.1 Overview ............................................ 95 16.2 Stateful Proxy ...................................... 96 16.3 Request Validation .................................. 97 16.4 Route Information Preprocessing ..................... 99 16.5 Determining Request Targets ......................... 100 16.6 Request Forwarding .................................. 101 16.7 Response Processing ................................. 108 16.8 Processing Timer C .................................. 115 16.9 Handling Transport Errors ........................... 115 16.10 CANCEL Processing ................................... 115 16.11 Stateless Proxy ..................................... 116 16.12 Summary of Proxy Route Processing ................... 117 16.12.1 Examples ............................................ 118 16.12.1.1 Basic SIP Trapezoid ................................. 118 16.12.1.2 Traversing a Strict-Routing Proxy ................... 119 16.12.1.3 Rewriting Record-Route Header Field Values .......... 120 17 Transactions ........................................ 121 17.1 Client Transaction .................................. 123 17.1.1 INVITE Client Transaction ........................... 124 17.1.1.1 Overview of INVITE Transaction ...................... 124 17.1.1.2 Formal Description .................................. 124 17.1.1.3 Construction of the ACK Request ..................... 128 17.1.2 Non-INVITE Client Transaction ....................... 130 17.1.2.1 Overview of the non-INVITE Transaction .............. 130 17.1.2.2 Formal Description .................................. 130 17.1.3 Matching Responses to Client Transactions ........... 131 17.1.4 Handling Transport Errors ........................... 133 17.2 Server Transaction .................................. 134 17.2.1 INVITE Server Transaction ........................... 134 17.2.2 Non-INVITE Server Transaction ....................... 137 Copyright(Footnotes/colors/links ONLY)(C), SIPKnowledge(2012) P. 4
SIP RFC (3261) explained, LIGHT 3.3 (2/2012) - www.sipknowledge.com 17.2.3 Matching Requests to Server Transactions ............ 137 17.2.4 Handling Transport Errors ........................... 140 18 Transport ........................................... 140 18.1 Clients ............................................. 141 18.1.1 Sending Requests .................................... 141 18.1.2 Receiving Responses ................................. 143 18.2 Servers ............................................. 144 18.2.1 Receiving Requests .................................. 144 18.2.2 Sending Responses ................................... 145 18.3 Framing ............................................. 146 18.4 Error Handling ...................................... 146 19 Common Message Components ........................... 146 19.1 SIP and SIPS Uniform Resource Indicators ............ 146 19.1.1 SIP and SIPS URI Components ......................... 147 19.1.2 Character Escaping Requirements ..................... 151 19.1.3 Example SIP and SIPS URIs ........................... 152 19.1.4 URI Comparison ...................................... 152 19.1.5 Forming Requests from a URI ......................... 155 19.1.6 Relating SIP URIs and tel URLs ...................... 156 19.2 Option Tags ......................................... 157 19.3 Tags ................................................ 157 20 Header Fields ....................................... 158 20.1 Accept .............................................. 162 20.2 Accept-Encoding ..................................... 162 20.3 Accept-Language ..................................... 162 20.4 Alert-Info .......................................... 162 20.5 Allow ............................................... 163 20.6 Authentication-Info ................................. 163 20.7 Authorization ....................................... 163 20.8 Call-ID ............................................. 164 20.9 Call-Info ........................................... 164 20.10 Contact ............................................. 165 20.11 Content-Disposition ................................. 166 20.12 Content-Encoding .................................... 166 20.13 Content-Language .................................... 167 20.14 Content-Length ...................................... 167 20.15 Content-Type ........................................ 167 20.16 CSeq ................................................ 168 20.17 Date ................................................ 168 20.18 Error-Info .......................................... 168 20.19 Expires ............................................. 169 20.20 From ................................................ 169 20.21 In-Reply-To ......................................... 170 20.22 Max-Forwards ........................................ 170 20.23 Min-Expires ......................................... 170 20.24 MIME-Version ........................................ 171 20.25 Organization ........................................ 171 20.26 Priority ............................................ 171 20.27 Proxy-Authenticate .................................. 172 20.28 Proxy-Authorization ................................. 172 20.29 Proxy-Require ....................................... 172 20.30 Record-Route ........................................ 172 20.31 Reply-To ............................................ 173 20.32 Require ............................................. 173 20.33 Retry-After ......................................... 173 20.34 Route ............................................... 174 20.35 Server .............................................. 174 Copyright(Footnotes/colors/links ONLY)(C), SIPKnowledge(2012) P. 5
SIP RFC (3261) explained, LIGHT 3.3 (2/2012) - www.sipknowledge.com 20.36 Subject ............................................. 174 20.37 Supported ........................................... 175 20.38 Timestamp ........................................... 175 20.39 To .................................................. 175 20.40 Unsupported ......................................... 176 20.41 User-Agent .......................................... 176 20.42 Via ................................................. 176 20.43 Warning ............................................. 177 20.44 WWW-Authenticate .................................... 178 21 Response Codes ...................................... 179 21.1 Provisional 1xx ..................................... 179 21.1.1 100 Trying .......................................... 179 21.1.2 180 Ringing ......................................... 179 21.1.3 181 Call Is Being Forwarded ......................... 180 21.1.4 182 Queued .......................................... 180 21.1.5 183 Session Progress ................................ 180 21.2 Successful 2xx ...................................... 180 21.2.1 200 OK .............................................. 180 21.3 Redirection 3xx ..................................... 180 21.3.1 300 Multiple Choices ................................ 181 21.3.2 301 Moved Permanently ............................... 181 21.3.3 302 Moved Temporarily ............................... 181 21.3.4 305 Use Proxy ....................................... 182 21.3.5 380 Alternative Service ............................. 182 21.4 Request Failure 4xx ................................. 182 21.4.1 400 Bad Request ..................................... 182 21.4.2 401 Unauthorized .................................... 182 21.4.3 402 Payment Required ................................ 182 21.4.4 403 Forbidden ....................................... 183 21.4.5 404 Not Found ....................................... 183 21.4.6 405 Method Not Allowed .............................. 183 21.4.7 406 Not Acceptable .................................. 183 21.4.8 407 Proxy Authentication Required ................... 183 21.4.9 408 Request Timeout ................................. 184 21.4.10 410 Gone ............................................ 184 21.4.11 413 Request Entity Too Large ........................ 184 21.4.12 414 Request-URI Too Long ............................ 184 21.4.13 415 Unsupported Media Type .......................... 184 21.4.14 416 Unsupported URI Scheme .......................... 184 21.4.15 420 Bad Extension ................................... 185 21.4.16 421 Extension Required .............................. 185 21.4.17 423 Interval Too Brief .............................. 185 21.4.18 480 Temporarily Unavailable ......................... 185 21.4.19 481 Call/Transaction Does Not Exist ................. 185 21.4.20 482 Loop Detected ................................... 186 21.4.21 483 Too Many Hops ................................... 186 21.4.22 484 Address Incomplete .............................. 186 21.4.23 485 Ambiguous ....................................... 186 21.4.24 486 Busy Here ....................................... 187 21.4.25 487 Request Terminated .............................. 187 21.4.26 488 Not Acceptable Here ............................. 187 21.4.27 491 Request Pending ................................. 187 21.4.28 493 Undecipherable .................................. 187 21.5 Server Failure 5xx .................................. 188 21.5.1 500 Server Internal Error ........................... 188 21.5.2 501 Not Implemented ................................. 188 21.5.3 502 Bad Gateway ..................................... 188 Copyright(Footnotes/colors/links ONLY)(C), SIPKnowledge(2012) P. 6
SIP RFC (3261) explained, LIGHT 3.3 (2/2012) - www.sipknowledge.com 21.5.4 503 Service Unavailable ............................. 188 21.5.5 504 Server Time-out ................................. 188 21.5.6 505 Version Not Supported ........................... 189 21.5.7 513 Message Too Large ............................... 189 21.6 Global Failures 6xx ................................. 189 21.6.1 600 Busy Everywhere ................................. 189 21.6.2 603 Decline ......................................... 189 21.6.3 604 Does Not Exist Anywhere ......................... 189 21.6.4 606 Not Acceptable .................................. 189 22 Usage of HTTP Authentication ........................ 190 22.1 Framework ........................................... 191 22.2 User-to-User Authentication ......................... 192 22.3 Proxy-to-User Authentication ........................ 194 22.4 The Digest Authentication Scheme .................... 195 23 S/MIME .............................................. 197 23.1 S/MIME Certificates ................................. 197 23.2 S/MIME Key Exchange ................................. 198 23.3 Securing MIME bodies ................................ 200 23.4 SIP Header Privacy and Integrity using S/MIME: Tunneling SIP ....................................... 201 23.4.1 Integrity and Confidentiality Properties of SIP Headers ............................................. 202 23.4.1.1 Integrity ........................................... 202 23.4.1.2 Confidentiality ..................................... 202 23.4.2 Tunneling Integrity and Authentication .............. 203 23.4.3 Tunneling Encryption ................................ 205 24 Examples ............................................ 206 24.1 Registration ........................................ 206 24.2 Session Setup ....................................... 207 25 Augmented BNF for the SIP Protocol .................. 213 25.1 Basic Rules ......................................... 213 26 Security Considerations: Threat Model and Security Usage Recommendations ............................... 225 26.1 Attacks and Threat Models ........................... 225 26.1.1 Registration Hijacking .............................. 225 26.1.2 Impersonating a Server .............................. 226 26.1.3 Tampering with Message Bodies ....................... 226 26.1.4 Tearing Down Sessions ............................... 227 26.1.5 Denial of Service and Amplification ................. 228 26.2 Security Mechanisms ................................. 228 26.2.1 Transport and Network Layer Security ................ 229 26.2.2 SIPS URI Scheme ..................................... 230 26.2.3 HTTP Authentication ................................. 231 26.2.4 S/MIME .............................................. 231 26.3 Implementing Security Mechanisms .................... 231 26.3.1 Requirements for Implementers of SIP ................ 231 26.3.2 Security Solutions .................................. 232 26.3.2.1 Registration ........................................ 232 26.3.2.2 Interdomain Requests ................................ 233 26.3.2.3 Peer-to-Peer Requests ............................... 235 26.3.2.4 DoS Protection ...................................... 236 26.4 Limitations ......................................... 236 26.4.1 HTTP Digest ......................................... 236 26.4.2 S/MIME .............................................. 237 26.4.3 TLS ................................................. 238 26.4.4 SIPS URIs ........................................... 238 26.5 Privacy ............................................. 239 Copyright(Footnotes/colors/links ONLY)(C), SIPKnowledge(2012) P. 7
SIP RFC (3261) explained, LIGHT 3.3 (2/2012) - www.sipknowledge.com 27 IANA Considerations ................................. 240 27.1 Option Tags ......................................... 240 27.2 Warn-Codes .......................................... 241 27.3 Header Field Names .................................. 241 27.4 Method and Response Codes ........................... 241 27.5 The "message/sip" MIME type. ....................... 242 27.6 New Content-Disposition Parameter Registrations ..... 242 28 Changes From RFC 2543 ............................... 243 28.1 Major Functional Changes ............................ 243 28.2 Minor Functional Changes ............................ 246 29 Normative References ................................ 247 30 Informative References .............................. 248 A Table of Timer Values ............................... 250 Acknowledgments ................................................ 250 Authors' Addresses ............................................. 251 Full Copyright Statement ....................................... 252 Copyright(Footnotes/colors/links ONLY)(C), SIPKnowledge(2012) P. 8
分享到:
收藏