idnits 2.17.1 draft-ietf-mmusic-ice-sip-sdp-01.txt: Checking boilerplate required by RFC 5378 and the IETF Trust (see https://trustee.ietf.org/license-info): ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/1id-guidelines.txt: ---------------------------------------------------------------------------- No issues found here. Checking nits according to https://www.ietf.org/id-info/checklist : ---------------------------------------------------------------------------- == There are 6 instances of lines with private range IPv4 addresses in the document. If these are generic example addresses, they should be changed to use any of the ranges defined in RFC 6890 (or successor): 192.0.2.x, 198.51.100.x or 203.0.113.x. -- The document has examples using IPv4 documentation addresses according to RFC6890, but does not use any IPv6 documentation addresses. Maybe there should be IPv6 examples, too? Miscellaneous warnings: ---------------------------------------------------------------------------- == The copyright year in the IETF Trust and authors Copyright Line does not match the current year == The document seems to contain a disclaimer for pre-RFC5378 work, but was first submitted on or after 10 November 2008. The disclaimer is usually necessary only for documents that revise or obsolete older RFCs, and that take significant amounts of text from those RFCs. If you can contact all authors of the source material and they are willing to grant the BCP78 rights to the IETF Trust, you can and should remove the disclaimer. Otherwise, the disclaimer is needed and you can ignore this comment. (See the Legal Provisions document at https://trustee.ietf.org/license-info for more information.) -- The document date (January 10, 2014) is 3752 days in the past. Is this intentional? Checking references for intended status: Proposed Standard ---------------------------------------------------------------------------- (See RFCs 3967 and 4897 for information about using normative references to lower-maturity documents in RFCs) ** Obsolete normative reference: RFC 4091 (Obsoleted by RFC 5245) ** Obsolete normative reference: RFC 4092 (Obsoleted by RFC 5245) ** Obsolete normative reference: RFC 4566 (Obsoleted by RFC 8866) ** Obsolete normative reference: RFC 5226 (Obsoleted by RFC 8126) ** Obsolete normative reference: RFC 5389 (Obsoleted by RFC 8489) Summary: 5 errors (**), 0 flaws (~~), 3 warnings (==), 2 comments (--). Run idnits with the --verbose option for more detailed information about the items above. -------------------------------------------------------------------------------- 2 MMUSIC M. Petit-Huguenin 3 Internet-Draft Jive Communications 4 Intended status: Standards Track A. Keranen 5 Expires: July 14, 2014 Ericsson 6 January 10, 2014 8 Using Interactive Connectivity Establishment (ICE) with 9 Session Description Protocol (SDP) offer/answer and 10 Session Initiation Protocol (SIP) 11 draft-ietf-mmusic-ice-sip-sdp-01 13 Abstract 15 This document describes how Interactive Connectivity Establishment 16 (ICE) is used with Session Description Protocol (SDP) offer/answer 17 and Session Initiation Protocol (SIP). 19 Status of This Memo 21 This Internet-Draft is submitted in full conformance with the 22 provisions of BCP 78 and BCP 79. 24 Internet-Drafts are working documents of the Internet Engineering 25 Task Force (IETF). Note that other groups may also distribute 26 working documents as Internet-Drafts. The list of current Internet- 27 Drafts is at http://datatracker.ietf.org/drafts/current/. 29 Internet-Drafts are draft documents valid for a maximum of six months 30 and may be updated, replaced, or obsoleted by other documents at any 31 time. It is inappropriate to use Internet-Drafts as reference 32 material or to cite them other than as "work in progress." 34 This Internet-Draft will expire on July 14, 2014. 36 Copyright Notice 38 Copyright (c) 2014 IETF Trust and the persons identified as the 39 document authors. All rights reserved. 41 This document is subject to BCP 78 and the IETF Trust's Legal 42 Provisions Relating to IETF Documents 43 (http://trustee.ietf.org/license-info) in effect on the date of 44 publication of this document. Please review these documents 45 carefully, as they describe your rights and restrictions with respect 46 to this document. Code Components extracted from this document must 47 include Simplified BSD License text as described in Section 4.e of 48 the Trust Legal Provisions and are provided without warranty as 49 described in the Simplified BSD License. 51 This document may contain material from IETF Documents or IETF 52 Contributions published or made publicly available before November 53 10, 2008. The person(s) controlling the copyright in some of this 54 material may not have granted the IETF Trust the right to allow 55 modifications of such material outside the IETF Standards Process. 56 Without obtaining an adequate license from the person(s) controlling 57 the copyright in such materials, this document may not be modified 58 outside the IETF Standards Process, and derivative works of it may 59 not be created outside the IETF Standards Process, except to format 60 it for publication as an RFC or to translate it into languages other 61 than English. 63 Table of Contents 65 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 4 66 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 4 67 3. Sending the Initial Offer . . . . . . . . . . . . . . . . . . 4 68 3.1. Choosing Default Candidates . . . . . . . . . . . . . . . 4 69 3.2. Encoding the SDP . . . . . . . . . . . . . . . . . . . . 5 70 4. Receiving the Initial Offer . . . . . . . . . . . . . . . . . 6 71 4.1. Choosing Default Candidates . . . . . . . . . . . . . . . 6 72 4.2. Verifying ICE Support . . . . . . . . . . . . . . . . . . 7 73 4.3. Determining Role . . . . . . . . . . . . . . . . . . . . 7 74 5. Receipt of the Initial Answer . . . . . . . . . . . . . . . . 7 75 5.1. Verifying ICE Support . . . . . . . . . . . . . . . . . . 8 76 6. Performing Connectivity Checks . . . . . . . . . . . . . . . 8 77 7. Concluding ICE . . . . . . . . . . . . . . . . . . . . . . . 8 78 7.1. Procedures for Full Implementations . . . . . . . . . . . 8 79 7.1.1. Updating states . . . . . . . . . . . . . . . . . . . 8 80 7.2. Freeing Candidates . . . . . . . . . . . . . . . . . . . 9 81 7.2.1. Full Implementation Procedures . . . . . . . . . . . 9 82 8. Grammar . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 83 8.1. "candidate" Attribute . . . . . . . . . . . . . . . . . . 9 84 8.2. "remote-candidates" Attribute . . . . . . . . . . . . . . 11 85 8.3. "ice-lite" and "ice-mismatch" Attributes . . . . . . . . 12 86 8.4. "ice-ufrag" and "ice-pwd" Attributes . . . . . . . . . . 12 87 8.5. "ice-options" Attribute . . . . . . . . . . . . . . . . . 13 88 9. Subsequent Offer/Answer Exchanges . . . . . . . . . . . . . . 13 89 9.1. Generating the Offer . . . . . . . . . . . . . . . . . . 13 90 9.1.1. Procedures for All Implementations . . . . . . . . . 13 91 9.1.2. Procedures for Full Implementations . . . . . . . . . 15 92 9.1.3. Procedures for Lite Implementations . . . . . . . . . 16 93 9.2. Receiving the Offer and Generating an Answer . . . . . . 17 94 9.2.1. Procedures for All Implementations . . . . . . . . . 17 95 9.2.2. Procedures for Full Implementations . . . . . . . . . 18 96 9.2.3. Procedures for Lite Implementations . . . . . . . . . 19 97 9.3. Updating the Check and Valid Lists . . . . . . . . . . . 20 98 9.3.1. Procedures for Full Implementations . . . . . . . . . 20 99 9.3.2. Procedures for Lite Implementations . . . . . . . . . 21 100 10. Keepalives . . . . . . . . . . . . . . . . . . . . . . . . . 21 101 11. Media Handling . . . . . . . . . . . . . . . . . . . . . . . 21 102 11.1. Sending Media . . . . . . . . . . . . . . . . . . . . . 22 103 11.1.1. Procedures for All Implementations . . . . . . . . . 22 104 11.2. Receiving Media . . . . . . . . . . . . . . . . . . . . 22 105 12. Usage with SIP . . . . . . . . . . . . . . . . . . . . . . . 23 106 12.1. Latency Guidelines . . . . . . . . . . . . . . . . . . . 23 107 12.1.1. Offer in INVITE . . . . . . . . . . . . . . . . . . 23 108 12.1.2. Offer in Response . . . . . . . . . . . . . . . . . 24 109 12.2. SIP Option Tags and Media Feature Tags . . . . . . . . . 25 110 12.3. Interactions with Forking . . . . . . . . . . . . . . . 25 111 12.4. Interactions with Preconditions . . . . . . . . . . . . 25 112 12.5. Interactions with Third Party Call Control . . . . . . . 26 113 13. Relationship with ANAT . . . . . . . . . . . . . . . . . . . 26 114 14. Setting Ta and RTO for RTP Media Streams . . . . . . . . . . 26 115 15. Security Considerations . . . . . . . . . . . . . . . . . . . 28 116 15.1. Attacks on the Offer/Answer Exchanges . . . . . . . . . 28 117 15.2. Insider Attacks . . . . . . . . . . . . . . . . . . . . 28 118 15.2.1. The Voice Hammer Attack . . . . . . . . . . . . . . 28 119 15.2.2. Interactions with Application Layer Gateways and SIP 29 120 16. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 30 121 16.1. SDP Attributes . . . . . . . . . . . . . . . . . . . . . 30 122 16.1.1. candidate Attribute . . . . . . . . . . . . . . . . 30 123 16.1.2. remote-candidates Attribute . . . . . . . . . . . . 31 124 16.1.3. ice-lite Attribute . . . . . . . . . . . . . . . . . 31 125 16.1.4. ice-mismatch Attribute . . . . . . . . . . . . . . . 32 126 16.1.5. ice-pwd Attribute . . . . . . . . . . . . . . . . . 32 127 16.1.6. ice-ufrag Attribute . . . . . . . . . . . . . . . . 32 128 16.1.7. ice-options Attribute . . . . . . . . . . . . . . . 33 129 16.2. Interactive Connectivity Establishment (ICE) Options 130 Registry . . . . . . . . . . . . . . . . . . . . . . . . 33 131 17. Acknowledgments . . . . . . . . . . . . . . . . . . . . . . . 34 132 18. References . . . . . . . . . . . . . . . . . . . . . . . . . 34 133 18.1. Normative References . . . . . . . . . . . . . . . . . . 34 134 18.2. Informative References . . . . . . . . . . . . . . . . . 36 135 Appendix A. Examples . . . . . . . . . . . . . . . . . . . . . . 37 136 Appendix B. The remote-candidates Attribute . . . . . . . . . . 38 137 Appendix C. Why Is the Conflict Resolution Mechanism Needed? . . 39 138 Appendix D. Why Send an Updated Offer? . . . . . . . . . . . . . 40 139 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 41 141 1. Introduction 143 [NOTE: this version of the document shows merely which parts of the 144 original ICE document could be split to a separate document if the 145 split of SDP is accepted by the WG. Later versions will define the 146 additional procedures needed] 148 This document describes how Interactive Connectivity Establishment 149 (ICE) is used with Session Description Protocol (SDP) offer/answer 150 and Session Initiation Protocol (SIP). The ICE specification 151 [ICE-BIS] describes procedures that are common to all usages of ICE 152 and this document gives the additional details needed to use ICE with 153 SIP and SDP offer/answer. 155 Note that ICE is not intended for NAT traversal for SIP, which is 156 assumed to be provided via another mechanism [RFC5626]. 158 2. Terminology 160 The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", 161 "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and 162 "OPTIONAL" in this document are to be interpreted as described in RFC 163 2119 [RFC2119]. 165 This document uses the terms defined in [ICE-BIS] and the following: 167 Default Destination/Candidate: The default destination for a 168 component of a media stream is the transport address that would be 169 used by an agent that is not ICE aware. A default candidate for a 170 component is one whose transport address matches the default 171 destination for that component. For the RTP component, the 172 default IP address is in the c line of the SDP, and the port is in 173 the m line. For the RTCP component, it is in the rtcp attribute 174 when present, and when not present, the IP address is in the c 175 line and 1 plus the port is in the m line. 177 3. Sending the Initial Offer 179 3.1. Choosing Default Candidates 181 A candidate is said to be default if it would be the target of media 182 from a non-ICE peer; that target is called the DEFAULT DESTINATION. 183 If the default candidates are not selected by the ICE algorithm when 184 communicating with an ICE-aware peer, an updated offer/answer will be 185 required after ICE processing completes in order to "fix up" the SDP 186 so that the default destination for media matches the candidates 187 selected by ICE. If ICE happens to select the default candidates, no 188 updated offer/answer is required. 190 An agent MUST choose a set of candidates, one for each component of 191 each in-use media stream, to be default. A media stream is in-use if 192 it does not have a port of zero (which is used in RFC 3264 to reject 193 a media stream). Consequently, a media stream is in-use even if it 194 is marked as a=inactive [RFC4566] or has a bandwidth value of zero. 196 It is RECOMMENDED that default candidates be chosen based on the 197 likelihood of those candidates to work with the peer that is being 198 contacted. It is RECOMMENDED that the default candidates are the 199 relayed candidates (if relayed candidates are available), server 200 reflexive candidates (if server reflexive candidates are available), 201 and finally host candidates. 203 3.2. Encoding the SDP 205 The process of encoding the SDP is identical between full and lite 206 implementations. 208 The agent will include an m line for each media stream it wishes to 209 use. The ordering of media streams in the SDP is relevant for ICE. 210 ICE will perform its connectivity checks for the first m line first, 211 and consequently media will be able to flow for that stream first. 212 Agents SHOULD place their most important media stream, if there is 213 one, first in the SDP. 215 There will be a candidate attribute for each candidate for a 216 particular media stream. Section 8 provides detailed rules for 217 constructing this attribute. 219 STUN connectivity checks between agents are authenticated using the 220 short-term credential mechanism defined for STUN [RFC5389]. This 221 mechanism relies on a username and password that are exchanged 222 through protocol machinery between the client and server. The 223 username fragment and password are exchanged in the ice-ufrag and 224 ice-pwd attributes, respectively. 226 If an agent is a lite implementation, it MUST include an "a=ice-lite" 227 session-level attribute in its SDP to indicate this. If an agent is 228 a full implementation, it MUST NOT include this attribute. 230 The default candidates are added to the SDP as the default 231 destination for media. For streams based on RTP, this is done by 232 placing the IP address and port of the RTP candidate into the c and m 233 lines, respectively. If the agent is utilizing RTCP, it MUST encode 234 the RTCP candidate using the a=rtcp attribute as defined in RFC 3605 235 [RFC3605]. If RTCP is not in use, the agent MUST signal that using 236 b=RS:0 and b=RR:0 as defined in RFC 3556 [RFC3556]. 238 The transport addresses that will be the default destination for 239 media when communicating with non-ICE peers MUST also be present as 240 candidates in one or more a=candidate lines. 242 ICE provides for extensibility by allowing an offer or answer to 243 contain a series of tokens that identify the ICE extensions used by 244 that agent. If an agent supports an ICE extension, it MUST include 245 the token defined for that extension in the ice-options attribute. 247 The following is an example SDP message that includes ICE attributes 248 (lines folded for readability): 250 v=0 251 o=jdoe 2890844526 2890842807 IN IP4 10.0.1.1 252 s= 253 c=IN IP4 192.0.2.3 254 t=0 0 255 a=ice-pwd:asd88fgpdd777uzjYhagZg 256 a=ice-ufrag:8hhY 257 m=audio 45664 RTP/AVP 0 258 b=RS:0 259 b=RR:0 260 a=rtpmap:0 PCMU/8000 261 a=candidate:1 1 UDP 2130706431 10.0.1.1 8998 typ host 262 a=candidate:2 1 UDP 1694498815 192.0.2.3 45664 typ srflx raddr 263 10.0.1.1 rport 8998 265 Once an agent has sent its offer or its answer, that agent MUST be 266 prepared to receive both STUN and media packets on each candidate. 267 As discussed in Section 10.1 of [ICE-BIS], media packets can be sent 268 to a candidate prior to its appearance as the default destination for 269 media in an offer or answer. 271 4. Receiving the Initial Offer 273 4.1. Choosing Default Candidates 275 The process for selecting default candidates at the answerer is 276 identical to the process followed by the offerer, as described in 277 Section 3.1 for full implementations and 4.2 of [ICE-BIS] for lite 278 implementations. 280 4.2. Verifying ICE Support 282 The agent will proceed with the ICE procedures defined in [ICE-BIS] 283 and this specification if, for each media stream in the SDP it 284 received, the default destination for each component of that media 285 stream appears in a candidate attribute. For example, in the case of 286 RTP, the IP address and port in the c and m lines, respectively, 287 appear in a candidate attribute and the value in the rtcp attribute 288 appears in a candidate attribute. 290 If this condition is not met, the agent MUST process the SDP based on 291 normal RFC 3264 procedures, without using any of the ICE mechanisms 292 described in the remainder of this specification with the following 293 exceptions: 295 1. The agent MUST follow the rules of section 9 of [ICE-BIS], which 296 describe keepalive procedures for all agents. 298 2. If the agent is not proceeding with ICE because there were 299 a=candidate attributes, but none that matched the default 300 destination of the media stream, the agent MUST include an a=ice- 301 mismatch attribute in its answer. 303 3. If the default candidates were relayed candidates learned through 304 a TURN server, the agent MUST create permissions in the TURN 305 server for the IP addresses learned from its peer in the SDP it 306 just received. If this is not done, initial packets in the media 307 stream from the peer may be lost. 309 4.3. Determining Role 311 In unusual cases, described in Appendix C, it is possible for both 312 agents to mistakenly believe they are controlled or controlling. To 313 resolve this, each agent MUST select a random number, called the tie- 314 breaker, uniformly distributed between 0 and (2**64) - 1 (that is, a 315 64-bit positive integer). This number is used in connectivity checks 316 to detect and repair this case, as described in Section 7.1.2.2 of 317 [ICE-BIS]. 319 5. Receipt of the Initial Answer 321 When ICE is used with SIP, forking may result in a single offer 322 generating a multiplicity of answers. In that case, ICE proceeds 323 completely in parallel and independently for each answer, treating 324 the combination of its offer and each answer as an independent offer/ 325 answer exchange, with its own set of pairs, check lists, states, and 326 so on. The only case in which processing of one pair impacts another 327 is freeing of candidates, discussed below in Section 7.2. 329 5.1. Verifying ICE Support 331 The logic at the offerer is identical to that of the answerer as 332 described in section 5.1 of [ICE-BIS], with the exception that an 333 offerer would not ever generate a=ice-mismatch attributes in an SDP. 335 In some cases, the answer may omit a=candidate attributes for the 336 media streams, and instead include an a=ice-mismatch attribute for 337 one or more of the media streams in the SDP. This signals to the 338 offerer that the answerer supports ICE, but that ICE processing was 339 not used for the session because a signaling intermediary modified 340 the default destination for media components without modifying the 341 corresponding candidate attributes. See Section 15.2.2 for a 342 discussion of cases where this can happen. This specification 343 provides no guidance on how an agent should proceed in such a failure 344 case. 346 6. Performing Connectivity Checks 348 The possibility for role conflicts described in Section 7.2.1.1 of 349 [ICE-BIS] applies to this usage and hence all full agents MUST 350 implement the role conflict repairing mechanism. Also both full and 351 lite agents MUST utilize the ICE-CONTROLLED and ICE-CONTROLLING 352 attributes as described in Section 7.1.2.2 of [ICE-BIS]. 354 7. Concluding ICE 356 Once all of the media streams are completed, the controlling endpoint 357 sends an updated offer if the candidates in the m and c lines for the 358 media stream (called the DEFAULT CANDIDATES) don't match ICE's 359 SELECTED CANDIDATES. 361 7.1. Procedures for Full Implementations 363 7.1.1. Updating states 365 Once the state of each check list is Completed, If an agent is 366 controlling, it examines the highest-priority nominated candidate 367 pair for each component of each media stream. If any of those 368 candidate pairs differ from the default candidate pairs in the most 369 recent offer/answer exchange, the controlling agent MUST generate an 370 updated offer as described in Section 9. 372 7.2. Freeing Candidates 374 7.2.1. Full Implementation Procedures 376 When ICE is used with SIP, and an offer is forked to multiple 377 recipients, ICE proceeds in parallel and independently with each 378 answerer, all using the same local candidates. Once ICE processing 379 has reached the Completed state for all peers for media streams using 380 those candidates, the agent SHOULD wait an additional three seconds, 381 and then it MAY cease responding to checks or generating triggered 382 checks on that candidate. It MAY free the candidate at that time. 383 Freeing of server reflexive candidates is never explicit; it happens 384 by lack of a keepalive. The three-second delay handles cases when 385 aggressive nomination is used, and the selected pairs can quickly 386 change after ICE has completed. 388 8. Grammar 390 This specification defines seven new SDP attributes -- the 391 "candidate", "remote-candidates", "ice-lite", "ice-mismatch", "ice- 392 ufrag", "ice-pwd", and "ice-options" attributes. 394 8.1. "candidate" Attribute 396 The candidate attribute is a media-level attribute only. It contains 397 a transport address for a candidate that can be used for connectivity 398 checks. 400 The syntax of this attribute is defined using Augmented BNF as 401 defined in [RFC5234]: 403 candidate-attribute = "candidate" ":" foundation SP component-id SP 404 transport SP 405 priority SP 406 connection-address SP ;from RFC 4566 407 port ;port from RFC 4566 408 SP cand-type 409 [SP rel-addr] 410 [SP rel-port] 411 *(SP extension-att-name SP 412 extension-att-value) 414 foundation = 1*32ice-char 415 component-id = 1*5DIGIT 416 transport = "UDP" / transport-extension 417 transport-extension = token ; from RFC 3261 418 priority = 1*10DIGIT 419 cand-type = "typ" SP candidate-types 420 candidate-types = "host" / "srflx" / "prflx" / "relay" / token 421 rel-addr = "raddr" SP connection-address 422 rel-port = "rport" SP port 423 extension-att-name = byte-string ;from RFC 4566 424 extension-att-value = byte-string 425 ice-char = ALPHA / DIGIT / "+" / "/" 427 This grammar encodes the primary information about a candidate: its 428 IP address, port and transport protocol, and its properties: the 429 foundation, component ID, priority, type, and related transport 430 address: 432 : is taken from RFC 4566 [RFC4566]. It is the 433 IP address of the candidate, allowing for IPv4 addresses, IPv6 434 addresses, and fully qualified domain names (FQDNs). When parsing 435 this field, an agent can differentiate an IPv4 address and an IPv6 436 address by presence of a colon in its value -- the presence of a 437 colon indicates IPv6. An agent MUST ignore candidate lines that 438 include candidates with IP address versions that are not supported 439 or recognized. An IP address SHOULD be used, but an FQDN MAY be 440 used in place of an IP address. In that case, when receiving an 441 offer or answer containing an FQDN in an a=candidate attribute, 442 the FQDN is looked up in the DNS first using an AAAA record 443 (assuming the agent supports IPv6), and if no result is found or 444 the agent only supports IPv4, using an A. If the DNS query 445 returns more than one IP address, one is chosen, and then used for 446 the remainder of ICE processing. 448 : is also taken from RFC 4566 [RFC4566]. It is the port of 449 the candidate. 451 : indicates the transport protocol for the candidate. 452 This specification only defines UDP. However, extensibility is 453 provided to allow for future transport protocols to be used with 454 ICE, such as TCP or the Datagram Congestion Control Protocol 455 (DCCP) [RFC4340]. 457 : is composed of 1 to 32 s. It is an 458 identifier that is equivalent for two candidates that are of the 459 same type, share the same base, and come from the same STUN 460 server. The foundation is used to optimize ICE performance in the 461 Frozen algorithm. 463 : is a positive integer between 1 and 256 that 464 identifies the specific component of the media stream for which 465 this is a candidate. It MUST start at 1 and MUST increment by 1 466 for each component of a particular candidate. For media streams 467 based on RTP, candidates for the actual RTP media MUST have a 468 component ID of 1, and candidates for RTCP MUST have a component 469 ID of 2. See section 11 in [ICE-BIS] for additional discussion on 470 extending ICE to new media streams. 472 : is a positive integer between 1 and (2**31 - 1). 474 : encodes the type of candidate. This specification 475 defines the values "host", "srflx", "prflx", and "relay" for host, 476 server reflexive, peer reflexive, and relayed candidates, 477 respectively. The set of candidate types is extensible for the 478 future. 480 and : convey transport addresses related to the 481 candidate, useful for diagnostics and other purposes. 482 and MUST be present for server reflexive, peer 483 reflexive, and relayed candidates. If a candidate is server or 484 peer reflexive, and are equal to the base 485 for that server or peer reflexive candidate. If the candidate is 486 relayed, and is equal to the mapped address 487 in the Allocate response that provided the client with that 488 relayed candidate (see section Appendix B.3 of [ICE-BIS] for a 489 discussion of its purpose). If the candidate is a host candidate, 490 and MUST be omitted. 492 The candidate attribute can itself be extended. The grammar allows 493 for new name/value pairs to be added at the end of the attribute. An 494 implementation MUST ignore any name/value pairs it doesn't 495 understand. 497 8.2. "remote-candidates" Attribute 498 The syntax of the "remote-candidates" attribute is defined using 499 Augmented BNF as defined in RFC 5234 [RFC5234]. The remote- 500 candidates attribute is a media-level attribute only. 502 remote-candidate-att = "remote-candidates" ":" remote-candidate 503 0*(SP remote-candidate) 504 remote-candidate = component-ID SP connection-address SP port 506 The attribute contains a connection-address and port for each 507 component. The ordering of components is irrelevant. However, a 508 value MUST be present for each component of a media stream. This 509 attribute MUST be included in an offer by a controlling agent for a 510 media stream that is Completed, and MUST NOT be included in any other 511 case. 513 8.3. "ice-lite" and "ice-mismatch" Attributes 515 The syntax of the "ice-lite" and "ice-mismatch" attributes, both of 516 which are flags, is: 518 ice-lite = "ice-lite" 519 ice-mismatch = "ice-mismatch" 521 "ice-lite" is a session-level attribute only, and indicates that an 522 agent is a lite implementation. "ice-mismatch" is a media-level 523 attribute only, and when present in an answer, indicates that the 524 offer arrived with a default destination for a media component that 525 didn't have a corresponding candidate attribute. 527 8.4. "ice-ufrag" and "ice-pwd" Attributes 529 The "ice-ufrag" and "ice-pwd" attributes convey the username fragment 530 and password used by ICE for message integrity. Their syntax is: 532 ice-pwd-att = "ice-pwd" ":" password 533 ice-ufrag-att = "ice-ufrag" ":" ufrag 534 password = 22*256ice-char 535 ufrag = 4*256ice-char 537 The "ice-pwd" and "ice-ufrag" attributes can appear at either the 538 session-level or media-level. When present in both, the value in the 539 media-level takes precedence. Thus, the value at the session-level 540 is effectively a default that applies to all media streams, unless 541 overridden by a media-level value. Whether present at the session or 542 media-level, there MUST be an ice-pwd and ice-ufrag attribute for 543 each media stream. If two media streams have identical ice-ufrag's, 544 they MUST have identical ice-pwd's. 546 The ice-ufrag and ice-pwd attributes MUST be chosen randomly at the 547 beginning of a session. The ice-ufrag attribute MUST contain at 548 least 24 bits of randomness, and the ice-pwd attribute MUST contain 549 at least 128 bits of randomness. This means that the ice-ufrag 550 attribute will be at least 4 characters long, and the ice-pwd at 551 least 22 characters long, since the grammar for these attributes 552 allows for 6 bits of randomness per character. The attributes MAY be 553 longer than 4 and 22 characters, respectively, of course, up to 256 554 characters. The upper limit allows for buffer sizing in 555 implementations. Its large upper limit allows for increased amounts 556 of randomness to be added over time. For compatibility with the 512 557 character limitation for the STUN username attribute value and for 558 bandwidth conservation considerations, the ice-ufrag attribute MUST 559 NOT be longer than 32 characters when sending, but an implementation 560 MUST accept up to 256 characters when receiving. 562 8.5. "ice-options" Attribute 564 The "ice-options" attribute is a session-level attribute. It 565 contains a series of tokens that identify the options supported by 566 the agent. Its grammar is: 568 ice-options = "ice-options" ":" ice-option-tag 569 0*(SP ice-option-tag) 570 ice-option-tag = 1*ice-char 572 9. Subsequent Offer/Answer Exchanges 574 Either agent MAY generate a subsequent offer at any time allowed by 575 RFC 3264 [RFC3264]. The rules in Section 7 will cause the 576 controlling agent to send an updated offer at the conclusion of ICE 577 processing when ICE has selected different candidate pairs from the 578 default pairs. This section defines rules for construction of 579 subsequent offers and answers. 581 Should a subsequent offer be rejected, ICE processing continues as if 582 the subsequent offer had never been made. 584 9.1. Generating the Offer 586 9.1.1. Procedures for All Implementations 588 9.1.1.1. ICE Restarts 590 An agent MAY restart ICE processing for an existing media stream. An 591 ICE restart, as the name implies, will cause all previous states of 592 ICE processing to be flushed and checks to start anew. The only 593 difference between an ICE restart and a brand new media session is 594 that, during the restart, media can continue to be sent to the 595 previously validated pair. 597 An agent MUST restart ICE for a media stream if: 599 o The offer is being generated for the purposes of changing the 600 target of the media stream. In other words, if an agent wants to 601 generate an updated offer that, had ICE not been in use, would 602 result in a new value for the destination of a media component. 604 o An agent is changing its implementation level. This typically 605 only happens in third party call control use cases, where the 606 entity performing the signaling is not the entity receiving the 607 media, and it has changed the target of media mid-session to 608 another entity that has a different ICE implementation. 610 These rules imply that setting the IP address in the c line to 611 0.0.0.0 will cause an ICE restart. Consequently, ICE implementations 612 MUST NOT utilize this mechanism for call hold, and instead MUST use 613 a=inactive and a=sendonly as described in [RFC3264]. 615 To restart ICE, an agent MUST change both the ice-pwd and the ice- 616 ufrag for the media stream in an offer. Note that it is permissible 617 to use a session-level attribute in one offer, but to provide the 618 same ice-pwd or ice-ufrag as a media-level attribute in a subsequent 619 offer. This is not a change in password, just a change in its 620 representation, and does not cause an ICE restart. 622 An agent sets the rest of the fields in the SDP for this media stream 623 as it would in an initial offer of this media stream (see 624 Section 3.2). Consequently, the set of candidates MAY include some, 625 none, or all of the previous candidates for that stream and MAY 626 include a totally new set of candidates. 628 9.1.1.2. Removing a Media Stream 630 If an agent removes a media stream by setting its port to zero, it 631 MUST NOT include any candidate attributes for that media stream and 632 SHOULD NOT include any other ICE-related attributes defined in 633 Section 8 for that media stream. 635 9.1.1.3. Adding a Media Stream 637 If an agent wishes to add a new media stream, it sets the fields in 638 the SDP for this media stream as if this was an initial offer for 639 that media stream (see Section 3.2). This will cause ICE processing 640 to begin for this media stream. 642 9.1.2. Procedures for Full Implementations 644 This section describes additional procedures for full 645 implementations, covering existing media streams. 647 The username fragments, password, and implementation level MUST 648 remain the same as used previously. If an agent needs to change one 649 of these, it MUST restart ICE for that media stream. 651 Additional behavior depends on the state ICE processing for that 652 media stream. 654 9.1.2.1. Existing Media Streams with ICE Running 656 If an agent generates an updated offer including a media stream that 657 was previously established, and for which ICE checks are in the 658 Running state, the agent follows the procedures defined here. 660 An agent MUST include candidate attributes for all local candidates 661 it had signaled previously for that media stream. The properties of 662 that candidate as signaled in SDP -- the priority, foundation, type, 663 and related transport address -- SHOULD remain the same. The IP 664 address, port, and transport protocol, which fundamentally identify 665 that candidate, MUST remain the same (if they change, it would be a 666 new candidate). The component ID MUST remain the same. The agent 667 MAY include additional candidates it did not offer previously, but 668 which it has gathered since the last offer/answer exchange, including 669 peer reflexive candidates. 671 The agent MAY change the default destination for media. As with 672 initial offers, there MUST be a set of candidate attributes in the 673 offer matching this default destination. 675 9.1.2.2. Existing Media Streams with ICE Completed 677 If an agent generates an updated offer including a media stream that 678 was previously established, and for which ICE checks are in the 679 Completed state, the agent follows the procedures defined here. 681 The default destination for media (i.e., the values of the IP 682 addresses and ports in the m and c lines used for that media stream) 683 MUST be the local candidate from the highest-priority nominated pair 684 in the valid list for each component. This "fixes" the default 685 destination for media to equal the destination ICE has selected for 686 media. 688 The agent MUST include candidate attributes for candidates matching 689 the default destination for each component of the media stream, and 690 MUST NOT include any other candidates. 692 In addition, if the agent is controlling, it MUST include the a 693 =remote-candidates attribute for each media stream whose check list 694 is in the Completed state. The attribute contains the remote 695 candidates from the highest-priority nominated pair in the valid list 696 for each component of that media stream. It is needed to avoid a 697 race condition whereby the controlling agent chooses its pairs, but 698 the updated offer beats the connectivity checks to the controlled 699 agent, which doesn't even know these pairs are valid, let alone 700 selected. See Appendix B for elaboration on this race condition. 702 9.1.3. Procedures for Lite Implementations 704 9.1.3.1. Existing Media Streams with ICE Running 706 This section describes procedures for lite implementations for 707 existing streams for which ICE is running. 709 A lite implementation MUST include all of its candidates for each 710 component of each media stream in an a=candidate attribute in any 711 subsequent offer. These candidates are formed identically to the 712 procedures for initial offers, as described in section 4.2 of 713 [ICE-BIS]. 715 A lite implementation MUST NOT add additional host candidates in a 716 subsequent offer. If an agent needs to offer additional candidates, 717 it MUST restart ICE. 719 The username fragments, password, and implementation level MUST 720 remain the same as used previously. If an agent needs to change one 721 of these, it MUST restart ICE for that media stream. 723 9.1.3.2. Existing Media Streams with ICE Completed 725 If ICE has completed for a media stream, the default destination for 726 that media stream MUST be set to the remote candidate of the 727 candidate pair for that component in the valid list. For a lite 728 implementation, there is always just a single candidate pair in the 729 valid list for each component of a media stream. Additionally, the 730 agent MUST include a candidate attribute for each default 731 destination. 733 Additionally, if the agent is controlling (which only happens when 734 both agents are lite), the agent MUST include the a=remote-candidates 735 attribute for each media stream. The attribute contains the remote 736 candidates from the candidate pairs in the valid list (one pair for 737 each component of each media stream). 739 9.2. Receiving the Offer and Generating an Answer 741 9.2.1. Procedures for All Implementations 743 When receiving a subsequent offer within an existing session, an 744 agent MUST reapply the verification procedures in Section 4.2 without 745 regard to the results of verification from any previous offer/answer 746 exchanges. Indeed, it is possible that a previous offer/answer 747 exchange resulted in ICE not being used, but it is used as a 748 consequence of a subsequent exchange. 750 9.2.1.1. Detecting ICE Restart 752 If the offer contained a change in the a=ice-ufrag or a=ice-pwd 753 attributes compared to the previous SDP from the peer, it indicates 754 that ICE is restarting for this media stream. If all media streams 755 are restarting, then ICE is restarting overall. 757 If ICE is restarting for a media stream: 759 o The agent MUST change the a=ice-ufrag and a=ice-pwd attributes in 760 the answer. 762 o The agent MAY change its implementation level in the answer. 764 An agent sets the rest of the fields in the SDP for this media stream 765 as it would in an initial answer to this media stream (see 766 Section 3.2). Consequently, the set of candidates MAY include some, 767 none, or all of the previous candidates for that stream and MAY 768 include a totally new set of candidates. 770 9.2.1.2. New Media Stream 772 If the offer contains a new media stream, the agent sets the fields 773 in the answer as if it had received an initial offer containing that 774 media stream (see Section 3.2). This will cause ICE processing to 775 begin for this media stream. 777 9.2.1.3. Removed Media Stream 779 If an offer contains a media stream whose port is zero, the agent 780 MUST NOT include any candidate attributes for that media stream in 781 its answer and SHOULD NOT include any other ICE-related attributes 782 defined in Section 8 for that media stream. 784 9.2.2. Procedures for Full Implementations 786 Unless the agent has detected an ICE restart from the offer, the 787 username fragments, password, and implementation level MUST remain 788 the same as used previously. If an agent needs to change one of 789 these it MUST restart ICE for that media stream by generating an 790 offer; ICE cannot be restarted in an answer. 792 Additional behaviors depend on the state of ICE processing for that 793 media stream. 795 9.2.2.1. Existing Media Streams with ICE Running and no remote- 796 candidates 798 If ICE is running for a media stream, and the offer for that media 799 stream lacked the remote-candidates attribute, the rules for 800 construction of the answer are identical to those for the offerer as 801 described in Section 9.1.2.1. 803 9.2.2.2. Existing Media Streams with ICE Completed and no remote- 804 candidates 806 If ICE is Completed for a media stream, and the offer for that media 807 stream lacked the remote-candidates attribute, the rules for 808 construction of the answer are identical to those for the offerer as 809 described in Section 9.1.2.2, except that the answerer MUST NOT 810 include the a=remote-candidates attribute in the answer. 812 9.2.2.3. Existing Media Streams and remote-candidates 814 A controlled agent will receive an offer with the a=remote-candidates 815 attribute for a media stream when its peer has concluded ICE 816 processing for that media stream. This attribute is present in the 817 offer to deal with a race condition between the receipt of the offer, 818 and the receipt of the Binding response that tells the answerer the 819 candidate that will be selected by ICE. See Appendix B for an 820 explanation of this race condition. Consequently, processing of an 821 offer with this attribute depends on the winner of the race. 823 The agent forms a candidate pair for each component of the media 824 stream by: 826 o Setting the remote candidate equal to the offerer's default 827 destination for that component (e.g., the contents of the m and c 828 lines for RTP, and the a=rtcp attribute for RTCP) 830 o Setting the local candidate equal to the transport address for 831 that same component in the a=remote-candidates attribute in the 832 offer. 834 The agent then sees if each of these candidate pairs is present in 835 the valid list. If a particular pair is not in the valid list, the 836 check has "lost" the race. Call such a pair a "losing pair". 838 The agent finds all the pairs in the check list whose remote 839 candidates equal the remote candidate in the losing pair: 841 o If none of the pairs are In-Progress, and at least one is Failed, 842 it is most likely that a network failure, such as a network 843 partition or serious packet loss, has occurred. The agent SHOULD 844 generate an answer for this media stream as if the remote- 845 candidates attribute had not been present, and then restart ICE 846 for this stream. 848 o If at least one of the pairs is In-Progress, the agent SHOULD wait 849 for those checks to complete, and as each completes, redo the 850 processing in this section until there are no losing pairs. 852 Once there are no losing pairs, the agent can generate the answer. 853 It MUST set the default destination for media to the candidates in 854 the remote-candidates attribute from the offer (each of which will 855 now be the local candidate of a candidate pair in the valid list). 856 It MUST include a candidate attribute in the answer for each 857 candidate in the remote-candidates attribute in the offer. 859 9.2.3. Procedures for Lite Implementations 861 If the received offer contains the remote-candidates attribute for a 862 media stream, the agent forms a candidate pair for each component of 863 the media stream by: 865 o Setting the remote candidate equal to the offerer's default 866 destination for that component (e.g., the contents of the m and c 867 lines for RTP, and the a=rtcp attribute for RTCP). 869 o Setting the local candidate equal to the transport address for 870 that same component in the a=remote-candidates attribute in the 871 offer. 873 It then places those candidates into the Valid list for the media 874 stream. The state of ICE processing for that media stream is set to 875 Completed. 877 Furthermore, if the agent believed it was controlling, but the offer 878 contained the remote-candidates attribute, both agents believe they 879 are controlling. In this case, both would have sent updated offers 880 around the same time. However, the signaling protocol carrying the 881 offer/answer exchanges will have resolved this glare condition, so 882 that one agent is always the 'winner' by having its offer received 883 before its peer has sent an offer. The winner takes the role of 884 controlled, so that the loser (the answerer under consideration in 885 this section) MUST change its role to controlled. Consequently, if 886 the agent was going to send an updated offer since, based on the 887 rules in section 8.2 of [ICE-BIS], it was controlling, it no longer 888 needs to. 890 Besides the potential role change, change in the Valid list, and 891 state changes, the construction of the answer is performed 892 identically to the construction of an offer as described in 893 Section 9.1.3. 895 9.3. Updating the Check and Valid Lists 897 9.3.1. Procedures for Full Implementations 899 9.3.1.1. ICE Restarts 901 The agent MUST remember the highest-priority nominated pairs in the 902 Valid list for each component of the media stream, called the 903 previous selected pairs, prior to the restart. The agent will 904 continue to send media using these pairs, as described in 905 Section 11.1. Once these destinations are noted, the agent MUST 906 flush the valid and check lists, and then recompute the check list 907 and its states as described in section 6.3 of [ICE-BIS]. 909 9.3.1.2. New Media Stream 911 If the offer/answer exchange added a new media stream, the agent MUST 912 create a new check list for it (and an empty Valid list to start of 913 course), as described in section 6.3 of [ICE-BIS]. 915 9.3.1.3. Removed Media Stream 917 If the offer/answer exchange removed a media stream, or an answer 918 rejected an offered media stream, an agent MUST flush the Valid list 919 for that media stream. It MUST terminate any STUN transactions in 920 progress for that media stream. An agent MUST remove the check list 921 for that media stream and cancel any pending ordinary checks for it. 923 9.3.1.4. ICE Continuing for Existing Media Stream 924 The valid list is not affected by an updated offer/answer exchange 925 unless ICE is restarting. 927 If an agent is in the Running state for that media stream, the check 928 list is updated (the check list is irrelevant if the state is 929 completed). To do that, the agent recomputes the check list using 930 the procedures described in section 6.3 of [ICE-BIS]. If a pair on 931 the new check list was also on the previous check list, and its state 932 was Waiting, In-Progress, Succeeded, or Failed, its state is copied 933 over. Otherwise, its state is set to Frozen. 935 If none of the check lists are active (meaning that the pairs in each 936 check list are Frozen), the full-mode agent sets the first pair in 937 the check list for the first media stream to Waiting, and then sets 938 the state of all other pairs in that check list for the same 939 component ID and with the same foundation to Waiting as well. 941 Next, the agent goes through each check list, starting with the 942 highest-priority pair. If a pair has a state of Succeeded, and it 943 has a component ID of 1, then all Frozen pairs in the same check list 944 with the same foundation whose component IDs are not 1 have their 945 state set to Waiting. If, for a particular check list, there are 946 pairs for each component of that media stream in the Succeeded state, 947 the agent moves the state of all Frozen pairs for the first component 948 of all other media streams (and thus in different check lists) with 949 the same foundation to Waiting. 951 9.3.2. Procedures for Lite Implementations 953 If ICE is restarting for a media stream, the agent MUST start a new 954 Valid list for that media stream. It MUST remember the pairs in the 955 previous Valid list for each component of the media stream, called 956 the previous selected pairs, and continue to send media there as 957 described in Section 11.1. The state of ICE processing for each 958 media stream MUST change to Running, and the state of ICE processing 959 MUST change to Running. 961 10. Keepalives 963 The keepalives MUST be sent regardless of whether the media stream is 964 currently inactive, sendonly, recvonly, or sendrecv, and regardless 965 of the presence or value of the bandwidth attribute. An agent can 966 determine that its peer supports ICE by the presence of a=candidate 967 attributes for each media session. 969 11. Media Handling 970 11.1. Sending Media 972 Note that the selected pair for a component of a media stream may not 973 equal the default pair for that same component from the most recent 974 offer/answer exchange. When this happens, the selected pair is used 975 for media, not the default pair. When ICE first completes, if the 976 selected pairs aren't a match for the default pairs, the controlling 977 agent sends an updated offer/answer exchange to remedy this 978 disparity. However, until that updated offer arrives, there will not 979 be a match. Furthermore, in very unusual cases, the default 980 candidates in the updated offer/answer will not be a match. 982 11.1.1. Procedures for All Implementations 984 ICE has interactions with jitter buffer adaptation mechanisms. An 985 RTP stream can begin using one candidate, and switch to another one, 986 though this happens rarely with ICE. The newer candidate may result 987 in RTP packets taking a different path through the network -- one 988 with different delay characteristics. As discussed below, agents are 989 encouraged to re-adjust jitter buffers when there are changes in 990 source or destination address of media packets. Furthermore, many 991 audio codecs use the marker bit to signal the beginning of a 992 talkspurt, for the purposes of jitter buffer adaptation. For such 993 codecs, it is RECOMMENDED that the sender set the marker bit 994 [RFC3550] when an agent switches transmission of media from one 995 candidate pair to another. 997 11.2. Receiving Media 999 ICE implementations MUST be prepared to receive media on each 1000 component on any candidates provided for that component in the most 1001 recent offer/answer exchange (in the case of RTP, this would include 1002 both RTP and RTCP if candidates were provided for both). 1004 It is RECOMMENDED that, when an agent receives an RTP packet with a 1005 new source or destination IP address for a particular media stream, 1006 that the agent re-adjust its jitter buffers. 1008 RFC 3550 [RFC3550] describes an algorithm in Section 8.2 for 1009 detecting synchronization source (SSRC) collisions and loops. These 1010 algorithms are based, in part, on seeing different source transport 1011 addresses with the same SSRC. However, when ICE is used, such 1012 changes will sometimes occur as the media streams switch between 1013 candidates. An agent will be able to determine that a media stream 1014 is from the same peer as a consequence of the STUN exchange that 1015 proceeds media transmission. Thus, if there is a change in source 1016 transport address, but the media packets come from the same peer 1017 agent, this SHOULD NOT be treated as an SSRC collision. 1019 12. Usage with SIP 1021 12.1. Latency Guidelines 1023 ICE requires a series of STUN-based connectivity checks to take place 1024 between endpoints. These checks start from the answerer on 1025 generation of its answer, and start from the offerer when it receives 1026 the answer. These checks can take time to complete, and as such, the 1027 selection of messages to use with offers and answers can affect 1028 perceived user latency. Two latency figures are of particular 1029 interest. These are the post-pickup delay and the post-dial delay. 1030 The post-pickup delay refers to the time between when a user "answers 1031 the phone" and when any speech they utter can be delivered to the 1032 caller. The post-dial delay refers to the time between when a user 1033 enters the destination address for the user and ringback begins as a 1034 consequence of having successfully started ringing the phone of the 1035 called party. 1037 Two cases can be considered -- one where the offer is present in the 1038 initial INVITE and one where it is in a response. 1040 12.1.1. Offer in INVITE 1042 To reduce post-dial delays, it is RECOMMENDED that the caller begin 1043 gathering candidates prior to actually sending its initial INVITE. 1044 This can be started upon user interface cues that a call is pending, 1045 such as activity on a keypad or the phone going off-hook. 1047 If an offer is received in an INVITE request, the answerer SHOULD 1048 begin to gather its candidates on receipt of the offer and then 1049 generate an answer in a provisional response once it has completed 1050 that process. ICE requires that a provisional response with an SDP 1051 be transmitted reliably. This can be done through the existing 1052 Provisional Response Acknowledgment (PRACK) mechanism [RFC3262] or 1053 through an optimization that is specific to ICE. With this 1054 optimization, provisional responses containing an SDP answer that 1055 begins ICE processing for one or more media streams can be sent 1056 reliably without RFC 3262. To do this, the agent retransmits the 1057 provisional response with the exponential backoff timers described in 1058 RFC 3262. Retransmits MUST cease on receipt of a STUN Binding 1059 request for one of the media streams signaled in that SDP (because 1060 receipt of a Binding request indicates the offerer has received the 1061 answer) or on transmission of the answer in a 2xx response. If the 1062 peer agent is lite, there will never be a STUN Binding request. In 1063 such a case, the agent MUST cease retransmitting the 18x after 1064 sending it four times (ICE will actually work even if the peer never 1065 receives the 18x; however, experience has shown that sending it is 1066 important for middleboxes and firewall traversal). If no Binding 1067 request is received prior to the last retransmit, the agent does not 1068 consider the session terminated. Despite the fact that the 1069 provisional response will be delivered reliably, the rules for when 1070 an agent can send an updated offer or answer do not change from those 1071 specified in RFC 3262. Specifically, if the INVITE contained an 1072 offer, the same answer appears in all of the 1xx and in the 2xx 1073 response to the INVITE. Only after that 2xx has been sent can an 1074 updated offer/answer exchange occur. This optimization SHOULD NOT be 1075 used if both agents support PRACK. Note that the optimization is 1076 very specific to provisional response carrying answers that start ICE 1077 processing; it is not a general technique for 1xx reliability. 1079 Alternatively, an agent MAY delay sending an answer until the 200 OK; 1080 however, this results in a poor user experience and is NOT 1081 RECOMMENDED. 1083 Once the answer has been sent, the agent SHOULD begin its 1084 connectivity checks. Once candidate pairs for each component of a 1085 media stream enter the valid list, the answerer can begin sending 1086 media on that media stream. 1088 However, prior to this point, any media that needs to be sent towards 1089 the caller (such as SIP early media [RFC3960]) MUST NOT be 1090 transmitted. For this reason, implementations SHOULD delay alerting 1091 the called party until candidates for each component of each media 1092 stream have entered the valid list. In the case of a PSTN gateway, 1093 this would mean that the setup message into the PSTN is delayed until 1094 this point. Doing this increases the post-dial delay, but has the 1095 effect of eliminating 'ghost rings'. Ghost rings are cases where the 1096 called party hears the phone ring, picks up, but hears nothing and 1097 cannot be heard. This technique works without requiring support for, 1098 or usage of, preconditions [RFC3312], since it's a localized 1099 decision. It also has the benefit of guaranteeing that not a single 1100 packet of media will get clipped, so that post-pickup delay is zero. 1101 If an agent chooses to delay local alerting in this way, it SHOULD 1102 generate a 180 response once alerting begins. 1104 12.1.2. Offer in Response 1106 In addition to uses where the offer is in an INVITE, and the answer 1107 is in the provisional and/or 200 OK response, ICE works with cases 1108 where the offer appears in the response. In such cases, which are 1109 common in third party call control [RFC3725], ICE agents SHOULD 1110 generate their offers in a reliable provisional response (which MUST 1111 utilize RFC 3262), and not alert the user on receipt of the INVITE. 1112 The answer will arrive in a PRACK. This allows for ICE processing to 1113 take place prior to alerting, so that there is no post-pickup delay, 1114 at the expense of increased call setup delays. Once ICE completes, 1115 the callee can alert the user and then generate a 200 OK when they 1116 answer. The 200 OK would contain no SDP, since the offer/answer 1117 exchange has completed. 1119 Alternatively, agents MAY place the offer in a 2xx instead (in which 1120 case the answer comes in the ACK). When this happens, the callee 1121 will alert the user on receipt of the INVITE, and the ICE exchanges 1122 will take place only after the user answers. This has the effect of 1123 reducing call setup delay, but can cause substantial post-pickup 1124 delays and media clipping. 1126 12.2. SIP Option Tags and Media Feature Tags 1128 [RFC5768] specifies a SIP option tag and media feature tag for usage 1129 with ICE. ICE implementations using SIP SHOULD support this 1130 specification, which uses a feature tag in registrations to 1131 facilitate interoperability through signaling intermediaries. 1133 12.3. Interactions with Forking 1135 ICE interacts very well with forking. Indeed, ICE fixes some of the 1136 problems associated with forking. Without ICE, when a call forks and 1137 the caller receives multiple incoming media streams, it cannot 1138 determine which media stream corresponds to which callee. 1140 With ICE, this problem is resolved. The connectivity checks which 1141 occur prior to transmission of media carry username fragments, which 1142 in turn are correlated to a specific callee. Subsequent media 1143 packets that arrive on the same candidate pair as the connectivity 1144 check will be associated with that same callee. Thus, the caller can 1145 perform this correlation as long as it has received an answer. 1147 12.4. Interactions with Preconditions 1149 Quality of Service (QoS) preconditions, which are defined in RFC 3312 1150 [RFC3312] and RFC 4032 [RFC4032], apply only to the transport 1151 addresses listed as the default targets for media in an offer/answer. 1152 If ICE changes the transport address where media is received, this 1153 change is reflected in an updated offer that changes the default 1154 destination for media to match ICE's selection. As such, it appears 1155 like any other re-INVITE would, and is fully treated in RFCs 3312 and 1156 4032, which apply without regard to the fact that the destination for 1157 media is changing due to ICE negotiations occurring "in the 1158 background". 1160 Indeed, an agent SHOULD NOT indicate that QoS preconditions have been 1161 met until the checks have completed and selected the candidate pairs 1162 to be used for media. 1164 ICE also has (purposeful) interactions with connectivity 1165 preconditions [RFC5898]. Those interactions are described there. 1166 Note that the procedures described in Section 12.1 describe their own 1167 type of "preconditions", albeit with less functionality than those 1168 provided by the explicit preconditions in [RFC5898]. 1170 12.5. Interactions with Third Party Call Control 1172 ICE works with Flows I, III, and IV as described in [RFC3725]. Flow 1173 I works without the controller supporting or being aware of ICE. 1174 Flow IV will work as long as the controller passes along the ICE 1175 attributes without alteration. Flow II is fundamentally incompatible 1176 with ICE; each agent will believe itself to be the answerer and thus 1177 never generate a re-INVITE. 1179 The flows for continued operation, as described in Section 7 of RFC 1180 3725, require additional behavior of ICE implementations to support. 1181 In particular, if an agent receives a mid-dialog re-INVITE that 1182 contains no offer, it MUST restart ICE for each media stream and go 1183 through the process of gathering new candidates. Furthermore, that 1184 list of candidates SHOULD include the ones currently being used for 1185 media. 1187 13. Relationship with ANAT 1189 RFC 4091 [RFC4091], the Alternative Network Address Types (ANAT) 1190 Semantics for the SDP grouping framework, and RFC 4092 [RFC4092], its 1191 usage with SIP, define a mechanism for indicating that an agent can 1192 support both IPv4 and IPv6 for a media stream, and it does so by 1193 including two m lines, one for v4 and one for v6. This is similar to 1194 ICE, which allows for an agent to indicate multiple transport 1195 addresses using the candidate attribute. However, ANAT relies on 1196 static selection to pick between choices, rather than a dynamic 1197 connectivity check used by ICE. 1199 This specification deprecates RFC 4091 and RFC 4092. Instead, agents 1200 wishing to support dual-stack will utilize ICE. 1202 14. Setting Ta and RTO for RTP Media Streams 1204 During the gathering phase of ICE (section 4.1.1 [ICE-BIS]) and while 1205 ICE is performing connectivity checks (section 7 [ICE-BIS]), an agent 1206 sends STUN and TURN transactions. These transactions are paced at a 1207 rate of one every Ta milliseconds, and utilize a specific RTO. This 1208 section describes how the values of Ta and RTO are computed with a 1209 real-time media stream (such as RTP). When ICE is used for a stream 1210 with a known maximum bandwidth, the following computation MAY be 1211 followed to rate-control the ICE exchanges. 1213 The values of RTO and Ta change during the lifetime of ICE 1214 processing. One set of values applies during the gathering phase, 1215 and the other, for connectivity checks. 1217 The value of Ta SHOULD be configurable, and SHOULD have a default of: 1219 For each media stream i: 1220 Ta_i = (stun_packet_size / rtp_packet_size) * rtp_ptime 1222 1 1223 Ta = MAX (20ms, ------------------- ) 1224 k 1225 ---- 1226 \ 1 1227 > ------ 1228 / Ta_i 1229 ---- 1230 i=1 1232 where k is the number of media streams. During the gathering phase, 1233 Ta is computed based on the number of media streams the agent has 1234 indicated in its offer or answer, and the RTP packet size and RTP 1235 ptime are those of the most preferred codec for each media stream. 1236 Once an offer and answer have been exchanged, the agent recomputes Ta 1237 to pace the connectivity checks. In that case, the value of Ta is 1238 based on the number of media streams that will actually be used in 1239 the session, and the RTP packet size and RTP ptime are those of the 1240 most preferred codec with which the agent will send. 1242 In addition, the retransmission timer for the STUN transactions, RTO, 1243 defined in [RFC5389], SHOULD be configurable and during the gathering 1244 phase, SHOULD have a default of: 1246 RTO = MAX (100ms, Ta * (number of pairs)) 1248 where the number of pairs refers to the number of pairs of candidates 1249 with STUN or TURN servers. 1251 For connectivity checks, RTO SHOULD be configurable and SHOULD have a 1252 default of: 1254 RTO = MAX (100ms, Ta*N * (Num-Waiting + Num-In-Progress)) 1256 where Num-Waiting is the number of checks in the check list in the 1257 Waiting state, and Num-In-Progress is the number of checks in the In- 1258 Progress state. Note that the RTO will be different for each 1259 transaction as the number of checks in the Waiting and In-Progress 1260 states change. 1262 These formulas are aimed at causing STUN transactions to be paced at 1263 the same rate as media. This ensures that ICE will work properly 1264 under the same network conditions needed to support the media as 1265 well. See section B.1 of [ICE-BIS] for additional discussion and 1266 motivations. Because of this pacing, it will take a certain amount 1267 of time to obtain all of the server reflexive and relayed candidates. 1268 Implementations should be aware of the time required to do this, and 1269 if the application requires a time budget, limit the number of 1270 candidates that are gathered. 1272 The formulas result in a behavior whereby an agent will send its 1273 first packet for every single connectivity check before performing a 1274 retransmit. This can be seen in the formulas for the RTO (which 1275 represents the retransmit interval). Those formulas scale with N, 1276 the number of checks to be performed. As a result of this, ICE 1277 maintains a nicely constant rate, but becomes more sensitive to 1278 packet loss. The loss of the first single packet for any 1279 connectivity check is likely to cause that pair to take a long time 1280 to be validated, and instead, a lower-priority check (but one for 1281 which there was no packet loss) is much more likely to complete 1282 first. This results in ICE performing sub-optimally, choosing lower- 1283 priority pairs over higher-priority pairs. Implementors should be 1284 aware of this consequence, but still should utilize the timer values 1285 described here. 1287 15. Security Considerations 1289 15.1. Attacks on the Offer/Answer Exchanges 1291 An attacker that can modify or disrupt the offer/answer exchanges 1292 themselves can readily launch a variety of attacks with ICE. They 1293 could direct media to a target of a DoS attack, they could insert 1294 themselves into the media stream, and so on. These are similar to 1295 the general security considerations for offer/answer exchanges, and 1296 the security considerations in RFC 3264 [RFC3264] apply. These 1297 require techniques for message integrity and encryption for offers 1298 and answers, which are satisfied by the SIPS mechanism [RFC3261] when 1299 SIP is used. As such, the usage of SIPS with ICE is RECOMMENDED. 1301 15.2. Insider Attacks 1303 In addition to attacks where the attacker is a third party trying to 1304 insert fake offers, answers, or stun messages, there are several 1305 attacks possible with ICE when the attacker is an authenticated and 1306 valid participant in the ICE exchange. 1308 15.2.1. The Voice Hammer Attack 1309 The voice hammer attack is an amplification attack. In this attack, 1310 the attacker initiates sessions to other agents, and maliciously 1311 includes the IP address and port of a DoS target as the destination 1312 for media traffic signaled in the SDP. This causes substantial 1313 amplification; a single offer/answer exchange can create a continuing 1314 flood of media packets, possibly at high rates (consider video 1315 sources). This attack is not specific to ICE, but ICE can help 1316 provide remediation. 1318 Specifically, if ICE is used, the agent receiving the malicious SDP 1319 will first perform connectivity checks to the target of media before 1320 sending media there. If this target is a third-party host, the 1321 checks will not succeed, and media is never sent. 1323 Unfortunately, ICE doesn't help if its not used, in which case an 1324 attacker could simply send the offer without the ICE parameters. 1325 However, in environments where the set of clients is known, and is 1326 limited to ones that support ICE, the server can reject any offers or 1327 answers that don't indicate ICE support. 1329 15.2.2. Interactions with Application Layer Gateways and SIP 1331 Application Layer Gateways (ALGs) are functions present in a NAT 1332 device that inspect the contents of packets and modify them, in order 1333 to facilitate NAT traversal for application protocols. Session 1334 Border Controllers (SBCs) are close cousins of ALGs, but are less 1335 transparent since they actually exist as application layer SIP 1336 intermediaries. ICE has interactions with SBCs and ALGs. 1338 If an ALG is SIP aware but not ICE aware, ICE will work through it as 1339 long as the ALG correctly modifies the SDP. A correct ALG 1340 implementation behaves as follows: 1342 o The ALG does not modify the m and c lines or the rtcp attribute if 1343 they contain external addresses. 1345 o If the m and c lines contain internal addresses, the modification 1346 depends on the state of the ALG: 1348 If the ALG already has a binding established that maps an 1349 external port to an internal IP address and port matching the 1350 values in the m and c lines or rtcp attribute, the ALG uses 1351 that binding instead of creating a new one. 1353 If the ALG does not already have a binding, it creates a new 1354 one and modifies the SDP, rewriting the m and c lines and rtcp 1355 attribute. 1357 Unfortunately, many ALGs are known to work poorly in these corner 1358 cases. ICE does not try to work around broken ALGs, as this is 1359 outside the scope of its functionality. ICE can help diagnose these 1360 conditions, which often show up as a mismatch between the set of 1361 candidates and the m and c lines and rtcp attributes. The ice- 1362 mismatch attribute is used for this purpose. 1364 ICE works best through ALGs when the signaling is run over TLS. This 1365 prevents the ALG from manipulating the SDP messages and interfering 1366 with ICE operation. Implementations that are expected to be deployed 1367 behind ALGs SHOULD provide for TLS transport of the SDP. 1369 If an SBC is SIP aware but not ICE aware, the result depends on the 1370 behavior of the SBC. If it is acting as a proper Back-to-Back User 1371 Agent (B2BUA), the SBC will remove any SDP attributes it doesn't 1372 understand, including the ICE attributes. Consequently, the call 1373 will appear to both endpoints as if the other side doesn't support 1374 ICE. This will result in ICE being disabled, and media flowing 1375 through the SBC, if the SBC has requested it. If, however, the SBC 1376 passes the ICE attributes without modification, yet modifies the 1377 default destination for media (contained in the m and c lines and 1378 rtcp attribute), this will be detected as an ICE mismatch, and ICE 1379 processing is aborted for the call. It is outside of the scope of 1380 ICE for it to act as a tool for "working around" SBCs. If one is 1381 present, ICE will not be used and the SBC techniques take precedence. 1383 16. IANA Considerations 1385 16.1. SDP Attributes 1387 Original ICE specification defined seven new SDP attributes per the 1388 procedures of Section 8.2.4 of [RFC4566]. The registration 1389 information is reproduced here. 1391 16.1.1. candidate Attribute 1393 Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. 1395 Attribute Name: candidate 1397 Long Form: candidate 1399 Type of Attribute: media-level 1401 Charset Considerations: The attribute is not subject to the charset 1402 attribute. 1404 Purpose: This attribute is used with Interactive Connectivity 1405 Establishment (ICE), and provides one of many possible candidate 1406 addresses for communication. These addresses are validated with 1407 an end-to-end connectivity check using Session Traversal Utilities 1408 for NAT (STUN). 1410 Appropriate Values: See Section 8 of RFC XXXX. 1412 16.1.2. remote-candidates Attribute 1414 Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. 1416 Attribute Name: remote-candidates 1418 Long Form: remote-candidates 1420 Type of Attribute: media-level 1422 Charset Considerations: The attribute is not subject to the charset 1423 attribute. 1425 Purpose: This attribute is used with Interactive Connectivity 1426 Establishment (ICE), and provides the identity of the remote 1427 candidates that the offerer wishes the answerer to use in its 1428 answer. 1430 Appropriate Values: See Section 8 of RFC XXXX. 1432 16.1.3. ice-lite Attribute 1434 Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. 1436 Attribute Name: ice-lite 1438 Long Form: ice-lite 1440 Type of Attribute: session-level 1442 Charset Considerations: The attribute is not subject to the charset 1443 attribute. 1445 Purpose: This attribute is used with Interactive Connectivity 1446 Establishment (ICE), and indicates that an agent has the minimum 1447 functionality required to support ICE inter-operation with a peer 1448 that has a full implementation. 1450 Appropriate Values: See Section 8 of RFC XXXX. 1452 16.1.4. ice-mismatch Attribute 1454 Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. 1456 Attribute Name: ice-mismatch 1458 Long Form: ice-mismatch 1460 Type of Attribute: session-level 1462 Charset Considerations: The attribute is not subject to the charset 1463 attribute. 1465 Purpose: This attribute is used with Interactive Connectivity 1466 Establishment (ICE), and indicates that an agent is ICE capable, 1467 but did not proceed with ICE due to a mismatch of candidates with 1468 the default destination for media signaled in the SDP. 1470 Appropriate Values: See Section 8 of RFC XXXX. 1472 16.1.5. ice-pwd Attribute 1474 Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. 1476 Attribute Name: ice-pwd 1478 Long Form: ice-pwd 1480 Type of Attribute: session- or media-level 1482 Charset Considerations: The attribute is not subject to the charset 1483 attribute. 1485 Purpose: This attribute is used with Interactive Connectivity 1486 Establishment (ICE), and provides the password used to protect 1487 STUN connectivity checks. 1489 Appropriate Values: See Section 8 of RFC XXXX. 1491 16.1.6. ice-ufrag Attribute 1493 Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. 1495 Attribute Name: ice-ufrag 1497 Long Form: ice-ufrag 1499 Type of Attribute: session- or media-level 1500 Charset Considerations: The attribute is not subject to the charset 1501 attribute. 1503 Purpose: This attribute is used with Interactive Connectivity 1504 Establishment (ICE), and provides the fragments used to construct 1505 the username in STUN connectivity checks. 1507 Appropriate Values: See Section 8 of RFC XXXX. 1509 16.1.7. ice-options Attribute 1511 Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net. 1513 Attribute Name: ice-options 1515 Long Form: ice-options 1517 Type of Attribute: session-level 1519 Charset Considerations: The attribute is not subject to the charset 1520 attribute. 1522 Purpose: This attribute is used with Interactive Connectivity 1523 Establishment (ICE), and indicates the ICE options or extensions 1524 used by the agent. 1526 Appropriate Values: See Section 8 of RFC XXXX. 1528 16.2. Interactive Connectivity Establishment (ICE) Options Registry 1530 IANA maintains a registry for ice-options identifiers under the 1531 Specification Required policy as defined in "Guidelines for Writing 1532 an IANA Considerations Section in RFCs" [RFC5226]. 1534 ICE options are of unlimited length according to the syntax in 1535 Section 8.5; however, they are RECOMMENDED to be no longer than 20 1536 characters. This is to reduce message sizes and allow for efficient 1537 parsing. 1539 In RFC 5245 ICE options could only be defined at the session level. 1540 ICE options can now also be defined at the media level. This can be 1541 used when aggregating between different ICE agents in the same 1542 endpoint, but future options may require to be defined at the media- 1543 level. To ensure compatibility with legacy implementation, the 1544 media-level ICE options MUST be aggregated into a session-level ICE 1545 option. Because aggregation rules depend on the specifics of each 1546 option, all new ICE options MUST also define in their specification 1547 how the media-level ICE option values are aggregated to generate the 1548 value of the session-level ICE option. 1550 The only ICE option defined at the time of publication is "rtp+ecn" 1551 [RFC6679]. The aggregation rule for this ICE options is that if all 1552 aggregated media using ICE contain a media-level "rtp+ecn" ICE option 1553 then an "rtp+ecn" ICE option MUST be inserted at the session-level. 1554 If one of the media does not contain the option, then it MUST NOT be 1555 inserted at the session-level. 1557 A registration request MUST include the following information: 1559 o The ICE option identifier to be registered 1561 o Name, Email, and Address of a contact person for the registration 1563 o Organization or individuals having the change control 1565 o Short description of the ICE extension to which the option relates 1567 o Reference(s) to the specification defining the ICE option and the 1568 related extensions 1570 17. Acknowledgments 1572 A large part of the text in this document was taken from RFC 5245, 1573 authored by Jonathan Rosenberg. 1575 Some of the text in this document was taken from RFC 6336, authored 1576 by Magnus Westerlund and Colin Perkins. 1578 18. References 1580 18.1. Normative References 1582 [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate 1583 Requirement Levels", BCP 14, RFC 2119, March 1997. 1585 [RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, 1586 A., Peterson, J., Sparks, R., Handley, M., and E. 1588 Schooler, "SIP: Session Initiation Protocol", RFC 3261, 1589 June 2002. 1591 [RFC3262] Rosenberg, J. and H. Schulzrinne, "Reliability of 1592 Provisional Responses in Session Initiation Protocol 1593 (SIP)", RFC 3262, June 2002. 1595 [RFC3264] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model 1596 with Session Description Protocol (SDP)", RFC 3264, June 1597 2002. 1599 [RFC3312] Camarillo, G., Marshall, W., and J. Rosenberg, 1600 "Integration of Resource Management and Session Initiation 1601 Protocol (SIP)", RFC 3312, October 2002. 1603 [RFC3550] Schulzrinne, H., Casner, S., Frederick, R., and V. 1604 Jacobson, "RTP: A Transport Protocol for Real-Time 1605 Applications", STD 64, RFC 3550, July 2003. 1607 [RFC3556] Casner, S., "Session Description Protocol (SDP) Bandwidth 1608 Modifiers for RTP Control Protocol (RTCP) Bandwidth", RFC 1609 3556, July 2003. 1611 [RFC3605] Huitema, C., "Real Time Control Protocol (RTCP) attribute 1612 in Session Description Protocol (SDP)", RFC 3605, October 1613 2003. 1615 [RFC4032] Camarillo, G. and P. Kyzivat, "Update to the Session 1616 Initiation Protocol (SIP) Preconditions Framework", RFC 1617 4032, March 2005. 1619 [RFC4091] Camarillo, G. and J. Rosenberg, "The Alternative Network 1620 Address Types (ANAT) Semantics for the Session Description 1621 Protocol (SDP) Grouping Framework", RFC 4091, June 2005. 1623 [RFC4092] Camarillo, G. and J. Rosenberg, "Usage of the Session 1624 Description Protocol (SDP) Alternative Network Address 1625 Types (ANAT) Semantics in the Session Initiation Protocol 1626 (SIP)", RFC 4092, June 2005. 1628 [RFC4566] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session 1629 Description Protocol", RFC 4566, July 2006. 1631 [RFC5226] Narten, T. and H. Alvestrand, "Guidelines for Writing an 1632 IANA Considerations Section in RFCs", BCP 26, RFC 5226, 1633 May 2008. 1635 [RFC5234] Crocker, D. and P. Overell, "Augmented BNF for Syntax 1636 Specifications: ABNF", STD 68, RFC 5234, January 2008. 1638 [RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, 1639 "Session Traversal Utilities for NAT (STUN)", RFC 5389, 1640 October 2008. 1642 [RFC5768] Rosenberg, J., "Indicating Support for Interactive 1643 Connectivity Establishment (ICE) in the Session Initiation 1644 Protocol (SIP)", RFC 5768, April 2010. 1646 [RFC6679] Westerlund, M., Johansson, I., Perkins, C., O'Hanlon, P., 1647 and K. Carlberg, "Explicit Congestion Notification (ECN) 1648 for RTP over UDP", RFC 6679, August 2012. 1650 [ICE-BIS] Keranen, A. and J. Rosenberg, "Interactive Connectivity 1651 Establishment (ICE): A Protocol for Network Address 1652 Translator (NAT) Traversal for Offer/Answer Protocols", 1653 draft-keranen-mmusic-rfc5245bis-01 (work in progress), 1654 February 2013. 1656 18.2. Informative References 1658 [RFC3725] Rosenberg, J., Peterson, J., Schulzrinne, H., and G. 1659 Camarillo, "Best Current Practices for Third Party Call 1660 Control (3pcc) in the Session Initiation Protocol (SIP)", 1661 BCP 85, RFC 3725, April 2004. 1663 [RFC3960] Camarillo, G. and H. Schulzrinne, "Early Media and Ringing 1664 Tone Generation in the Session Initiation Protocol (SIP)", 1665 RFC 3960, December 2004. 1667 [RFC4340] Kohler, E., Handley, M., and S. Floyd, "Datagram 1668 Congestion Control Protocol (DCCP)", RFC 4340, March 2006. 1670 [RFC5626] Jennings, C., Mahy, R., and F. Audet, "Managing Client- 1671 Initiated Connections in the Session Initiation Protocol 1672 (SIP)", RFC 5626, October 2009. 1674 [RFC5898] Andreasen, F., Camarillo, G., Oran, D., and D. Wing, 1675 "Connectivity Preconditions for Session Description 1676 Protocol (SDP) Media Streams", RFC 5898, July 2010. 1678 Appendix A. Examples 1680 For the example shown in Section 13 of [ICE-BIS] the resulting offer 1681 (message 5) encoded in SDP looks like: 1683 v=0 1684 o=jdoe 2890844526 2890842807 IN IP4 $L-PRIV-1.IP 1685 s= 1686 c=IN IP4 $NAT-PUB-1.IP 1687 t=0 0 1688 a=ice-pwd:asd88fgpdd777uzjYhagZg 1689 a=ice-ufrag:8hhY 1690 m=audio $NAT-PUB-1.PORT RTP/AVP 0 1691 b=RS:0 1692 b=RR:0 1693 a=rtpmap:0 PCMU/8000 1694 a=candidate:1 1 UDP 2130706431 $L-PRIV-1.IP $L-PRIV-1.PORT typ host 1695 a=candidate:2 1 UDP 1694498815 $NAT-PUB-1.IP $NAT-PUB-1.PORT typ 1696 srflx raddr $L-PRIV-1.IP rport $L-PRIV-1.PORT 1698 The offer, with the variables replaced with their values, will look 1699 like (lines folded for clarity): 1701 v=0 1702 o=jdoe 2890844526 2890842807 IN IP4 10.0.1.1 1703 s= 1704 c=IN IP4 192.0.2.3 1705 t=0 0 1706 a=ice-pwd:asd88fgpdd777uzjYhagZg 1707 a=ice-ufrag:8hhY 1708 m=audio 45664 RTP/AVP 0 1709 b=RS:0 1710 b=RR:0 1711 a=rtpmap:0 PCMU/8000 1712 a=candidate:1 1 UDP 2130706431 10.0.1.1 8998 typ host 1713 a=candidate:2 1 UDP 1694498815 192.0.2.3 45664 typ srflx raddr 1714 10.0.1.1 rport 8998 1716 The resulting answer looks like: 1718 v=0 1719 o=bob 2808844564 2808844564 IN IP4 $R-PUB-1.IP 1720 s= 1721 c=IN IP4 $R-PUB-1.IP 1722 t=0 0 1723 a=ice-pwd:YH75Fviy6338Vbrhrlp8Yh 1724 a=ice-ufrag:9uB6 1725 m=audio $R-PUB-1.PORT RTP/AVP 0 1726 b=RS:0 1727 b=RR:0 1728 a=rtpmap:0 PCMU/8000 1729 a=candidate:1 1 UDP 2130706431 $R-PUB-1.IP $R-PUB-1.PORT typ host 1731 With the variables filled in: 1733 v=0 1734 o=bob 2808844564 2808844564 IN IP4 192.0.2.1 1735 s= 1736 c=IN IP4 192.0.2.1 1737 t=0 0 1738 a=ice-pwd:YH75Fviy6338Vbrhrlp8Yh 1739 a=ice-ufrag:9uB6 1740 m=audio 3478 RTP/AVP 0 1741 b=RS:0 1742 b=RR:0 1743 a=rtpmap:0 PCMU/8000 1744 a=candidate:1 1 UDP 2130706431 192.0.2.1 3478 typ host 1746 Appendix B. The remote-candidates Attribute 1748 The a=remote-candidates attribute exists to eliminate a race 1749 condition between the updated offer and the response to the STUN 1750 Binding request that moved a candidate into the Valid list. This 1751 race condition is shown in Figure 1. On receipt of message 4, agent 1752 L adds a candidate pair to the valid list. If there was only a 1753 single media stream with a single component, agent L could now send 1754 an updated offer. However, the check from agent R has not yet 1755 generated a response, and agent R receives the updated offer (message 1756 7) before getting the response (message 9). Thus, it does not yet 1757 know that this particular pair is valid. To eliminate this 1758 condition, the actual candidates at R that were selected by the 1759 offerer (the remote candidates) are included in the offer itself, and 1760 the answerer delays its answer until those pairs validate. 1762 Agent A Network Agent B 1763 |(1) Offer | | 1764 |------------------------------------------>| 1765 |(2) Answer | | 1766 |<------------------------------------------| 1767 |(3) STUN Req. | | 1768 |------------------------------------------>| 1769 |(4) STUN Res. | | 1770 |<------------------------------------------| 1771 |(5) STUN Req. | | 1772 |<------------------------------------------| 1773 |(6) STUN Res. | | 1774 |-------------------->| | 1775 | |Lost | 1776 |(7) Offer | | 1777 |------------------------------------------>| 1778 |(8) STUN Req. | | 1779 |<------------------------------------------| 1780 |(9) STUN Res. | | 1781 |------------------------------------------>| 1782 |(10) Answer | | 1783 |<------------------------------------------| 1785 Figure 1: Race Condition Flow 1787 Appendix C. Why Is the Conflict Resolution Mechanism Needed? 1789 When ICE runs between two peers, one agent acts as controlled, and 1790 the other as controlling. Rules are defined as a function of 1791 implementation type and offerer/answerer to determine who is 1792 controlling and who is controlled. However, the specification 1793 mentions that, in some cases, both sides might believe they are 1794 controlling, or both sides might believe they are controlled. How 1795 can this happen? 1797 The condition when both agents believe they are controlled shows up 1798 in third party call control cases. Consider the following flow: 1800 A Controller B 1801 |(1) INV() | | 1802 |<-------------| | 1803 |(2) 200(SDP1) | | 1804 |------------->| | 1805 | |(3) INV() | 1806 | |------------->| 1807 | |(4) 200(SDP2) | 1808 | |<-------------| 1809 |(5) ACK(SDP2) | | 1810 |<-------------| | 1811 | |(6) ACK(SDP1) | 1812 | |------------->| 1814 Figure 2: Role Conflict Flow 1816 This flow is a variation on flow III of RFC 3725 [RFC3725]. In fact, 1817 it works better than flow III since it produces fewer messages. In 1818 this flow, the controller sends an offerless INVITE to agent A, which 1819 responds with its offer, SDP1. The agent then sends an offerless 1820 INVITE to agent B, which it responds to with its offer, SDP2. The 1821 controller then uses the offer from each agent to generate the 1822 answers. When this flow is used, ICE will run between agents A and 1823 B, but both will believe they are in the controlling role. With the 1824 role conflict resolution procedures, this flow will function properly 1825 when ICE is used. 1827 At this time, there are no documented flows that can result in the 1828 case where both agents believe they are controlled. However, the 1829 conflict resolution procedures allow for this case, should a flow 1830 arise that would fit into this category. 1832 Appendix D. Why Send an Updated Offer? 1834 Section 11.1 describes rules for sending media. Both agents can send 1835 media once ICE checks complete, without waiting for an updated offer. 1836 Indeed, the only purpose of the updated offer is to "correct" the SDP 1837 so that the default destination for media matches where media is 1838 being sent based on ICE procedures (which will be the highest- 1839 priority nominated candidate pair). 1841 This begs the question -- why is the updated offer/answer exchange 1842 needed at all? Indeed, in a pure offer/answer environment, it would 1843 not be. The offerer and answerer will agree on the candidates to use 1844 through ICE, and then can begin using them. As far as the agents 1845 themselves are concerned, the updated offer/answer provides no new 1846 information. However, in practice, numerous components along the 1847 signaling path look at the SDP information. These include entities 1848 performing off-path QoS reservations, NAT traversal components such 1849 as ALGs and Session Border Controllers (SBCs), and diagnostic tools 1850 that passively monitor the network. For these tools to continue to 1851 function without change, the core property of SDP -- that the 1852 existing, pre-ICE definitions of the addresses used for media -- the 1853 m and c lines and the rtcp attribute -- must be retained. For this 1854 reason, an updated offer must be sent. 1856 Authors' Addresses 1858 Marc Petit-Huguenin 1859 Jive Communications 1860 1275 West 1600 North, Suite 100 1861 Orem, UT 84057 1862 USA 1864 Email: marcph@getjive.com 1866 Ari Keranen 1867 Ericsson 1868 Jorvas 02420 1869 Finland 1871 Email: ari.keranen@ericsson.com