SIP: Understanding the Session Initiation Protocol, Third Edition
Total Page:16
File Type:pdf, Size:1020Kb
SIP: Understanding the Session Initiation Protocol Third Edition For a complete listing of titles in the Artech House Telecommunications Series, turn to the back of this book. SIP: Understanding the Session Initiation Protocol Third Edition Alan B. Johnston Library of Congress Cataloging-in-Publication Data A catalog record for this book is available from the U.S. Library of Congress. British Library Cataloguing in Publication Data A catalogue record for this book is available from the British Library. Cover design by Yekaterina Ratner Cover art by Lisa Johnston ISBN 13: 978-1-60783-995-8 © 2009 ARTECH HOUSE 685 Canton Street Norwood, MA 02062 All rights reserved. Printed and bound in the United States of America. No part of this book may be reproduced or utilized in any form or by any means, electronic or mechanical, including pho- tocopying, recording, or by any information storage and retrieval system, without permission in writing from the publisher. All terms mentioned in this book that are known to be trademarks or service marks have been appropriately capitalized. Artech House cannot attest to the accuracy of this information. Use of a term in this book should not be regarded as affecting the validity of any trademark or service mark. 10 9 8 7 6 5 4 3 2 1 For Lisa Contents Foreword to the First Edition xxi Preface to the Third Edition xxiii Preface to the Second Edition xxv Preface to the First Edition xxvii 1 SIP and the Internet 1 1.1 Signaling Protocols 1 1.2 Internet Multimedia Protocol Stack 2 1.2.1 Physical Layer 2 1.2.2 Data/Link Layer 2 1.2.3 Network Layer 3 1.2.4 Transport Layer 4 1.2.5 Application Layer 9 1.2.6 Utility Applications 9 1.2.7 Multicast 10 1.3 Internet Names 11 1.4 URLs, URIs, and URNs 11 1.5 Domain Name Service 13 1.5.1 DNS Resource Records 14 1.5.2 Address Resource Records (A or AAAA) 15 vii viii SIP: Understanding the Session Initiation Protocol 1.5.3 Service Resource Records (SRV) 15 1.5.4 Naming Authority Pointer Resource Records (NAPTR) 16 1.5.5 DNS Resolvers 16 1.6 Global Open Standards 17 1.7 Internet Standards Process 18 1.8 A Brief History of SIP 20 1.9 Conclusion 21 References 21 2 Introduction to SIP 23 2.1 A Simple Session Establishment Example 23 2.2 SIP Call with a Proxy Server 31 2.3 SIP Registration Example 36 2.4 SIP Presence and Instant Message Example 38 2.5 Message Transport 43 2.5.1 UDP Transport 43 2.5.2 TCP Transport 45 2.5.3 TLS Transport 46 2.5.4 SCTP Transport 46 2.6 Transport Protocol Selection 47 2.7 Conclusion 48 2.8 Questions 48 References 50 3 SIP Clients and Servers 51 3.1 SIP User Agents 51 3.2 Presence Agents 52 3.3 Back-to-Back User Agents 53 3.4 SIP Gateways 54 3.5 SIP Servers 56 3.5.1 Proxy Servers 56 3.5.2 Redirect Servers 61 3.5.3 Registrar Servers 63 3.6 Uniform Resource Indicators 64 3.7 Acknowledgment of Messages 65 Contents ix 3.8 Reliability 66 3.9 Multicast Support 68 3.10 Conclusion 69 3.11 Questions 69 References 72 4 SIP Request Messages 73 4.1 Methods 73 4.1.1 INVITE 73 4.1.2 REGISTER 76 4.1.3 BYE 78 4.1.4 ACK 78 4.1.5 CANCEL 81 4.1.6 OPTIONS 82 4.1.7 SUBSCRIBE 84 4.1.8 NOTIFY 87 4.1.9 PUBLISH 88 4.1.10 REFER 91 4.1.11 MESSAGE 94 4.1.12 INFO 96 4.1.13 PRACK 97 4.1.14 UPDATE 99 4.2 URI and URL Schemes Used by SIP 100 4.2.1 SIP and SIPS URIs 101 4.2.2 Telephone URLs 102 4.2.3 Presence and Instant Messaging URLs 104 4.3 Tags 104 4.4 Message Bodies 105 4.5 Conclusion 107 4.6 Questions 107 References 108 5 SIP Response Messages 111 5.1 Informational 112 5.1.1 100 Trying 112 5.1.2 180 Ringing 113 x SIP: Understanding the Session Initiation Protocol 5.1.3 181 Call is Being Forwarded 113 5.1.4 182 Call Queued 113 5.1.5 183 Session Progress 113 5.2 Success 114 5.2.1 200 OK 114 5.2.2 202 Accepted 115 5.2.3 204 No Notifi cation 115 5.3 Redirection 115 5.3.1 300 Multiple Choices 115 5.3.2 301 Moved Permanently 116 5.3.3 302 Moved Temporarily 116 5.3.4 305 Use Proxy 116 5.3.5 380 Alternative Service 116 5.4 Client Error 116 5.4.1 400 Bad Request 116 5.4.2 401 Unauthorized 117 5.4.3 402 Payment Required 117 5.4.4 403 Forbidden 117 5.4.5 404 Not Found 118 5.4.6 405 Method Not Allowed 118 5.4.7 406 Not Acceptable 118 5.4.8 407 Proxy Authentication Required 118 5.4.9 408 Request Timeout 119 5.4.10 409 Confl ict 119 5.4.11 410 Gone 119 5.4.12 411 Length Required 119 5.4.13 412 Conditional Request Failed 119 5.4.14 413 Request Entity Too Large 120 5.4.15 414 Request-URI Too Long 120 5.4.16 415 Unsupported Media Type 120 5.4.17 416 Unsupported URI Scheme 120 5.4.18 417 Unknown Resource Priority 120 5.4.19 420 Bad Extension 121 5.4.20 421 Extension Required 121 5.4.21 422 Session Timer Interval Too Small 121 5.4.22 423 Interval Too Brief 121 Contents xi 5.4.23 428 Use Identity Header 121 5.4.24 429 Provide Referror Identity 122 5.4.25 430 Flow Failed 122 5.4.26 433 Anonymity Disallowed 122 5.4.27 436 Bad Identity-Info Header 122 5.4.28 437 Unsupported Certifi cate 122 5.4.29 438 Invalid Identity Header 123 5.4.30 439 First Hop Lacks Outbound Support 123 5.4.31 440 Max-Breadth Exceeded 123 5.4.32 470 Consent Needed 123 5.4.33 480 Temporarily Unavailable 123 5.4.34 481 Dialog/Transaction Does Not Exist 123 5.4.35 482 Loop Detected 124 5.4.36 483 Too Many Hops 124 5.4.37 484 Address Incomplete 125 5.4.38 485 Ambiguous 125 5.4.39 486 Busy Here 126 5.4.40 487 Request Terminated 126 5.4.41 488 Not Acceptable Here 126 5.4.42 489 Bad Event 126 5.4.43 491 Request Pending 126 5.4.44 493 Request Undecipherable 127 5.4.45 494 Security Agreement Required 127 5.5 Server Error 128 5.5.1 500 Server Internal Error 128 5.5.2 501 Not Implemented 128 5.5.3 502 Bad Gateway 128 5.5.4 503 Service Unavailable 128 5.5.5 504 Gateway Timeout 128 5.5.6 505 Version Not Supported 129 5.5.7 513 Message Too Large 129 5.5.8 580 Preconditions Failure 129 5.6 Global Error 129 5.6.1 600 Busy Everywhere 129 5.6.2 603 Decline 129 5.6.3 604 Does Not Exist Anywhere 130 xii SIP: Understanding the Session Initiation Protocol 5.6.4 606 Not Acceptable 130 5.7 Questions 130 References 131 6 SIP Header Fields 133 6.1 Request and Response Header Fields 134 6.1.1 Accept 134 6.1.2 Accept-Encoding 134 6.1.3 Accept-Language 136 6.1.4 Alert-Info 136 6.1.5 Allow 137 6.1.6 Allow-Events 137 6.1.7 Answer-Mode 137 6.1.8 Call-ID 137 6.1.9 Contact 138 6.1.10 CSeq 140 6.1.11 Date 141 6.1.12 Encryption 141 6.1.13 Expires 141 6.1.14 From 141 6.1.15 History Info 142 6.1.16 Organization 143 6.1.17 Path 143 6.1.18 Priv-Answer-Mode 143 6.1.19 Record-Route 144 6.1.20 Recv-Info 144 6.1.21 Refer-Sub 144 6.1.22 Retry-After 145 6.1.23 Subject 145 6.1.24 Supported 146 6.1.25 Timestamp 147 6.1.26 To 147 6.1.27 User-Agent 147 6.1.28 Via 148 6.2 Request Header Fields 149 6.2.1 Accept-Contact 149 Contents xiii 6.2.2 Authorization 150 6.2.3 Call-Info 150 6.2.4 Event 150 6.2.5 Hide 151 6.2.6 Identity 151 6.2.7 Identity-Info 151 6.2.8 In-Reply-To 151 6.2.9 Info-Package 152 6.2.10 Join 152 6.2.11 Priority 153 6.2.12 Privacy 153 6.2.13 Proxy-Authorization 153 6.2.14 Proxy-Require 154 6.2.15 P-OSP-Auth-Token 155 6.2.16 P-Asserted-Identity 155 6.2.17 P-Preferred-Identity 155 6.2.18 Max-Breadth 155 6.2.19 Max-Forwards 156 6.2.20 Reason 156 6.2.21 Refer-To 156 6.2.22 Referred-By 157 6.2.23 Reply-To 157 6.2.24 Replaces 158 6.2.25 Reject-Contact 158 6.2.26 Request-Disposition 159 6.2.27 Require 159 6.2.28 Resource-Priority 160 6.2.29 Response-Key 160 6.2.30 Route 160 6.2.31 RAck 161 6.2.32 Security-Client 161 6.2.33 Security-Verify 162 6.2.34 Session-Expires 162 6.2.35 SIP-If-Match 162 6.2.36 Subscription-State 162 6.2.37 Suppress-If-Match 163 6.2.38 Target-Dialog 163 xiv SIP: Understanding the Session Initiation Protocol 6.2.39 Trigger-Consent 163 6.3 Response Header Fields 163 6.3.1 Accept-Resource-Priority 163 6.3.2 Authentication-Info 164 6.3.3 Error-Info 164 6.3.4 Flow-Timer 165 6.3.5 Min-Expires 165 6.3.6 Min-SE 165 6.3.7 Permission-Missing 165 6.3.8 Proxy-Authenticate 166 6.3.9 Security-Server 166 6.3.10 Server 166 6.3.11 Service-Route 166 6.3.12 SIP-ETag 167 6.3.13 Unsupported 167 6.3.14 Warning 167 6.3.15 WWW-Authenticate 168 6.3.16 RSeq 168 6.4 Message Body Header Fields 169 6.4.1 Content-Encoding 169 6.4.2 Content-Disposition 169 6.4.3 Content-Language 170 6.4.4 Content-Length 170 6.4.5 Content-Type 170 6.4.6 MIME-Version 171 6.5 Questions 171 References 172 7 Wireless, Mobility, and IMS 177 7.1 IP Mobility 177 7.2 SIP Mobility 178 7.3 IMS and SIP 184 7.4 IMS Header Fields 186 7.5 Conclusion 186 7.6 Questions 187 References 187 Contents xv 8 Presence and Instant Messaging 189 8.1 Introduction 189 8.2 History of IM and Presence 189 8.3 SIMPLE 191 8.4 Presence with SIMPLE 191 8.4.1 SIP Events Framework 191 8.4.2 Presence Bodies 192 8.4.3 Resource Lists 194 8.4.4 Filtering 200 8.4.5 Conditional Event Notifi cations and ETags 201 8.4.6 Partial Publication 202 8.4.7 Presence Documents Summary 204 8.5 Instant Messaging with SIMPLE 205 8.5.1 Page Mode Instant Messaging 205 8.5.2 Common Profi le for Instant Messaging 205 8.5.3 Instant Messaging Delivery Notifi cation 206 8.5.4 Message Composition Indication 208 8.5.5 Multiple Recipient Messages 209 8.5.6 Session Mode Instant Messaging 210 8.6 Jabber 213 8.6.1 Standardization as Extensible Messaging and Presence Protocol 213 8.6.2 Interworking with SIMPLE 214 8.6.3 Jingle 214 8.6.4 Future Standardization of XMPP 214 8.7 Conclusion 214 8.8 Questions 215 References 216 9 Services in SIP 219 9.1 Gateway Services 219 9.2 SIP Trunking 221 9.3 SIP Service Examples 221 9.4 Voicemail 223 9.5 SIP Video 225 xvi SIP: Understanding the Session Initiation Protocol 9.6 Facsimile 226 9.7 Conferencing 227 9.7.1 Focus