Internet Engineering Task Force (IETF) J. Rosenberg Request for Comments: 5245 jdrosen.net Obsoletes: 4091, 4092 April 2010 Category: Standards Track ISSN: 2070-1721
Internet Engineering Task Force (IETF) J. Rosenberg Request for Comments: 5245 jdrosen.net Obsoletes: 4091, 4092 April 2010 Category: Standards Track ISSN: 2070-1721
Interactive Connectivity Establishment (ICE): A Protocol for Network Address Translator (NAT) Traversal for Offer/Answer Protocols
交互式连接建立(ICE):提供/应答协议的网络地址转换器(NAT)遍历协议
Abstract
摘要
This document describes a protocol for Network Address Translator (NAT) traversal for UDP-based multimedia sessions established with the offer/answer model. This protocol is called Interactive Connectivity Establishment (ICE). ICE makes use of the Session Traversal Utilities for NAT (STUN) protocol and its extension, Traversal Using Relay NAT (TURN). ICE can be used by any protocol utilizing the offer/answer model, such as the Session Initiation Protocol (SIP).
本文档描述了一种用于网络地址转换器(NAT)遍历的协议,该协议用于使用提供/应答模型建立的基于UDP的多媒体会话。该协议称为交互式连接建立(ICE)。ICE利用NAT(STUN)协议的会话遍历实用程序及其扩展,使用中继NAT(TURN)进行遍历。ICE可由任何利用提供/应答模型的协议使用,例如会话发起协议(SIP)。
Status of This Memo
关于下段备忘
This is an Internet Standards Track document.
这是一份互联网标准跟踪文件。
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 5741.
本文件是互联网工程任务组(IETF)的产品。它代表了IETF社区的共识。它已经接受了公众审查,并已被互联网工程指导小组(IESG)批准出版。有关互联网标准的更多信息,请参见RFC 5741第2节。
Information about the current status of this document, any errata, and how to provide feedback on it may be obtained at http://www.rfc-editor.org/info/rfc5245.
有关本文件当前状态、任何勘误表以及如何提供反馈的信息,请访问http://www.rfc-editor.org/info/rfc5245.
Copyright Notice
版权公告
Copyright (c) 2010 IETF Trust and the persons identified as the document authors. All rights reserved.
版权所有(c)2010 IETF信托基金和确定为文件作者的人员。版权所有。
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (http://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Simplified BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Simplified BSD License.
本文件受BCP 78和IETF信托有关IETF文件的法律规定的约束(http://trustee.ietf.org/license-info)自本文件出版之日起生效。请仔细阅读这些文件,因为它们描述了您对本文件的权利和限制。从本文件中提取的代码组件必须包括信托法律条款第4.e节中所述的简化BSD许可证文本,并提供简化BSD许可证中所述的无担保。
Table of Contents
目录
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 2. Overview of ICE . . . . . . . . . . . . . . . . . . . . . . . 7 2.1. Gathering Candidate Addresses . . . . . . . . . . . . . . 9 2.2. Connectivity Checks . . . . . . . . . . . . . . . . . . . 11 2.3. Sorting Candidates . . . . . . . . . . . . . . . . . . . 12 2.4. Frozen Candidates . . . . . . . . . . . . . . . . . . . . 13 2.5. Security for Checks . . . . . . . . . . . . . . . . . . . 14 2.6. Concluding ICE . . . . . . . . . . . . . . . . . . . . . 14 2.7. Lite Implementations . . . . . . . . . . . . . . . . . . 16 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 16 4. Sending the Initial Offer . . . . . . . . . . . . . . . . . . 19 4.1. Full Implementation Requirements . . . . . . . . . . . . 19 4.1.1. Gathering Candidates . . . . . . . . . . . . . . . . 19 4.1.1.1. Host Candidates . . . . . . . . . . . . . . . . . 20 4.1.1.2. Server Reflexive and Relayed Candidates . . . . . 20 4.1.1.3. Computing Foundations . . . . . . . . . . . . . . 22 4.1.1.4. Keeping Candidates Alive . . . . . . . . . . . . 22 4.1.2. Prioritizing Candidates . . . . . . . . . . . . . . . 22 4.1.2.1. Recommended Formula . . . . . . . . . . . . . . . 23 4.1.2.2. Guidelines for Choosing Type and Local Preferences . . . . . . . . . . . . . . . . . . . 23 4.1.3. Eliminating Redundant Candidates . . . . . . . . . . 25 4.1.4. Choosing Default Candidates . . . . . . . . . . . . . 25 4.2. Lite Implementation Requirements . . . . . . . . . . . . 25 4.3. Encoding the SDP . . . . . . . . . . . . . . . . . . . . 26 5. Receiving the Initial Offer . . . . . . . . . . . . . . . . . 28 5.1. Verifying ICE Support . . . . . . . . . . . . . . . . . . 28 5.2. Determining Role . . . . . . . . . . . . . . . . . . . . 29 5.3. Gathering Candidates . . . . . . . . . . . . . . . . . . 30 5.4. Prioritizing Candidates . . . . . . . . . . . . . . . . . 30 5.5. Choosing Default Candidates . . . . . . . . . . . . . . . 31
1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 6 2. Overview of ICE . . . . . . . . . . . . . . . . . . . . . . . 7 2.1. Gathering Candidate Addresses . . . . . . . . . . . . . . 9 2.2. Connectivity Checks . . . . . . . . . . . . . . . . . . . 11 2.3. Sorting Candidates . . . . . . . . . . . . . . . . . . . 12 2.4. Frozen Candidates . . . . . . . . . . . . . . . . . . . . 13 2.5. Security for Checks . . . . . . . . . . . . . . . . . . . 14 2.6. Concluding ICE . . . . . . . . . . . . . . . . . . . . . 14 2.7. Lite Implementations . . . . . . . . . . . . . . . . . . 16 3. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 16 4. Sending the Initial Offer . . . . . . . . . . . . . . . . . . 19 4.1. Full Implementation Requirements . . . . . . . . . . . . 19 4.1.1. Gathering Candidates . . . . . . . . . . . . . . . . 19 4.1.1.1. Host Candidates . . . . . . . . . . . . . . . . . 20 4.1.1.2. Server Reflexive and Relayed Candidates . . . . . 20 4.1.1.3. Computing Foundations . . . . . . . . . . . . . . 22 4.1.1.4. Keeping Candidates Alive . . . . . . . . . . . . 22 4.1.2. Prioritizing Candidates . . . . . . . . . . . . . . . 22 4.1.2.1. Recommended Formula . . . . . . . . . . . . . . . 23 4.1.2.2. Guidelines for Choosing Type and Local Preferences . . . . . . . . . . . . . . . . . . . 23 4.1.3. Eliminating Redundant Candidates . . . . . . . . . . 25 4.1.4. Choosing Default Candidates . . . . . . . . . . . . . 25 4.2. Lite Implementation Requirements . . . . . . . . . . . . 25 4.3. Encoding the SDP . . . . . . . . . . . . . . . . . . . . 26 5. Receiving the Initial Offer . . . . . . . . . . . . . . . . . 28 5.1. Verifying ICE Support . . . . . . . . . . . . . . . . . . 28 5.2. Determining Role . . . . . . . . . . . . . . . . . . . . 29 5.3. Gathering Candidates . . . . . . . . . . . . . . . . . . 30 5.4. Prioritizing Candidates . . . . . . . . . . . . . . . . . 30 5.5. Choosing Default Candidates . . . . . . . . . . . . . . . 31
5.6. Encoding the SDP . . . . . . . . . . . . . . . . . . . . 31 5.7. Forming the Check Lists . . . . . . . . . . . . . . . . . 31 5.7.1. Forming Candidate Pairs . . . . . . . . . . . . . . . 31 5.7.2. Computing Pair Priority and Ordering Pairs . . . . . 34 5.7.3. Pruning the Pairs . . . . . . . . . . . . . . . . . . 34 5.7.4. Computing States . . . . . . . . . . . . . . . . . . 34 5.8. Scheduling Checks . . . . . . . . . . . . . . . . . . . . 37 6. Receipt of the Initial Answer . . . . . . . . . . . . . . . . 39 6.1. Verifying ICE Support . . . . . . . . . . . . . . . . . . 39 6.2. Determining Role . . . . . . . . . . . . . . . . . . . . 39 6.3. Forming the Check List . . . . . . . . . . . . . . . . . 40 6.4. Performing Ordinary Checks . . . . . . . . . . . . . . . 40 7. Performing Connectivity Checks . . . . . . . . . . . . . . . 40 7.1. STUN Client Procedures . . . . . . . . . . . . . . . . . 40 7.1.1. Creating Permissions for Relayed Candidates . . . . . 40 7.1.2. Sending the Request . . . . . . . . . . . . . . . . . 40 7.1.2.1. PRIORITY and USE-CANDIDATE . . . . . . . . . . . 41 7.1.2.2. ICE-CONTROLLED and ICE-CONTROLLING . . . . . . . 41 7.1.2.3. Forming Credentials . . . . . . . . . . . . . . . 41 7.1.2.4. DiffServ Treatment . . . . . . . . . . . . . . . 42 7.1.3. Processing the Response . . . . . . . . . . . . . . . 42 7.1.3.1. Failure Cases . . . . . . . . . . . . . . . . . . 42 7.1.3.2. Success Cases . . . . . . . . . . . . . . . . . . 43 7.1.3.2.1. Discovering Peer Reflexive Candidates . . . . 43 7.1.3.2.2. Constructing a Valid Pair . . . . . . . . . . 44 7.1.3.2.3. Updating Pair States . . . . . . . . . . . . 45 7.1.3.2.4. Updating the Nominated Flag . . . . . . . . . 46 7.1.3.3. Check List and Timer State Updates . . . . . . . 46 7.2. STUN Server Procedures . . . . . . . . . . . . . . . . . 46 7.2.1. Additional Procedures for Full Implementations . . . 47 7.2.1.1. Detecting and Repairing Role Conflicts . . . . . 47 7.2.1.2. Computing Mapped Address . . . . . . . . . . . . 48 7.2.1.3. Learning Peer Reflexive Candidates . . . . . . . 49 7.2.1.4. Triggered Checks . . . . . . . . . . . . . . . . 49 7.2.1.5. Updating the Nominated Flag . . . . . . . . . . . 50 7.2.2. Additional Procedures for Lite Implementations . . . 51 8. Concluding ICE Processing . . . . . . . . . . . . . . . . . . 51 8.1. Procedures for Full Implementations . . . . . . . . . . . 51 8.1.1. Nominating Pairs . . . . . . . . . . . . . . . . . . 51 8.1.1.1. Regular Nomination . . . . . . . . . . . . . . . 52 8.1.1.2. Aggressive Nomination . . . . . . . . . . . . . . 52 8.1.2. Updating States . . . . . . . . . . . . . . . . . . . 53 8.2. Procedures for Lite Implementations . . . . . . . . . . . 54 8.2.1. Peer Is Full . . . . . . . . . . . . . . . . . . . . 54 8.2.2. Peer Is Lite . . . . . . . . . . . . . . . . . . . . 55 8.3. Freeing Candidates . . . . . . . . . . . . . . . . . . . 56 8.3.1. Full Implementation Procedures . . . . . . . . . . . 56 8.3.2. Lite Implementation Procedures . . . . . . . . . . . 56
5.6. Encoding the SDP . . . . . . . . . . . . . . . . . . . . 31 5.7. Forming the Check Lists . . . . . . . . . . . . . . . . . 31 5.7.1. Forming Candidate Pairs . . . . . . . . . . . . . . . 31 5.7.2. Computing Pair Priority and Ordering Pairs . . . . . 34 5.7.3. Pruning the Pairs . . . . . . . . . . . . . . . . . . 34 5.7.4. Computing States . . . . . . . . . . . . . . . . . . 34 5.8. Scheduling Checks . . . . . . . . . . . . . . . . . . . . 37 6. Receipt of the Initial Answer . . . . . . . . . . . . . . . . 39 6.1. Verifying ICE Support . . . . . . . . . . . . . . . . . . 39 6.2. Determining Role . . . . . . . . . . . . . . . . . . . . 39 6.3. Forming the Check List . . . . . . . . . . . . . . . . . 40 6.4. Performing Ordinary Checks . . . . . . . . . . . . . . . 40 7. Performing Connectivity Checks . . . . . . . . . . . . . . . 40 7.1. STUN Client Procedures . . . . . . . . . . . . . . . . . 40 7.1.1. Creating Permissions for Relayed Candidates . . . . . 40 7.1.2. Sending the Request . . . . . . . . . . . . . . . . . 40 7.1.2.1. PRIORITY and USE-CANDIDATE . . . . . . . . . . . 41 7.1.2.2. ICE-CONTROLLED and ICE-CONTROLLING . . . . . . . 41 7.1.2.3. Forming Credentials . . . . . . . . . . . . . . . 41 7.1.2.4. DiffServ Treatment . . . . . . . . . . . . . . . 42 7.1.3. Processing the Response . . . . . . . . . . . . . . . 42 7.1.3.1. Failure Cases . . . . . . . . . . . . . . . . . . 42 7.1.3.2. Success Cases . . . . . . . . . . . . . . . . . . 43 7.1.3.2.1. Discovering Peer Reflexive Candidates . . . . 43 7.1.3.2.2. Constructing a Valid Pair . . . . . . . . . . 44 7.1.3.2.3. Updating Pair States . . . . . . . . . . . . 45 7.1.3.2.4. Updating the Nominated Flag . . . . . . . . . 46 7.1.3.3. Check List and Timer State Updates . . . . . . . 46 7.2. STUN Server Procedures . . . . . . . . . . . . . . . . . 46 7.2.1. Additional Procedures for Full Implementations . . . 47 7.2.1.1. Detecting and Repairing Role Conflicts . . . . . 47 7.2.1.2. Computing Mapped Address . . . . . . . . . . . . 48 7.2.1.3. Learning Peer Reflexive Candidates . . . . . . . 49 7.2.1.4. Triggered Checks . . . . . . . . . . . . . . . . 49 7.2.1.5. Updating the Nominated Flag . . . . . . . . . . . 50 7.2.2. Additional Procedures for Lite Implementations . . . 51 8. Concluding ICE Processing . . . . . . . . . . . . . . . . . . 51 8.1. Procedures for Full Implementations . . . . . . . . . . . 51 8.1.1. Nominating Pairs . . . . . . . . . . . . . . . . . . 51 8.1.1.1. Regular Nomination . . . . . . . . . . . . . . . 52 8.1.1.2. Aggressive Nomination . . . . . . . . . . . . . . 52 8.1.2. Updating States . . . . . . . . . . . . . . . . . . . 53 8.2. Procedures for Lite Implementations . . . . . . . . . . . 54 8.2.1. Peer Is Full . . . . . . . . . . . . . . . . . . . . 54 8.2.2. Peer Is Lite . . . . . . . . . . . . . . . . . . . . 55 8.3. Freeing Candidates . . . . . . . . . . . . . . . . . . . 56 8.3.1. Full Implementation Procedures . . . . . . . . . . . 56 8.3.2. Lite Implementation Procedures . . . . . . . . . . . 56
9. Subsequent Offer/Answer Exchanges . . . . . . . . . . . . . . 56 9.1. Generating the Offer . . . . . . . . . . . . . . . . . . 57 9.1.1. Procedures for All Implementations . . . . . . . . . 57 9.1.1.1. ICE Restarts . . . . . . . . . . . . . . . . . . 57 9.1.1.2. Removing a Media Stream . . . . . . . . . . . . . 58 9.1.1.3. Adding a Media Stream . . . . . . . . . . . . . . 58 9.1.2. Procedures for Full Implementations . . . . . . . . . 58 9.1.2.1. Existing Media Streams with ICE Running . . . . . 58 9.1.2.2. Existing Media Streams with ICE Completed . . . . 59 9.1.3. Procedures for Lite Implementations . . . . . . . . . 59 9.1.3.1. Existing Media Streams with ICE Running . . . . . 59 9.1.3.2. Existing Media Streams with ICE Completed . . . . 60 9.2. Receiving the Offer and Generating an Answer . . . . . . 60 9.2.1. Procedures for All Implementations . . . . . . . . . 60 9.2.1.1. Detecting ICE Restart . . . . . . . . . . . . . . 60 9.2.1.2. New Media Stream . . . . . . . . . . . . . . . . 61 9.2.1.3. Removed Media Stream . . . . . . . . . . . . . . 61 9.2.2. Procedures for Full Implementations . . . . . . . . . 61 9.2.2.1. Existing Media Streams with ICE Running and no remote-candidates . . . . . . . . . . . . . . . . 61 9.2.2.2. Existing Media Streams with ICE Completed and no remote-candidates . . . . . . . . . . . . . . 61 9.2.2.3. Existing Media Streams and remote-candidates . . 61 9.2.3. Procedures for Lite Implementations . . . . . . . . . 62 9.3. Updating the Check and Valid Lists . . . . . . . . . . . 63 9.3.1. Procedures for Full Implementations . . . . . . . . . 63 9.3.1.1. ICE Restarts . . . . . . . . . . . . . . . . . . 63 9.3.1.2. New Media Stream . . . . . . . . . . . . . . . . 63 9.3.1.3. Removed Media Stream . . . . . . . . . . . . . . 64 9.3.1.4. ICE Continuing for Existing Media Stream . . . . 64 9.3.2. Procedures for Lite Implementations . . . . . . . . . 64 10. Keepalives . . . . . . . . . . . . . . . . . . . . . . . . . 65 11. Media Handling . . . . . . . . . . . . . . . . . . . . . . . 66 11.1. Sending Media . . . . . . . . . . . . . . . . . . . . . . 66 11.1.1. Procedures for Full Implementations . . . . . . . . . 66 11.1.2. Procedures for Lite Implementations . . . . . . . . . 67 11.1.3. Procedures for All Implementations . . . . . . . . . 67 11.2. Receiving Media . . . . . . . . . . . . . . . . . . . . . 67 12. Usage with SIP . . . . . . . . . . . . . . . . . . . . . . . 68 12.1. Latency Guidelines . . . . . . . . . . . . . . . . . . . 68 12.1.1. Offer in INVITE . . . . . . . . . . . . . . . . . . . 68 12.1.2. Offer in Response . . . . . . . . . . . . . . . . . . 70 12.2. SIP Option Tags and Media Feature Tags . . . . . . . . . 70 12.3. Interactions with Forking . . . . . . . . . . . . . . . . 70 12.4. Interactions with Preconditions . . . . . . . . . . . . . 70 12.5. Interactions with Third Party Call Control . . . . . . . 71 13. Relationship with ANAT . . . . . . . . . . . . . . . . . . . 71 14. Extensibility Considerations . . . . . . . . . . . . . . . . 72
9. Subsequent Offer/Answer Exchanges . . . . . . . . . . . . . . 56 9.1. Generating the Offer . . . . . . . . . . . . . . . . . . 57 9.1.1. Procedures for All Implementations . . . . . . . . . 57 9.1.1.1. ICE Restarts . . . . . . . . . . . . . . . . . . 57 9.1.1.2. Removing a Media Stream . . . . . . . . . . . . . 58 9.1.1.3. Adding a Media Stream . . . . . . . . . . . . . . 58 9.1.2. Procedures for Full Implementations . . . . . . . . . 58 9.1.2.1. Existing Media Streams with ICE Running . . . . . 58 9.1.2.2. Existing Media Streams with ICE Completed . . . . 59 9.1.3. Procedures for Lite Implementations . . . . . . . . . 59 9.1.3.1. Existing Media Streams with ICE Running . . . . . 59 9.1.3.2. Existing Media Streams with ICE Completed . . . . 60 9.2. Receiving the Offer and Generating an Answer . . . . . . 60 9.2.1. Procedures for All Implementations . . . . . . . . . 60 9.2.1.1. Detecting ICE Restart . . . . . . . . . . . . . . 60 9.2.1.2. New Media Stream . . . . . . . . . . . . . . . . 61 9.2.1.3. Removed Media Stream . . . . . . . . . . . . . . 61 9.2.2. Procedures for Full Implementations . . . . . . . . . 61 9.2.2.1. Existing Media Streams with ICE Running and no remote-candidates . . . . . . . . . . . . . . . . 61 9.2.2.2. Existing Media Streams with ICE Completed and no remote-candidates . . . . . . . . . . . . . . 61 9.2.2.3. Existing Media Streams and remote-candidates . . 61 9.2.3. Procedures for Lite Implementations . . . . . . . . . 62 9.3. Updating the Check and Valid Lists . . . . . . . . . . . 63 9.3.1. Procedures for Full Implementations . . . . . . . . . 63 9.3.1.1. ICE Restarts . . . . . . . . . . . . . . . . . . 63 9.3.1.2. New Media Stream . . . . . . . . . . . . . . . . 63 9.3.1.3. Removed Media Stream . . . . . . . . . . . . . . 64 9.3.1.4. ICE Continuing for Existing Media Stream . . . . 64 9.3.2. Procedures for Lite Implementations . . . . . . . . . 64 10. Keepalives . . . . . . . . . . . . . . . . . . . . . . . . . 65 11. Media Handling . . . . . . . . . . . . . . . . . . . . . . . 66 11.1. Sending Media . . . . . . . . . . . . . . . . . . . . . . 66 11.1.1. Procedures for Full Implementations . . . . . . . . . 66 11.1.2. Procedures for Lite Implementations . . . . . . . . . 67 11.1.3. Procedures for All Implementations . . . . . . . . . 67 11.2. Receiving Media . . . . . . . . . . . . . . . . . . . . . 67 12. Usage with SIP . . . . . . . . . . . . . . . . . . . . . . . 68 12.1. Latency Guidelines . . . . . . . . . . . . . . . . . . . 68 12.1.1. Offer in INVITE . . . . . . . . . . . . . . . . . . . 68 12.1.2. Offer in Response . . . . . . . . . . . . . . . . . . 70 12.2. SIP Option Tags and Media Feature Tags . . . . . . . . . 70 12.3. Interactions with Forking . . . . . . . . . . . . . . . . 70 12.4. Interactions with Preconditions . . . . . . . . . . . . . 70 12.5. Interactions with Third Party Call Control . . . . . . . 71 13. Relationship with ANAT . . . . . . . . . . . . . . . . . . . 71 14. Extensibility Considerations . . . . . . . . . . . . . . . . 72
15. Grammar . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 15.1. "candidate" Attribute . . . . . . . . . . . . . . . . . . 73 15.2. "remote-candidates" Attribute . . . . . . . . . . . . . . 75 15.3. "ice-lite" and "ice-mismatch" Attributes . . . . . . . . 75 15.4. "ice-ufrag" and "ice-pwd" Attributes . . . . . . . . . . 76 15.5. "ice-options" Attribute . . . . . . . . . . . . . . . . . 76 16. Setting Ta and RTO . . . . . . . . . . . . . . . . . . . . . 76 16.1. RTP Media Streams . . . . . . . . . . . . . . . . . . . . 77 16.2. Non-RTP Sessions . . . . . . . . . . . . . . . . . . . . 78 17. Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 18. Security Considerations . . . . . . . . . . . . . . . . . . . 85 18.1. Attacks on Connectivity Checks . . . . . . . . . . . . . 86 18.2. Attacks on Server Reflexive Address Gathering . . . . . . 88 18.3. Attacks on Relayed Candidate Gathering . . . . . . . . . 89 18.4. Attacks on the Offer/Answer Exchanges . . . . . . . . . . 89 18.5. Insider Attacks . . . . . . . . . . . . . . . . . . . . . 90 18.5.1. The Voice Hammer Attack . . . . . . . . . . . . . . . 90 18.5.2. STUN Amplification Attack . . . . . . . . . . . . . . 90 18.6. Interactions with Application Layer Gateways and SIP . . 91 19. STUN Extensions . . . . . . . . . . . . . . . . . . . . . . . 92 19.1. New Attributes . . . . . . . . . . . . . . . . . . . . . 92 19.2. New Error Response Codes . . . . . . . . . . . . . . . . 93 20. Operational Considerations . . . . . . . . . . . . . . . . . 93 20.1. NAT and Firewall Types . . . . . . . . . . . . . . . . . 93 20.2. Bandwidth Requirements . . . . . . . . . . . . . . . . . 93 20.2.1. STUN and TURN Server Capacity Planning . . . . . . . 93 20.2.2. Gathering and Connectivity Checks . . . . . . . . . . 94 20.2.3. Keepalives . . . . . . . . . . . . . . . . . . . . . 94 20.3. ICE and ICE-lite . . . . . . . . . . . . . . . . . . . . 95 20.4. Troubleshooting and Performance Management . . . . . . . 95 20.5. Endpoint Configuration . . . . . . . . . . . . . . . . . 95 21. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 96 21.1. SDP Attributes . . . . . . . . . . . . . . . . . . . . . 96 21.1.1. candidate Attribute . . . . . . . . . . . . . . . . . 96 21.1.2. remote-candidates Attribute . . . . . . . . . . . . . 96 21.1.3. ice-lite Attribute . . . . . . . . . . . . . . . . . 97 21.1.4. ice-mismatch Attribute . . . . . . . . . . . . . . . 97 21.1.5. ice-pwd Attribute . . . . . . . . . . . . . . . . . . 98 21.1.6. ice-ufrag Attribute . . . . . . . . . . . . . . . . . 98 21.1.7. ice-options Attribute . . . . . . . . . . . . . . . . 98 21.2. STUN Attributes . . . . . . . . . . . . . . . . . . . . . 99 21.3. STUN Error Responses . . . . . . . . . . . . . . . . . . 99 22. IAB Considerations . . . . . . . . . . . . . . . . . . . . . 99 22.1. Problem Definition . . . . . . . . . . . . . . . . . . . 100 22.2. Exit Strategy . . . . . . . . . . . . . . . . . . . . . . 100 22.3. Brittleness Introduced by ICE . . . . . . . . . . . . . . 101 22.4. Requirements for a Long-Term Solution . . . . . . . . . . 102 22.5. Issues with Existing NAPT Boxes . . . . . . . . . . . . . 102
15. Grammar . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 15.1. "candidate" Attribute . . . . . . . . . . . . . . . . . . 73 15.2. "remote-candidates" Attribute . . . . . . . . . . . . . . 75 15.3. "ice-lite" and "ice-mismatch" Attributes . . . . . . . . 75 15.4. "ice-ufrag" and "ice-pwd" Attributes . . . . . . . . . . 76 15.5. "ice-options" Attribute . . . . . . . . . . . . . . . . . 76 16. Setting Ta and RTO . . . . . . . . . . . . . . . . . . . . . 76 16.1. RTP Media Streams . . . . . . . . . . . . . . . . . . . . 77 16.2. Non-RTP Sessions . . . . . . . . . . . . . . . . . . . . 78 17. Example . . . . . . . . . . . . . . . . . . . . . . . . . . . 79 18. Security Considerations . . . . . . . . . . . . . . . . . . . 85 18.1. Attacks on Connectivity Checks . . . . . . . . . . . . . 86 18.2. Attacks on Server Reflexive Address Gathering . . . . . . 88 18.3. Attacks on Relayed Candidate Gathering . . . . . . . . . 89 18.4. Attacks on the Offer/Answer Exchanges . . . . . . . . . . 89 18.5. Insider Attacks . . . . . . . . . . . . . . . . . . . . . 90 18.5.1. The Voice Hammer Attack . . . . . . . . . . . . . . . 90 18.5.2. STUN Amplification Attack . . . . . . . . . . . . . . 90 18.6. Interactions with Application Layer Gateways and SIP . . 91 19. STUN Extensions . . . . . . . . . . . . . . . . . . . . . . . 92 19.1. New Attributes . . . . . . . . . . . . . . . . . . . . . 92 19.2. New Error Response Codes . . . . . . . . . . . . . . . . 93 20. Operational Considerations . . . . . . . . . . . . . . . . . 93 20.1. NAT and Firewall Types . . . . . . . . . . . . . . . . . 93 20.2. Bandwidth Requirements . . . . . . . . . . . . . . . . . 93 20.2.1. STUN and TURN Server Capacity Planning . . . . . . . 93 20.2.2. Gathering and Connectivity Checks . . . . . . . . . . 94 20.2.3. Keepalives . . . . . . . . . . . . . . . . . . . . . 94 20.3. ICE and ICE-lite . . . . . . . . . . . . . . . . . . . . 95 20.4. Troubleshooting and Performance Management . . . . . . . 95 20.5. Endpoint Configuration . . . . . . . . . . . . . . . . . 95 21. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 96 21.1. SDP Attributes . . . . . . . . . . . . . . . . . . . . . 96 21.1.1. candidate Attribute . . . . . . . . . . . . . . . . . 96 21.1.2. remote-candidates Attribute . . . . . . . . . . . . . 96 21.1.3. ice-lite Attribute . . . . . . . . . . . . . . . . . 97 21.1.4. ice-mismatch Attribute . . . . . . . . . . . . . . . 97 21.1.5. ice-pwd Attribute . . . . . . . . . . . . . . . . . . 98 21.1.6. ice-ufrag Attribute . . . . . . . . . . . . . . . . . 98 21.1.7. ice-options Attribute . . . . . . . . . . . . . . . . 98 21.2. STUN Attributes . . . . . . . . . . . . . . . . . . . . . 99 21.3. STUN Error Responses . . . . . . . . . . . . . . . . . . 99 22. IAB Considerations . . . . . . . . . . . . . . . . . . . . . 99 22.1. Problem Definition . . . . . . . . . . . . . . . . . . . 100 22.2. Exit Strategy . . . . . . . . . . . . . . . . . . . . . . 100 22.3. Brittleness Introduced by ICE . . . . . . . . . . . . . . 101 22.4. Requirements for a Long-Term Solution . . . . . . . . . . 102 22.5. Issues with Existing NAPT Boxes . . . . . . . . . . . . . 102
23. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 102 24. References . . . . . . . . . . . . . . . . . . . . . . . . . 103 24.1. Normative References . . . . . . . . . . . . . . . . . . 103 24.2. Informative References . . . . . . . . . . . . . . . . . 104 Appendix A. Lite and Full Implementations . . . . . . . . . . . 107 Appendix B. Design Motivations . . . . . . . . . . . . . . . . . 108 B.1. Pacing of STUN Transactions . . . . . . . . . . . . . . . 108 B.2. Candidates with Multiple Bases . . . . . . . . . . . . . 109 B.3. Purpose of the <rel-addr> and <rel-port> Attributes . . . 111 B.4. Importance of the STUN Username . . . . . . . . . . . . . 111 B.5. The Candidate Pair Priority Formula . . . . . . . . . . . 113 B.6. The remote-candidates Attribute . . . . . . . . . . . . . 113 B.7. Why Are Keepalives Needed? . . . . . . . . . . . . . . . 114 B.8. Why Prefer Peer Reflexive Candidates? . . . . . . . . . . 115 B.9. Why Send an Updated Offer? . . . . . . . . . . . . . . . 115 B.10. Why Are Binding Indications Used for Keepalives? . . . . 115 B.11. Why Is the Conflict Resolution Mechanism Needed? . . . . 116
23. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 102 24. References . . . . . . . . . . . . . . . . . . . . . . . . . 103 24.1. Normative References . . . . . . . . . . . . . . . . . . 103 24.2. Informative References . . . . . . . . . . . . . . . . . 104 Appendix A. Lite and Full Implementations . . . . . . . . . . . 107 Appendix B. Design Motivations . . . . . . . . . . . . . . . . . 108 B.1. Pacing of STUN Transactions . . . . . . . . . . . . . . . 108 B.2. Candidates with Multiple Bases . . . . . . . . . . . . . 109 B.3. Purpose of the <rel-addr> and <rel-port> Attributes . . . 111 B.4. Importance of the STUN Username . . . . . . . . . . . . . 111 B.5. The Candidate Pair Priority Formula . . . . . . . . . . . 113 B.6. The remote-candidates Attribute . . . . . . . . . . . . . 113 B.7. Why Are Keepalives Needed? . . . . . . . . . . . . . . . 114 B.8. Why Prefer Peer Reflexive Candidates? . . . . . . . . . . 115 B.9. Why Send an Updated Offer? . . . . . . . . . . . . . . . 115 B.10. Why Are Binding Indications Used for Keepalives? . . . . 115 B.11. Why Is the Conflict Resolution Mechanism Needed? . . . . 116
RFC 3264 [RFC3264] defines a two-phase exchange of Session Description Protocol (SDP) messages [RFC4566] for the purposes of establishment of multimedia sessions. This offer/answer mechanism is used by protocols such as the Session Initiation Protocol (SIP) [RFC3261].
RFC 3264[RFC3264]定义了会话描述协议(SDP)消息[RFC4566]的两阶段交换,用于建立多媒体会话。此提供/应答机制由诸如会话发起协议(SIP)[RFC3261]之类的协议使用。
Protocols using offer/answer are difficult to operate through Network Address Translators (NATs). Because their purpose is to establish a flow of media packets, they tend to carry the IP addresses and ports of media sources and sinks within their messages, which is known to be problematic through NAT [RFC3235]. The protocols also seek to create a media flow directly between participants, so that there is no application layer intermediary between them. This is done to reduce media latency, decrease packet loss, and reduce the operational costs of deploying the application. However, this is difficult to accomplish through NAT. A full treatment of the reasons for this is beyond the scope of this specification.
使用提供/应答的协议很难通过网络地址转换器(NAT)进行操作。因为它们的目的是建立媒体包流,所以它们往往在消息中携带媒体源和接收器的IP地址和端口,这在NAT[RFC3235]中是有问题的。协议还寻求在参与者之间直接创建媒体流,以便在参与者之间没有应用层中介。这样做是为了减少媒体延迟、减少数据包丢失和降低部署应用程序的操作成本。然而,这很难通过NAT实现。对此原因的全面处理超出了本规范的范围。
Numerous solutions have been defined for allowing these protocols to operate through NAT. These include Application Layer Gateways (ALGs), the Middlebox Control Protocol [RFC3303], the original Simple Traversal of UDP Through NAT (STUN) [RFC3489] specification, and Realm Specific IP [RFC3102] [RFC3103] along with session description extensions needed to make them work, such as the Session Description Protocol (SDP) [RFC4566] attribute for the Real Time Control Protocol (RTCP) [RFC3605]. Unfortunately, these techniques all have pros and cons which, make each one optimal in some network topologies, but a poor choice in others. The result is that administrators and
为了允许这些协议通过NAT运行,已经定义了许多解决方案。其中包括应用层网关(ALG)、中间盒控制协议[RFC3303]、原始的通过NAT(STUN)[RFC3489]简单遍历UDP规范、领域特定IP[RFC3102][RFC3103]以及使其工作所需的会话描述扩展,如会话描述协议(SDP)[RFC4566]实时控制协议(RTCP)[RFC3605]的属性。不幸的是,这些技术都有优点和缺点,这使得每一种技术在某些网络拓扑中都是最优的,但在另一些网络拓扑中却不是一个很好的选择。结果是管理员和
implementors are making assumptions about the topologies of the networks in which their solutions will be deployed. This introduces complexity and brittleness into the system. What is needed is a single solution that is flexible enough to work well in all situations.
实施者正在对部署其解决方案的网络拓扑进行假设。这给系统带来了复杂性和脆弱性。我们需要的是一个足够灵活的单一解决方案,能够在所有情况下都能很好地工作。
This specification defines Interactive Connectivity Establishment (ICE) as a technique for NAT traversal for UDP-based media streams (though ICE can be extended to handle other transport protocols, such as TCP [ICE-TCP]) established by the offer/answer model. ICE is an extension to the offer/answer model, and works by including a multiplicity of IP addresses and ports in SDP offers and answers, which are then tested for connectivity by peer-to-peer connectivity checks. The IP addresses and ports included in the SDP and the connectivity checks are performed using the revised STUN specification [RFC5389], now renamed to Session Traversal Utilities for NAT. The new name and new specification reflect its new role as a tool that is used with other NAT traversal techniques (namely ICE) rather than a standalone NAT traversal solution, as the original STUN specification was. ICE also makes use of Traversal Using Relays around NAT (TURN) [RFC5766], an extension to STUN. Because ICE exchanges a multiplicity of IP addresses and ports for each media stream, it also allows for address selection for multihomed and dual-stack hosts, and for this reason it deprecates RFC 4091 [RFC4091] and [RFC4092].
本规范将交互式连接建立(ICE)定义为基于UDP的媒体流的NAT穿越技术(尽管ICE可以扩展到处理其他传输协议,如由提供/应答模型建立的TCP[ICE-TCP])。ICE是提供/应答模型的扩展,其工作原理是在SDP提供和应答中包含多个IP地址和端口,然后通过对等连接检查对其进行连接测试。SDP中包含的IP地址和端口以及连接检查使用修订的STUN规范[RFC5389]执行,该规范现已重命名为NAT会话遍历实用程序。新名称和新规范反映了它作为一种工具的新角色,与其他NAT遍历技术(即ICE)一起使用,而不是像最初的STUN规范那样作为一个独立的NAT遍历解决方案。ICE还利用NAT(TURN)[RFC5766]周围的继电器进行遍历,这是STUN的一个扩展。由于ICE为每个媒体流交换多个IP地址和端口,因此它还允许为多宿主机和双堆栈主机选择地址,因此它不推荐RFC 4091[RFC4091]和[RFC4092]。
In a typical ICE deployment, we have two endpoints (known as AGENTS in RFC 3264 terminology) that want to communicate. They are able to communicate indirectly via some signaling protocol (such as SIP), by which they can perform an offer/answer exchange of SDP [RFC3264] messages. Note that ICE is not intended for NAT traversal for SIP, which is assumed to be provided via another mechanism [RFC5626]. At the beginning of the ICE process, the agents are ignorant of their own topologies. In particular, they might or might not be behind a NAT (or multiple tiers of NATs). ICE allows the agents to discover enough information about their topologies to potentially find one or more paths by which they can communicate.
在典型的ICE部署中,我们有两个端点(RFC3264术语中称为代理)想要通信。他们能够通过一些信令协议(如SIP)进行间接通信,通过这些协议,他们可以执行SDP[RFC3264]消息的提供/应答交换。请注意,ICE不用于SIP的NAT穿越,假定通过另一种机制提供[RFC5626]。在ICE过程开始时,代理不知道自己的拓扑结构。特别是,它们可能在NAT(或多个NAT层)后面,也可能不在NAT后面。ICE允许代理发现有关其拓扑的足够信息,以便潜在地找到一条或多条它们可以通信的路径。
Figure 1 shows a typical environment for ICE deployment. The two endpoints are labelled L and R (for left and right, which helps visualize call flows). Both L and R are behind their own respective NATs though they may not be aware of it. The type of NAT and its properties are also unknown. Agents L and R are capable of engaging in an offer/answer exchange by which they can exchange SDP messages, whose purpose is to set up a media session between L and R. Typically, this exchange will occur through a SIP server.
图1显示了ICE部署的典型环境。这两个端点被标记为L和R(用于左和右,这有助于可视化调用流)。L和R都支持各自的NAT,尽管他们可能没有意识到这一点。NAT的类型及其属性也未知。代理L和R能够参与提供/应答交换,通过该交换,他们可以交换SDP消息,SDP消息的目的是在L和R之间建立媒体会话。通常,这种交换将通过SIP服务器进行。
In addition to the agents, a SIP server and NATs, ICE is typically used in concert with STUN or TURN servers in the network. Each agent can have its own STUN or TURN server, or they can be the same.
除了代理、SIP服务器和NAT之外,ICE通常与网络中的STUN或TURN服务器配合使用。每个代理可以有自己的眩晕或转身服务器,也可以是相同的。
+-------+ | SIP | +-------+ | Srvr | +-------+ | STUN | | | | STUN | | Srvr | +-------+ | Srvr | | | / \ | | +-------+ / \ +-------+ / \ / \ / \ / \ / <- Signaling -> \ / \ / \ +--------+ +--------+ | NAT | | NAT | +--------+ +--------+ / \ / \ / \ +-------+ +-------+ | Agent | | Agent | | L | | R | | | | | +-------+ +-------+
+-------+ | SIP | +-------+ | Srvr | +-------+ | STUN | | | | STUN | | Srvr | +-------+ | Srvr | | | / \ | | +-------+ / \ +-------+ / \ / \ / \ / \ / <- Signaling -> \ / \ / \ +--------+ +--------+ | NAT | | NAT | +--------+ +--------+ / \ / \ / \ +-------+ +-------+ | Agent | | Agent | | L | | R | | | | | +-------+ +-------+
Figure 1: ICE Deployment Scenario
图1:ICE部署场景
The basic idea behind ICE is as follows: each agent has a variety of candidate TRANSPORT ADDRESSES (combination of IP address and port for a particular transport protocol, which is always UDP in this specification)) it could use to communicate with the other agent. These might include:
ICE背后的基本思想如下:每个代理都有各种候选传输地址(特定传输协议的IP地址和端口的组合,在本规范中始终是UDP),可用于与其他代理通信。这些措施可能包括:
o A transport address on a directly attached network interface
o 直接连接的网络接口上的传输地址
o A translated transport address on the public side of a NAT (a "server reflexive" address)
o NAT公共端的翻译传输地址(“服务器自反”地址)
o A transport address allocated from a TURN server (a "relayed address").
o 从TURN服务器分配的传输地址(“中继地址”)。
Potentially, any of L's candidate transport addresses can be used to communicate with any of R's candidate transport addresses. In
潜在地,L的任何候选传输地址都可用于与R的任何候选传输地址通信。在里面
practice, however, many combinations will not work. For instance, if L and R are both behind NATs, their directly attached interface addresses are unlikely to be able to communicate directly (this is why ICE is needed, after all!). The purpose of ICE is to discover which pairs of addresses will work. The way that ICE does this is to systematically try all possible pairs (in a carefully sorted order) until it finds one or more that work.
然而,实践中,许多组合都不起作用。例如,如果L和R都在NAT后面,那么它们直接连接的接口地址不太可能直接通信(这就是为什么需要ICE的原因!)。ICE的目的是发现哪对地址有效。ICE这样做的方式是系统地尝试所有可能的配对(以仔细排序的顺序),直到找到一个或多个有效的配对。
In order to execute ICE, an agent has to identify all of its address candidates. A CANDIDATE is a transport address -- a combination of IP address and port for a particular transport protocol (with only UDP specified here). This document defines three types of candidates, some derived from physical or logical network interfaces, others discoverable via STUN and TURN. Naturally, one viable candidate is a transport address obtained directly from a local interface. Such a candidate is called a HOST CANDIDATE. The local interface could be ethernet or WiFi, or it could be one that is obtained through a tunnel mechanism, such as a Virtual Private Network (VPN) or Mobile IP (MIP). In all cases, such a network interface appears to the agent as a local interface from which ports (and thus candidates) can be allocated.
为了执行ICE,代理必须识别其所有候选地址。候选地址是传输地址——特定传输协议的IP地址和端口的组合(此处仅指定UDP)。本文档定义了三种候选类型,一些来自物理或逻辑网络接口,另一些可通过STUN和TURN发现。当然,一个可行的候选者是直接从本地接口获得的传输地址。这样的候选人被称为东道主候选人。本地接口可以是以太网或WiFi,也可以是通过隧道机制获得的接口,如虚拟专用网络(VPN)或移动IP(MIP)。在所有情况下,这样的网络接口在代理看来都是一个本地接口,可以从中分配端口(以及候选端口)。
If an agent is multihomed, it obtains a candidate from each IP address. Depending on the location of the PEER (the other agent in the session) on the IP network relative to the agent, the agent may be reachable by the peer through one or more of those IP addresses. Consider, for example, an agent that has a local IP address on a private net 10 network (I1), and a second connected to the public Internet (I2). A candidate from I1 will be directly reachable when communicating with a peer on the same private net 10 network, while a candidate from I2 will be directly reachable when communicating with a peer on the public Internet. Rather than trying to guess which IP address will work prior to sending an offer, the offering agent includes both candidates in its offer.
如果代理是多址的,它将从每个IP地址获得一个候选代理。根据对等方(会话中的另一个代理)在IP网络上相对于代理的位置,对等方可以通过这些IP地址中的一个或多个来访问代理。例如,考虑在私有网10网络(I1)上具有本地IP地址的代理,以及第二连接到公共因特网(I2)的代理。来自I1的候选者在与同一专用网10网络上的对等者通信时可直接访问,而来自I2的候选者在与公共因特网上的对等者通信时可直接访问。在发送报价之前,报价代理不会试图猜测哪个IP地址有效,而是在报价中包含两个候选人。
Next, the agent uses STUN or TURN to obtain additional candidates. These come in two flavors: translated addresses on the public side of a NAT (SERVER REFLEXIVE CANDIDATES) and addresses on TURN servers (RELAYED CANDIDATES). When TURN servers are utilized, both types of candidates are obtained from the TURN server. If only STUN servers are utilized, only server reflexive candidates are obtained from them. The relationship of these candidates to the host candidate is shown in Figure 2. In this figure, both types of candidates are discovered using TURN. In the figure, the notation X:x means IP address X and UDP port x.
接下来,代理使用眩晕或转身来获得其他候选。它们有两种风格:NAT公共端的翻译地址(服务器自反候选)和TURN服务器上的地址(中继候选)。当使用TURN服务器时,两种类型的候选者都从TURN服务器获得。如果仅使用STUN服务器,则仅从它们获得服务器自反候选。这些候选对象与宿主候选对象的关系如图2所示。在这个图中,两种类型的候选者都是使用TURN发现的。在图中,符号X:X表示IP地址X和UDP端口X。
To Internet
上网
| | | /------------ Relayed Y:y | / Address +--------+ | | | TURN | | Server | | | +--------+ | | | /------------ Server X1':x1'|/ Reflexive +------------+ Address | NAT | +------------+ | | /------------ Local X:x |/ Address +--------+ | | | Agent | | | +--------+
| | | /------------ Relayed Y:y | / Address +--------+ | | | TURN | | Server | | | +--------+ | | | /------------ Server X1':x1'|/ Reflexive +------------+ Address | NAT | +------------+ | | /------------ Local X:x |/ Address +--------+ | | | Agent | | | +--------+
Figure 2: Candidate Relationships
图2:候选关系
When the agent sends the TURN Allocate request from IP address and port X:x, the NAT (assuming there is one) will create a binding X1':x1', mapping this server reflexive candidate to the host candidate X:x. Outgoing packets sent from the host candidate will be translated by the NAT to the server reflexive candidate. Incoming packets sent to the server reflexive candidate will be translated by the NAT to the host candidate and forwarded to the agent. We call the host candidate associated with a given server reflexive candidate the BASE.
当代理从IP地址和端口X:X发送TURN Allocate请求时,NAT(假设有一个)将创建绑定X1':X1',将此服务器自反候选映射到主机候选X:X。从主机候选发送的传出数据包将由NAT转换为服务器自反候选。发送到服务器自反候选的传入数据包将由NAT转换为主机候选并转发给代理。我们将与给定服务器自反候选关联的主机候选称为基。
Note: "Base" refers to the address an agent sends from for a particular candidate. Thus, as a degenerate case host candidates also have a base, but it's the same as the host candidate.
注:“基”是指代理为特定候选人发送的地址。因此,作为一种退化情况,宿主候选者也有一个基数,但它与宿主候选者相同。
When there are multiple NATs between the agent and the TURN server, the TURN request will create a binding on each NAT, but only the outermost server reflexive candidate (the one nearest the TURN
当代理和TURN服务器之间存在多个NAT时,TURN请求将在每个NAT上创建绑定,但仅在最外层的服务器自反候选(离TURN最近的一个)上创建绑定
server) will be discovered by the agent. If the agent is not behind a NAT, then the base candidate will be the same as the server reflexive candidate and the server reflexive candidate is redundant and will be eliminated.
服务器)将由代理发现。如果代理不在NAT后面,那么基本候选将与服务器自反候选相同,并且服务器自反候选是冗余的,将被消除。
The Allocate request then arrives at the TURN server. The TURN server allocates a port y from its local IP address Y, and generates an Allocate response, informing the agent of this relayed candidate. The TURN server also informs the agent of the server reflexive candidate, X1':x1' by copying the source transport address of the Allocate request into the Allocate response. The TURN server acts as a packet relay, forwarding traffic between L and R. In order to send traffic to L, R sends traffic to the TURN server at Y:y, and the TURN server forwards that to X1':x1', which passes through the NAT where it is mapped to X:x and delivered to L.
然后,分配请求到达TURN服务器。TURN服务器从其本地IP地址y分配端口y,并生成分配响应,将此中继候选通知代理。TURN服务器还通过将Allocate请求的源传输地址复制到Allocate响应中来通知代理服务器自反候选者X1':X1'。转弯服务器充当数据包中继,在L和R之间转发流量。为了向L发送流量,R在Y:Y向转弯服务器发送流量,转弯服务器将该流量转发到X1':X1',该流量通过NAT,在NAT中映射到X:X并传递到L。
When only STUN servers are utilized, the agent sends a STUN Binding request [RFC5389] to its STUN server. The STUN server will inform the agent of the server reflexive candidate X1':x1' by copying the source transport address of the Binding request into the Binding response.
当仅使用STUN服务器时,代理向其STUN服务器发送STUN绑定请求[RFC5389]。通过将绑定请求的源传输地址复制到绑定响应中,STUN服务器将通知代理服务器自反候选X1':X1'。
Once L has gathered all of its candidates, it orders them in highest to lowest priority and sends them to R over the signaling channel. The candidates are carried in attributes in the SDP offer. When R receives the offer, it performs the same gathering process and responds with its own list of candidates. At the end of this process, each agent has a complete list of both its candidates and its peer's candidates. It pairs them up, resulting in CANDIDATE PAIRS. To see which pairs work, each agent schedules a series of CHECKS. Each check is a STUN request/response transaction that the client will perform on a particular candidate pair by sending a STUN request from the local candidate to the remote candidate.
一旦L收集了它的所有候选对象,它将它们按从高到低的优先级排序,并通过信令通道将它们发送给R。在SDP报价中,候选人被列入属性。当R收到报价时,它执行相同的收集过程,并用自己的候选列表进行响应。在这个过程结束时,每个代理都有一个完整的候选名单和其对等代理的候选名单。它将它们配对,从而生成候选对。要查看哪些对有效,每个代理都会安排一系列检查。每个检查都是一个STUN请求/响应事务,客户端将通过从本地候选者向远程候选者发送STUN请求来对特定候选者对执行该事务。
The basic principle of the connectivity checks is simple:
连接检查的基本原理很简单:
1. Sort the candidate pairs in priority order.
1. 按优先级顺序对候选对进行排序。
2. Send checks on each candidate pair in priority order.
2. 按优先级顺序发送对每个候选对的检查。
3. Acknowledge checks received from the other agent.
3. 确认从其他代理收到的支票。
With both agents performing a check on a candidate pair, the result is a 4-way handshake:
当两个代理对候选对执行检查时,结果是4路握手:
L R - - STUN request -> \ L's <- STUN response / check
L R--晕眩请求->\L的<-晕眩响应/检查
<- STUN request \ R's STUN response -> / check
<- STUN request \ R's STUN response -> / check
Figure 3: Basic Connectivity Check
图3:基本连接检查
It is important to note that the STUN requests are sent to and from the exact same IP addresses and ports that will be used for media (e.g., RTP and RTCP). Consequently, agents demultiplex STUN and RTP/ RTCP using contents of the packets, rather than the port on which they are received. Fortunately, this demultiplexing is easy to do, especially for RTP and RTCP.
需要注意的是,STUN请求发送至和发送自将用于介质(例如RTP和RTCP)的完全相同的IP地址和端口。因此,代理使用数据包的内容而不是接收它们的端口来解复用STUN和RTP/RTCP。幸运的是,这种解复用很容易实现,特别是对于RTP和RTCP。
Because a STUN Binding request is used for the connectivity check, the STUN Binding response will contain the agent's translated transport address on the public side of any NATs between the agent and its peer. If this transport address is different from other candidates the agent already learned, it represents a new candidate, called a PEER REFLEXIVE CANDIDATE, which then gets tested by ICE just the same as any other candidate.
因为STUN绑定请求用于连接检查,所以STUN绑定响应将在代理与其对等方之间的任何NAT的公共端包含代理的翻译传输地址。如果此传输地址与代理已学习的其他候选地址不同,则它表示一个新的候选地址,称为对等自反候选地址,然后由ICE对其进行测试,测试结果与任何其他候选地址相同。
As an optimization, as soon as R gets L's check message, R schedules a connectivity check message to be sent to L on the same candidate pair. This accelerates the process of finding a valid candidate, and is called a TRIGGERED CHECK.
作为一种优化,只要R获得L的检查消息,R就会安排一条连接检查消息发送到同一候选对上的L。这加快了寻找有效候选对象的过程,称为触发检查。
At the end of this handshake, both L and R know that they can send (and receive) messages end-to-end in both directions.
在握手结束时,L和R都知道他们可以在两个方向上端到端地发送(和接收)消息。
Because the algorithm above searches all candidate pairs, if a working pair exists it will eventually find it no matter what order the candidates are tried in. In order to produce faster (and better) results, the candidates are sorted in a specified order. The resulting list of sorted candidate pairs is called the CHECK LIST. The algorithm is described in Section 4.1.2 but follows two general principles:
因为上面的算法搜索所有候选对,如果存在一个工作对,那么不管候选对的尝试顺序如何,它最终都会找到它。为了产生更快(更好)的结果,候选项按指定顺序排序。排序后的候选对的结果列表称为检查列表。第4.1.2节描述了该算法,但遵循两个一般原则:
o Each agent gives its candidates a numeric priority, which is sent along with the candidate to the peer.
o 每个代理为其候选者提供一个数字优先级,该优先级与候选者一起发送给对等方。
o The local and remote priorities are combined so that each agent has the same ordering for the candidate pairs.
o 本地和远程优先级组合在一起,以便每个代理对候选对具有相同的排序。
The second property is important for getting ICE to work when there are NATs in front of L and R. Frequently, NATs will not allow packets in from a host until the agent behind the NAT has sent a packet towards that host. Consequently, ICE checks in each direction will not succeed until both sides have sent a check through their respective NATs.
当L和R前面有NAT时,第二个属性对于使ICE工作很重要。通常,NAT将不允许来自主机的数据包进入,直到NAT后面的代理向该主机发送数据包。因此,在双方通过各自的NAT发送检查之前,每个方向的ICE检查都不会成功。
The agent works through this check list by sending a STUN request for the next candidate pair on the list periodically. These are called ORDINARY CHECKS.
代理通过定期发送列表上下一个候选对的STUN请求来完成此检查列表。这些被称为普通支票。
In general, the priority algorithm is designed so that candidates of similar type get similar priorities and so that more direct routes (that is, through fewer media relays and through fewer NATs) are preferred over indirect ones (ones with more media relays and more NATs). Within those guidelines, however, agents have a fair amount of discretion about how to tune their algorithms.
通常,优先级算法的设计是为了使相似类型的候选者获得相似的优先级,并使更多的直接路由(即通过更少的媒体中继和更少的NAT)优于间接路由(具有更多媒体中继和更多NAT的路由)。然而,在这些准则中,代理对于如何调整其算法有相当大的自由裁量权。
The previous description only addresses the case where the agents wish to establish a media session with one COMPONENT (a piece of a media stream requiring a single transport address; a media stream may require multiple components, each of which has to work for the media stream as a whole to be work). Typically (e.g., with RTP and RTCP), the agents actually need to establish connectivity for more than one flow.
前面的描述仅涉及代理希望与一个组件建立媒体会话的情况(媒体流的一段需要单个传输地址;媒体流可能需要多个组件,每个组件都必须工作以使整个媒体流工作)。通常(例如,使用RTP和RTCP),代理实际上需要为多个流建立连接。
The network properties are likely to be very similar for each component (especially because RTP and RTCP are sent and received from the same IP address). It is usually possible to leverage information from one media component in order to determine the best candidates for another. ICE does this with a mechanism called "frozen candidates".
每个组件的网络属性可能非常相似(特别是因为RTP和RTCP是从同一IP地址发送和接收的)。通常可以利用来自一个媒体组件的信息来确定另一个媒体组件的最佳候选。ICE通过一种称为“冻结候选对象”的机制来实现这一点。
Each candidate is associated with a property called its FOUNDATION. Two candidates have the same foundation when they are "similar" -- of the same type and obtained from the same host candidate and STUN server using the same protocol. Otherwise, their foundation is different. A candidate pair has a foundation too, which is just the concatenation of the foundations of its two candidates. Initially, only the candidate pairs with unique foundations are tested. The other candidate pairs are marked "frozen". When the connectivity checks for a candidate pair succeed, the other candidate pairs with
每个候选都与一个称为基金会的属性相关联。两个候选者在“相似”时具有相同的基础——相同类型,并从相同的主机候选和STUN服务器获得相同的协议。否则,他们的基础就不一样了。候选对也有一个基础,这只是它的两个候选者的基础的连接。最初,只测试具有唯一基础的候选对。其他候选对标记为“冻结”。当连接检查一个候选对成功时,其他候选对
the same foundation are unfrozen. This avoids repeated checking of components that are superficially more attractive but in fact are likely to fail.
同样的地基被解冻了。这样可以避免重复检查表面上更吸引人但实际上很可能失败的组件。
While we've described "frozen" here as a separate mechanism for expository purposes, in fact it is an integral part of ICE and the ICE prioritization algorithm automatically ensures that the right candidates are unfrozen and checked in the right order.
虽然我们在这里将“冻结”描述为一种单独的机制,用于解释目的,但实际上它是ICE的一个组成部分,ICE优先级算法自动确保以正确的顺序解冻和检查正确的候选对象。
Because ICE is used to discover which addresses can be used to send media between two agents, it is important to ensure that the process cannot be hijacked to send media to the wrong location. Each STUN connectivity check is covered by a message authentication code (MAC) computed using a key exchanged in the signaling channel. This MAC provides message integrity and data origin authentication, thus stopping an attacker from forging or modifying connectivity check messages. Furthermore, if the SIP [RFC3261] caller is using ICE, and their call forks, the ICE exchanges happen independently with each forked recipient. In such a case, the keys exchanged in the signaling help associate each ICE exchange with each forked recipient.
由于ICE用于发现可用于在两个代理之间发送媒体的地址,因此必须确保进程不会被劫持以将媒体发送到错误的位置。每个STUN连接检查由使用信令信道中交换的密钥计算的消息认证码(MAC)覆盖。此MAC提供消息完整性和数据源身份验证,从而阻止攻击者伪造或修改连接检查消息。此外,如果SIP[RFC3261]呼叫方正在使用ICE及其呼叫分叉,则ICE交换将独立于每个分叉的接收方进行。在这种情况下,信令中交换的密钥有助于将每个ICE交换与每个分叉接收者相关联。
ICE checks are performed in a specific sequence, so that high-priority candidate pairs are checked first, followed by lower-priority ones. One way to conclude ICE is to declare victory as soon as a check for each component of each media stream completes successfully. Indeed, this is a reasonable algorithm, and details for it are provided below. However, it is possible that a packet loss will cause a higher-priority check to take longer to complete. In that case, allowing ICE to run a little longer might produce better results. More fundamentally, however, the prioritization defined by this specification may not yield "optimal" results. As an example, if the aim is to select low-latency media paths, usage of a relay is a hint that latencies may be higher, but it is nothing more than a hint. An actual round-trip time (RTT) measurement could be made, and it might demonstrate that a pair with lower priority is actually better than one with higher priority.
ICE检查按特定顺序执行,以便首先检查高优先级候选对,然后检查低优先级候选对。结束ICE的一种方法是,一旦每个媒体流的每个组件的检查成功完成,就宣布胜利。事实上,这是一个合理的算法,下面提供了详细信息。然而,数据包丢失可能会导致更高优先级的检查需要更长的时间才能完成。在这种情况下,让冰运行更长时间可能会产生更好的结果。然而,更根本的是,本规范定义的优先级可能不会产生“最佳”结果。例如,如果目的是选择低延迟媒体路径,那么使用中继就是提示延迟可能更高,但它只不过是一个提示。可以进行实际的往返时间(RTT)测量,它可以证明优先级较低的一对实际上比优先级较高的一对更好。
Consequently, ICE assigns one of the agents in the role of the CONTROLLING AGENT, and the other of the CONTROLLED AGENT. The controlling agent gets to nominate which candidate pairs will get used for media amongst the ones that are valid. It can do this in one of two ways -- using REGULAR NOMINATION or AGGRESSIVE NOMINATION.
因此,ICE分配一个代理作为控制代理,另一个代理作为受控代理。控制代理可以在有效的候选对中指定哪些候选对将用于媒体。它可以通过两种方式之一做到这一点——定期提名或积极提名。
With regular nomination, the controlling agent lets the checks continue until at least one valid candidate pair for each media stream is found. Then, it picks amongst those that are valid, and sends a second STUN request on its NOMINATED candidate pair, but this time with a flag set to tell the peer that this pair has been nominated for use. This is shown in Figure 4.
对于常规提名,控制代理允许继续检查,直到找到每个媒体流的至少一个有效候选对为止。然后,它从有效的候选对中进行挑选,并对其指定的候选对发送第二个眩晕请求,但这次设置了一个标志,告知对等方该对已被指定使用。这如图4所示。
L R - - STUN request -> \ L's <- STUN response / check
L R--晕眩请求->\L的<-晕眩响应/检查
<- STUN request \ R's STUN response -> / check
<- STUN request \ R's STUN response -> / check
STUN request + flag -> \ L's <- STUN response / check
STUN request + flag -> \ L's <- STUN response / check
Figure 4: Regular Nomination
图4:定期提名
Once the STUN transaction with the flag completes, both sides cancel any future checks for that media stream. ICE will now send media using this pair. The pair an ICE agent is using for media is called the SELECTED PAIR.
一旦带有该标志的STUN事务完成,双方将取消对该媒体流的任何未来检查。ICE现在将使用此对发送媒体。ICE代理用于介质的对称为所选对。
In aggressive nomination, the controlling agent puts the flag in every STUN request it sends. This way, once the first check succeeds, ICE processing is complete for that media stream and the controlling agent doesn't have to send a second STUN request. The selected pair will be the highest-priority valid pair whose check succeeded. Aggressive nomination is faster than regular nomination, but gives less flexibility. Aggressive nomination is shown in Figure 5.
在攻击性提名中,控制代理在其发送的每一个晕眩请求中都插上旗子。这样,一旦第一次检查成功,该媒体流的ICE处理就完成了,并且控制代理不必发送第二次STUN请求。所选对将是检查成功的最高优先级有效对。积极的提名比常规提名快,但灵活性较低。积极的提名如图5所示。
L R - - STUN request + flag -> \ L's <- STUN response / check
L R - - STUN request + flag -> \ L's <- STUN response / check
<- STUN request \ R's STUN response -> / check
<- STUN request \ R's STUN response -> / check
Figure 5: Aggressive Nomination
图5:积极的提名
Once all of the media streams are completed, the controlling endpoint sends an updated offer if the candidates in the m and c lines for the media stream (called the DEFAULT CANDIDATES) don't match ICE's SELECTED CANDIDATES.
一旦完成所有媒体流,如果媒体流的m行和c行中的候选(称为默认候选)与ICE选择的候选不匹配,则控制端点发送更新的要约。
Once ICE is concluded, it can be restarted at any time for one or all of the media streams by either agent. This is done by sending an updated offer indicating a restart.
一旦ICE结束,任何一个代理都可以随时为一个或所有媒体流重新启动ICE。这是通过发送指示重新启动的更新报价来完成的。
In order for ICE to be used in a call, both agents need to support it. However, certain agents will always be connected to the public Internet and have a public IP address at which it can receive packets from any correspondent. To make it easier for these devices to support ICE, ICE defines a special type of implementation called LITE (in contrast to the normal FULL implementation). A lite implementation doesn't gather candidates; it includes only host candidates for any media stream. Lite agents do not generate connectivity checks or run the state machines, though they need to be able to respond to connectivity checks. When a lite implementation connects with a full implementation, the full agent takes the role of the controlling agent, and the lite agent takes on the controlled role. When two lite implementations connect, no checks are sent.
为了在通话中使用ICE,两个代理都需要支持ICE。但是,某些代理将始终连接到公共Internet,并具有公共IP地址,可以在该地址接收来自任何通信方的数据包。为了使这些设备更容易支持ICE,ICE定义了一种称为LITE的特殊实现类型(与正常的完整实现不同)。lite实现不会收集候选对象;它只包括任何媒体流的主机候选。Lite代理不生成连接检查或运行状态机,尽管它们需要能够响应连接检查。当lite实现与完整实现连接时,完整代理扮演控制代理的角色,lite代理扮演受控角色。当两个lite实现连接时,不会发送任何检查。
For guidance on when a lite implementation is appropriate, see the discussion in Appendix A.
有关lite实施何时合适的指导,请参见附录a中的讨论。
It is important to note that the lite implementation was added to this specification to provide a stepping stone to full implementation. Even for devices that are always connected to the public Internet, a full implementation is preferable if achievable.
重要的是要注意,lite实现被添加到本规范中,以提供完整实现的垫脚石。即使对于始终连接到公共互联网的设备,如果可以实现,完整的实现也是可取的。
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119].
本文件中的关键词“必须”、“不得”、“要求”、“应”、“不应”、“应”、“不应”、“建议”、“可”和“可选”应按照RFC 2119[RFC2119]中所述进行解释。
Readers should be familiar with the terminology defined in the offer/ answer model [RFC3264], STUN [RFC5389], and NAT Behavioral requirements for UDP [RFC4787].
读者应熟悉UDP的提供/应答模型[RFC3264]、STUN[RFC5389]和NAT行为要求[RFC4787]中定义的术语。
This specification makes use of the following additional terminology:
本规范使用了以下附加术语:
Agent: As defined in RFC 3264, an agent is the protocol implementation involved in the offer/answer exchange. There are two agents involved in an offer/answer exchange.
代理:根据RFC 3264中的定义,代理是参与提供/应答交换的协议实现。有两个代理参与报价/应答交换。
Peer: From the perspective of one of the agents in a session, its peer is the other agent. Specifically, from the perspective of the offerer, the peer is the answerer. From the perspective of the answerer, the peer is the offerer.
对等:从会话中一个代理的角度来看,它的对等代理是另一个代理。具体地说,从报价人的角度来看,对方是回答者。从回答者的角度来看,同伴是提供者。
Transport Address: The combination of an IP address and transport protocol (such as UDP or TCP) port.
传输地址:IP地址和传输协议(如UDP或TCP)端口的组合。
Candidate: A transport address that is a potential point of contact for receipt of media. Candidates also have properties -- their type (server reflexive, relayed or host), priority, foundation, and base.
候选地址:作为接收媒体的潜在联系人的传输地址。候选人也有属性——他们的类型(服务器自反,中继或主机),优先级,基础和基础。
Component: A component is a piece of a media stream requiring a single transport address; a media stream may require multiple components, each of which has to work for the media stream as a whole to work. For media streams based on RTP, there are two components per media stream -- one for RTP, and one for RTCP.
组件:组件是需要单个传输地址的媒体流的一部分;媒体流可能需要多个组件,每个组件都必须工作才能使媒体流作为一个整体工作。对于基于RTP的媒体流,每个媒体流有两个组件——一个用于RTP,一个用于RTCP。
Host Candidate: A candidate obtained by binding to a specific port from an IP address on the host. This includes IP addresses on physical interfaces and logical ones, such as ones obtained through Virtual Private Networks (VPNs) and Realm Specific IP (RSIP) [RFC3102] (which lives at the operating system level).
候选主机:通过从主机上的IP地址绑定到特定端口而获得的候选主机。这包括物理接口和逻辑接口上的IP地址,例如通过虚拟专用网络(VPN)和领域特定IP(RSIP)[RFC3102](位于操作系统级别)获得的IP地址。
Server Reflexive Candidate: A candidate whose IP address and port are a binding allocated by a NAT for an agent when it sent a packet through the NAT to a server. Server reflexive candidates can be learned by STUN servers using the Binding request, or TURN servers, which provides both a relayed and server reflexive candidate.
服务器自反候选:当代理通过NAT向服务器发送数据包时,其IP地址和端口是NAT为代理分配的绑定的候选。STUN服务器可以使用绑定请求或TURN服务器学习服务器自反候选者,后者提供中继和服务器自反候选者。
Peer Reflexive Candidate: A candidate whose IP address and port are a binding allocated by a NAT for an agent when it sent a STUN Binding request through the NAT to its peer.
对等自反候选:当代理通过NAT向其对等方发送STUN绑定请求时,其IP地址和端口是NAT为代理分配的绑定的候选。
Relayed Candidate: A candidate obtained by sending a TURN Allocate request from a host candidate to a TURN server. The relayed candidate is resident on the TURN server, and the TURN server relays packets back towards the agent.
中继候选者:通过从主机候选者向回合服务器发送回合分配请求而获得的候选者。中继的候选者驻留在TURN服务器上,TURN服务器将数据包中继回代理。
Base: The base of a server reflexive candidate is the host candidate from which it was derived. A host candidate is also said to have a base, equal to that candidate itself. Similarly, the base of a relayed candidate is that candidate itself.
Base:服务器自反候选的基是从中派生的主机候选。所谓东道主候选人也有一个基数,等于该候选人本身。类似地,中继候选的基础是该候选本身。
Foundation: An arbitrary string that is the same for two candidates that have the same type, base IP address, protocol (UDP, TCP, etc.), and STUN or TURN server. If any of these are different, then the foundation will be different. Two candidate pairs with the same foundation pairs are likely to have similar network characteristics. Foundations are used in the frozen algorithm.
基础:一个任意字符串,对于具有相同类型、基本IP地址、协议(UDP、TCP等)和STUN或TURN服务器的两个候选者来说是相同的。如果其中任何一个都不同,那么基金会将有所不同。具有相同的基对的两个候选对很可能具有相似的网络特性。冻结算法中使用了基础。
Local Candidate: A candidate that an agent has obtained and included in an offer or answer it sent.
本地候选人:代理人已获得并包含在其发送的报价或答复中的候选人。
Remote Candidate: A candidate that an agent received in an offer or answer from its peer.
远程候选人:代理在其对等方的报价或答复中收到的候选人。
Default Destination/Candidate: The default destination for a component of a media stream is the transport address that would be used by an agent that is not ICE aware. For the RTP component, the default IP address is in the c line of the SDP, and the port is in the m line. For the RTCP component, it is in the rtcp attribute when present, and when not present, the IP address is in the c line and 1 plus the port is in the m line. A default candidate for a component is one whose transport address matches the default destination for that component.
默认目的地/候选目的地:媒体流组件的默认目的地是不知道ICE的代理将使用的传输地址。对于RTP组件,默认IP地址在SDP的c行中,端口在m行中。对于RTCP组件,存在时在RTCP属性中,不存在时,IP地址在c行中,1加上端口在m行中。组件的默认候选者是其传输地址与该组件的默认目标匹配的候选者。
Candidate Pair: A pairing containing a local candidate and a remote candidate.
候选对:包含本地候选和远程候选的对。
Check, Connectivity Check, STUN Check: A STUN Binding request transaction for the purposes of verifying connectivity. A check is sent from the local candidate to the remote candidate of a candidate pair.
检查、连接检查、眩晕检查:用于验证连接的眩晕绑定请求事务。将检查从本地候选发送到候选对的远程候选。
Check List: An ordered set of candidate pairs that an agent will use to generate checks.
检查列表:代理将用于生成检查的候选对的有序集。
Ordinary Check: A connectivity check generated by an agent as a consequence of a timer that fires periodically, instructing it to send a check.
普通检查:由代理生成的连接检查,作为定时触发的结果,指示其发送检查。
Triggered Check: A connectivity check generated as a consequence of the receipt of a connectivity check from the peer.
触发检查:从对等方收到连接检查后生成的连接检查。
Valid List: An ordered set of candidate pairs for a media stream that have been validated by a successful STUN transaction.
有效列表:已通过成功的STUN事务验证的媒体流候选对的有序集。
Full: An ICE implementation that performs the complete set of functionality defined by this specification.
完整:执行本规范定义的完整功能集的ICE实现。
Lite: An ICE implementation that omits certain functions, implementing only as much as is necessary for a peer implementation that is full to gain the benefits of ICE. Lite implementations do not maintain any of the state machines and do not generate connectivity checks.
Lite:一种ICE实现,它省略了某些功能,只实现完全可以获得ICE好处的对等实现所需的功能。Lite实现不维护任何状态机,也不生成连接检查。
Controlling Agent: The ICE agent that is responsible for selecting the final choice of candidate pairs and signaling them through STUN and an updated offer, if needed. In any session, one agent is always controlling. The other is the controlled agent.
控制代理:ICE代理,负责选择候选对的最终选择,并在需要时通过STUN和更新的报价发送信号。在任何会话中,始终由一个代理控制。另一个是受控代理。
Controlled Agent: An ICE agent that waits for the controlling agent to select the final choice of candidate pairs.
受控代理:等待控制代理选择最终候选对的ICE代理。
Regular Nomination: The process of picking a valid candidate pair for media traffic by validating the pair with one STUN request, and then picking it by sending a second STUN request with a flag indicating its nomination.
常规提名:为媒体流量挑选有效候选对的过程,通过一个眩晕请求验证该对,然后通过发送第二个眩晕请求(带有指示其提名的标志)来挑选该对。
Aggressive Nomination: The process of picking a valid candidate pair for media traffic by including a flag in every STUN request, such that the first one to produce a valid candidate pair is used for media.
积极提名:通过在每个昏迷请求中包含一个标志,为媒体流量挑选有效候选对的过程,以便第一个产生有效候选对的候选对用于媒体。
Nominated: If a valid candidate pair has its nominated flag set, it means that it may be selected by ICE for sending and receiving media.
指定:如果有效候选对设置了其指定标志,则表示ICE可以选择该候选对发送和接收媒体。
Selected Pair, Selected Candidate: The candidate pair selected by ICE for sending and receiving media is called the selected pair, and each of its candidates is called the selected candidate.
所选对,所选候选者:ICE选择用于发送和接收媒体的候选者对称为所选对,其每个候选者称为所选候选者。
In order to send the initial offer in an offer/answer exchange, an agent must (1) gather candidates, (2) prioritize them, (3) eliminate redundant candidates, (4) choose default candidates, and then (5) formulate and send the SDP offer. All but the last of these five steps differ for full and lite implementations.
为了在报价/应答交换中发送初始报价,代理必须(1)收集候选人,(2)优先考虑他们,(3)消除多余的候选人,(4)选择默认候选人,然后(5)制定并发送SDP报价。这五个步骤中的最后一个步骤对于完整实现和精简实现都有所不同。
An agent gathers candidates when it believes that communication is imminent. An offerer can do this based on a user interface cue, or based on an explicit request to initiate a session. Every candidate
代理人在认为沟通即将到来时收集候选人。报价人可以基于用户界面提示,或者基于发起会话的明确请求来执行此操作。每位候选人
is a transport address. It also has a type and a base. Four types are defined and gathered by this specification -- host candidates, server reflexive candidates, peer reflexive candidates, and relayed candidates. The server reflexive candidates are gathered using STUN or TURN, and relayed candidates are obtained through TURN. Peer reflexive candidates are obtained in later phases of ICE, as a consequence of connectivity checks. The base of a candidate is the candidate that an agent must send from when using that candidate.
是一个传输地址。它还有一个类型和一个基。本规范定义并收集了四种类型——主机候选、服务器自反候选、对等自反候选和中继候选。使用STUN或TURN收集服务器自反候选,通过TURN获得中继候选。作为连通性检查的结果,在ICE的后期阶段获得对等自反候选。候选对象的基础是代理在使用该候选对象时必须发送的候选对象。
The first step is to gather host candidates. Host candidates are obtained by binding to ports (typically ephemeral) on a IP address attached to an interface (physical or virtual, including VPN interfaces) on the host.
第一步是收集东道主候选人。通过绑定到连接到主机上接口(物理或虚拟,包括VPN接口)的IP地址上的端口(通常是短暂的)来获得候选主机。
For each UDP media stream the agent wishes to use, the agent SHOULD obtain a candidate for each component of the media stream on each IP address that the host has. It obtains each candidate by binding to a UDP port on the specific IP address. A host candidate (and indeed every candidate) is always associated with a specific component for which it is a candidate. Each component has an ID assigned to it, called the component ID. For RTP-based media streams, the RTP itself has a component ID of 1, and RTCP a component ID of 2. If an agent is using RTCP, it MUST obtain a candidate for it. If an agent is using both RTP and RTCP, it would end up with 2*K host candidates if an agent has K IP addresses.
对于代理希望使用的每个UDP媒体流,代理应在主机拥有的每个IP地址上为媒体流的每个组件获取候选。它通过绑定到特定IP地址上的UDP端口来获得每个候选端口。候选主机(实际上是每个候选主机)始终与它作为候选主机的特定组件相关联。每个组件都有一个分配给它的ID,称为组件ID。对于基于RTP的媒体流,RTP本身的组件ID为1,RTCP的组件ID为2。如果代理正在使用RTCP,则必须为其获取候选。如果一个代理同时使用RTP和RTCP,那么如果一个代理有K个IP地址,那么它将得到2*K个主机候选。
The base for each host candidate is set to the candidate itself.
每个主机候选的基数设置为候选本身。
Agents SHOULD obtain relayed candidates and SHOULD obtain server reflexive candidates. These requirements are at SHOULD strength to allow for provider variation. Use of STUN and TURN servers may be unnecessary in closed networks where agents are never connected to the public Internet or to endpoints outside of the closed network. In such cases, a full implementation would be used for agents that are dual stack or multihomed, to select a host candidate. Use of TURN servers is expensive, and when ICE is being used, they will only be utilized when both endpoints are behind NATs that perform address and port dependent mapping. Consequently, some deployments might consider this use case to be marginal, and elect not to use TURN servers. If an agent does not gather server reflexive or relayed candidates, it is RECOMMENDED that the functionality be implemented and just disabled through configuration, so that it can be re-enabled through configuration if conditions change in the future.
代理应获得中继候选,并应获得服务器自反候选。这些要求应具有足够的强度,以允许供应商变更。在封闭网络中,可能不需要使用STUN和TURN服务器,因为代理从未连接到公共Internet或封闭网络之外的端点。在这种情况下,双栈或多宿代理将使用完整的实现来选择候选主机。TURN服务器的使用非常昂贵,当使用ICE时,只有当两个端点都位于执行地址和端口相关映射的NAT之后时,才会使用它们。因此,一些部署可能会认为这种用例是边缘的,并且选择不使用转弯服务器。如果代理未收集服务器自反或中继候选,建议通过配置实现并禁用该功能,以便在将来条件发生变化时通过配置重新启用该功能。
If an agent is gathering both relayed and server reflexive candidates, it uses a TURN server. If it is gathering just server reflexive candidates, it uses a STUN server.
如果一个代理同时收集中继和服务器自反候选,它将使用TURN服务器。如果它只是收集服务器自反候选项,那么它将使用一个眩晕服务器。
The agent next pairs each host candidate with the STUN or TURN server with which it is configured or has discovered by some means. If a STUN or TURN server is configured, it is RECOMMENDED that a domain name be configured, and the DNS procedures in [RFC5389] (using SRV records with the "stun" service) be used to discover the STUN server, and the DNS procedures in [RFC5766] (using SRV records with the "turn" service) be used to discover the TURN server.
接下来,代理将每个候选主机与STUN或TURN服务器配对,STUN或TURN服务器通过某种方式配置或发现。如果配置了STUN或TURN服务器,建议配置域名,[RFC5389]中的DNS过程(使用SRV记录和“STUN”服务)用于发现STUN服务器,[RFC5766]中的DNS过程(使用SRV记录和“TURN”服务)用于发现TURN服务器。
This specification only considers usage of a single STUN or TURN server. When there are multiple choices for that single STUN or TURN server (when, for example, they are learned through DNS records and multiple results are returned), an agent SHOULD use a single STUN or TURN server (based on its IP address) for all candidates for a particular session. This improves the performance of ICE. The result is a set of pairs of host candidates with STUN or TURN servers. The agent then chooses one pair, and sends a Binding or Allocate request to the server from that host candidate. Binding requests to a STUN server are not authenticated, and any ALTERNATE-SERVER attribute in a response is ignored. Agents MUST support the backwards compatibility mode for the Binding request defined in [RFC5389]. Allocate requests SHOULD be authenticated using a long-term credential obtained by the client through some other means.
本规范仅考虑使用单个昏迷或转身服务器。当单个STUN或TURN服务器有多个选项时(例如,当通过DNS记录了解这些选项并返回多个结果时),代理应为特定会话的所有候选服务器使用单个STUN或TURN服务器(基于其IP地址)。这提高了ICE的性能。结果是一组成对的主机候选,带有眩晕或转身服务器。然后,代理选择一对,并从该候选主机向服务器发送绑定或分配请求。对STUN服务器的绑定请求未经过身份验证,响应中的任何备用服务器属性都将被忽略。代理必须支持[RFC5389]中定义的绑定请求的向后兼容模式。分配请求应该使用客户端通过其他方式获得的长期凭证进行身份验证。
Every Ta milliseconds thereafter, the agent can generate another new STUN or TURN transaction. This transaction can either be a retry of a previous transaction that failed with a recoverable error (such as authentication failure), or a transaction for a new host candidate and STUN or TURN server pair. The agent SHOULD NOT generate transactions more frequently than one every Ta milliseconds. See Section 16 for guidance on how to set Ta and the STUN retransmit timer, RTO.
此后每隔一个Ta毫秒,代理就可以生成另一个新的昏迷或转身事务。此事务可以是由于可恢复错误(如身份验证失败)而失败的前一个事务的重试,也可以是新的候选主机和STUN或TURN服务器对的事务。代理生成事务的频率不应超过每Ta毫秒一次。有关如何设置Ta和STUN重传计时器RTO的指南,请参见第16节。
The agent will receive a Binding or Allocate response. A successful Allocate response will provide the agent with a server reflexive candidate (obtained from the mapped address) and a relayed candidate in the XOR-RELAYED-ADDRESS attribute. If the Allocate request is rejected because the server lacks resources to fulfill it, the agent SHOULD instead send a Binding request to obtain a server reflexive candidate. A Binding response will provide the agent with only a server reflexive candidate (also obtained from the mapped address). The base of the server reflexive candidate is the host candidate from which the Allocate or Binding request was sent. The base of a relayed candidate is that candidate itself. If a relayed candidate
代理将收到绑定或分配响应。成功的分配响应将为代理提供服务器自反候选(从映射地址获得)和XOR-relayed-address属性中的中继候选。如果分配请求因服务器缺少资源而被拒绝,则代理应该发送绑定请求以获取服务器自反候选。绑定响应将仅为代理提供服务器自反候选(也从映射地址获得)。服务器自反候选的基础是发送分配或绑定请求的主机候选。中继候选对象的基础是该候选对象本身。如果一个中继候选人
is identical to a host candidate (which can happen in rare cases), the relayed candidate MUST be discarded.
与主机候选相同(在极少数情况下可能发生),中继候选必须被丢弃。
Finally, the agent assigns each candidate a foundation. The foundation is an identifier, scoped within a session. Two candidates MUST have the same foundation ID when all of the following are true:
最后,代理为每个候选分配一个基础。基础是一个标识符,作用于会话内。两个候选人必须具有相同的基础身份证时,以下所有是真实的:
o they are of the same type (host, relayed, server reflexive, or peer reflexive).
o 它们属于同一类型(主机、中继、服务器反射或对等反射)。
o their bases have the same IP address (the ports can be different).
o 它们的基址具有相同的IP地址(端口可以不同)。
o for reflexive and relayed candidates, the STUN or TURN servers used to obtain them have the same IP address.
o 对于自反和中继候选,用于获取它们的STUN或TURN服务器具有相同的IP地址。
o they were obtained using the same transport protocol (TCP, UDP, etc.).
o 它们是使用相同的传输协议(TCP、UDP等)获得的。
Similarly, two candidates MUST have different foundations if their types are different, their bases have different IP addresses, the STUN or TURN servers used to obtain them have different IP addresses, or their transport protocols are different.
类似地,如果两个候选人的类型不同,他们的基础具有不同的IP地址,用于获取他们的STUN或TURN服务器具有不同的IP地址,或者他们的传输协议不同,那么他们必须具有不同的基础。
Once server reflexive and relayed candidates are allocated, they MUST be kept alive until ICE processing has completed, as described in Section 8.3. For server reflexive candidates learned through a Binding request, the bindings MUST be kept alive by additional Binding requests to the server. Refreshes for allocations are done using the Refresh transaction, as described in [RFC5766]. The Refresh requests will also refresh the server reflexive candidate.
一旦分配了服务器自反和中继候选服务器,它们必须保持活动状态,直到ICE处理完成,如第8.3节所述。对于通过绑定请求学习的服务器自反候选项,必须通过向服务器发送额外的绑定请求来保持绑定的活动性。使用刷新事务完成分配刷新,如[RFC5766]中所述。刷新请求还将刷新服务器自反候选。
The prioritization process results in the assignment of a priority to each candidate. Each candidate for a media stream MUST have a unique priority that MUST be a positive integer between 1 and (2**31 - 1). This priority will be used by ICE to determine the order of the connectivity checks and the relative preference for candidates.
优先级排序过程会将优先级分配给每个候选人。媒体流的每个候选必须具有唯一的优先级,该优先级必须是介于1和(2**31-1)之间的正整数。ICE将使用该优先级来确定连接检查的顺序和候选项的相对偏好。
An agent SHOULD compute this priority using the formula in Section 4.1.2.1 and choose its parameters using the guidelines in Section 4.1.2.2. If an agent elects to use a different formula, ICE will take longer to converge since both agents will not be coordinated in their checks.
代理应使用第4.1.2.1节中的公式计算该优先级,并使用第4.1.2.2节中的指南选择其参数。如果一个代理选择使用不同的公式,ICE将需要更长的时间来收敛,因为两个代理在其检查中不会进行协调。
When using the formula, an agent computes the priority by determining a preference for each type of candidate (server reflexive, peer reflexive, relayed, and host), and, when the agent is multihomed, choosing a preference for its IP addresses. These two preferences are then combined to compute the priority for a candidate. That priority is computed using the following formula:
当使用该公式时,代理通过确定每种候选类型(服务器自反、对等自反、中继和主机)的首选项来计算优先级,并且当代理是多宿时,为其IP地址选择首选项。然后结合这两个首选项来计算候选项的优先级。该优先级使用以下公式计算:
priority = (2^24)*(type preference) + (2^8)*(local preference) + (2^0)*(256 - component ID)
priority = (2^24)*(type preference) + (2^8)*(local preference) + (2^0)*(256 - component ID)
The type preference MUST be an integer from 0 to 126 inclusive, and represents the preference for the type of the candidate (where the types are local, server reflexive, peer reflexive, and relayed). A 126 is the highest preference, and a 0 is the lowest. Setting the value to a 0 means that candidates of this type will only be used as a last resort. The type preference MUST be identical for all candidates of the same type and MUST be different for candidates of different types. The type preference for peer reflexive candidates MUST be higher than that of server reflexive candidates. Note that candidates gathered based on the procedures of Section 4.1.1 will never be peer reflexive candidates; candidates of these type are learned from the connectivity checks performed by ICE.
类型首选项必须是0到126(包括0到126)之间的整数,并表示候选类型的首选项(其中类型为本地、服务器自反、对等自反和中继)。126是最高的首选项,0是最低的首选项。将该值设置为0表示此类型的候选对象将仅用作最后手段。同一类型的所有候选项的类型首选项必须相同,不同类型的候选项的类型首选项必须不同。对等自反候选的类型首选项必须高于服务器自反候选的类型首选项。请注意,根据第4.1.1节的程序收集的候选人永远不会是同侪自反候选人;这些类型的候选者从ICE执行的连接检查中学习。
The local preference MUST be an integer from 0 to 65535 inclusive. It represents a preference for the particular IP address from which the candidate was obtained, in cases where an agent is multihomed. 65535 represents the highest preference, and a zero, the lowest. When there is only a single IP address, this value SHOULD be set to 65535. More generally, if there are multiple candidates for a particular component for a particular media stream that have the same type, the local preference MUST be unique for each one. In this specification, this only happens for multihomed hosts. If a host is multihomed because it is dual stack, the local preference SHOULD be set equal to the precedence value for IP addresses described in RFC 3484 [RFC3484].
本地首选项必须是0到65535(含0到65535)之间的整数。在代理是多宿的情况下,它表示从中获取候选的特定IP地址的首选项。65535代表最高偏好,0代表最低偏好。当只有一个IP地址时,该值应设置为65535。更一般地说,如果特定媒体流的特定组件有多个具有相同类型的候选者,则每个候选者的本地首选项必须是唯一的。在本规范中,这仅适用于多宿主主机。如果主机是多宿主机,因为它是双堆栈,则本地首选项应设置为RFC 3484[RFC3484]中描述的IP地址的优先级值。
The component ID is the component ID for the candidate, and MUST be between 1 and 256 inclusive.
组件ID是候选组件的组件ID,必须介于1和256之间(包括1和256)。
One criterion for selection of the type and local preference values is the use of a media intermediary, such as a TURN server, VPN server, or NAT. With a media intermediary, if media is sent to that
选择类型和本地首选项值的一个标准是使用媒体中介,例如TURN服务器、VPN服务器或NAT。使用媒体中介,如果媒体被发送到该中介
candidate, it will first transit the media intermediary before being received. Relayed candidates are one type of candidate that involves a media intermediary. Another are host candidates obtained from a VPN interface. When media is transited through a media intermediary, it can increase the latency between transmission and reception. It can increase the packet losses, because of the additional router hops that may be taken. It may increase the cost of providing service, since media will be routed in and right back out of a media intermediary run by a provider. If these concerns are important, the type preference for relayed candidates SHOULD be lower than host candidates. The RECOMMENDED values are 126 for host candidates, 100 for server reflexive candidates, 110 for peer reflexive candidates, and 0 for relayed candidates. Furthermore, if an agent is multihomed and has multiple IP addresses, the local preference for host candidates from a VPN interface SHOULD have a priority of 0.
候选人,在收到之前,将首先通过媒体中介。中继候选人是一种涉及媒体中介的候选人。另一个是从VPN接口获得的主机候选。当媒体通过媒体媒介传输时,会增加传输和接收之间的延迟。由于可能采取额外的路由器跳数,它会增加数据包丢失。这可能会增加提供服务的成本,因为媒体将被路由到由提供商运行的媒体中介并从中返回。如果这些问题很重要,中继候选者的类型偏好应低于主机候选者。对于主机候选,建议值为126;对于服务器自反候选,建议值为100;对于对等自反候选,建议值为110;对于中继候选,建议值为0。此外,如果一个代理是多址的,并且有多个IP地址,则VPN接口的主机候选本地首选项的优先级应为0。
Another criterion for selection of preferences is IP address family. ICE works with both IPv4 and IPv6. It therefore provides a transition mechanism that allows dual-stack hosts to prefer connectivity over IPv6, but to fall back to IPv4 in case the v6 networks are disconnected (due, for example, to a failure in a 6to4 relay) [RFC3056]. It can also help with hosts that have both a native IPv6 address and a 6to4 address. In such a case, higher local preferences could be assigned to the v6 addresses, followed by the 6to4 addresses, followed by the v4 addresses. This allows a site to obtain and begin using native v6 addresses immediately, yet still fall back to 6to4 addresses when communicating with agents in other sites that do not yet have native v6 connectivity.
选择首选项的另一个标准是IP地址系列。ICE同时适用于IPv4和IPv6。因此,它提供了一种转换机制,允许双栈主机优先选择连接而不是IPv6,但在v6网络断开连接(例如,由于6to4中继中的故障)的情况下返回IPv4)[RFC3056]。它还可以帮助同时具有本机IPv6地址和6to4地址的主机。在这种情况下,可以将更高的本地首选项分配给v6地址,然后是6to4地址,然后是v4地址。这允许站点立即获取并开始使用本机v6地址,但在与其他站点(尚未具有本机v6连接)中的代理进行通信时,仍然返回到6to4地址。
Another criterion for selecting preferences is security. If a user is a telecommuter, and therefore connected to a corporate network and a local home network, the user may prefer their voice traffic to be routed over the VPN in order to keep it on the corporate network when communicating within the enterprise, but use the local network when communicating with users outside of the enterprise. In such a case, a VPN address would have a higher local preference than any other address.
选择首选项的另一个标准是安全性。如果用户是远程工作者,因此连接到公司网络和本地家庭网络,则用户可能更喜欢通过VPN路由他们的语音通信,以便在企业内部通信时将其保持在公司网络上,但在与企业外部的用户通信时使用本地网络。在这种情况下,VPN地址将比任何其他地址具有更高的本地首选项。
Another criterion for selecting preferences is topological awareness. This is most useful for candidates that make use of intermediaries. In those cases, if an agent has preconfigured or dynamically discovered knowledge of the topological proximity of the intermediaries to itself, it can use that to assign higher local preferences to candidates obtained from closer intermediaries.
选择偏好的另一个标准是拓扑感知。这对于使用中介机构的候选人最为有用。在这些情况下,如果代理预先配置或动态发现了中介体与其自身拓扑接近性的知识,则可以使用该知识将更高的局部偏好分配给从更接近的中介体获得的候选对象。
Next, the agent eliminates redundant candidates. A candidate is redundant if its transport address equals another candidate, and its base equals the base of that other candidate. Note that two candidates can have the same transport address yet have different bases, and these would not be considered redundant. Frequently, a server reflexive candidate and a host candidate will be redundant when the agent is not behind a NAT. The agent SHOULD eliminate the redundant candidate with the lower priority.
接下来,代理消除多余的候选者。如果一个候选者的传输地址等于另一个候选者,并且其基数等于另一个候选者的基数,则该候选者是冗余的。请注意,两个候选者可以具有相同的传输地址,但具有不同的基,并且这些不会被视为冗余。通常,当代理不在NAT后面时,服务器自反候选和主机候选将是冗余的。代理应消除优先级较低的冗余候选。
A candidate is said to be default if it would be the target of media from a non-ICE peer; that target is called the DEFAULT DESTINATION. If the default candidates are not selected by the ICE algorithm when communicating with an ICE-aware peer, an updated offer/answer will be required after ICE processing completes in order to "fix up" the SDP so that the default destination for media matches the candidates selected by ICE. If ICE happens to select the default candidates, no updated offer/answer is required.
如果候选人是非ICE同行媒体的目标,则称其为默认候选人;该目标称为默认目标。如果ICE算法在与ICE感知对等方通信时未选择默认候选方,则在ICE处理完成后需要更新的报价/应答,以便“修复”SDP,以便媒体的默认目的地与ICE选择的候选方匹配。如果ICE选择了默认候选人,则无需更新报价/答案。
An agent MUST choose a set of candidates, one for each component of each in-use media stream, to be default. A media stream is in-use if it does not have a port of zero (which is used in RFC 3264 to reject a media stream). Consequently, a media stream is in-use even if it is marked as a=inactive [RFC4566] or has a bandwidth value of zero.
代理必须选择一组候选者作为默认值,每个在用媒体流的每个组件一个候选者。如果媒体流没有零端口(在RFC 3264中用于拒绝媒体流),则该媒体流正在使用中。因此,即使媒体流被标记为a=非活动[RFC4566]或带宽值为零,媒体流仍在使用中。
It is RECOMMENDED that default candidates be chosen based on the likelihood of those candidates to work with the peer that is being contacted. It is RECOMMENDED that the default candidates are the relayed candidates (if relayed candidates are available), server reflexive candidates (if server reflexive candidates are available), and finally host candidates.
建议根据候选人与被联系的同伴合作的可能性选择默认候选人。建议默认候选是中继候选(如果中继候选可用)、服务器自反候选(如果服务器自反候选可用),最后是主机候选。
Lite implementations only utilize host candidates. A lite implementation MUST, for each component of each media stream, allocate zero or one IPv4 candidates. It MAY allocate zero or more IPv6 candidates, but no more than one per each IPv6 address utilized by the host. Since there can be no more than one IPv4 candidate per component of each media stream, if an agent has multiple IPv4 addresses, it MUST choose one for allocating the candidate. If a host is dual stack, it is RECOMMENDED that it allocate one IPv4 candidate and one global IPv6 address. With the lite implementation, ICE cannot be used to dynamically choose amongst candidates. Therefore, including more than one candidate from a particular scope
Lite实现只利用候选主机。lite实现必须为每个媒体流的每个组件分配零个或一个IPv4候选。它可以分配零个或多个IPv6候选,但主机使用的每个IPv6地址不超过一个。由于每个媒体流的每个组件最多只能有一个IPv4候选,因此,如果代理具有多个IPv4地址,则必须选择一个来分配候选。如果主机是双堆栈的,建议它分配一个IPv4候选和一个全局IPv6地址。在lite实现中,ICE不能用于在候选对象之间进行动态选择。因此,包括来自特定范围的多个候选人
is NOT RECOMMENDED, since only a connectivity check can truly determine whether to use one address or the other.
不建议这样做,因为只有连接检查才能真正确定是使用一个地址还是另一个地址。
Each component has an ID assigned to it, called the component ID. For RTP-based media streams, the RTP itself has a component ID of 1, and RTCP a component ID of 2. If an agent is using RTCP, it MUST obtain candidates for it.
每个组件都有一个分配给它的ID,称为组件ID。对于基于RTP的媒体流,RTP本身的组件ID为1,RTCP的组件ID为2。如果代理正在使用RTCP,则必须为其获取候选。
Each candidate is assigned a foundation. The foundation MUST be different for two candidates allocated from different IP addresses, and MUST be the same otherwise. A simple integer that increments for each IP address will suffice. In addition, each candidate MUST be assigned a unique priority amongst all candidates for the same media stream. This priority SHOULD be equal to:
每个候选人被分配一个基金会。对于两个从不同IP地址分配的候选,基础必须不同,否则必须相同。一个简单的整数为每个IP地址递增就足够了。此外,必须在同一媒体流的所有候选对象中为每个候选对象分配唯一的优先级。此优先级应等于:
priority = (2^24)*(126) + (2^8)*(IP precedence) + (2^0)*(256 - component ID)
priority = (2^24)*(126) + (2^8)*(IP precedence) + (2^0)*(256 - component ID)
If a host is v4-only, it SHOULD set the IP precedence to 65535. If a host is v6 or dual stack, the IP precedence SHOULD be the precedence value for IP addresses described in RFC 3484 [RFC3484].
如果主机仅为v4,则应将IP优先级设置为65535。如果主机是v6或双堆栈,则IP优先级应为RFC 3484[RFC3484]中描述的IP地址的优先级值。
Next, an agent chooses a default candidate for each component of each media stream. If a host is IPv4 only, there would only be one candidate for each component of each media stream, and therefore that candidate is the default. If a host is IPv6 or dual stack, the selection of default is a matter of local policy. This default SHOULD be chosen such that it is the candidate most likely to be used with a peer. For IPv6-only hosts, this would typically be a globally scoped IPv6 address. For dual-stack hosts, the IPv4 address is RECOMMENDED.
接下来,代理为每个媒体流的每个组件选择默认候选。如果主机仅为IPv4,则每个媒体流的每个组件将只有一个候选主机,因此该候选主机是默认主机。如果主机是IPv6或双堆栈,则默认值的选择取决于本地策略。应选择此默认值,使其成为最有可能与对等方一起使用的候选项。对于仅限IPv6的主机,这通常是一个全局范围的IPv6地址。对于双堆栈主机,建议使用IPv4地址。
The process of encoding the SDP is identical between full and lite implementations.
完整实现和精简实现之间的SDP编码过程是相同的。
The agent will include an m line for each media stream it wishes to use. The ordering of media streams in the SDP is relevant for ICE. ICE will perform its connectivity checks for the first m line first, and consequently media will be able to flow for that stream first. Agents SHOULD place their most important media stream, if there is one, first in the SDP.
代理将为其希望使用的每个媒体流包括一条m线。SDP中媒体流的顺序与ICE相关。ICE将首先对第一条m线执行连接检查,因此媒体将能够首先为该流流动。代理应将其最重要的媒体流(如果有)放在SDP的第一位。
There will be a candidate attribute for each candidate for a particular media stream. Section 15 provides detailed rules for constructing this attribute. The attribute carries the IP address,
对于特定媒体流的每个候选者,都有一个候选者属性。第15节提供了构造此属性的详细规则。该属性携带IP地址,
port, and transport protocol for the candidate, in addition to its properties that need to be signaled to the peer for ICE to work: the priority, foundation, and component ID. The candidate attribute also carries information about the candidate that is useful for diagnostics and other functions: its type and related transport addresses.
端口和传输协议的候选者,除了它的属性,需要发出信号给对等点ICE工作:优先级,基础,和组件ID。候选属性还携带有关候选人的信息,这是有用的诊断和其他功能:它的类型和相关的传输地址。
STUN connectivity checks between agents are authenticated using the short-term credential mechanism defined for STUN [RFC5389]. This mechanism relies on a username and password that are exchanged through protocol machinery between the client and server. With ICE, the offer/answer exchange is used to exchange them. The username part of this credential is formed by concatenating a username fragment from each agent, separated by a colon. Each agent also provides a password, used to compute the message integrity for requests it receives. The username fragment and password are exchanged in the ice-ufrag and ice-pwd attributes, respectively. In addition to providing security, the username provides disambiguation and correlation of checks to media streams. See Appendix B.4 for motivation.
使用为STUN[RFC5389]定义的短期凭证机制对代理之间的STUN连接检查进行身份验证。此机制依赖于通过协议机制在客户端和服务器之间交换的用户名和密码。对于ICE,提供/应答交换用于交换它们。此凭证的用户名部分是通过连接每个代理的用户名片段形成的,用户名片段之间用冒号分隔。每个代理还提供一个密码,用于计算其接收的请求的消息完整性。用户名片段和密码分别在ice ufrag和ice pwd属性中交换。除了提供安全性之外,用户名还提供了对检查与媒体流的消歧和关联。参见附录B.4了解动机。
If an agent is a lite implementation, it MUST include an "a=ice-lite" session-level attribute in its SDP. If an agent is a full implementation, it MUST NOT include this attribute.
如果代理是lite实现,它必须在其SDP中包含“a=ice lite”会话级别属性。如果代理是完整实现,则它不能包含此属性。
The default candidates are added to the SDP as the default destination for media. For streams based on RTP, this is done by placing the IP address and port of the RTP candidate into the c and m lines, respectively. If the agent is utilizing RTCP, it MUST encode the RTCP candidate using the a=rtcp attribute as defined in RFC 3605 [RFC3605]. If RTCP is not in use, the agent MUST signal that using b=RS:0 and b=RR:0 as defined in RFC 3556 [RFC3556].
默认候选介质将作为介质的默认目标添加到SDP中。对于基于RTP的流,这是通过将RTP候选的IP地址和端口分别放入c和m行来完成的。如果代理正在使用RTCP,则必须使用RFC 3605[RFC3605]中定义的a=RTCP属性对RTCP候选进行编码。如果未使用RTCP,则代理必须使用RFC 3556[RFC3556]中定义的b=RS:0和b=RR:0发出信号。
The transport addresses that will be the default destination for media when communicating with non-ICE peers MUST also be present as candidates in one or more a=candidate lines.
当与非ICE对等方通信时,作为介质默认目的地的传输地址也必须作为候选地址出现在一条或多条a=候选线路中。
ICE provides for extensibility by allowing an offer or answer to contain a series of tokens that identify the ICE extensions used by that agent. If an agent supports an ICE extension, it MUST include the token defined for that extension in the ice-options attribute.
ICE通过允许报价或应答包含一系列标识该代理使用的ICE扩展的令牌来提供扩展性。如果代理支持ICE扩展,则必须在ICE选项属性中包含为该扩展定义的令牌。
The following is an example SDP message that includes ICE attributes (lines folded for readability):
以下是包含ICE属性的示例SDP消息(为便于阅读而折叠的行):
v=0 o=jdoe 2890844526 2890842807 IN IP4 10.0.1.1 s= c=IN IP4 192.0.2.3 t=0 0 a=ice-pwd:asd88fgpdd777uzjYhagZg a=ice-ufrag:8hhY m=audio 45664 RTP/AVP 0 b=RS:0 b=RR:0 a=rtpmap:0 PCMU/8000 a=candidate:1 1 UDP 2130706431 10.0.1.1 8998 typ host a=candidate:2 1 UDP 1694498815 192.0.2.3 45664 typ srflx raddr 10.0.1.1 rport 8998
v=0 o=jdoe 2890844526 2890842807 IN IP4 10.0.1.1 s= c=IN IP4 192.0.2.3 t=0 0 a=ice-pwd:asd88fgpdd777uzjYhagZg a=ice-ufrag:8hhY m=audio 45664 RTP/AVP 0 b=RS:0 b=RR:0 a=rtpmap:0 PCMU/8000 a=candidate:1 1 UDP 2130706431 10.0.1.1 8998 typ host a=candidate:2 1 UDP 1694498815 192.0.2.3 45664 typ srflx raddr 10.0.1.1 rport 8998
Once an agent has sent its offer or its answer, that agent MUST be prepared to receive both STUN and media packets on each candidate. As discussed in Section 11.1, media packets can be sent to a candidate prior to its appearance as the default destination for media in an offer or answer.
一旦代理发送了报价或答复,该代理必须准备好接收每个候选人的STUN和媒体数据包。如第11.1节所述,媒体数据包可在作为报价或应答中媒体的默认目的地出现之前发送给候选人。
When an agent receives an initial offer, it will check if the offerer supports ICE, determine its own role, gather candidates, prioritize them, choose default candidates, encode and send an answer, and for full implementations, form the check lists and begin connectivity checks.
当代理收到初始报价时,它将检查报价人是否支持ICE,确定其自己的角色,收集候选人,确定他们的优先级,选择默认候选人,编码并发送答案,对于完整实施,形成检查列表并开始连接检查。
The agent will proceed with the ICE procedures defined in this specification if, for each media stream in the SDP it received, the default destination for each component of that media stream appears in a candidate attribute. For example, in the case of RTP, the IP address and port in the c and m lines, respectively, appear in a candidate attribute and the value in the rtcp attribute appears in a candidate attribute.
如果对于接收到的SDP中的每个媒体流,该媒体流的每个组件的默认目的地出现在候选属性中,则代理将继续执行本规范中定义的ICE过程。例如,在RTP的情况下,c和m行中的IP地址和端口分别出现在候选属性中,rtcp属性中的值出现在候选属性中。
If this condition is not met, the agent MUST process the SDP based on normal RFC 3264 procedures, without using any of the ICE mechanisms described in the remainder of this specification with the following exceptions:
如果不满足此条件,则代理必须根据正常RFC 3264程序处理SDP,不使用本规范其余部分中描述的任何ICE机制,但以下例外情况除外:
1. The agent MUST follow the rules of Section 10, which describe keepalive procedures for all agents.
1. 代理必须遵守第10节的规则,该节描述了所有代理的保留程序。
2. If the agent is not proceeding with ICE because there were a=candidate attributes, but none that matched the default destination of the media stream, the agent MUST include an a=ice-mismatch attribute in its answer.
2. 如果代理未继续使用ICE,因为存在a=候选属性,但没有与媒体流的默认目标匹配的属性,则代理必须在其答案中包含a=ICE不匹配属性。
3. If the default candidates were relayed candidates learned through a TURN server, the agent MUST create permissions in the TURN server for the IP addresses learned from its peer in the SDP it just received. If this is not done, initial packets in the media stream from the peer may be lost.
3. 如果默认候选者是通过TURN服务器学习的中继候选者,则代理必须在TURN服务器中为其刚收到的SDP中从对等方学习的IP地址创建权限。如果不这样做,则来自对等方的媒体流中的初始分组可能丢失。
For each session, each agent takes on a role. There are two roles -- controlling and controlled. The controlling agent is responsible for the choice of the final candidate pairs used for communications. For a full agent, this means nominating the candidate pairs that can be used by ICE for each media stream, and for generating the updated offer based on ICE's selection, when needed. For a lite implementation, being the controlling agent means selecting a candidate pair based on the ones in the offer and answer (for IPv4, there is only ever one pair), and then generating an updated offer reflecting that selection, when needed (it is never needed for an IPv4-only host). The controlled agent is told which candidate pairs to use for each media stream, and does not generate an updated offer to signal this information. The sections below describe in detail the actual procedures followed by controlling and controlled nodes.
对于每个会话,每个代理承担一个角色。有两个角色——控制和控制。控制代理负责选择用于通信的最终候选对。对于完整代理,这意味着指定ICE可用于每个媒体流的候选对,并在需要时根据ICE的选择生成更新的报价。对于lite实现,作为控制代理意味着根据提供和应答中的对选择候选对(对于IPv4,只有一对),然后在需要时生成反映该选择的更新的提供(对于仅IPv4的主机,永远不需要)。受控代理被告知每个媒体流要使用哪些候选对,并且不会生成更新的要约来表示此信息。以下各节详细描述了控制节点和受控节点遵循的实际程序。
The rules for determining the role and the impact on behavior are as follows:
确定角色及其对行为的影响的规则如下:
Both agents are full: The agent that generated the offer which started the ICE processing MUST take the controlling role, and the other MUST take the controlled role. Both agents will form check lists, run the ICE state machines, and generate connectivity checks. The controlling agent will execute the logic in Section 8.1 to nominate pairs that will be selected by ICE, and then both agents end ICE as described in Section 8.1.2. In unusual cases, described in Appendix B.11, it is possible for both agents to mistakenly believe they are controlled or controlling. To resolve this, each agent MUST select a random number, called the tie-breaker, uniformly distributed between 0 and (2**64) - 1 (that is, a 64-bit positive integer). This number is used in connectivity checks to detect and repair this case, as described in Section 7.1.2.2.
两个代理都已满:生成开始ICE处理的报价的代理必须担任控制角色,另一个必须担任控制角色。这两个代理将形成检查列表,运行ICE状态机,并生成连接检查。控制代理将执行第8.1节中的逻辑,以指定ICE将选择的对,然后两个代理结束ICE,如第8.1.2节所述。在附录B.11中所述的异常情况下,两种代理都可能错误地认为自己受到控制或控制。为了解决这个问题,每个代理都必须选择一个随机数,称为tie breaker,均匀分布在0和(2**64)-1之间(即64位正整数)。如第7.1.2.2节所述,该编号用于连接检查,以检测和修复这种情况。
One agent full, one lite: The full agent MUST take the controlling role, and the lite agent MUST take the controlled role. The full agent will form check lists, run the ICE state machines, and generate connectivity checks. That agent will execute the logic in Section 8.1 to nominate pairs that will be selected by ICE, and use the logic in Section 8.1.2 to end ICE. The lite implementation will just listen for connectivity checks, receive them and respond to them, and then conclude ICE as described in Section 8.2. For the lite implementation, the state of ICE processing for each media stream is considered to be Running, and the state of ICE overall is Running.
一个完全代理,一个lite:完全代理必须担任控制角色,lite代理必须担任控制角色。完整代理将形成检查列表,运行ICE状态机,并生成连接检查。该代理将执行第8.1节中的逻辑,以指定ICE将选择的对,并使用第8.1.2节中的逻辑结束ICE。lite实现只需监听连接检查,接收并响应连接检查,然后按照第8.2节所述结束ICE。对于lite实现,每个媒体流的ICE处理状态被视为正在运行,ICE整体状态为正在运行。
Both lite: The agent that generated the offer which started the ICE processing MUST take the controlling role, and the other MUST take the controlled role. In this case, no connectivity checks are ever sent. Rather, once the offer/answer exchange completes, each agent performs the processing described in Section 8 without connectivity checks. It is possible that both agents will believe they are controlled or controlling. In the latter case, the conflict is resolved through glare detection capabilities in the signaling protocol carrying the offer/answer exchange. The state of ICE processing for each media stream is considered to be Running, and the state of ICE overall is Running.
Both lite: The agent that generated the offer which started the ICE processing MUST take the controlling role, and the other MUST take the controlled role. In this case, no connectivity checks are ever sent. Rather, once the offer/answer exchange completes, each agent performs the processing described in Section 8 without connectivity checks. It is possible that both agents will believe they are controlled or controlling. In the latter case, the conflict is resolved through glare detection capabilities in the signaling protocol carrying the offer/answer exchange. The state of ICE processing for each media stream is considered to be Running, and the state of ICE overall is Running.translate error, please retry
Once roles are determined for a session, they persist unless ICE is restarted. An ICE restart (Section 9.1) causes a new selection of roles and tie-breakers.
一旦为会话确定了角色,除非ICE重新启动,否则角色将持续存在。ICE重启(第9.1节)会导致角色和联系断路器的新选择。
The process for gathering candidates at the answerer is identical to the process for the offerer as described in Section 4.1.1 for full implementations and Section 4.2 for lite implementations. It is RECOMMENDED that this process begin immediately on receipt of the offer, prior to alerting the user. Such gathering MAY begin when an agent starts.
在回答者处收集候选人的过程与第4.1.1节(完整实施)和第4.2节(lite实施)中描述的报价人过程相同。建议在收到报价后立即开始此过程,然后再通知用户。这样的收集可以在代理启动时开始。
The process for prioritizing candidates at the answerer is identical to the process followed by the offerer, as described in Section 4.1.2 for full implementations and Section 4.2 for lite implementations.
答疑人对候选人进行优先排序的过程与报价人遵循的过程相同,如第4.1.2节所述的完整实施过程和第4.2节所述的lite实施过程。
The process for selecting default candidates at the answerer is identical to the process followed by the offerer, as described in Section 4.1.4 for full implementations and Section 4.2 for lite implementations.
在回答者处选择默认候选人的过程与报价人遵循的过程相同,如第4.1.4节完整实施和第4.2节lite实施所述。
The process for encoding the SDP at the answerer is identical to the process followed by the offerer for both full and lite implementations, as described in Section 4.3.
如第4.3节所述,应答方对SDP进行编码的过程与报价方在完整和精简实现中遵循的过程相同。
Forming check lists is done only by full implementations. Lite implementations MUST skip the steps defined in this section.
只有通过完整的实现才能形成检查表。Lite实现必须跳过本节中定义的步骤。
There is one check list per in-use media stream resulting from the offer/answer exchange. To form the check list for a media stream, the agent forms candidate pairs, computes a candidate pair priority, orders the pairs by priority, prunes them, and sets their states. These steps are described in this section.
提供/应答交换产生的每个正在使用的媒体流都有一个检查列表。为了形成媒体流的检查列表,代理形成候选对,计算候选对优先级,按优先级排序候选对,修剪它们,并设置它们的状态。本节介绍了这些步骤。
First, the agent takes each of its candidates for a media stream (called LOCAL CANDIDATES) and pairs them with the candidates it received from its peer (called REMOTE CANDIDATES) for that media stream. In order to prevent the attacks described in Section 18.5.2, agents MAY limit the number of candidates they'll accept in an offer or answer. A local candidate is paired with a remote candidate if and only if the two candidates have the same component ID and have the same IP address version. It is possible that some of the local candidates won't get paired with remote candidates, and some of the remote candidates won't get paired with local candidates. This can happen if one agent doesn't include candidates for the all of the components for a media stream. If this happens, the number of components for that media stream is effectively reduced, and considered to be equal to the minimum across both agents of the maximum component ID provided by each agent across all components for the media stream.
首先,代理获取媒体流的每个候选对象(称为本地候选对象),并将它们与从该媒体流的对等方(称为远程候选对象)接收的候选对象配对。为了防止第18.5.2节所述的攻击,代理可以限制他们在报价或答复中接受的候选人数量。当且仅当两个候选组件具有相同的组件ID和相同的IP地址版本时,本地候选组件才会与远程候选组件配对。有些本地候选人可能无法与远程候选人配对,有些远程候选人也无法与本地候选人配对。如果一个代理不包含媒体流所有组件的候选组件,则可能会发生这种情况。如果发生这种情况,则该媒体流的组件数量将有效地减少,并被认为等于两个代理之间的最小组件ID,即每个代理在媒体流的所有组件之间提供的最大组件ID。
In the case of RTP, this would happen when one agent provides candidates for RTCP, and the other does not. As another example, the offerer can multiplex RTP and RTCP on the same port and signals that it can do that in the SDP through an SDP attribute [RFC5761]. However, since the offerer doesn't know if the answerer can perform
在RTP的情况下,当一个代理为RTCP提供候选者,而另一个不提供候选者时,就会发生这种情况。作为另一个示例,报价人可以在同一端口上多路复用RTP和RTCP,并通过SDP属性[RFC5761]在SDP中发送信号。但是,由于报价人不知道回答人是否能够执行
such multiplexing, the offerer includes candidates for RTP and RTCP on separate ports, so that the offer has two components per media stream. If the answerer can perform such multiplexing, it would include just a single component for each candidate - for the combined RTP/RTCP mux. ICE would end up acting as if there was just a single component for this candidate.
在这种多路复用中,报价方在单独的端口上包括RTP和RTCP的候选,以便报价方在每个媒体流上有两个组件。如果应答者能够执行这种多路复用,那么对于每个候选者,它将只包括一个组件——对于组合的RTP/RTCP mux。ICE最终会表现得好像这个候选人只有一个组成部分。
The candidate pairs whose local and remote candidates are both the default candidates for a particular component is called, unsurprisingly, the default candidate pair for that component. This is the pair that would be used to transmit media if both agents had not been ICE aware.
本地和远程候选都是特定组件的默认候选的候选对被称为该组件的默认候选对,这并不奇怪。如果两个代理都未意识到ICE,则这一对将用于传输媒体。
In order to aid understanding, Figure 6 shows the relationships between several key concepts -- transport addresses, candidates, candidate pairs, and check lists, in addition to indicating the main properties of candidates and candidate pairs.
为了帮助理解,图6显示了几个关键概念之间的关系——传输地址、候选者、候选者对和检查列表,以及候选者和候选者对的主要属性。
+------------------------------------------+ | | | +---------------------+ | | |+----+ +----+ +----+ | +Type | | || IP | |Port| |Tran| | +Priority | | ||Addr| | | | | | +Foundation | | |+----+ +----+ +----+ | +ComponentiD | | | Transport | +RelatedAddr | | | Addr | | | +---------------------+ +Base | | Candidate | +------------------------------------------+ * * * ************************************* * * +-------------------------------+ .| | | Local Remote | | +----+ +----+ +default? | | |Cand| |Cand| +valid? | | +----+ +----+ +nominated?| | +State | | | | | | Candidate Pair | +-------------------------------+ * * * ************ * * +------------------+ | Candidate Pair | +------------------+ +------------------+ | Candidate Pair | +------------------+ +------------------+ | Candidate Pair | +------------------+
+------------------------------------------+ | | | +---------------------+ | | |+----+ +----+ +----+ | +Type | | || IP | |Port| |Tran| | +Priority | | ||Addr| | | | | | +Foundation | | |+----+ +----+ +----+ | +ComponentiD | | | Transport | +RelatedAddr | | | Addr | | | +---------------------+ +Base | | Candidate | +------------------------------------------+ * * * ************************************* * * +-------------------------------+ .| | | Local Remote | | +----+ +----+ +default? | | |Cand| |Cand| +valid? | | +----+ +----+ +nominated?| | +State | | | | | | Candidate Pair | +-------------------------------+ * * * ************ * * +------------------+ | Candidate Pair | +------------------+ +------------------+ | Candidate Pair | +------------------+ +------------------+ | Candidate Pair | +------------------+
Check List
检查表
Figure 6: Conceptual Diagram of a Check List
图6:检查表的概念图
Once the pairs are formed, a candidate pair priority is computed. Let G be the priority for the candidate provided by the controlling agent. Let D be the priority for the candidate provided by the controlled agent. The priority for a pair is computed as:
一旦形成对,就计算候选对优先级。设G为控制代理提供的候选的优先级。设D为受控代理提供的候选对象的优先级。对的优先级计算为:
pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0)
pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0)
Where G>D?1:0 is an expression whose value is 1 if G is greater than D, and 0 otherwise. Once the priority is assigned, the agent sorts the candidate pairs in decreasing order of priority. If two pairs have identical priority, the ordering amongst them is arbitrary.
其中G>D?1:0是一个表达式,如果G大于D,则其值为1,否则为0。一旦分配了优先级,代理将按优先级的降序对候选对进行排序。如果两对具有相同的优先级,则它们之间的顺序是任意的。
This sorted list of candidate pairs is used to determine a sequence of connectivity checks that will be performed. Each check involves sending a request from a local candidate to a remote candidate. Since an agent cannot send requests directly from a reflexive candidate, but only from its base, the agent next goes through the sorted list of candidate pairs. For each pair where the local candidate is server reflexive, the server reflexive candidate MUST be replaced by its base. Once this has been done, the agent MUST prune the list. This is done by removing a pair if its local and remote candidates are identical to the local and remote candidates of a pair higher up on the priority list. The result is a sequence of ordered candidate pairs, called the check list for that media stream.
候选对的排序列表用于确定将要执行的连接检查序列。每次检查都涉及从本地候选人向远程候选人发送请求。由于代理不能直接从自反候选发送请求,而只能从其基发送请求,因此代理接下来将遍历候选对的排序列表。对于本地候选者是服务器自反的每一对,服务器自反候选者必须被其基替换。完成此操作后,代理必须修剪列表。如果一对的本地和远程候选项与优先级列表中较高的一对的本地和远程候选项相同,则可通过删除该对来完成此操作。结果是一系列有序的候选对,称为该媒体流的检查列表。
In addition, in order to limit the attacks described in Section 18.5.2, an agent MUST limit the total number of connectivity checks the agent performs across all check lists to a specific value, and this value MUST be configurable. A default of 100 is RECOMMENDED. This limit is enforced by discarding the lower-priority candidate pairs until there are less than 100. It is RECOMMENDED that a lower value be utilized when possible, set to the maximum number of plausible checks that might be seen in an actual deployment configuration. The requirement for configuration is meant to provide a tool for fixing this value in the field if, once deployed, it is found to be problematic.
此外,为了限制第18.5.2节中描述的攻击,代理必须将代理在所有检查列表中执行的连接检查总数限制为特定值,并且该值必须是可配置的。建议默认值为100。通过丢弃较低优先级的候选对直到少于100个,可以强制执行此限制。建议尽可能使用较低的值,设置为实际部署配置中可能看到的最大合理检查数。配置要求旨在提供一种工具,用于在部署后发现问题时在现场修复此值。
Each candidate pair in the check list has a foundation and a state. The foundation is the combination of the foundations of the local and remote candidates in the pair. The state is assigned once the check list for each media stream has been computed. There are five potential values that the state can have:
检查表中的每个候选对都有一个基础和一个状态。基金会是一对本地和远程候选人的基础组合。一旦计算了每个媒体流的检查列表,就会分配状态。该状态可以有五个潜在值:
Waiting: A check has not been performed for this pair, and can be performed as soon as it is the highest-priority Waiting pair on the check list.
等待:尚未对此对执行检查,只要它是检查列表中优先级最高的等待对,就可以执行检查。
In-Progress: A check has been sent for this pair, but the transaction is in progress.
正在进行:已为此对发送检查,但事务正在进行中。
Succeeded: A check for this pair was already done and produced a successful result.
成功:已对此对进行检查并生成成功结果。
Failed: A check for this pair was already done and failed, either never producing any response or producing an unrecoverable failure response.
失败:此对的检查已完成且失败,可能从未产生任何响应,也可能产生不可恢复的故障响应。
Frozen: A check for this pair hasn't been performed, and it can't yet be performed until some other check succeeds, allowing this pair to unfreeze and move into the Waiting state.
冻结:尚未执行此对的检查,在其他检查成功之前无法执行该检查,从而允许此对解冻并进入等待状态。
As ICE runs, the pairs will move between states as shown in Figure 7.
当ICE运行时,这些对将在状态之间移动,如图7所示。
+-----------+ | | | | | Frozen | | | | | +-----------+ | |unfreeze | V +-----------+ +-----------+ | | | | | | perform | | | Waiting |-------->|In-Progress| | | | | | | | | +-----------+ +-----------+ / | // | // | // | / | // | failure // |success // | / | // | // | // | V V +-----------+ +-----------+ | | | | | | | | | Failed | | Succeeded | | | | | | | | | +-----------+ +-----------+
+-----------+ | | | | | Frozen | | | | | +-----------+ | |unfreeze | V +-----------+ +-----------+ | | | | | | perform | | | Waiting |-------->|In-Progress| | | | | | | | | +-----------+ +-----------+ / | // | // | // | / | // | failure // |success // | / | // | // | // | V V +-----------+ +-----------+ | | | | | | | | | Failed | | Succeeded | | | | | | | | | +-----------+ +-----------+
Figure 7: Pair State FSM
图7:配对状态FSM
The initial states for each pair in a check list are computed by performing the following sequence of steps:
通过执行以下步骤序列,计算检查列表中每对的初始状态:
1. The agent sets all of the pairs in each check list to the Frozen state.
1. 代理将每个检查列表中的所有对设置为冻结状态。
2. The agent examines the check list for the first media stream (a media stream is the first media stream when it is described by the first m line in the SDP offer and answer). For that media stream:
2. 代理检查第一媒体流的检查列表(当在SDP offer and answer中的第一m行描述媒体流时,媒体流是第一媒体流)。对于该媒体流:
* For all pairs with the same foundation, it sets the state of the pair with the lowest component ID to Waiting. If there is more than one such pair, the one with the highest priority is used.
* 对于所有具有相同基础的对,它设置具有最低组件ID的对的状态以等待。如果存在多个这样的对,则使用具有最高优先级的对。
One of the check lists will have some number of pairs in the Waiting state, and the other check lists will have all of their pairs in the Frozen state. A check list with at least one pair that is Waiting is called an active check list, and a check list with all pairs Frozen is called a frozen check list.
其中一个检查表将有一定数量的对处于等待状态,而另一个检查表将有其所有对处于冻结状态。至少有一对处于等待状态的检查列表称为活动检查列表,所有对处于冻结状态的检查列表称为冻结检查列表。
The check list itself is associated with a state, which captures the state of ICE checks for that media stream. There are three states:
检查列表本身与一个状态相关联,该状态捕获该媒体流的ICE检查状态。有三个州:
Running: In this state, ICE checks are still in progress for this media stream.
正在运行:在此状态下,此媒体流的ICE检查仍在进行中。
Completed: In this state, ICE checks have produced nominated pairs for each component of the media stream. Consequently, ICE has succeeded and media can be sent.
已完成:在此状态下,ICE检查已为媒体流的每个组件生成指定对。因此,ICE已成功,可以发送媒体。
Failed: In this state, the ICE checks have not completed successfully for this media stream.
失败:在此状态下,此媒体流的ICE检查未成功完成。
When a check list is first constructed as the consequence of an offer/answer exchange, it is placed in the Running state.
当作为提供/应答交换的结果首次构造检查表时,它将处于运行状态。
ICE processing across all media streams also has a state associated with it. This state is equal to Running while ICE processing is under way. The state is Completed when ICE processing is complete and Failed if it failed without success. Rules for transitioning between states are described below.
跨所有媒体流的ICE处理也具有与其关联的状态。此状态等于在冰处理过程中运行。ICE处理完成时状态为Completed,如果ICE处理失败而未成功,则状态为Failed。各州之间的过渡规则如下所述。
Checks are generated only by full implementations. Lite implementations MUST skip the steps described in this section.
检查仅由完整实现生成。Lite实现必须跳过本节中描述的步骤。
An agent performs ordinary checks and triggered checks. The generation of both checks is governed by a timer that fires periodically for each media stream. The agent maintains a FIFO queue, called the triggered check queue, which contains candidate pairs for which checks are to be sent at the next available
代理执行普通检查和触发检查。这两个检查的生成都由一个计时器控制,该计时器为每个媒体流定期触发。代理维护一个称为触发检查队列的FIFO队列,该队列包含候选对,在下一次可用时将为其发送检查
opportunity. When the timer fires, the agent removes the top pair from the triggered check queue, performs a connectivity check on that pair, and sets the state of the candidate pair to In-Progress. If there are no pairs in the triggered check queue, an ordinary check is sent.
机会当计时器触发时,代理将从触发的检查队列中移除顶部对,对该对执行连接检查,并将候选对的状态设置为“正在进行”。如果触发的检查队列中没有对,则发送普通检查。
Once the agent has computed the check lists as described in Section 5.7, it sets a timer for each active check list. The timer fires every Ta*N seconds, where N is the number of active check lists (initially, there is only one active check list). Implementations MAY set the timer to fire less frequently than this. Implementations SHOULD take care to spread out these timers so that they do not fire at the same time for each media stream. Ta and the retransmit timer RTO are computed as described in Section 16. Multiplying by N allows this aggregate check throughput to be split between all active check lists. The first timer fires immediately, so that the agent performs a connectivity check the moment the offer/answer exchange has been done, followed by the next check Ta seconds later (since there is only one active check list).
一旦代理计算了第5.7节所述的检查表,它将为每个活动检查表设置一个计时器。计时器每Ta*N秒触发一次,其中N是活动检查列表的数量(最初,只有一个活动检查列表)。实现可能会将计时器设置为触发频率低于此值。实现应该注意分散这些计时器,以便它们不会对每个媒体流同时启动。Ta和重传定时器RTO的计算如第16节所述。乘以N允许在所有活动检查列表之间拆分此聚合检查吞吐量。第一个计时器立即启动,以便代理在提供/应答交换完成时执行连接检查,然后在几秒钟后执行下一个检查(因为只有一个活动的检查列表)。
When the timer fires and there is no triggered check to be sent, the agent MUST choose an ordinary check as follows:
当计时器启动且没有要发送的触发检查时,代理必须选择普通检查,如下所示:
o Find the highest-priority pair in that check list that is in the Waiting state.
o 在该检查列表中查找处于等待状态的最高优先级对。
o If there is such a pair:
o 如果有这样一对:
* Send a STUN check from the local candidate of that pair to the remote candidate of that pair. The procedures for forming the STUN request for this purpose are described in Section 7.1.2.
* 从该对的本地候选者向该对的远程候选者发送眩晕检查。第7.1.2节描述了为此目的形成STUN请求的程序。
* Set the state of the candidate pair to In-Progress.
* 将候选对的状态设置为“正在进行”。
o If there is no such pair:
o 如果没有这样的一对:
* Find the highest-priority pair in that check list that is in the Frozen state.
* 在该检查列表中查找处于冻结状态的最高优先级对。
* If there is such a pair:
* 如果有这样一对:
+ Unfreeze the pair.
+ 解冻这对。
+ Perform a check for that pair, causing its state to transition to In-Progress.
+ 对该对执行检查,使其状态转换为进行中。
* If there is no such pair:
* 如果没有这样的一对:
+ Terminate the timer for that check list.
+ 终止该检查列表的计时器。
To compute the message integrity for the check, the agent uses the remote username fragment and password learned from the SDP from its peer. The local username fragment is known directly by the agent for its own candidate.
为了计算用于检查的消息完整性,代理使用从其对等方的SDP学习的远程用户名片段和密码。代理直接知道本地用户名片段的候选名称。
This section describes the procedures that an agent follows when it receives the answer from the peer. It verifies that its peer supports ICE, determines its role, and for full implementations, forms the check list and begins performing ordinary checks.
本节描述代理从对等方接收答案时所遵循的过程。它验证其对等方是否支持ICE,确定其角色,对于完整实现,形成检查列表并开始执行普通检查。
When ICE is used with SIP, forking may result in a single offer generating a multiplicity of answers. In that case, ICE proceeds completely in parallel and independently for each answer, treating the combination of its offer and each answer as an independent offer/ answer exchange, with its own set of pairs, check lists, states, and so on. The only case in which processing of one pair impacts another is freeing of candidates, discussed below in Section 8.3.
当ICE与SIP一起使用时,分叉可能会导致单个报价生成多个答案。在这种情况下,ICE对每个答案完全并行且独立地进行,将其报价和每个答案的组合视为一个独立的报价/应答交换,具有自己的一组对、检查表、状态等。处理一对影响另一对的唯一情况是释放候选者,将在下文第8.3节中讨论。
The logic at the offerer is identical to that of the answerer as described in Section 5.1, with the exception that an offerer would not ever generate a=ice-mismatch attributes in an SDP.
报价人的逻辑与第5.1节所述的应答人的逻辑相同,但报价人不会在SDP中生成a=ice不匹配属性。
In some cases, the answer may omit a=candidate attributes for the media streams, and instead include an a=ice-mismatch attribute for one or more of the media streams in the SDP. This signals to the offerer that the answerer supports ICE, but that ICE processing was not used for the session because a signaling intermediary modified the default destination for media components without modifying the corresponding candidate attributes. See Section 18 for a discussion of cases where this can happen. This specification provides no guidance on how an agent should proceed in such a failure case.
在一些情况下,答案可以省略媒体流的a=候选属性,而是包括SDP中的一个或多个媒体流的a=ice不匹配属性。这向报价人发出信号,表示应答人支持ICE,但ICE处理未用于会话,因为信令中介修改了媒体组件的默认目的地,而没有修改相应的候选属性。有关可能发生这种情况的案例讨论,请参见第18节。本规范未提供有关代理在此类故障情况下应如何进行的指导。
The offerer follows the same procedures described for the answerer in Section 5.2.
报价人遵循第5.2节中为应答人描述的相同程序。
Formation of check lists is performed only by full implementations. The offerer follows the same procedures described for the answerer in Section 5.7.
检查表的形成仅由完整实施执行。报价人遵循第5.7节中为应答人描述的相同程序。
Ordinary checks are performed only by full implementations. The offerer follows the same procedures described for the answerer in Section 5.8.
普通检查仅由完整实现执行。报价人遵循第5.8节中为应答人描述的相同程序。
This section describes how connectivity checks are performed. All ICE implementations are required to be compliant to [RFC5389], as opposed to the older [RFC3489]. However, whereas a full implementation will both generate checks (acting as a STUN client) and receive them (acting as a STUN server), a lite implementation will only receive checks, and thus will only act as a STUN server.
本节介绍如何执行连接检查。所有ICE实施都需要符合[RFC5389],而不是旧的[RFC3489]。但是,尽管完整的实现将生成检查(充当STUN客户端)并接收检查(充当STUN服务器),但lite实现将只接收检查,因此将只充当STUN服务器。
These procedures define how an agent sends a connectivity check, whether it is an ordinary or a triggered check. These procedures are only applicable to full implementations.
这些过程定义了代理如何发送连接检查,无论是普通检查还是触发检查。这些过程仅适用于完整实施。
If the connectivity check is being sent using a relayed local candidate, the client MUST create a permission first if it has not already created one previously. It would have created one previously if it had told the TURN server to create a permission for the given relayed candidate towards the IP address of the remote candidate. To create the permission, the agent follows the procedures defined in [RFC5766]. The permission MUST be created towards the IP address of the remote candidate. It is RECOMMENDED that the agent defer creation of a TURN channel until ICE completes, in which case permissions for connectivity checks are normally created using a CreatePermission request. Once established, the agent MUST keep the permission active until ICE concludes.
如果使用中继本地候选发送连接检查,则客户端必须首先创建权限(如果以前尚未创建权限)。如果它告诉TURN服务器为给定中继候选者创建一个指向远程候选者IP地址的权限,那么它以前就会创建一个。要创建权限,代理程序遵循[RFC5766]中定义的过程。必须针对远程候选的IP地址创建权限。建议代理将转弯通道的创建推迟到ICE完成,在这种情况下,连接检查的权限通常使用CreatePermission请求创建。一旦建立,代理必须保持权限处于活动状态,直到ICE结束。
The check is generated by sending a Binding request from a local candidate to a remote candidate. [RFC5389] describes how Binding requests are constructed and generated. A connectivity check MUST
检查是通过从本地候选对象向远程候选对象发送绑定请求生成的。[RFC5389]描述如何构造和生成绑定请求。必须进行连接检查
utilize the STUN short-term credential mechanism. Support for backwards compatibility with RFC 3489 MUST NOT be used or assumed with connectivity checks. The FINGERPRINT mechanism MUST be used for connectivity checks.
利用STUN短期凭证机制。连接检查不得使用或假设支持RFC 3489的向后兼容性。指纹机制必须用于连接检查。
ICE extends STUN by defining several new attributes, including PRIORITY, USE-CANDIDATE, ICE-CONTROLLED, and ICE-CONTROLLING. These new attributes are formally defined in Section 19.1, and their usage is described in the subsections below. These STUN extensions are applicable only to connectivity checks used for ICE.
ICE通过定义几个新属性扩展了STUN,包括优先级、使用候选、ICE控制和ICE控制。这些新属性在第19.1节中有正式定义,其用法在下面的小节中描述。这些STUN扩展仅适用于ICE的连接检查。
An agent MUST include the PRIORITY attribute in its Binding request. The attribute MUST be set equal to the priority that would be assigned, based on the algorithm in Section 4.1.2, to a peer reflexive candidate, should one be learned as a consequence of this check (see Section 7.1.3.2.1 for how peer reflexive candidates are learned). This priority value will be computed identically to how the priority for the local candidate of the pair was computed, except that the type preference is set to the value for peer reflexive candidate types.
代理必须在其绑定请求中包含优先级属性。该属性必须设置为等于根据第4.1.2节中的算法分配给对等自反候选者的优先级,如果该检查的结果是学习一个对等自反候选者(如何学习对等自反候选者,请参见第7.1.3.2.1节)。该优先级值的计算方式与计算对的本地候选优先级的方式相同,但类型首选项设置为对等自反候选类型的值。
The controlling agent MAY include the USE-CANDIDATE attribute in the Binding request. The controlled agent MUST NOT include it in its Binding request. This attribute signals that the controlling agent wishes to cease checks for this component, and use the candidate pair resulting from the check for this component. Section 8.1.1 provides guidance on determining when to include it.
控制代理可以在绑定请求中包括USE-CANDIDATE属性。受控代理不得将其包含在其绑定请求中。此属性表示控制代理希望停止对该组件的检查,并使用该组件检查产生的候选对。第8.1.1节提供了确定何时纳入的指南。
The agent MUST include the ICE-CONTROLLED attribute in the request if it is in the controlled role, and MUST include the ICE-CONTROLLING attribute in the request if it is in the controlling role. The content of either attribute MUST be the tie-breaker that was determined in Section 5.2. These attributes are defined fully in Section 19.1.
如果代理处于受控角色,则必须在请求中包含ICE受控属性;如果代理处于控制角色,则必须在请求中包含ICE受控属性。任一属性的内容都必须是第5.2节中确定的联系断路器。这些属性在第19.1节中有完整定义。
A Binding request serving as a connectivity check MUST utilize the STUN short-term credential mechanism. The username for the credential is formed by concatenating the username fragment provided by the peer with the username fragment of the agent sending the request, separated by a colon (":"). The password is equal to the password provided by the peer. For example, consider the case where agent L is the offerer, and agent R is the answerer. Agent L
用作连接检查的绑定请求必须利用STUN短期凭证机制。凭证的用户名是通过将对等方提供的用户名片段与发送请求的代理的用户名片段连接起来形成的,以冒号(“:”)分隔。密码等于对等方提供的密码。例如,考虑代理L是发盘人的情况,代理R是回答者。特工L
included a username fragment of LFRAG for its candidates and a password of LPASS. Agent R provided a username fragment of RFRAG and a password of RPASS. A connectivity check from L to R utilizes the username RFRAG:LFRAG and a password of RPASS. A connectivity check from R to L utilizes the username LFRAG:RFRAG and a password of LPASS. The responses utilize the same usernames and passwords as the requests (note that the USERNAME attribute is not present in the response).
包括候选的LFRAG用户名片段和LPAS密码。代理R提供了RFRAG的用户名片段和RPASS的密码。从L到R的连接检查使用用户名RFRAG:LFRAG和密码RPASS。从R到L的连接性检查使用用户名LFRAG:RFRAG和LPAS密码。响应使用与请求相同的用户名和密码(请注意,响应中不存在USERNAME属性)。
If the agent is using Diffserv Codepoint markings [RFC2475] in its media packets, it SHOULD apply those same markings to its connectivity checks.
如果代理在其媒体数据包中使用Diffserv代码点标记[RFC2475],则应将这些标记应用于其连接检查。
When a Binding response is received, it is correlated to its Binding request using the transaction ID, as defined in [RFC5389], which then ties it to the candidate pair for which the Binding request was sent. This section defines additional procedures for processing Binding responses specific to this usage of STUN.
当接收到绑定响应时,它使用[RFC5389]中定义的事务ID与其绑定请求关联,然后将其绑定到发送绑定请求的候选对。本节定义了处理特定于此STUN用法的绑定响应的附加过程。
If the STUN transaction generates a 487 (Role Conflict) error response, the agent checks whether it included the ICE-CONTROLLED or ICE-CONTROLLING attribute in the Binding request. If the request contained the ICE-CONTROLLED attribute, the agent MUST switch to the controlling role if it has not already done so. If the request contained the ICE-CONTROLLING attribute, the agent MUST switch to the controlled role if it has not already done so. Once it has switched, the agent MUST enqueue the candidate pair whose check generated the 487 into the triggered check queue. The state of that pair is set to Waiting. When the triggered check is sent, it will contain an ICE-CONTROLLING or ICE-CONTROLLED attribute reflecting its new role. Note, however, that the tie-breaker value MUST NOT be reselected.
如果STUN事务生成487(角色冲突)错误响应,则代理将检查绑定请求中是否包含ICE-CONTROLED或ICE-CONTROLING属性。如果请求包含ICE-CONTROLED属性,则代理必须切换到控制角色(如果尚未切换到控制角色)。如果请求包含ICE-CONTROLING属性,则代理必须切换到受控角色(如果尚未切换到该角色)。一旦切换,代理必须将其检查生成487的候选对排队到触发的检查队列中。该对的状态设置为等待。发送触发的检查时,它将包含反映其新角色的ICE-CONTROLING或ICE-CONTROLED属性。但是,请注意,不得重新选择连接断路器值。
A change in roles will require an agent to recompute pair priorities (Section 5.7.2), since those priorities are a function of controlling and controlled roles. The change in role will also impact whether the agent is responsible for selecting nominated pairs and generating updated offers upon conclusion of ICE.
角色变更将要求代理重新计算配对优先级(第5.7.2节),因为这些优先级是控制和控制角色的功能。角色的变化还将影响代理是否负责选择指定的配对,并在ICE结束时生成更新的报价。
Agents MAY support receipt of ICMP errors for connectivity checks. If the STUN transaction generates an ICMP error, the agent sets the state of the pair to Failed. If the STUN transaction generates a
代理可能支持接收ICMP错误以进行连接检查。如果STUN事务生成ICMP错误,则代理将对的状态设置为失败。如果STUN事务生成
STUN error response that is unrecoverable (as defined in [RFC5389]) or times out, the agent sets the state of the pair to Failed.
无法恢复(如[RFC5389]中定义)或超时的昏迷错误响应,代理将对的状态设置为失败。
The agent MUST check that the source IP address and port of the response equal the destination IP address and port to which the Binding request was sent, and that the destination IP address and port of the response match the source IP address and port from which the Binding request was sent. In other words, the source and destination transport addresses in the request and responses are symmetric. If they are not symmetric, the agent sets the state of the pair to Failed.
代理必须检查响应的源IP地址和端口是否等于绑定请求发送到的目标IP地址和端口,以及响应的目标IP地址和端口是否与发送绑定请求的源IP地址和端口匹配。换句话说,请求和响应中的源和目标传输地址是对称的。如果它们不是对称的,则代理将对的状态设置为Failed。
A check is considered to be a success if all of the following are true:
如果符合以下所有条件,则认为检查成功:
o The STUN transaction generated a success response.
o STUN事务生成了一个成功响应。
o The source IP address and port of the response equals the destination IP address and port to which the Binding request was sent.
o 响应的源IP地址和端口等于绑定请求发送到的目标IP地址和端口。
o The destination IP address and port of the response match the source IP address and port from which the Binding request was sent.
o 响应的目标IP地址和端口与发送绑定请求的源IP地址和端口匹配。
The agent checks the mapped address from the STUN response. If the transport address does not match any of the local candidates that the agent knows about, the mapped address represents a new candidate -- a peer reflexive candidate. Like other candidates, it has a type, base, priority, and foundation. They are computed as follows:
代理从STUN响应中检查映射的地址。如果传输地址与代理知道的任何本地候选地址都不匹配,则映射的地址表示一个新的候选地址——对等自反候选。像其他候选人一样,它有一种类型、基础、优先权和基础。它们的计算如下:
o Its type is equal to peer reflexive.
o 它的类型等同于同辈自反。
o Its base is set equal to the local candidate of the candidate pair from which the STUN check was sent.
o 其基数设置为发送眩晕检查的候选对的本地候选。
o Its priority is set equal to the value of the PRIORITY attribute in the Binding request.
o 其优先级设置为绑定请求中优先级属性的值。
o Its foundation is selected as described in Section 4.1.1.3.
o 如4.1.1.3节所述,其基础是选择的。
This peer reflexive candidate is then added to the list of local candidates for the media stream. Its username fragment and password are the same as all other local candidates for that media stream.
然后将该对等自反候选添加到媒体流的本地候选列表中。它的用户名片段和密码与该媒体流的所有其他本地候选项相同。
However, the peer reflexive candidate is not paired with other remote candidates. This is not necessary; a valid pair will be generated from it momentarily based on the procedures in Section 7.1.3.2.2. If an agent wishes to pair the peer reflexive candidate with other remote candidates besides the one in the valid pair that will be generated, the agent MAY generate an updated offer which includes the peer reflexive candidate. This will cause it to be paired with all other remote candidates.
然而,同侪自反候选者不与其他远程候选者配对。这是没有必要的;根据第7.1.3.2.2节中的程序,将立即从中生成有效对。如果代理希望将对等自反候选与除了将生成的有效对中的一个之外的其他远程候选配对,则代理可以生成包括对等自反候选的更新要约。这将导致它与所有其他远程候选者配对。
The agent constructs a candidate pair whose local candidate equals the mapped address of the response, and whose remote candidate equals the destination address to which the request was sent. This is called a valid pair, since it has been validated by a STUN connectivity check. The valid pair may equal the pair that generated the check, may equal a different pair in the check list, or may be a pair not currently on any check list. If the pair equals the pair that generated the check or is on a check list currently, it is also added to the VALID LIST, which is maintained by the agent for each media stream. This list is empty at the start of ICE processing, and fills as checks are performed, resulting in valid candidate pairs.
代理构造一个候选对,其本地候选等于响应的映射地址,远程候选等于请求发送到的目标地址。这称为有效对,因为它已通过STUN连接检查验证。有效对可能等于生成检查的对,可能等于检查列表中的不同对,或者可能是当前不在任何检查列表中的对。如果该对等于生成检查的对或当前在检查列表中,则该对也将添加到有效列表中,该列表由代理为每个媒体流维护。此列表在ICE处理开始时为空,并在执行检查时填充,从而生成有效的候选对。
It will be very common that the pair will not be on any check list. Recall that the check list has pairs whose local candidates are never server reflexive; those pairs had their local candidates converted to the base of the server reflexive candidates, and then pruned if they were redundant. When the response to the STUN check arrives, the mapped address will be reflexive if there is a NAT between the two. In that case, the valid pair will have a local candidate that doesn't match any of the pairs in the check list.
这对夫妇不在任何检查表上是很常见的。回想一下,检查列表中有一些对,它们的本地候选者从来都不是服务器自反的;这些对将其本地候选对象转换为服务器自反候选对象的基,如果它们是冗余的,则进行修剪。当对STUN检查的响应到达时,如果两者之间存在NAT,则映射的地址将是自反的。在这种情况下,有效对将具有与检查列表中的任何对都不匹配的本地候选项。
If the pair is not on any check list, the agent computes the priority for the pair based on the priority of each candidate, using the algorithm in Section 5.7. The priority of the local candidate depends on its type. If it is not peer reflexive, it is equal to the priority signaled for that candidate in the SDP. If it is peer reflexive, it is equal to the PRIORITY attribute the agent placed in the Binding request that just completed. The priority of the remote candidate is taken from the SDP of the peer. If the candidate does not appear there, then the check must have been a triggered check to a new remote candidate. In that case, the priority is taken as the value of the PRIORITY attribute in the Binding request that triggered the check that just completed. The pair is then added to the VALID LIST.
如果该对不在任何检查列表中,代理将使用第5.7节中的算法,根据每个候选项的优先级计算该对的优先级。本地候选者的优先级取决于其类型。如果不是对等反射,则等于SDP中为该候选者发送的优先级。如果它是对等自反的,则等于代理在刚刚完成的绑定请求中放置的优先级属性。远程候选的优先级取自对等方的SDP。如果候选人没有出现在那里,则该检查必须是对新的远程候选人的触发检查。在这种情况下,优先级被视为触发刚刚完成的检查的绑定请求中优先级属性的值。然后将该对添加到有效列表中。
The agent sets the state of the pair that *generated* the check to Succeeded. Note that, the pair which *generated* the check may be different than the valid pair constructed in Section 7.1.3.2.2 as a consequence of the response. The success of this check might also cause the state of other checks to change as well. The agent MUST perform the following two steps:
代理将*生成*检查的对的状态设置为成功。注意,*生成*检查的对可能与第7.1.3.2.2节中构造的有效对不同,这是响应的结果。此检查的成功也可能导致其他检查的状态发生更改。代理必须执行以下两个步骤:
1. The agent changes the states for all other Frozen pairs for the same media stream and same foundation to Waiting. Typically, but not always, these other pairs will have different component IDs.
1. 代理为相同的媒体流和等待的相同基础改变所有其他冻结对的状态。通常,但并非总是,这些其他对将具有不同的组件ID。
2. If there is a pair in the valid list for every component of this media stream (where this is the actual number of components being used, in cases where the number of components signaled in the SDP differs from offerer to answerer), the success of this check may unfreeze checks for other media streams. Note that this step is followed not just the first time the valid list under consideration has a pair for every component, but every subsequent time a check succeeds and adds yet another pair to that valid list. The agent examines the check list for each other media stream in turn:
2. 如果此媒体流的每个组件的有效列表中都有一对(其中,这是正在使用的组件的实际数量,在SDP中发出信号的组件数量不同于报价人和应答人的情况下),则此检查的成功可能会解冻对其他媒体流的检查。请注意,不仅在第一次考虑中的有效列表对每个组件都有一对时,而且在随后的每次检查成功并将另一对添加到该有效列表时,都会执行此步骤。代理依次检查每个其他媒体流的检查列表:
* If the check list is active, the agent changes the state of all Frozen pairs in that check list whose foundation matches a pair in the valid list under consideration to Waiting.
* 如果检查表是活动的,则代理更改其检查列表中所有冻结的对的状态,其基础与正在考虑的有效列表中的一对匹配为等待。
* If the check list is frozen, and there is at least one pair in the check list whose foundation matches a pair in the valid list under consideration, the state of all pairs in the check list whose foundation matches a pair in the valid list under consideration is set to Waiting. This will cause the check list to become active, and ordinary checks will begin for it, as described in Section 5.8.
* 如果检查表被冻结,并且在检查列表中至少有一对在基础列表中与有效列表中的一对匹配,则检查列表中的所有配对的状态被设置为等待,其基础与正在考虑的有效列表中的一对匹配。如第5.8节所述,这将导致检查表激活,并开始对其进行普通检查。
* If the check list is frozen, and there are no pairs in the check list whose foundation matches a pair in the valid list under consideration, the agent
* 如果检查表被冻结,并且在检查列表中没有配对,其基础与正在考虑的有效列表中的一对匹配,则代理
+ groups together all of the pairs with the same foundation, and
+ 用相同的基础将所有的成对组合在一起,
+ for each group, sets the state of the pair with the lowest component ID to Waiting. If there is more than one such pair, the one with the highest priority is used.
+ 对于每个组,将具有最低组件ID的对的状态设置为等待。如果存在多个这样的对,则使用具有最高优先级的对。
If the agent was a controlling agent, and it had included a USE-CANDIDATE attribute in the Binding request, the valid pair generated from that check has its nominated flag set to true. This flag indicates that this valid pair should be used for media if it is the highest-priority one amongst those whose nominated flag is set. This may conclude ICE processing for this media stream or all media streams; see Section 8.
如果代理是控制代理,并且在绑定请求中包含了USE-CANDIDATE属性,则从该检查生成的有效对将其指定标志设置为true。此标志表示如果此有效对是设置了指定标志的介质中优先级最高的介质,则应将其用于介质。这可以结束该媒体流或所有媒体流的ICE处理;见第8节。
If the agent is the controlled agent, the response may be the result of a triggered check that was sent in response to a request that itself had the USE-CANDIDATE attribute. This case is described in Section 7.2.1.5, and may now result in setting the nominated flag for the pair learned from the original request.
如果代理是受控代理,则响应可能是为响应本身具有USE-CANDIDATE属性的请求而发送的触发检查的结果。第7.2.1.5节描述了这种情况,现在可能会导致为从原始请求中学习到的配对设置指定标志。
Regardless of whether the check was successful or failed, the completion of the transaction may require updating of check list and timer states.
无论检查是否成功,事务的完成都可能需要更新检查列表和计时器状态。
If all of the pairs in the check list are now either in the Failed or Succeeded state:
如果检查列表中的所有对现在都处于失败或成功状态:
o If there is not a pair in the valid list for each component of the media stream, the state of the check list is set to Failed.
o 如果媒体流的每个组件的有效列表中没有一对,则检查列表的状态设置为失败。
o For each frozen check list, the agent
o 对于每个冻结的检查列表,代理
* groups together all of the pairs with the same foundation, and
* 用相同的基础将所有的成对组合在一起,
* for each group, sets the state of the pair with the lowest component ID to Waiting. If there is more than one such pair, the one with the highest priority is used.
* 对于每个组,将具有最低组件ID的对的状态设置为等待。如果存在多个这样的对,则使用具有最高优先级的对。
If none of the pairs in the check list are in the Waiting or Frozen state, the check list is no longer considered active, and will not count towards the value of N in the computation of timers for ordinary checks as described in Section 5.8.
如果检查表中没有一对处于等待或冻结状态,则检查表不再被视为处于活动状态,并且在计算第5.8节所述的普通检查计时器时,检查表不会计入N值。
An agent MUST be prepared to receive a Binding request on the base of each candidate it included in its most recent offer or answer. This requirement holds even if the peer is a lite implementation.
代理人必须准备好根据其最近报价或答复中包含的每个候选人接收具有约束力的请求。即使对等方是lite实现,此要求仍然有效。
The agent MUST use a short-term credential to authenticate the request and perform a message integrity check. The agent MUST consider the username to be valid if it consists of two values separated by a colon, where the first value is equal to the username fragment generated by the agent in an offer or answer for a session in-progress. It is possible (and in fact very likely) that an offerer will receive a Binding request prior to receiving the answer from its peer. If this happens, the agent MUST immediately generate a response (including computation of the mapped address as described in Section 7.2.1.2). The agent has sufficient information at this point to generate the response; the password from the peer is not required. Once the answer is received, it MUST proceed with the remaining steps required, namely, 7.2.1.3, 7.2.1.4, and 7.2.1.5 for full implementations. In cases where multiple STUN requests are received before the answer, this may cause several pairs to be queued up in the triggered check queue.
代理必须使用短期凭据来验证请求并执行消息完整性检查。代理必须考虑用户名是有效的,如果它由由冒号分隔的两个值组成,其中第一个值等于代理在一个正在进行的会话中的提供或应答中生成的用户名片段。报价人有可能(事实上很可能)在收到对方的答复之前收到具有约束力的请求。如果发生这种情况,代理必须立即生成响应(包括计算第7.2.1.2节所述的映射地址)。此时代理有足够的信息生成响应;不需要来自对等方的密码。一旦收到答复,它必须继续执行所需的其余步骤,即7.2.1.3、7.2.1.4和7.2.1.5,以便全面实施。如果在应答之前收到多个STUN请求,这可能会导致多个对在触发的检查队列中排队。
An agent MUST NOT utilize the ALTERNATE-SERVER mechanism, and MUST NOT support the backwards-compatibility mechanisms to RFC 3489. It MUST utilize the FINGERPRINT mechanism.
代理不得使用备用服务器机制,也不得支持RFC 3489的向后兼容机制。它必须利用指纹机制。
If the agent is using Diffserv Codepoint markings [RFC2475] in its media packets, it SHOULD apply those same markings to its responses to Binding requests. The same would apply to any layer 2 markings the endpoint might be applying to media packets.
如果代理在其媒体数据包中使用Diffserv代码点标记[RFC2475],则应将这些标记应用于其对绑定请求的响应。这同样适用于端点可能应用于媒体包的任何第2层标记。
This subsection defines the additional server procedures applicable to full implementations.
本小节定义了适用于完整实现的附加服务器过程。
Normally, the rules for selection of a role in Section 5.2 will result in each agent selecting a different role -- one controlling and one controlled. However, in unusual call flows, typically utilizing third party call control, it is possible for both agents to select the same role. This section describes procedures for checking for this case and repairing it.
通常,第5.2节中的角色选择规则会导致每个代理选择不同的角色——一个控制角色和一个控制角色。然而,在不寻常的呼叫流中,通常利用第三方呼叫控制,两个代理可以选择相同的角色。本节介绍了检查和修复此案例的步骤。
An agent MUST examine the Binding request for either the ICE-CONTROLLING or ICE-CONTROLLED attribute. It MUST follow these procedures:
代理必须检查ICE-CONTROLING或ICE-CONTROLED属性的绑定请求。它必须遵循以下程序:
o If neither ICE-CONTROLLING nor ICE-CONTROLLED is present in the request, the peer agent may have implemented a previous version of this specification. There may be a conflict, but it cannot be detected.
o 如果请求中既不存在ICE-CONTROLING也不存在ICE-CONTROLED,则对等代理可能已经实现了此规范的早期版本。可能存在冲突,但无法检测到。
o If the agent is in the controlling role, and the ICE-CONTROLLING attribute is present in the request:
o 如果代理处于控制角色,并且ICE-CONTROLING属性存在于请求中:
* If the agent's tie-breaker is larger than or equal to the contents of the ICE-CONTROLLING attribute, the agent generates a Binding error response and includes an ERROR-CODE attribute with a value of 487 (Role Conflict) but retains its role.
* 如果代理的绑定中断器大于或等于ICE-CONTROLING属性的内容,则代理将生成绑定错误响应,并包含一个值为487(角色冲突)的错误代码属性,但保留其角色。
* If the agent's tie-breaker is less than the contents of the ICE-CONTROLLING attribute, the agent switches to the controlled role.
* 如果代理的联系断路器小于ICE-CONTROLING属性的内容,则代理将切换到受控角色。
o If the agent is in the controlled role, and the ICE-CONTROLLED attribute is present in the request:
o 如果代理处于受控角色,并且ICE-CONTROLED属性存在于请求中:
* If the agent's tie-breaker is larger than or equal to the contents of the ICE-CONTROLLED attribute, the agent switches to the controlling role.
* 如果代理的连接断路器大于或等于ICE-CONTROLED属性的内容,则代理将切换到控制角色。
* If the agent's tie-breaker is less than the contents of the ICE-CONTROLLED attribute, the agent generates a Binding error response and includes an ERROR-CODE attribute with a value of 487 (Role Conflict) but retains its role.
* 如果代理的绑定断开器小于ICE-CONTROLED属性的内容,则代理将生成绑定错误响应,并包含一个值为487(角色冲突)的错误代码属性,但保留其角色。
o If the agent is in the controlled role and the ICE-CONTROLLING attribute was present in the request, or the agent was in the controlling role and the ICE-CONTROLLED attribute was present in the request, there is no conflict.
o 如果代理处于受控角色且ICE控制属性存在于请求中,或者代理处于控制角色且ICE控制属性存在于请求中,则不存在冲突。
A change in roles will require an agent to recompute pair priorities (Section 5.7.2), since those priorities are a function of controlling and controlled roles. The change in role will also impact whether the agent is responsible for selecting nominated pairs and generated updated offers upon conclusion of ICE.
角色变更将要求代理重新计算配对优先级(第5.7.2节),因为这些优先级是控制和控制角色的功能。角色的变化还将影响代理是否负责选择指定的配对,并在ICE结束时生成更新的报价。
The remaining sections in Section 7.2.1 are followed if the server generated a successful response to the Binding request, even if the agent changed roles.
如果服务器生成了对绑定请求的成功响应,即使代理更改了角色,也将遵循第7.2.1节中的其余部分。
For requests being received on a relayed candidate, the source transport address used for STUN processing (namely, generation of the XOR-MAPPED-ADDRESS attribute) is the transport address as seen by the TURN server. That source transport address will be present in the XOR-PEER-ADDRESS attribute of a Data Indication message, if the Binding request was delivered through a Data Indication. If the
对于中继候选上接收的请求,用于STUN处理(即,生成XOR-MAPPED-address属性)的源传输地址是TURN服务器看到的传输地址。如果绑定请求是通过数据指示传递的,则该源传输地址将出现在数据指示消息的XOR-PEER-address属性中。如果
Binding request was delivered through a ChannelData message, the source transport address is the one that was bound to the channel.
绑定请求是通过ChannelData消息传递的,源传输地址是绑定到通道的地址。
If the source transport address of the request does not match any existing remote candidates, it represents a new peer reflexive remote candidate. This candidate is constructed as follows:
如果请求的源传输地址与任何现有远程候选不匹配,则它表示新的对等自反远程候选。该候选者的结构如下:
o The priority of the candidate is set to the PRIORITY attribute from the request.
o 候选者的优先级设置为请求的优先级属性。
o The type of the candidate is set to peer reflexive.
o 候选人的类型设置为对等自反。
o The foundation of the candidate is set to an arbitrary value, different from the foundation for all other remote candidates. If any subsequent offer/answer exchanges contain this peer reflexive candidate in the SDP, it will signal the actual foundation for the candidate.
o 候选的基础被设置为任意值,不同于所有其他远程候选的基础。如果任何后续的报价/应答交换机包含SDP中的对等反射候选,它将为候选信号提供实际基础。
o The component ID of this candidate is set to the component ID for the local candidate to which the request was sent.
o 此候选组件的组件ID设置为向其发送请求的本地候选组件的组件ID。
This candidate is added to the list of remote candidates. However, the agent does not pair this candidate with any local candidates.
此候选对象将添加到远程候选对象列表中。但是,代理不会将此候选人与任何本地候选人配对。
Next, the agent constructs a pair whose local candidate is equal to the transport address on which the STUN request was received, and a remote candidate equal to the source transport address where the request came from (which may be the peer reflexive remote candidate that was just learned). The local candidate will either be a host candidate (for cases where the request was not received through a relay) or a relayed candidate (for cases where it is received through a relay). The local candidate can never be a server reflexive candidate. Since both candidates are known to the agent, it can obtain their priorities and compute the candidate pair priority. This pair is then looked up in the check list. There can be one of several outcomes:
接下来,代理构造一对,其本地候选地址等于接收STUN请求的传输地址,远程候选地址等于请求来自的源传输地址(可能是刚刚学习的对等自反远程候选)。本地候选将是主机候选(对于未通过中继接收到请求的情况)或中继候选(对于通过中继接收到请求的情况)。本地候选者永远不能是服务器自反候选者。由于代理知道这两个候选项,因此它可以获得它们的优先级并计算候选项对优先级。然后在检查列表中查找这一对。可能有以下几种结果之一:
o If the pair is already on the check list:
o 如果该对已在检查列表中:
* If the state of that pair is Waiting or Frozen, a check for that pair is enqueued into the triggered check queue if not already present.
* 如果该对的状态为“等待”或“冻结”,则该对的检查将排入触发的检查队列(如果尚未存在)。
* If the state of that pair is In-Progress, the agent cancels the in-progress transaction. Cancellation means that the agent will not retransmit the request, will not treat the lack of response to be a failure, but will wait the duration of the transaction timeout for a response. In addition, the agent MUST create a new connectivity check for that pair (representing a new STUN Binding request transaction) by enqueueing the pair in the triggered check queue. The state of the pair is then changed to Waiting.
* 如果该对的状态为“正在进行”,则代理将取消正在进行的事务。取消意味着代理不会重新传输请求,不会将缺少响应视为失败,而是等待事务超时的持续时间以获得响应。此外,代理必须通过将该对排队到触发的检查队列中,为该对创建新的连接检查(表示新的STUN绑定请求事务)。然后,该对的状态更改为等待。
* If the state of the pair is Failed, it is changed to Waiting and the agent MUST create a new connectivity check for that pair (representing a new STUN Binding request transaction), by enqueueing the pair in the triggered check queue.
* 如果对的状态为Failed(失败),则将其更改为Waiting(等待),并且代理必须通过将对排入触发的检查队列,为该对创建新的连接检查(表示新的STUN绑定请求事务)。
* If the state of that pair is Succeeded, nothing further is done.
* 如果该对的状态成功,则不会执行任何进一步的操作。
These steps are done to facilitate rapid completion of ICE when both agents are behind NAT.
当两种试剂都落后于NAT时,这些步骤有助于快速完成ICE。
o If the pair is not already on the check list:
o 如果该对不在检查列表中:
* The pair is inserted into the check list based on its priority.
* 该对将根据其优先级插入检查列表。
* Its state is set to Waiting.
* 其状态设置为等待。
* The pair is enqueued into the triggered check queue.
* 该对被排队到触发的检查队列中。
When a triggered check is to be sent, it is constructed and processed as described in Section 7.1.2. These procedures require the agent to know the transport address, username fragment, and password for the peer. The username fragment for the remote candidate is equal to the part after the colon of the USERNAME in the Binding request that was just received. Using that username fragment, the agent can check the SDP messages received from its peer (there may be more than one in cases of forking), and find this username fragment. The corresponding password is then selected.
当发送触发检查时,应按照第7.1.2节所述进行构造和处理。这些过程要求代理知道对等方的传输地址、用户名片段和密码。远程候选用户的用户名片段等于刚刚收到的绑定请求中用户名冒号后的部分。使用该用户名片段,代理可以检查从其对等方接收的SDP消息(在分叉的情况下可能有多个),并找到该用户名片段。然后选择相应的密码。
If the Binding request received by the agent had the USE-CANDIDATE attribute set, and the agent is in the controlled role, the agent looks at the state of the pair computed in Section 7.2.1.4:
如果代理收到的绑定请求设置了USE-CANDIDATE属性,并且代理处于受控角色,则代理将查看第7.2.1.4节中计算的绑定对的状态:
o If the state of this pair is Succeeded, it means that the check generated by this pair produced a successful response. This would have caused the agent to construct a valid pair when that success
o 如果此对的状态为成功,则表示此对生成的检查生成了成功响应。这将导致代理在成功执行该操作时构造有效对
response was received (see Section 7.1.3.2.2). The agent now sets the nominated flag in the valid pair to true. This may end ICE processing for this media stream; see Section 8.
收到响应(见第7.1.3.2.2节)。代理现在将有效对中的指定标志设置为true。这可以结束该媒体流的ICE处理;见第8节。
o If the state of this pair is In-Progress, if its check produces a successful result, the resulting valid pair has its nominated flag set when the response arrives. This may end ICE processing for this media stream when it arrives; see Section 8.
o 如果该对的状态正在进行中,如果其检查产生成功的结果,则在响应到达时,生成的有效对将设置其指定标志。这可能会在该媒体流到达时结束其ICE处理;见第8节。
If the check that was just received contained a USE-CANDIDATE attribute, the agent constructs a candidate pair whose local candidate is equal to the transport address on which the request was received, and whose remote candidate is equal to the source transport address of the request that was received. This candidate pair is assigned an arbitrary priority, and placed into a list of valid candidates called the valid list. The agent sets the nominated flag for that pair to true. ICE processing is considered complete for a media stream if the valid list contains a candidate pair for each component.
如果刚刚收到的检查包含USE-CANDIDATE属性,则代理将构造一个候选对,其本地候选项等于接收请求的传输地址,远程候选项等于接收到的请求的源传输地址。该候选项对被分配一个任意优先级,并被放入名为“有效列表”的有效候选项列表中。代理将该对的指定标志设置为true。如果有效列表包含每个组件的候选对,则认为媒体流的ICE处理已完成。
This section describes how an agent completes ICE.
本节介绍代理如何完成ICE。
Concluding ICE involves nominating pairs by the controlling agent and updating of state machinery.
结论ICE包括由控制代理指定对和更新状态机制。
The controlling agent nominates pairs to be selected by ICE by using one of two techniques: regular nomination or aggressive nomination. If its peer has a lite implementation, an agent MUST use a regular nomination algorithm. If its peer is using ICE options (present in an ice-options attribute from the peer) that the agent does not understand, the agent MUST use a regular nomination algorithm. If its peer is a full implementation and isn't using any ICE options or is using ICE options understood by the agent, the agent MAY use either the aggressive or the regular nomination algorithm. However, the regular algorithm is RECOMMENDED since it provides greater stability.
控制代理通过使用两种技术中的一种来指定ICE要选择的对:常规指定或攻击性指定。如果其对等方具有lite实现,则代理必须使用常规的提名算法。如果其对等方正在使用代理不了解的ICE选项(存在于对等方的ICE选项属性中),则代理必须使用常规提名算法。如果其对等方是完整的实现,并且没有使用任何ICE选项,或者正在使用代理理解的ICE选项,则代理可以使用主动或常规提名算法。但是,推荐使用常规算法,因为它提供了更大的稳定性。
With regular nomination, the agent lets some number of checks complete, each of which omit the USE-CANDIDATE attribute. Once one or more checks complete successfully for a component of a media stream, valid pairs are generated and added to the valid list. The agent lets the checks continue until some stopping criterion is met, and then picks amongst the valid pairs based on an evaluation criterion. The criteria for stopping the checks and for evaluating the valid pairs is entirely a matter of local optimization.
对于常规提名,代理允许完成一定数量的检查,每个检查都会忽略USE-CANDIDATE属性。一旦媒体流组件的一个或多个检查成功完成,将生成有效对并将其添加到有效列表中。代理让检查继续进行,直到满足某个停止标准,然后根据评估标准从有效对中进行选择。停止检查和评估有效对的标准完全是局部优化的问题。
When the controlling agent selects the valid pair, it repeats the check that produced this valid pair (by enqueuing the pair that generated the check into the triggered check queue), this time with the USE-CANDIDATE attribute. This check should succeed (since the previous did), causing the nominated flag of that and only that pair to be set. Consequently, there will be only a single nominated pair in the valid list for each component, and when the state of the check list moves to completed, that exact pair is selected by ICE for sending and receiving media for that component.
当控制代理选择有效对时,它会重复生成该有效对的检查(通过将生成检查的对排队到触发的检查队列中),这次使用USE-CANDIDATE属性。此检查应成功(因为上一次检查成功),从而设置该对的指定标志,并且仅设置该对。因此,每个组件的有效列表中只有一个指定对,当检查列表的状态移动到“完成”时,ICE将选择该对,用于发送和接收该组件的介质。
Regular nomination provides the most flexibility, since the agent has control over the stopping and selection criteria for checks. The only requirement is that the agent MUST eventually pick one and only one candidate pair and generate a check for that pair with the USE-CANDIDATE attribute present. Regular nomination also improves ICE's resilience to variations in implementation (see Section 14). Regular nomination is also more stable, allowing both agents to converge on a single pair for media without any transient selections, which can happen with the aggressive algorithm. The drawback of regular nomination is that it is guaranteed to increase latencies because it requires an additional check to be done.
定期提名提供了最大的灵活性,因为代理人可以控制支票的停止和选择标准。唯一的要求是,代理必须最终选择一个且仅选择一个候选对,并为存在USE-candidate属性的候选对生成检查。定期提名还提高了ICE对实施变化的适应能力(见第14节)。常规提名也更稳定,允许两个代理在没有任何瞬态选择的情况下收敛于媒体的单个对,这可能发生在激进算法中。常规提名的缺点是,它保证会增加延迟,因为它需要进行额外的检查。
With aggressive nomination, the controlling agent includes the USE-CANDIDATE attribute in every check it sends. Once the first check for a component succeeds, it will be added to the valid list and have its nominated flag set. When all components have a nominated pair in the valid list, media can begin to flow using the highest priority nominated pair. However, because the agent included the USE-CANDIDATE attribute in all of its checks, another check may yet complete, causing another valid pair to have its nominated flag set. ICE always selects the highest-priority nominated candidate pair from the valid list as the one used for media. Consequently, the selected pair may actually change briefly as ICE checks complete, resulting in a set of transient selections until it stabilizes.
对于主动提名,控制代理在其发送的每个检查中都包含USE-CANDIDATE属性。一旦组件的第一次检查成功,它将被添加到有效列表并设置其指定标志。当所有组件在有效列表中都有一个指定对时,介质可以使用最高优先级的指定对开始流动。但是,由于代理在其所有检查中都包含USE-CANDIDATE属性,另一个检查可能仍会完成,从而导致另一个有效对设置了其指定标志。ICE始终从有效列表中选择优先级最高的指定候选对作为用于介质的候选对。因此,当ICE检查完成时,所选对实际上可能会短暂改变,从而产生一组瞬态选择,直到其稳定为止。
For both controlling and controlled agents, the state of ICE processing depends on the presence of nominated candidate pairs in the valid list and on the state of the check list. Note that, at any time, more than one of the following cases can apply:
对于控制和受控代理,ICE处理的状态取决于有效列表中指定候选对的存在和检查列表的状态。请注意,在任何时候,以下情况中的一种以上都可能适用:
o If there are no nominated pairs in the valid list for a media stream and the state of the check list is Running, ICE processing continues.
o 如果媒体流的有效列表中没有指定对,并且检查列表的状态为运行,ICE处理将继续。
o If there is at least one nominated pair in the valid list for a media stream and the state of the check list is Running:
o 如果媒体流的有效列表中至少有一个指定对,并且检查列表的状态正在运行:
* The agent MUST remove all Waiting and Frozen pairs in the check list and triggered check queue for the same component as the nominated pairs for that media stream.
* 代理必须删除与该媒体流的指定对相同组件的检查列表和触发检查队列中的所有等待和冻结对。
* If an In-Progress pair in the check list is for the same component as a nominated pair, the agent SHOULD cease retransmissions for its check if its pair priority is lower than the lowest-priority nominated pair for that component.
* 如果检查列表中的进行中对与指定对针对同一组件,则如果其对优先级低于该组件的最低优先级指定对,则代理应停止重新传输以进行检查。
o Once there is at least one nominated pair in the valid list for every component of at least one media stream and the state of the check list is Running:
o 一旦至少一个媒体流的每个组件的有效列表中至少有一个指定对,并且检查列表的状态正在运行:
* The agent MUST change the state of processing for its check list for that media stream to Completed.
* 代理必须更改处理状态,才能将该媒体流的检查列表更改为“已完成”。
* The agent MUST continue to respond to any checks it may still receive for that media stream, and MUST perform triggered checks if required by the processing of Section 7.2.
* 代理必须继续对其可能仍然收到的该媒体流的任何检查作出响应,并且如果第7.2节的处理要求,必须执行触发检查。
* The agent MUST continue retransmitting any In-Progress checks for that check list.
* 代理必须继续重新传输该检查列表的任何正在进行的检查。
* The agent MAY begin transmitting media for this media stream as described in Section 11.1.
* 如第11.1节所述,代理可以开始传输该媒体流的媒体。
o Once the state of each check list is Completed:
o 完成每个检查表的状态后:
* The agent sets the state of ICE processing overall to Completed.
* 代理将冰处理的整体状态设置为“已完成”。
* If an agent is controlling, it examines the highest-priority nominated candidate pair for each component of each media stream. If any of those candidate pairs differ from the
* 如果代理正在控制,它将检查每个媒体流的每个组件的最高优先级指定候选对。如果这些候选对中的任何一对与
default candidate pairs in the most recent offer/answer exchange, the controlling agent MUST generate an updated offer as described in Section 9. If the controlling agent is using an aggressive nomination algorithm, this may result in several updated offers as the pairs selected for media change. An agent MAY delay sending the offer for a brief interval (one second is RECOMMENDED) in order to allow the selected pairs to stabilize.
默认候选对在最近的报价/应答交换中,控制代理必须生成更新的报价,如第9节所述。如果控制代理使用积极的提名算法,这可能会导致在选择对进行媒体更改时更新多个报价。代理可能会将发送要约延迟一段短暂的时间间隔(建议为1秒),以使所选对保持稳定。
o If the state of the check list is Failed, ICE has not been able to complete for this media stream. The correct behavior depends on the state of the check lists for other media streams:
o 如果检查列表的状态失败,则ICE无法完成此媒体流。正确的行为取决于其他媒体流的检查列表的状态:
* If all check lists are Failed, ICE processing overall is considered to be in the Failed state, and the agent SHOULD consider the session a failure, SHOULD NOT restart ICE, and the controlling agent SHOULD terminate the entire session.
* 如果所有检查表都失败,则整个ICE处理被认为处于故障状态,并且代理应考虑会话失败,不应重新启动ICE,并且控制代理应终止整个会话。
* If at least one of the check lists for other media streams is Completed, the controlling agent SHOULD remove the failed media stream from the session in its updated offer.
* 如果其他媒体流的至少一个检查列表已完成,则控制代理应在其更新的报价中从会话中删除失败的媒体流。
* If none of the check lists for other media streams are Completed, but at least one is Running, the agent SHOULD let ICE continue.
* 如果其他媒体流的检查列表均未完成,但至少有一个正在运行,则代理应让ICE继续。
Concluding ICE for a lite implementation is relatively straightforward. There are two cases to consider:
为lite实现总结ICE相对简单。有两种情况需要考虑:
The implementation is lite, and its peer is full.
实现是lite,它的对等端是满的。
The implementation is lite, and its peer is lite.
实现是lite,它的对等体是lite。
The effect of ICE concluding is that the agent can free any allocated host candidates that were not utilized by ICE, as described in Section 8.3.
ICE结论的效果是,代理可以释放ICE未使用的任何分配的主机候选,如第8.3节所述。
In this case, the agent will receive connectivity checks from its peer. When an agent has received a connectivity check that includes the USE-CANDIDATE attribute for each component of a media stream, the state of ICE processing for that media stream moves from Running to Completed. When the state of ICE processing for all media streams is Completed, the state of ICE processing overall is Completed.
在这种情况下,代理将从其对等方接收连接检查。当代理已接收到包括媒体流的每个组件的USE-CANDIDATE属性的连接检查时,该媒体流的ICE处理的状态将从Running移动到Completed。当所有媒体流的ICE处理状态完成时,ICE处理整体状态完成。
The lite implementation will never itself determine that ICE processing has failed for a media stream; rather, the full peer will make that determination and then remove or restart the failed media stream in a subsequent offer.
lite实现本身永远不会确定媒体流的ICE处理失败;相反,完全对等方将做出该决定,然后在后续提供中删除或重新启动失败的媒体流。
Once the offer/answer exchange has completed, both agents examine their candidates and those of its peer. For each media stream, each agent pairs up its own candidates with the candidates of its peer for that media stream. Two candidates are paired up when they are for the same component, utilize the same transport protocol (UDP in this specification), and are from the same IP address family (IPv4 or IPv6).
一旦提议/答复交换完成,两个代理都会检查其候选人及其同行的候选人。对于每个媒体流,每个代理将其自己的候选对象与其对等媒体流的候选对象配对。当两个候选组件用于相同组件、使用相同的传输协议(本规范中为UDP)并且来自相同的IP地址系列(IPv4或IPv6)时,它们将配对。
o If there is a single pair per component, that pair is added to the Valid list. If all of the components for a media stream had one pair, the state of ICE processing for that media stream is set to Completed. If all media streams are Completed, the state of ICE processing is set to Completed overall. This will always be the case for implementations that are IPv4 only.
o 如果每个组件只有一对,则该对将添加到有效列表中。如果媒体流的所有组件都有一对,则该媒体流的ICE处理状态设置为已完成。如果所有媒体流都已完成,ICE处理的状态将设置为“全部完成”。对于仅使用IPv4的实现,情况总是如此。
o If there is more than one pair per component:
o 如果每个组件有一对以上:
* The agent MUST select a pair based on local policy. Since this case only arises for IPv6, it is RECOMMENDED that an agent follow the procedures of RFC 3484 [RFC3484] to select a single pair.
* 代理必须根据本地策略选择一对。由于这种情况仅适用于IPv6,因此建议代理按照RFC 3484[RFC3484]的步骤选择一对。
* The agent adds the selected pair for each component to the valid list. As described in Section 11.1, this will permit media to begin flowing. However, it is possible (and in fact likely) that both agents have chosen different pairs.
* 代理将每个组件的选定对添加到有效列表中。如第11.1节所述,这将允许介质开始流动。然而,这两个代理可能(事实上很可能)选择了不同的对。
* To reconcile this, the controlling agent MUST send an updated offer as described in Section 9.1.3, which will include the remote-candidates attribute.
* 为了协调这一点,控制代理必须发送第9.1.3节所述的更新要约,其中包括远程候选人属性。
* The agent MUST NOT update the state of ICE processing when the offer is sent. If this subsequent offer completes, the controlling agent MUST change the state of ICE processing to Completed for all media streams, and the state of ICE processing overall to Completed. The states for the controlled agent are set based on the logic in Section 9.2.3.
* 发送报价时,代理不得更新ICE处理状态。如果此后续报价完成,则控制代理必须将所有媒体流的ICE处理状态更改为已完成,并将ICE处理整体状态更改为已完成。根据第9.2.3节中的逻辑设置受控代理的状态。
The procedures in Section 8 require that an agent continue to listen for STUN requests and continue to generate triggered checks for a media stream, even once processing for that stream completes. The rules in this section describe when it is safe for an agent to cease sending or receiving checks on a candidate that was not selected by ICE, and then free the candidate.
第8节中的过程要求代理继续侦听STUN请求,并继续生成媒体流的触发检查,即使该流的处理完成。本节中的规则描述了代理何时可以安全地停止发送或接收对ICE未选择的候选人的检查,然后释放该候选人。
When ICE is used with SIP, and an offer is forked to multiple recipients, ICE proceeds in parallel and independently with each answerer, all using the same local candidates. Once ICE processing has reached the Completed state for all peers for media streams using those candidates, the agent SHOULD wait an additional three seconds, and then it MAY cease responding to checks or generating triggered checks on that candidate. It MAY free the candidate at that time. Freeing of server reflexive candidates is never explicit; it happens by lack of a keepalive. The three-second delay handles cases when aggressive nomination is used, and the selected pairs can quickly change after ICE has completed.
当ICE与SIP一起使用时,一个报价被分给多个接收者,ICE与每个应答者并行且独立地进行,所有应答者都使用相同的本地候选人。一旦ICE处理对于使用这些候选对象的媒体流的所有对等方达到完成状态,代理应再等待三秒钟,然后它可能停止响应检查或对该候选对象生成触发检查。届时可能会释放候选人。释放服务器自反候选者从来都不是明确的;这是由于缺少一个保持活力。当使用攻击性提名时,三秒延迟处理情况,并且在ICE完成后,所选对可以快速更改。
A lite implementation MAY free candidates not selected by ICE as soon as ICE processing has reached the Completed state for all peers for all media streams using those candidates.
lite实现可以在ICE处理对于使用这些候选的所有媒体流的所有对等方达到完成状态时释放ICE未选择的候选。
Either agent MAY generate a subsequent offer at any time allowed by RFC 3264 [RFC3264]. The rules in Section 8 will cause the controlling agent to send an updated offer at the conclusion of ICE processing when ICE has selected different candidate pairs from the default pairs. This section defines rules for construction of subsequent offers and answers.
任一代理均可在RFC 3264[RFC3264]允许的任何时间生成后续报价。当ICE从默认对中选择了不同的候选对时,第8节中的规则将导致控制代理在ICE处理结束时发送更新的报价。本节定义了后续报价和应答的构造规则。
Should a subsequent offer be rejected, ICE processing continues as if the subsequent offer had never been made.
如果后续报价被拒绝,ICE处理将继续进行,就像后续报价从未被提出一样。
An agent MAY restart ICE processing for an existing media stream. An ICE restart, as the name implies, will cause all previous states of ICE processing to be flushed and checks to start anew. The only difference between an ICE restart and a brand new media session is that, during the restart, media can continue to be sent to the previously validated pair.
代理可以重新启动现有媒体流的ICE处理。顾名思义,ICE重启将导致刷新ICE处理的所有先前状态,并重新开始检查。ICE重启和全新媒体会话之间的唯一区别在于,在重启过程中,媒体可以继续发送到先前验证的配对。
An agent MUST restart ICE for a media stream if:
在以下情况下,代理必须为媒体流重新启动ICE:
o The offer is being generated for the purposes of changing the target of the media stream. In other words, if an agent wants to generate an updated offer that, had ICE not been in use, would result in a new value for the destination of a media component.
o 为了更改媒体流的目标而生成要约。换句话说,如果代理希望生成更新的报价,如果ICE未被使用,将为媒体组件的目标生成新的值。
o An agent is changing its implementation level. This typically only happens in third party call control use cases, where the entity performing the signaling is not the entity receiving the media, and it has changed the target of media mid-session to another entity that has a different ICE implementation.
o 代理正在更改其实现级别。这通常仅发生在第三方呼叫控制用例中,其中执行信令的实体不是接收媒体的实体,并且它已将媒体中间会话的目标更改为具有不同ICE实现的另一实体。
These rules imply that setting the IP address in the c line to 0.0.0.0 will cause an ICE restart. Consequently, ICE implementations MUST NOT utilize this mechanism for call hold, and instead MUST use a=inactive and a=sendonly as described in [RFC3264].
这些规则意味着将c行中的IP地址设置为0.0.0.0将导致ICE重新启动。因此,ICE实现不得将此机制用于呼叫保持,而必须使用[RFC3264]中所述的a=inactive和a=sendonly。
To restart ICE, an agent MUST change both the ice-pwd and the ice-ufrag for the media stream in an offer. Note that it is permissible to use a session-level attribute in one offer, but to provide the same ice-pwd or ice-ufrag as a media-level attribute in a subsequent offer. This is not a change in password, just a change in its representation, and does not cause an ICE restart.
要重新启动ICE,代理必须更改报价中媒体流的ICE pwd和ICE ufrag。请注意,允许在一个报价中使用会话级属性,但在后续报价中提供与媒体级属性相同的ice pwd或ice ufrag。这不是对密码的更改,只是对其表示形式的更改,并且不会导致ICE重新启动。
An agent sets the rest of the fields in the SDP for this media stream as it would in an initial offer of this media stream (see Section 4.3). Consequently, the set of candidates MAY include some, none, or all of the previous candidates for that stream and MAY include a totally new set of candidates gathered as described in Section 4.1.1.
代理为该媒体流设置SDP中的其余字段,就像在该媒体流的初始报价中一样(参见第4.3节)。因此,候选集可能包括该流的部分、无或所有先前候选集,并且可能包括如第4.1.1节所述收集的全新候选集。
If an agent removes a media stream by setting its port to zero, it MUST NOT include any candidate attributes for that media stream and SHOULD NOT include any other ICE-related attributes defined in Section 15 for that media stream.
如果代理通过将其端口设置为零来删除媒体流,则它不得包括该媒体流的任何候选属性,并且不应包括第15节中为该媒体流定义的任何其他ICE相关属性。
If an agent wishes to add a new media stream, it sets the fields in the SDP for this media stream as if this was an initial offer for that media stream (see Section 4.3). This will cause ICE processing to begin for this media stream.
如果代理希望添加新的媒体流,它会在SDP中为该媒体流设置字段,就像这是该媒体流的初始报价一样(参见第4.3节)。这将导致此媒体流的ICE处理开始。
This section describes additional procedures for full implementations, covering existing media streams.
本节介绍完整实施的其他过程,包括现有媒体流。
The username fragments, password, and implementation level MUST remain the same as used previously. If an agent needs to change one of these, it MUST restart ICE for that media stream.
用户名片段、密码和实现级别必须与以前使用的相同。如果代理需要更改其中一个,则必须重新启动该媒体流的ICE。
Additional behavior depends on the state ICE processing for that media stream.
其他行为取决于该媒体流的ICE处理状态。
If an agent generates an updated offer including a media stream that was previously established, and for which ICE checks are in the Running state, the agent follows the procedures defined here.
如果代理生成更新的报价,包括先前建立的媒体流,并且ICE检查处于运行状态,则代理将遵循此处定义的过程。
An agent MUST include candidate attributes for all local candidates it had signaled previously for that media stream. The properties of that candidate as signaled in SDP -- the priority, foundation, type, and related transport address -- SHOULD remain the same. The IP address, port, and transport protocol, which fundamentally identify that candidate, MUST remain the same (if they change, it would be a new candidate). The component ID MUST remain the same. The agent MAY include additional candidates it did not offer previously, but which it has gathered since the last offer/answer exchange, including peer reflexive candidates.
代理必须包括它先前为该媒体流发出信号的所有本地候选的候选属性。在SDP中发出的信号的属性——优先级、基础、类型和相关的传输地址——应该保持不变。IP地址、端口和传输协议(从根本上确定该候选者)必须保持不变(如果它们发生变化,则将是一个新候选者)。组件ID必须保持不变。代理可能包括以前未提供但自上次提供/回答交换以来已收集的其他候选人,包括同行自反候选人。
The agent MAY change the default destination for media. As with initial offers, there MUST be a set of candidate attributes in the offer matching this default destination.
代理可以更改介质的默认目标。与初始报价一样,报价中必须有一组候选属性与此默认目的地相匹配。
If an agent generates an updated offer including a media stream that was previously established, and for which ICE checks are in the Completed state, the agent follows the procedures defined here.
如果代理生成更新的报价,包括先前建立的媒体流,并且ICE检查处于完成状态,则代理将遵循此处定义的过程。
The default destination for media (i.e., the values of the IP addresses and ports in the m and c lines used for that media stream) MUST be the local candidate from the highest-priority nominated pair in the valid list for each component. This "fixes" the default destination for media to equal the destination ICE has selected for media.
媒体的默认目标(即,用于该媒体流的m和c行中的IP地址和端口值)必须是每个组件的有效列表中最高优先级指定对中的本地候选。这将“修复”介质的默认目标,使其等于ICE为介质选择的目标。
The agent MUST include candidate attributes for candidates matching the default destination for each component of the media stream, and MUST NOT include any other candidates.
代理必须包括与媒体流每个组件的默认目标相匹配的候选对象的候选对象属性,并且不得包括任何其他候选对象。
In addition, if the agent is controlling, it MUST include the a=remote-candidates attribute for each media stream whose check list is in the Completed state. The attribute contains the remote candidates from the highest-priority nominated pair in the valid list for each component of that media stream. It is needed to avoid a race condition whereby the controlling agent chooses its pairs, but the updated offer beats the connectivity checks to the controlled agent, which doesn't even know these pairs are valid, let alone selected. See Appendix B.6 for elaboration on this race condition.
此外,如果代理正在控制,则必须为检查列表处于完成状态的每个媒体流包含a=远程候选属性。该属性包含该媒体流的每个组件的有效列表中最高优先级指定对中的远程候选。需要避免控制代理选择其对的竞争条件,但更新后的报价胜过对控制代理的连接性检查,后者甚至不知道这些对是有效的,更不用说选择了。有关该竞赛条件的详细说明,请参见附录B.6。
This section describes procedures for lite implementations for existing streams for which ICE is running.
本节描述了运行ICE的现有流的lite实现过程。
A lite implementation MUST include all of its candidates for each component of each media stream in an a=candidate attribute in any subsequent offer. These candidates are formed identically to the procedures for initial offers, as described in Section 4.2.
lite实现必须在任何后续提供的A=candidate属性中包含每个媒体流的每个组件的所有候选项。如第4.2节所述,这些候选人的构成与初始报价程序相同。
A lite implementation MUST NOT add additional host candidates in a subsequent offer. If an agent needs to offer additional candidates, it MUST restart ICE.
lite实施不得在后续报价中添加其他候选主机。如果代理需要提供其他候选人,则必须重新启动ICE。
The username fragments, password, and implementation level MUST remain the same as used previously. If an agent needs to change one of these, it MUST restart ICE for that media stream.
用户名片段、密码和实现级别必须与以前使用的相同。如果代理需要更改其中一个,则必须重新启动该媒体流的ICE。
If ICE has completed for a media stream, the default destination for that media stream MUST be set to the remote candidate of the candidate pair for that component in the valid list. For a lite implementation, there is always just a single candidate pair in the valid list for each component of a media stream. Additionally, the agent MUST include a candidate attribute for each default destination.
如果媒体流的ICE已完成,则该媒体流的默认目标必须设置为有效列表中该组件的候选对的远程候选。对于lite实现,媒体流的每个组件的有效列表中始终只有一个候选对。此外,代理必须为每个默认目标包含一个候选属性。
Additionally, if the agent is controlling (which only happens when both agents are lite), the agent MUST include the a=remote-candidates attribute for each media stream. The attribute contains the remote candidates from the candidate pairs in the valid list (one pair for each component of each media stream).
此外,如果代理正在控制(仅当两个代理都是lite时才会发生),则代理必须为每个媒体流包含a=远程候选属性。该属性包含有效列表中候选对中的远程候选(每个媒体流的每个组件对应一对)。
When receiving a subsequent offer within an existing session, an agent MUST reapply the verification procedures in Section 5.1 without regard to the results of verification from any previous offer/answer exchanges. Indeed, it is possible that a previous offer/answer exchange resulted in ICE not being used, but it is used as a consequence of a subsequent exchange.
在现有会话中收到后续要约时,代理人必须重新应用第5.1节中的验证程序,而不考虑任何先前要约/应答交换的验证结果。事实上,先前的报价/应答交换可能导致ICE未被使用,但它是后续交换的结果。
If the offer contained a change in the a=ice-ufrag or a=ice-pwd attributes compared to the previous SDP from the peer, it indicates that ICE is restarting for this media stream. If all media streams are restarting, then ICE is restarting overall.
如果与来自对等方的前一个SDP相比,报价中包含a=ice ufrag或a=ice pwd属性的更改,则表示ice正在为此媒体流重新启动。如果所有媒体流都在重新启动,则ICE将整体重新启动。
If ICE is restarting for a media stream:
如果ICE正在重新启动媒体流:
o The agent MUST change the a=ice-ufrag and a=ice-pwd attributes in the answer.
o 代理必须更改答案中的a=ice ufrag和a=ice pwd属性。
o The agent MAY change its implementation level in the answer.
o 代理可以在应答中更改其实现级别。
An agent sets the rest of the fields in the SDP for this media stream as it would in an initial answer to this media stream (see Section 4.3). Consequently, the set of candidates MAY include some, none, or all of the previous candidates for that stream and MAY include a totally new set of candidates gathered as described in Section 4.1.1.
代理为该媒体流设置SDP中的其余字段,就像在对此媒体流的初始回答中一样(参见第4.3节)。因此,候选集可能包括该流的部分、无或所有先前候选集,并且可能包括如第4.1.1节所述收集的全新候选集。
If the offer contains a new media stream, the agent sets the fields in the answer as if it had received an initial offer containing that media stream (see Section 4.3). This will cause ICE processing to begin for this media stream.
如果报价包含一个新的媒体流,则代理将答案中的字段设置为好像它已收到包含该媒体流的初始报价(见第4.3节)。这将导致此媒体流的ICE处理开始。
If an offer contains a media stream whose port is zero, the agent MUST NOT include any candidate attributes for that media stream in its answer and SHOULD NOT include any other ICE-related attributes defined in Section 15 for that media stream.
如果要约包含端口为零的媒体流,则代理不得在其回答中包括该媒体流的任何候选属性,并且不应包括第15节中为该媒体流定义的任何其他ICE相关属性。
Unless the agent has detected an ICE restart from the offer, the username fragments, password, and implementation level MUST remain the same as used previously. If an agent needs to change one of these it MUST restart ICE for that media stream by generating an offer; ICE cannot be restarted in an answer.
除非代理已从提供中检测到ICE重新启动,否则用户名片段、密码和实现级别必须与以前使用的相同。如果代理需要更改其中一个,则必须通过生成报价重新启动该媒体流的ICE;ICE不能在应答中重新启动。
Additional behaviors depend on the state of ICE processing for that media stream.
其他行为取决于该媒体流的ICE处理状态。
9.2.2.1. Existing Media Streams with ICE Running and no remote-candidates
9.2.2.1. 运行ICE且没有远程候选的现有媒体流
If ICE is running for a media stream, and the offer for that media stream lacked the remote-candidates attribute, the rules for construction of the answer are identical to those for the offerer as described in Section 9.1.2.1.
如果ICE正在为媒体流运行,且该媒体流的报价缺少“远程候选人”属性,则答案的构造规则与第9.1.2.1节中描述的报价人的规则相同。
9.2.2.2. Existing Media Streams with ICE Completed and no remote-candidates
9.2.2.2. ICE已完成且没有远程候选的现有媒体流
If ICE is Completed for a media stream, and the offer for that media stream lacked the remote-candidates attribute, the rules for construction of the answer are identical to those for the offerer as described in Section 9.1.2.2, except that the answerer MUST NOT include the a=remote-candidates attribute in the answer.
如果媒体流的ICE已完成,且该媒体流的报价缺少“远程候选人”属性,则回答的构造规则与第9.1.2.2节中描述的报价人的规则相同,但回答者不得在回答中包含“a=远程候选人”属性。
A controlled agent will receive an offer with the a=remote-candidates attribute for a media stream when its peer has concluded ICE processing for that media stream. This attribute is present in the offer to deal with a race condition between the receipt of the offer,
当其对等方完成媒体流的ICE处理时,受控代理将收到媒体流的带有=远程候选属性的要约。此属性存在于报价中,用于处理收到报价之间的竞争条件,
and the receipt of the Binding response that tells the answerer the candidate that will be selected by ICE. See Appendix B.6 for an explanation of this race condition. Consequently, processing of an offer with this attribute depends on the winner of the race.
以及接收约束性响应,告知应答者ICE将选择的候选人。有关该竞赛条件的解释,请参见附录B.6。因此,具有此属性的报价的处理取决于比赛的获胜者。
The agent forms a candidate pair for each component of the media stream by:
代理通过以下方式为媒体流的每个组件形成候选对:
o Setting the remote candidate equal to the offerer's default destination for that component (e.g., the contents of the m and c lines for RTP, and the a=rtcp attribute for RTCP)
o 将远程候选者设置为该组件的报价人默认目的地(例如,RTP的m和c行内容,rtcp的a=rtcp属性)
o Setting the local candidate equal to the transport address for that same component in the a=remote-candidates attribute in the offer.
o 在报价中的a=远程候选项属性中将本地候选项设置为该组件的传输地址。
The agent then sees if each of these candidate pairs is present in the valid list. If a particular pair is not in the valid list, the check has "lost" the race. Call such a pair a "losing pair".
然后,代理查看这些候选对中的每一对是否都存在于有效列表中。如果某对不在有效列表中,则该检查已“丢失”比赛。把这样的一对称为“失去的一对”。
The agent finds all the pairs in the check list whose remote candidates equal the remote candidate in the losing pair:
代理在检查列表中查找远程候选与丢失对中的远程候选相等的所有对:
o If none of the pairs are In-Progress, and at least one is Failed, it is most likely that a network failure, such as a network partition or serious packet loss, has occurred. The agent SHOULD generate an answer for this media stream as if the remote-candidates attribute had not been present, and then restart ICE for this stream.
o 如果这些对中没有一对正在进行,并且至少有一对出现故障,则很可能发生了网络故障,例如网络分区或严重的数据包丢失。代理应该为该媒体流生成一个应答,就像远程候选属性不存在一样,然后为此流重新启动ICE。
o If at least one of the pairs is In-Progress, the agent SHOULD wait for those checks to complete, and as each completes, redo the processing in this section until there are no losing pairs.
o 如果至少有一对正在进行中,代理应该等待这些检查完成,并且在每个检查完成时,重复本节中的处理,直到没有丢失的对为止。
Once there are no losing pairs, the agent can generate the answer. It MUST set the default destination for media to the candidates in the remote-candidates attribute from the offer (each of which will now be the local candidate of a candidate pair in the valid list). It MUST include a candidate attribute in the answer for each candidate in the remote-candidates attribute in the offer.
一旦没有丢失的配对,代理就可以生成答案。它必须将媒体的默认目的地设置为要约中“远程候选人”属性中的候选人(每个候选人现在都是有效列表中候选人对的本地候选人)。它必须在报价的“远程候选人”属性中的每个候选人的答案中包含候选人属性。
If the received offer contains the remote-candidates attribute for a media stream, the agent forms a candidate pair for each component of the media stream by:
如果接收到的要约包含媒体流的远程候选属性,则代理通过以下方式为媒体流的每个组件形成候选对:
o Setting the remote candidate equal to the offerer's default destination for that component (e.g., the contents of the m and c lines for RTP, and the a=rtcp attribute for RTCP).
o 将远程候选设置为该组件的报价人默认目的地(例如,RTP的m和c行内容,rtcp的a=rtcp属性)。
o Setting the local candidate equal to the transport address for that same component in the a=remote-candidates attribute in the offer.
o 在报价中的a=远程候选项属性中将本地候选项设置为该组件的传输地址。
It then places those candidates into the Valid list for the media stream. The state of ICE processing for that media stream is set to Completed.
然后,它将这些候选对象放入媒体流的有效列表中。该媒体流的ICE处理状态设置为已完成。
Furthermore, if the agent believed it was controlling, but the offer contained the remote-candidates attribute, both agents believe they are controlling. In this case, both would have sent updated offers around the same time. However, the signaling protocol carrying the offer/answer exchanges will have resolved this glare condition, so that one agent is always the 'winner' by having its offer received before its peer has sent an offer. The winner takes the role of controlled, so that the loser (the answerer under consideration in this section) MUST change its role to controlled. Consequently, if the agent was going to send an updated offer since, based on the rules in Section 8.2.2, it was controlling, it no longer needs to.
此外,如果代理认为自己在控制,但要约包含远程候选人属性,则两个代理都认为自己在控制。在这种情况下,双方都会在同一时间发送更新的报价。然而,承载提供/应答交换的信令协议将解决这种眩目情况,因此一个代理始终是“赢家”,在其对等方发送提供之前接收其提供。赢家扮演受控角色,因此输家(本节中考虑的回答者)必须将其角色更改为受控角色。因此,根据第8.2.2节中的规则,如果代理将发送更新的报价,因为它是控制方,则不再需要发送。
Besides the potential role change, change in the Valid list, and state changes, the construction of the answer is performed identically to the construction of an offer as described in Section 9.1.3.
除了潜在的角色变更、有效列表的变更和状态变更外,答案的构建与第9.1.3节中描述的报价的构建是相同的。
The agent MUST remember the highest-priority nominated pairs in the Valid list for each component of the media stream, called the previous selected pairs, prior to the restart. The agent will continue to send media using these pairs, as described in Section 11.1. Once these destinations are noted, the agent MUST flush the valid and check lists, and then recompute the check list and its states as described in Section 5.7.
在重新启动之前,代理必须记住媒体流每个组件的有效列表中的最高优先级指定对,称为“先前选定对”。代理将继续使用这些对发送媒体,如第11.1节所述。一旦注意到这些目的地,代理必须刷新有效和检查列表,然后按照第5.7节的说明重新计算检查列表及其状态。
If the offer/answer exchange added a new media stream, the agent MUST create a new check list for it (and an empty Valid list to start of course), as described in Section 5.7.
If the offer/answer exchange added a new media stream, the agent MUST create a new check list for it (and an empty Valid list to start of course), as described in Section 5.7.translate error, please retry
If the offer/answer exchange removed a media stream, or an answer rejected an offered media stream, an agent MUST flush the Valid list for that media stream. It MUST terminate any STUN transactions in progress for that media stream. An agent MUST remove the check list for that media stream and cancel any pending ordinary checks for it.
如果提供/应答交换删除了媒体流,或应答拒绝了提供的媒体流,则代理必须刷新该媒体流的有效列表。它必须终止该媒体流正在进行的任何STUN事务。代理必须删除该媒体流的检查列表,并取消任何挂起的普通检查。
The valid list is not affected by an updated offer/answer exchange unless ICE is restarting.
除非ICE重新启动,否则有效列表不受更新的报价/应答交换的影响。
If an agent is in the Running state for that media stream, the check list is updated (the check list is irrelevant if the state is completed). To do that, the agent recomputes the check list using the procedures described in Section 5.7. If a pair on the new check list was also on the previous check list, and its state was Waiting, In-Progress, Succeeded, or Failed, its state is copied over. Otherwise, its state is set to Frozen.
如果代理处于该媒体流的运行状态,则会更新检查列表(如果状态已完成,则检查列表不相关)。为此,代理使用第5.7节中描述的程序重新计算检查表。如果新检查列表中的一对也在上一个检查列表中,并且其状态为“正在等待”、“正在进行”、“成功”或“失败”,则其状态将被复制。否则,其状态将设置为冻结。
If none of the check lists are active (meaning that the pairs in each check list are Frozen), the full-mode agent sets the first pair in the check list for the first media stream to Waiting, and then sets the state of all other pairs in that check list for the same component ID and with the same foundation to Waiting as well.
如果检查表中没有一个是活动的(意味着每个检查表中的对是冻结的),则完全模式代理将第一对在第一个媒体流的检查表中设置为等待,然后在同一个组件ID中设置检查列表中的所有其他对的状态,并以同样的基础设置等待。
Next, the agent goes through each check list, starting with the highest-priority pair. If a pair has a state of Succeeded, and it has a component ID of 1, then all Frozen pairs in the same check list with the same foundation whose component IDs are not 1 have their state set to Waiting. If, for a particular check list, there are pairs for each component of that media stream in the Succeeded state, the agent moves the state of all Frozen pairs for the first component of all other media streams (and thus in different check lists) with the same foundation to Waiting.
接下来,代理检查每个检查列表,从最高优先级对开始。如果一对有一个成功的状态,并且它有一个1的组件ID,那么在同一个检查表中的所有冻结的对,它们的组件ID不是1,它们的状态被设置为等待。如果对于特定检查表,在成功状态下,该媒体流的每个组件都有对,则代理为所有其他媒体流(因此在不同的检查列表中)的第一个组件移动所有冻结的状态,以与等待相同的基础。
If ICE is restarting for a media stream, the agent MUST start a new Valid list for that media stream. It MUST remember the pairs in the previous Valid list for each component of the media stream, called the previous selected pairs, and continue to send media there as described in Section 11.1. The state of ICE processing for each media stream MUST change to Running, and the state of ICE processing MUST change to Running.
如果ICE正在为媒体流重新启动,则代理必须为该媒体流启动一个新的有效列表。它必须记住媒体流的每个组件的前一个有效列表中的对,称为前一个选定对,并按照第11.1节中的说明继续向该组件发送媒体。每个媒体流的ICE处理状态必须更改为运行,ICE处理状态必须更改为运行。
All endpoints MUST send keepalives for each media session. These keepalives serve the purpose of keeping NAT bindings alive for the media session. These keepalives MUST be sent regardless of whether the media stream is currently inactive, sendonly, recvonly, or sendrecv, and regardless of the presence or value of the bandwidth attribute. These keepalives MUST be sent even if ICE is not being utilized for the session at all. The keepalive SHOULD be sent using a format that is supported by its peer. ICE endpoints allow for STUN-based keepalives for UDP streams, and as such, STUN keepalives MUST be used when an agent is a full ICE implementation and is communicating with a peer that supports ICE (lite or full). An agent can determine that its peer supports ICE by the presence of a=candidate attributes for each media session. If the peer does not support ICE, the choice of a packet format for keepalives is a matter of local implementation. A format that allows packets to easily be sent in the absence of actual media content is RECOMMENDED. Examples of formats that readily meet this goal are RTP No-Op [NO-OP-RTP], and in cases where both sides support it, RTP comfort noise [RFC3389]. If the peer doesn't support any formats that are particularly well suited for keepalives, an agent SHOULD send RTP packets with an incorrect version number, or some other form of error that would cause them to be discarded by the peer.
所有端点必须为每个媒体会话发送keepalives。这些keepalive用于保持NAT绑定在媒体会话中处于活动状态。无论媒体流当前是否处于非活动状态、仅发送、仅接收或发送RECV,也不管带宽属性的存在或值,都必须发送这些keepalives。即使会话中根本没有使用ICE,也必须发送这些keepalive。keepalive应使用其对等方支持的格式发送。ICE端点允许对UDP流使用基于STUN的keepalives,因此,当代理是完整ICE实现并且与支持ICE(lite或full)的对等方通信时,必须使用STUN keepalives。代理可以通过存在每个媒体会话的a=候选属性来确定其对等方是否支持ICE。如果对等方不支持ICE,那么为keepalives选择数据包格式是本地实现的问题。建议采用一种在没有实际媒体内容的情况下轻松发送数据包的格式。容易满足这一目标的格式示例为RTP No-Op[No-Op-RTP],在双方都支持的情况下,RTP舒适噪音[RFC3389]。如果对等方不支持任何特别适合keepalives的格式,则代理应发送具有错误版本号的RTP数据包,或其他可能导致对等方丢弃这些数据包的错误形式。
If there has been no packet sent on the candidate pair ICE is using for a media component for Tr seconds (where packets include those defined for the component (RTP or RTCP) and previous keepalives), an agent MUST generate a keepalive on that pair. Tr SHOULD be configurable and SHOULD have a default of 15 seconds. Tr MUST NOT be configured to less than 15 seconds. Alternatively, if an agent has a dynamic way to discover the binding lifetimes of the intervening NATs, it can use that value to determine Tr. Administrators deploying ICE in more controlled networking environments SHOULD set Tr to the longest duration possible in their environment.
如果ICE用于媒体组件的候选对在Tr秒内没有发送数据包(其中数据包包括为组件定义的数据包(RTP或RTCP)和以前的keepalive),则代理必须在该对上生成keepalive。Tr应该是可配置的,默认值为15秒。Tr的配置不得少于15秒。或者,如果代理具有动态方法来发现介入NAT的绑定生存期,则可以使用该值来确定Tr。在更受控的网络环境中部署ICE的管理员应将Tr设置为其环境中可能的最长持续时间。
If STUN is being used for keepalives, a STUN Binding Indication is used [RFC5389]. The Indication MUST NOT utilize any authentication mechanism. It SHOULD contain the FINGERPRINT attribute to aid in demultiplexing, but SHOULD NOT contain any other attributes. It is used solely to keep the NAT bindings alive. The Binding Indication is sent using the same local and remote candidates that are being used for media. Though Binding Indications are used for keepalives, an agent MUST be prepared to receive a connectivity check as well. If a connectivity check is received, a response is generated as discussed in [RFC5389], but there is no impact on ICE processing otherwise.
如果昏迷用于keepalives,则使用昏迷绑定指示[RFC5389]。指示不得使用任何认证机制。它应该包含指纹属性以帮助解复用,但不应该包含任何其他属性。它仅用于保持NAT绑定的活动状态。绑定指示使用与介质相同的本地和远程候选者发送。尽管绑定指示用于keepalives,但代理也必须准备好接收连接检查。如果接收到连接检查,则会生成响应,如[RFC5389]中所述,但不会对ICE处理产生影响。
An agent MUST begin the keepalive processing once ICE has selected candidates for usage with media, or media begins to flow, whichever happens first. Keepalives end once the session terminates or the media stream is removed.
ICE选择用于介质的候选对象或介质开始流动(以先发生的为准)后,代理必须开始keepalive处理。一旦会话终止或媒体流被删除,Keepalives将结束。
Procedures for sending media differ for full and lite implementations.
发送媒体的过程因完整和精简实现而异。
Agents always send media using a candidate pair, called the selected candidate pair. An agent will send media to the remote candidate in the selected pair (setting the destination address and port of the packet equal to that remote candidate), and will send it from the local candidate of the selected pair. When the local candidate is server or peer reflexive, media is originated from the base. Media sent from a relayed candidate is sent from the base through that TURN server, using procedures defined in [RFC5766].
代理始终使用称为“选定候选对”的候选对发送媒体。代理将向所选对中的远程候选发送媒体(将数据包的目标地址和端口设置为等于该远程候选),并从所选对的本地候选发送媒体。当本地候选者是服务器或对等自反时,媒体源于基础。使用[RFC5766]中定义的程序,从中继候选者发送的媒体通过该TURN服务器从基地发送。
If the local candidate is a relayed candidate, it is RECOMMENDED that an agent create a channel on the TURN server towards the remote candidate. This is done using the procedures for channel creation as defined in Section 11 of [RFC5766].
如果本地候选者是中继候选者,建议代理在TURN服务器上创建一个指向远程候选者的通道。这是使用[RFC5766]第11节中定义的通道创建程序完成的。
The selected pair for a component of a media stream is:
媒体流组件的选定对为:
o empty if the state of the check list for that media stream is Running, and there is no previous selected pair for that component due to an ICE restart
o 如果该媒体流的检查列表的状态正在运行,并且由于ICE重新启动,该组件没有以前选择的对,则为空
o equal to the previous selected pair for a component of a media stream if the state of the check list for that media stream is Running, and there was a previous selected pair for that component due to an ICE restart
o 如果媒体流的检查列表的状态正在运行,并且由于ICE重新启动,该组件存在先前选择的对,则等于媒体流组件的先前选择的对
o equal to the highest-priority nominated pair for that component in the valid list if the state of the check list is Completed
o 如果检查表的状态已完成,则等于有效列表中该组件的最高优先级指定对
If the selected pair for at least one component of a media stream is empty, an agent MUST NOT send media for any component of that media stream. If the selected pair for each component of a media stream has a value, an agent MAY send media for all components of that media stream.
如果为媒体流的至少一个组件选择的对为空,则代理不得为该媒体流的任何组件发送媒体。如果为媒体流的每个组件选择的对具有值,则代理可以为该媒体流的所有组件发送媒体。
Note that the selected pair for a component of a media stream may not equal the default pair for that same component from the most recent offer/answer exchange. When this happens, the selected pair is used for media, not the default pair. When ICE first completes, if the selected pairs aren't a match for the default pairs, the controlling agent sends an updated offer/answer exchange to remedy this disparity. However, until that updated offer arrives, there will not be a match. Furthermore, in very unusual cases, the default candidates in the updated offer/answer will not be a match.
请注意,为媒体流的组件选择的对可能不等于来自最近提供/应答交换的同一组件的默认对。发生这种情况时,所选对将用于介质,而不是默认对。当ICE首次完成时,如果所选对与默认对不匹配,则控制代理将发送更新的提供/应答交换以弥补此差异。但是,在更新后的报价到达之前,不会有匹配的报价。此外,在非常罕见的情况下,更新的报价/答案中的默认候选人将不匹配。
A lite implementation MUST NOT send media until it has a Valid list that contains a candidate pair for each component of that media stream. Once that happens, the agent MAY begin sending media packets. To do that, it sends media to the remote candidate in the pair (setting the destination address and port of the packet equal to that remote candidate), and will send it from the local candidate.
lite实现必须在具有包含该媒体流的每个组件的候选对的有效列表后才能发送媒体。一旦发生这种情况,代理就可以开始发送媒体包。为此,它将媒体成对发送给远程候选(将数据包的目标地址和端口设置为与该远程候选相同),并从本地候选发送。
ICE has interactions with jitter buffer adaptation mechanisms. An RTP stream can begin using one candidate, and switch to another one, though this happens rarely with ICE. The newer candidate may result in RTP packets taking a different path through the network -- one with different delay characteristics. As discussed below, agents are encouraged to re-adjust jitter buffers when there are changes in source or destination address of media packets. Furthermore, many audio codecs use the marker bit to signal the beginning of a talkspurt, for the purposes of jitter buffer adaptation. For such codecs, it is RECOMMENDED that the sender set the marker bit [RFC3550] when an agent switches transmission of media from one candidate pair to another.
ICE与抖动缓冲适应机制相互作用。RTP流可以开始使用一个候选者,然后切换到另一个候选者,尽管这在ICE中很少发生。较新的候选者可能会导致RTP数据包在网络中采用不同的路径——一条具有不同延迟特性的路径。如下文所述,当媒体分组的源地址或目的地址发生变化时,鼓励代理重新调整抖动缓冲区。此外,许多音频编解码器使用标记位来表示TalkSport的开始,以适应抖动缓冲区。对于此类编解码器,建议发送方在代理将媒体传输从一个候选对切换到另一个候选对时设置标记位[RFC3550]。
ICE implementations MUST be prepared to receive media on each component on any candidates provided for that component in the most recent offer/answer exchange (in the case of RTP, this would include both RTP and RTCP if candidates were provided for both).
ICE实施必须准备好在最近的报价/应答交换中为该组件提供的任何候选组件上接收每个组件上的媒体(对于RTP,如果RTP和RTCP都提供了候选组件,则这将包括RTP和RTCP)。
It is RECOMMENDED that, when an agent receives an RTP packet with a new source or destination IP address for a particular media stream, that the agent re-adjust its jitter buffers.
当代理接收到具有特定媒体流的新源或目标IP地址的RTP数据包时,建议代理重新调整其抖动缓冲区。
RFC 3550 [RFC3550] describes an algorithm in Section 8.2 for detecting synchronization source (SSRC) collisions and loops. These algorithms are based, in part, on seeing different source transport
RFC 3550[RFC3550]描述了第8.2节中用于检测同步源(SSRC)碰撞和循环的算法。这些算法部分基于看到不同的源传输
addresses with the same SSRC. However, when ICE is used, such changes will sometimes occur as the media streams switch between candidates. An agent will be able to determine that a media stream is from the same peer as a consequence of the STUN exchange that proceeds media transmission. Thus, if there is a change in source transport address, but the media packets come from the same peer agent, this SHOULD NOT be treated as an SSRC collision.
具有相同SSRC的地址。然而,当使用ICE时,当媒体流在候选媒体之间切换时,有时会发生这样的变化。作为进行媒体传输的STUN交换的结果,代理将能够确定媒体流来自同一对等方。因此,如果源传输地址发生变化,但媒体数据包来自同一对等代理,则不应将其视为SSRC冲突。
ICE requires a series of STUN-based connectivity checks to take place between endpoints. These checks start from the answerer on generation of its answer, and start from the offerer when it receives the answer. These checks can take time to complete, and as such, the selection of messages to use with offers and answers can affect perceived user latency. Two latency figures are of particular interest. These are the post-pickup delay and the post-dial delay. The post-pickup delay refers to the time between when a user "answers the phone" and when any speech they utter can be delivered to the caller. The post-dial delay refers to the time between when a user enters the destination address for the user and ringback begins as a consequence of having successfully started ringing the phone of the called party.
ICE需要在端点之间进行一系列基于STUN的连接检查。这些检查从应答者生成其答案开始,从提供者收到答案开始。这些检查可能需要一段时间才能完成,因此,选择用于提供和回答的消息可能会影响感知的用户延迟。两个延迟数字特别令人感兴趣。这些是后拾取延迟和后拨号延迟。拾取后延迟指的是用户“接听电话”和他们发出的任何语音能够传送给呼叫者之间的时间。拨后延迟是指用户输入用户的目的地地址和由于成功开始振铃被叫方的电话而开始回铃之间的时间。
Two cases can be considered -- one where the offer is present in the initial INVITE and one where it is in a response.
可以考虑两种情况——一种是要约出现在初始邀请中,另一种是要约出现在响应中。
To reduce post-dial delays, it is RECOMMENDED that the caller begin gathering candidates prior to actually sending its initial INVITE. This can be started upon user interface cues that a call is pending, such as activity on a keypad or the phone going offhook.
为了减少拨号后的延迟,建议呼叫者在实际发送初始邀请之前开始收集候选人。这可以在用户界面提示呼叫挂起时启动,例如键盘上的活动或电话挂断。
If an offer is received in an INVITE request, the answerer SHOULD begin to gather its candidates on receipt of the offer and then generate an answer in a provisional response once it has completed that process. ICE requires that a provisional response with an SDP be transmitted reliably. This can be done through the existing Provisional Response Acknowledgment (PRACK) mechanism [RFC3262] or through an optimization that is specific to ICE. With this optimization, provisional responses containing an SDP answer that begins ICE processing for one or more media streams can be sent reliably without RFC 3262. To do this, the agent retransmits the provisional response with the exponential backoff timers described in RFC 3262. Retransmits MUST cease on receipt of a STUN Binding
如果在邀请请求中收到邀请,应答者应在收到邀请后开始收集其候选人,然后在完成该过程后在临时响应中生成答案。ICE要求使用SDP可靠地传输临时响应。这可以通过现有的临时响应确认(PRACK)机制[RFC3262]或特定于ICE的优化来实现。通过这种优化,可以在不使用RFC 3262的情况下可靠地发送包含开始一个或多个媒体流的ICE处理的SDP应答的临时响应。为此,代理使用RFC 3262中描述的指数退避定时器重新传输临时响应。重新传输必须在收到眩晕绑定后停止
request for one of the media streams signaled in that SDP (because receipt of a Binding request indicates the offerer has received the answer) or on transmission of the answer in a 2xx response. If the peer agent is lite, there will never be a STUN Binding request. In such a case, the agent MUST cease retransmitting the 18x after sending it four times (ICE will actually work even if the peer never receives the 18x; however, experience has shown that sending it is important for middleboxes and firewall traversal). If no Binding request is received prior to the last retransmit, the agent does not consider the session terminated. Despite the fact that the provisional response will be delivered reliably, the rules for when an agent can send an updated offer or answer do not change from those specified in RFC 3262. Specifically, if the INVITE contained an offer, the same answer appears in all of the 1xx and in the 2xx response to the INVITE. Only after that 2xx has been sent can an updated offer/answer exchange occur. This optimization SHOULD NOT be used if both agents support PRACK. Note that the optimization is very specific to provisional response carrying answers that start ICE processing; it is not a general technique for 1xx reliability.
请求SDP中发出信号的媒体流之一(因为收到绑定请求表示报价人已收到答复)或在2xx响应中发送答复时。如果对等代理是lite,则永远不会有STUN绑定请求。在这种情况下,代理必须在发送18x四次后停止重新传输18x(即使对等方从未收到18x,ICE实际上也会工作;然而,经验表明,发送18x对于中间包和防火墙穿越非常重要)。如果在最后一次重传之前没有接收绑定请求,则代理不考虑会话终止。尽管临时响应将可靠地交付,但代理何时可以发送更新的报价或答复的规则与RFC 3262中规定的规则没有变化。具体而言,如果邀请包含报价,则在所有1x和2xx回复中都会显示相同的答案。只有在发送2xx之后,才能进行更新的报价/应答交换。如果两个代理都支持PRACK,则不应使用此优化。请注意,优化非常特定于临时响应,其中包含启动冰处理的答案;这不是1xx可靠性的一般技术。
Alternatively, an agent MAY delay sending an answer until the 200 OK; however, this results in a poor user experience and is NOT RECOMMENDED.
或者,代理可以延迟发送应答直到200确定;但是,这会导致较差的用户体验,因此不建议这样做。
Once the answer has been sent, the agent SHOULD begin its connectivity checks. Once candidate pairs for each component of a media stream enter the valid list, the answerer can begin sending media on that media stream.
发送应答后,代理应开始其连接检查。一旦媒体流的每个组件的候选对进入有效列表,应答者就可以开始在该媒体流上发送媒体。
However, prior to this point, any media that needs to be sent towards the caller (such as SIP early media [RFC3960]) MUST NOT be transmitted. For this reason, implementations SHOULD delay alerting the called party until candidates for each component of each media stream have entered the valid list. In the case of a PSTN gateway, this would mean that the setup message into the PSTN is delayed until this point. Doing this increases the post-dial delay, but has the effect of eliminating 'ghost rings'. Ghost rings are cases where the called party hears the phone ring, picks up, but hears nothing and cannot be heard. This technique works without requiring support for, or usage of, preconditions [RFC3312], since it's a localized decision. It also has the benefit of guaranteeing that not a single packet of media will get clipped, so that post-pickup delay is zero. If an agent chooses to delay local alerting in this way, it SHOULD generate a 180 response once alerting begins.
然而,在此之前,任何需要发送到呼叫方的媒体(如SIP早期媒体[RFC3960])都不能被传输。出于这个原因,实现应该延迟通知被叫方,直到每个媒体流的每个组件的候选者进入有效列表。在PSTN网关的情况下,这意味着进入PSTN的设置消息将延迟到此时。这样做会增加拨号后的延迟,但有消除“鬼环”的效果。鬼铃是被叫方听到电话铃,拿起电话,但什么也听不到,无法听到的情况。这种技术不需要支持或使用前提条件[RFC3312],因为它是一种本地化的决策。它还有一个好处,即保证没有一个媒体包被截取,因此拾取后的延迟为零。如果代理选择以这种方式延迟本地警报,则一旦警报开始,它应生成180响应。
In addition to uses where the offer is in an INVITE, and the answer is in the provisional and/or 200 OK response, ICE works with cases where the offer appears in the response. In such cases, which are common in third party call control [RFC3725], ICE agents SHOULD generate their offers in a reliable provisional response (which MUST utilize RFC 3262), and not alert the user on receipt of the INVITE. The answer will arrive in a PRACK. This allows for ICE processing to take place prior to alerting, so that there is no post-pickup delay, at the expense of increased call setup delays. Once ICE completes, the callee can alert the user and then generate a 200 OK when they answer. The 200 OK would contain no SDP, since the offer/answer exchange has completed.
除了在邀请函中使用邀请函,以及在临时和/或200 OK回复中使用邀请函,ICE还适用于邀请函中出现邀请函的情况。在第三方呼叫控制[RFC3725]中常见的这种情况下,ICE代理应以可靠的临时响应(必须使用RFC 3262)生成其报价,并且在收到邀请时不提醒用户。答案将在一场恶作剧中得到。这使得ICE处理可以在报警之前进行,因此不会出现拾取后延迟,但会增加呼叫设置延迟。ICE完成后,被叫方可以提醒用户,然后在用户回答时生成200 OK。200 OK将不包含SDP,因为报价/应答交换已完成。
Alternatively, agents MAY place the offer in a 2xx instead (in which case the answer comes in the ACK). When this happens, the callee will alert the user on receipt of the INVITE, and the ICE exchanges will take place only after the user answers. This has the effect of reducing call setup delay, but can cause substantial post-pickup delays and media clipping.
或者,代理商可以将报价放在2xx中(在这种情况下,答案在ACK中)。当这种情况发生时,被叫方将在收到邀请时提醒用户,ICE交换将仅在用户应答后进行。这具有减少呼叫设置延迟的效果,但可能会导致大量的拾取后延迟和媒体剪辑。
[RFC5768] specifies a SIP option tag and media feature tag for usage with ICE. ICE implementations using SIP SHOULD support this specification, which uses a feature tag in registrations to facilitate interoperability through signaling intermediaries.
[RFC5768]指定用于ICE的SIP选项标签和媒体功能标签。使用SIP的ICE实现应支持该规范,该规范在注册中使用功能标签,以通过信令中介促进互操作性。
ICE interacts very well with forking. Indeed, ICE fixes some of the problems associated with forking. Without ICE, when a call forks and the caller receives multiple incoming media streams, it cannot determine which media stream corresponds to which callee.
冰与分叉作用很好。事实上,ICE解决了一些与分叉相关的问题。在没有ICE的情况下,当一个呼叫分叉并且呼叫者接收到多个传入媒体流时,它无法确定哪个媒体流对应于哪个被呼叫者。
With ICE, this problem is resolved. The connectivity checks which occur prior to transmission of media carry username fragments, which in turn are correlated to a specific callee. Subsequent media packets that arrive on the same candidate pair as the connectivity check will be associated with that same callee. Thus, the caller can perform this correlation as long as it has received an answer.
有了冰,这个问题就解决了。在传输媒体之前进行的连接检查包含用户名片段,而用户名片段又与特定的被叫方相关。与连接检查到达同一候选对的后续媒体包将与同一被叫方关联。因此,只要呼叫者已经收到应答,它就可以执行这种关联。
Quality of Service (QoS) preconditions, which are defined in RFC 3312 [RFC3312] and RFC 4032 [RFC4032], apply only to the transport addresses listed as the default targets for media in an offer/answer.
RFC 3312[RFC3312]和RFC 4032[RFC4032]中定义的服务质量(QoS)前提条件仅适用于作为报价/应答中媒体的默认目标列出的传输地址。
If ICE changes the transport address where media is received, this change is reflected in an updated offer that changes the default destination for media to match ICE's selection. As such, it appears like any other re-INVITE would, and is fully treated in RFCs 3312 and 4032, which apply without regard to the fact that the destination for media is changing due to ICE negotiations occurring "in the background".
如果ICE更改接收介质的传输地址,此更改将反映在更新的报价中,该报价将更改介质的默认目标,以匹配ICE的选择。因此,它似乎与任何其他重新邀请一样,并在RFCs 3312和4032中得到充分处理,其适用不考虑媒体目的地因“在后台”发生的ICE谈判而发生变化这一事实。
Indeed, an agent SHOULD NOT indicate that QoS preconditions have been met until the checks have completed and selected the candidate pairs to be used for media.
事实上,在检查完成并选择用于媒体的候选对之前,代理不应指示已满足QoS前提条件。
ICE also has (purposeful) interactions with connectivity preconditions [SDP-PRECON]. Those interactions are described there. Note that the procedures described in Section 12.1 describe their own type of "preconditions", albeit with less functionality than those provided by the explicit preconditions in [SDP-PRECON].
ICE还与连接前提条件[SDP-PRECO]进行(有目的的)交互。这里描述了这些相互作用。请注意,第12.1节中描述的程序描述了其自身类型的“先决条件”,尽管其功能不如[SDP-PRECO]中明确的先决条件所提供的功能。
ICE works with Flows I, III, and IV as described in [RFC3725]. Flow I works without the controller supporting or being aware of ICE. Flow IV will work as long as the controller passes along the ICE attributes without alteration. Flow II is fundamentally incompatible with ICE; each agent will believe itself to be the answerer and thus never generate a re-INVITE.
ICE与[RFC3725]中所述的流量I、III和IV一起工作。Flow I在控制器不支持或不知道ICE的情况下工作。只要控制器沿ICE属性通过而不发生改变,则流IV将工作。流量II与冰基本不相容;每个代理都会相信自己是回答者,因此不会生成重新邀请。
The flows for continued operation, as described in Section 7 of RFC 3725, require additional behavior of ICE implementations to support. In particular, if an agent receives a mid-dialog re-INVITE that contains no offer, it MUST restart ICE for each media stream and go through the process of gathering new candidates. Furthermore, that list of candidates SHOULD include the ones currently being used for media.
如RFC 3725第7节所述,持续运行的流程需要ICE实施的额外行为来支持。特别是,如果代理收到未包含报价的mid对话重新邀请,则必须为每个媒体流重新启动ICE,并完成收集新候选对象的过程。此外,该候选人名单应包括目前用于媒体的候选人。
RFC 4091 [RFC4091], the Alternative Network Address Types (ANAT) Semantics for the SDP grouping framework, and RFC 4092 [RFC4092], its usage with SIP, define a mechanism for indicating that an agent can support both IPv4 and IPv6 for a media stream, and it does so by including two m lines, one for v4 and one for v6. This is similar to ICE, which allows for an agent to indicate multiple transport addresses using the candidate attribute. However, ANAT relies on static selection to pick between choices, rather than a dynamic connectivity check used by ICE.
SDP分组框架的替代网络地址类型(ANAT)语义RFC 4091[RFC4091]和RFC 4092[RFC4092]及其与SIP的使用定义了一种机制,用于指示代理可以支持媒体流的IPv4和IPv6,并通过包括两条m线来实现,一条用于v4,一条用于v6。这与ICE类似,ICE允许代理使用候选属性指示多个传输地址。然而,ANAT依靠静态选择在选择之间进行选择,而不是ICE使用的动态连接检查。
This specification deprecates RFC 4091 and RFC 4092. Instead, agents wishing to support dual stack will utilize ICE.
本规范不推荐RFC 4091和RFC 4092。相反,希望支持双堆栈的代理将使用ICE。
This specification makes very specific choices about how both agents in a session coordinate to arrive at the set of candidate pairs that are selected for media. It is anticipated that future specifications will want to alter these algorithms, whether they are simple changes like timer tweaks or larger changes like a revamp of the priority algorithm. When such a change is made, providing interoperability between the two agents in a session is critical.
该规范对会话中的两个代理如何协调以获得为媒体选择的候选对集做出了非常具体的选择。预计未来的规范将希望改变这些算法,无论是简单的更改(如计时器调整)还是更大的更改(如优先级算法的改进)。进行此类更改时,在会话中提供两个代理之间的互操作性是至关重要的。
First, ICE provides the a=ice-options SDP attribute. Each extension or change to ICE is associated with a token. When an agent supporting such an extension or change generates an offer or an answer, it MUST include the token for that extension in this attribute. This allows each side to know what the other side is doing. This attribute MUST NOT be present if the agent doesn't support any ICE extensions or changes.
首先,ICE提供a=ICE选项SDP属性。ICE的每个扩展或更改都与一个令牌相关联。当支持此类扩展或更改的代理生成报价或应答时,它必须在此属性中包含该扩展的令牌。这让双方都知道对方在做什么。如果代理不支持任何ICE扩展或更改,则此属性不得存在。
At this time, no IANA registry or registration procedures are defined for these option tags. At time of writing, it is unclear whether ICE changes and extensions will be sufficiently common to warrant a registry.
目前,没有为这些选项标记定义IANA注册表或注册过程。在撰写本文时,尚不清楚ICE变更和扩展是否足够普遍,以保证注册。
One of the complications in achieving interoperability is that ICE relies on a distributed algorithm running on both agents to converge on an agreed set of candidate pairs. If the two agents run different algorithms, it can be difficult to guarantee convergence on the same candidate pairs. The regular nomination procedure described in Section 8 eliminates some of the tight coordination by delegating the selection algorithm completely to the controlling agent. Consequently, when a controlling agent is communicating with a peer that supports options it doesn't know about, the agent MUST run a regular nomination algorithm. When regular nomination is used, ICE will converge perfectly even when both agents use different pair prioritization algorithms. One of the keys to such convergence is triggered checks, which ensure that the nominated pair is validated by both agents. Consequently, any future ICE enhancements MUST preserve triggered checks.
实现互操作性的一个复杂因素是ICE依赖于在两个代理上运行的分布式算法来收敛于一组商定的候选对。如果两个代理运行不同的算法,则很难保证在相同的候选对上收敛。第8节中描述的常规提名程序通过将选择算法完全委托给控制代理消除了一些紧密的协调。因此,当控制代理与支持其不知道的选项的对等方通信时,该代理必须运行常规的提名算法。当使用常规指定时,即使两个代理使用不同的对优先级算法,ICE也会完全收敛。这种收敛的关键之一是触发检查,它确保指定对由两个代理验证。因此,任何未来的ICE增强必须保留触发检查。
ICE is also extensible to other media streams beyond RTP, and for transport protocols beyond UDP. Extensions to ICE for non-RTP media streams need to specify how many components they utilize, and assign component IDs to them, starting at 1 for the most important component ID. Specifications for new transport protocols must define how, if at all, various steps in the ICE processing differ from UDP.
ICE还可扩展到RTP之外的其他媒体流,以及UDP之外的传输协议。非RTP媒体流的ICE扩展需要指定它们使用的组件数量,并为它们分配组件ID,最重要的组件ID从1开始。新传输协议的规范必须定义ICE处理中的各个步骤与UDP的区别(如果有的话)。
This specification defines seven new SDP attributes -- the "candidate", "remote-candidates", "ice-lite", "ice-mismatch", "ice-ufrag", "ice-pwd", and "ice-options" attributes.
本规范定义了七个新的SDP属性——“候选”、“远程候选”、“ice lite”、“ice不匹配”、“ice ufrag”、“ice pwd”和“ice选项”属性。
The candidate attribute is a media-level attribute only. It contains a transport address for a candidate that can be used for connectivity checks.
候选属性仅为媒体级属性。它包含可用于连接检查的候选的传输地址。
The syntax of this attribute is defined using Augmented BNF as defined in RFC 5234 [RFC5234]:
此属性的语法是使用RFC 5234[RFC5234]中定义的扩充BNF定义的:
candidate-attribute = "candidate" ":" foundation SP component-id SP transport SP priority SP connection-address SP ;from RFC 4566 port ;port from RFC 4566 SP cand-type [SP rel-addr] [SP rel-port] *(SP extension-att-name SP extension-att-value)
候选属性=“候选者”“:”基金会SP组件ID SP SP SP SP连接地址SP;来自RFC4566端口;来自RFC 4566 SP cand类型[SP rel addr][SP rel port]*(SP扩展附件名称SP扩展附件值)的端口
foundation = 1*32ice-char component-id = 1*5DIGIT transport = "UDP" / transport-extension transport-extension = token ; from RFC 3261 priority = 1*10DIGIT cand-type = "typ" SP candidate-types candidate-types = "host" / "srflx" / "prflx" / "relay" / token rel-addr = "raddr" SP connection-address rel-port = "rport" SP port extension-att-name = byte-string ;from RFC 4566 extension-att-value = byte-string ice-char = ALPHA / DIGIT / "+" / "/"
foundation = 1*32ice-char component-id = 1*5DIGIT transport = "UDP" / transport-extension transport-extension = token ; from RFC 3261 priority = 1*10DIGIT cand-type = "typ" SP candidate-types candidate-types = "host" / "srflx" / "prflx" / "relay" / token rel-addr = "raddr" SP connection-address rel-port = "rport" SP port extension-att-name = byte-string ;from RFC 4566 extension-att-value = byte-string ice-char = ALPHA / DIGIT / "+" / "/"
This grammar encodes the primary information about a candidate: its IP address, port and transport protocol, and its properties: the foundation, component ID, priority, type, and related transport address:
该语法编码候选的主要信息:IP地址、端口和传输协议,以及其属性:基础、组件ID、优先级、类型和相关的传输地址:
<connection-address>: is taken from RFC 4566 [RFC4566]. It is the IP address of the candidate, allowing for IPv4 addresses, IPv6 addresses, and fully qualified domain names (FQDNs). When parsing this field, an agent can differentiate an IPv4 address and an IPv6
<connection address>:取自RFC 4566[RFC4566]。它是候选的IP地址,允许IPv4地址、IPv6地址和完全限定域名(FQDN)。解析此字段时,代理可以区分IPv4地址和IPv6地址
address by presence of a colon in its value - the presence of a colon indicates IPv6. An agent MUST ignore candidate lines that include candidates with IP address versions that are not supported or recognized. An IP address SHOULD be used, but an FQDN MAY be used in place of an IP address. In that case, when receiving an offer or answer containing an FQDN in an a=candidate attribute, the FQDN is looked up in the DNS first using an AAAA record (assuming the agent supports IPv6), and if no result is found or the agent only supports IPv4, using an A. If the DNS query returns more than one IP address, one is chosen, and then used for the remainder of ICE processing.
按值中是否存在冒号表示地址-冒号表示IPv6。代理必须忽略包含IP地址版本不受支持或无法识别的候选行。应该使用IP地址,但可以使用FQDN代替IP地址。在这种情况下,当接收到a=候选属性中包含FQDN的要约或应答时,首先使用AAAA记录(假设代理支持IPv6)在DNS中查找FQDN,如果未找到结果或代理仅支持IPv4,则使用a。如果DNS查询返回多个IP地址,则选择一个,然后用于剩下的冰加工。
<port>: is also taken from RFC 4566 [RFC4566]. It is the port of the candidate.
<port>:也取自RFC 4566[RFC4566]。这是候选人的港口。
<transport>: indicates the transport protocol for the candidate. This specification only defines UDP. However, extensibility is provided to allow for future transport protocols to be used with ICE, such as TCP or the Datagram Congestion Control Protocol (DCCP) [RFC4340].
<transport>:表示候选的传输协议。此规范仅定义UDP。然而,提供可扩展性以允许将来的传输协议与ICE一起使用,例如TCP或数据报拥塞控制协议(DCCP)[RFC4340]。
<foundation>: is composed of 1 to 32 <ice-char>s. It is an identifier that is equivalent for two candidates that are of the same type, share the same base, and come from the same STUN server. The foundation is used to optimize ICE performance in the Frozen algorithm.
<foundation>:由1到32个<ice char>组成。它是一个标识符,相当于两个具有相同类型、共享相同基础并且来自同一STUN服务器的候选者。该基础用于冻结算法中的冰性能优化。
<component-id>: is a positive integer between 1 and 256 that identifies the specific component of the media stream for which this is a candidate. It MUST start at 1 and MUST increment by 1 for each component of a particular candidate. For media streams based on RTP, candidates for the actual RTP media MUST have a component ID of 1, and candidates for RTCP MUST have a component ID of 2. Other types of media streams that require multiple components MUST develop specifications that define the mapping of components to component IDs. See Section 14 for additional discussion on extending ICE to new media streams.
<component id>:是介于1和256之间的正整数,用于标识媒体流的特定组件,该组件是其候选组件。它必须从1开始,并且必须为特定候选组件的每个组件增加1。对于基于RTP的媒体流,实际RTP媒体的候选组件ID必须为1,RTCP的候选组件ID必须为2。需要多个组件的其他类型的媒体流必须制定规范,定义组件到组件ID的映射。有关将ICE扩展到新媒体流的更多讨论,请参见第14节。
<priority>: is a positive integer between 1 and (2**31 - 1).
<priority>:是介于1和(2**31-1)之间的正整数。
<cand-type>: encodes the type of candidate. This specification defines the values "host", "srflx", "prflx", and "relay" for host, server reflexive, peer reflexive, and relayed candidates, respectively. The set of candidate types is extensible for the future.
<cand type>:对候选类型进行编码。本规范分别为主机、服务器自反、对等自反和中继候选定义了值“主机”、“srflx”、“prflx”和“中继”。候选类型集在将来是可扩展的。
<rel-addr> and <rel-port>: convey transport addresses related to the candidate, useful for diagnostics and other purposes. <rel-addr> and <rel-port> MUST be present for server reflexive, peer reflexive, and relayed candidates. If a candidate is server or peer reflexive, <rel-addr> and <rel-port> are equal to the base for that server or peer reflexive candidate. If the candidate is relayed, <rel-addr> and <rel-port> is equal to the mapped address in the Allocate response that provided the client with that relayed candidate (see Appendix B.3 for a discussion of its purpose). If the candidate is a host candidate, <rel-addr> and <rel-port> MUST be omitted.
<rel addr>和<rel port>:传送与候选者相关的传输地址,用于诊断和其他目的<对于服务器自反、对等自反和中继候选,必须存在rel addr>和<rel port>。如果候选者是服务器或对等自反候选者,<rel addr>和<rel port>等于该服务器或对等自反候选者的基数。如果候选者是中继的,<rel addr>和<rel port>等于为客户机提供该中继候选者的分配响应中的映射地址(有关其用途的讨论,请参见附录B.3)。如果候选者是主机候选者,则必须省略<rel addr>和<rel port>。
The candidate attribute can itself be extended. The grammar allows for new name/value pairs to be added at the end of the attribute. An implementation MUST ignore any name/value pairs it doesn't understand.
候选属性本身可以扩展。语法允许在属性末尾添加新的名称/值对。实现必须忽略它不理解的任何名称/值对。
The syntax of the "remote-candidates" attribute is defined using Augmented BNF as defined in RFC 5234 [RFC5234]. The remote-candidates attribute is a media-level attribute only.
“远程候选者”属性的语法是使用RFC 5234[RFC5234]中定义的增广BNF定义的。“远程候选对象”属性仅为媒体级属性。
remote-candidate-att = "remote-candidates" ":" remote-candidate 0*(SP remote-candidate) remote-candidate = component-ID SP connection-address SP port
远程候选att=“远程候选”“:“远程候选0*(SP远程候选)远程候选=组件ID SP连接地址SP端口
The attribute contains a connection-address and port for each component. The ordering of components is irrelevant. However, a value MUST be present for each component of a media stream. This attribute MUST be included in an offer by a controlling agent for a media stream that is Completed, and MUST NOT be included in any other case.
该属性包含每个组件的连接地址和端口。组件的顺序是不相关的。但是,必须为媒体流的每个组件提供一个值。此属性必须包含在控制代理为已完成的媒体流提供的内容中,并且不得包含在任何其他情况下。
The syntax of the "ice-lite" and "ice-mismatch" attributes, both of which are flags, is:
“ice lite”和“ice不匹配”属性(均为标志)的语法为:
ice-lite = "ice-lite" ice-mismatch = "ice-mismatch"
ice lite=“ice lite”ice失配=“ice失配”
"ice-lite" is a session-level attribute only, and indicates that an agent is a lite implementation. "ice-mismatch" is a media-level attribute only, and when present in an answer, indicates that the offer arrived with a default destination for a media component that didn't have a corresponding candidate attribute.
“ice lite”只是会话级属性,表示代理是lite实现。“ice不匹配”仅是一个媒体级属性,当答案中出现时,表示提供的媒体组件的默认目标没有相应的候选属性。
The "ice-ufrag" and "ice-pwd" attributes convey the username fragment and password used by ICE for message integrity. Their syntax is:
“ice ufrag”和“ice pwd”属性传递ice用于消息完整性的用户名片段和密码。它们的语法是:
ice-pwd-att = "ice-pwd" ":" password ice-ufrag-att = "ice-ufrag" ":" ufrag password = 22*256ice-char ufrag = 4*256ice-char
ice-pwd-att = "ice-pwd" ":" password ice-ufrag-att = "ice-ufrag" ":" ufrag password = 22*256ice-char ufrag = 4*256ice-char
The "ice-pwd" and "ice-ufrag" attributes can appear at either the session-level or media-level. When present in both, the value in the media-level takes precedence. Thus, the value at the session-level is effectively a default that applies to all media streams, unless overridden by a media-level value. Whether present at the session or media-level, there MUST be an ice-pwd and ice-ufrag attribute for each media stream. If two media streams have identical ice-ufrag's, they MUST have identical ice-pwd's.
“ice pwd”和“ice ufrag”属性可以出现在会话级别或媒体级别。当两者都存在时,媒体级别的值优先。因此,会话级别的值实际上是应用于所有媒体流的默认值,除非被媒体级别的值覆盖。无论是在会话级别还是媒体级别,每个媒体流都必须具有ice pwd和ice ufrag属性。如果两个媒体流具有相同的ice ufrag,则它们必须具有相同的ice pwd。
The ice-ufrag and ice-pwd attributes MUST be chosen randomly at the beginning of a session. The ice-ufrag attribute MUST contain at least 24 bits of randomness, and the ice-pwd attribute MUST contain at least 128 bits of randomness. This means that the ice-ufrag attribute will be at least 4 characters long, and the ice-pwd at least 22 characters long, since the grammar for these attributes allows for 6 bits of randomness per character. The attributes MAY be longer than 4 and 22 characters, respectively, of course, up to 256 characters. The upper limit allows for buffer sizing in implementations. Its large upper limit allows for increased amounts of randomness to be added over time.
ice ufrag和ice pwd属性必须在会话开始时随机选择。ice ufrag属性必须包含至少24位随机性,ice pwd属性必须包含至少128位随机性。这意味着ice ufrag属性的长度至少为4个字符,ice pwd的长度至少为22个字符,因为这些属性的语法允许每个字符具有6位随机性。属性可能分别长于4个字符和22个字符,当然,最多可达256个字符。上限允许在实现中调整缓冲区大小。其较大的上限允许随时间增加随机性。
The "ice-options" attribute is a session-level attribute. It contains a series of tokens that identify the options supported by the agent. Its grammar is:
“ice选项”属性是会话级属性。它包含一系列标识代理支持的选项的令牌。其语法是:
ice-options = "ice-options" ":" ice-option-tag 0*(SP ice-option-tag) ice-option-tag = 1*ice-char
ice-options = "ice-options" ":" ice-option-tag 0*(SP ice-option-tag) ice-option-tag = 1*ice-char
During the gathering phase of ICE (Section 4.1.1) and while ICE is performing connectivity checks (Section 7), an agent sends STUN and TURN transactions. These transactions are paced at a rate of one every Ta milliseconds, and utilize a specific RTO. This section describes how the values of Ta and RTO are computed. This
在ICE收集阶段(第4.1.1节)和ICE执行连接检查(第7节)期间,代理发送STUN和TURN事务。这些事务以每Ta毫秒一次的速率进行调整,并利用特定的RTO。本节描述如何计算Ta和RTO的值。这
computation depends on whether ICE is being used with a real-time media stream (such as RTP) or something else. When ICE is used for a stream with a known maximum bandwidth, the computation in Section 16.1 MAY be followed to rate-control the ICE exchanges. For all other streams, the computation in Section 16.2 MUST be followed.
计算取决于ICE是否与实时媒体流(如RTP)或其他内容一起使用。当ICE用于具有已知最大带宽的流时,可遵循第16.1节中的计算,以对ICE交换进行速率控制。对于所有其他流,必须遵循第16.2节中的计算。
The values of RTO and Ta change during the lifetime of ICE processing. One set of values applies during the gathering phase, and the other, for connectivity checks.
RTO和Ta值在冰处理寿命期间发生变化。一组值在收集阶段应用,另一组用于连接检查。
The value of Ta SHOULD be configurable, and SHOULD have a default of:
Ta的值应该是可配置的,并且应该具有默认值:
For each media stream i:
对于每个媒体流i:
Ta_i = (stun_packet_size / rtp_packet_size) * rtp_ptime
Ta_i = (stun_packet_size / rtp_packet_size) * rtp_ptime
1 Ta = MAX (20ms, ------------------- ) k ---- \ 1 > ------ / Ta_i ---- i=1
1 Ta = MAX (20ms, ------------------- ) k ---- \ 1 > ------ / Ta_i ---- i=1
where k is the number of media streams. During the gathering phase, Ta is computed based on the number of media streams the agent has indicated in its offer or answer, and the RTP packet size and RTP ptime are those of the most preferred codec for each media stream. Once an offer and answer have been exchanged, the agent recomputes Ta to pace the connectivity checks. In that case, the value of Ta is based on the number of media streams that will actually be used in the session, and the RTP packet size and RTP ptime are those of the most preferred codec with which the agent will send.
其中k是媒体流的数量。在收集阶段,基于代理在其提供或应答中指示的媒体流的数量来计算Ta,并且RTP分组大小和RTP ptime是每个媒体流的最优选编解码器的大小和RTP ptime。交换报价和应答后,代理重新计算Ta以加快连接检查的速度。在这种情况下,Ta的值基于会话中将实际使用的媒体流的数量,并且RTP分组大小和RTP ptime是代理将与之发送的最优选编解码器的那些。
In addition, the retransmission timer for the STUN transactions, RTO, defined in [RFC5389], SHOULD be configurable and during the gathering phase, SHOULD have a default of:
此外,[RFC5389]中定义的STUN事务的重传计时器RTO应是可配置的,并且在收集阶段,应具有以下默认值:
RTO = MAX (100ms, Ta * (number of pairs))
RTO=最大值(100ms,Ta*(对数))
where the number of pairs refers to the number of pairs of candidates with STUN or TURN servers.
其中,对数是指具有眩晕或转身服务器的候选对数。
For connectivity checks, RTO SHOULD be configurable and SHOULD have a default of:
对于连接性检查,RTO应该是可配置的,并且应该具有默认值:
RTO = MAX (100ms, Ta*N * (Num-Waiting + Num-In-Progress))
RTO = MAX (100ms, Ta*N * (Num-Waiting + Num-In-Progress))
where Num-Waiting is the number of checks in the check list in the Waiting state, and Num-In-Progress is the number of checks in the In-Progress state. Note that the RTO will be different for each transaction as the number of checks in the Waiting and In-Progress states change.
其中Num Waiting是处于等待状态的检查列表中的检查数,Num in Progress是处于正在进行状态的检查数。请注意,随着等待状态和进行中状态中的检查数量的变化,每个事务的RTO将不同。
These formulas are aimed at causing STUN transactions to be paced at the same rate as media. This ensures that ICE will work properly under the same network conditions needed to support the media as well. See Appendix B.1 for additional discussion and motivations. Because of this pacing, it will take a certain amount of time to obtain all of the server reflexive and relayed candidates. Implementations should be aware of the time required to do this, and if the application requires a time budget, limit the number of candidates that are gathered.
这些公式的目的是使STUN事务以与媒体相同的速度进行。这可确保ICE在支持媒体所需的相同网络条件下正常工作。更多讨论和动机见附录B.1。由于这种调整,获得所有服务器自反和中继候选服务器将需要一定的时间。实现应该知道执行此操作所需的时间,如果应用程序需要时间预算,则限制收集的候选对象的数量。
The formulas result in a behavior whereby an agent will send its first packet for every single connectivity check before performing a retransmit. This can be seen in the formulas for the RTO (which represents the retransmit interval). Those formulas scale with N, the number of checks to be performed. As a result of this, ICE maintains a nicely constant rate, but becomes more sensitive to packet loss. The loss of the first single packet for any connectivity check is likely to cause that pair to take a long time to be validated, and instead, a lower-priority check (but one for which there was no packet loss) is much more likely to complete first. This results in ICE performing sub-optimally, choosing lower-priority pairs over higher-priority pairs. Implementors should be aware of this consequence, but still should utilize the timer values described here.
这些公式导致了这样一种行为,即代理在执行重传之前,将为每一次连接检查发送其第一个数据包。这可以在RTO(代表重传间隔)的公式中看到。这些公式以N(要执行的检查的数量)进行缩放。因此,ICE保持了良好的恒定速率,但对数据包丢失更加敏感。任何连接检查中第一个数据包的丢失都可能导致该对需要很长时间进行验证,相反,较低优先级的检查(但没有数据包丢失的检查)更有可能首先完成。这导致ICE执行次优,选择低优先级对而不是高优先级对。实现者应该知道这个结果,但是仍然应该使用这里描述的计时器值。
In cases where ICE is used to establish some kind of session that is not real time, and has no fixed rate associated with it that is known to work on the network in which ICE is deployed, Ta and RTO revert to more conservative values. Ta SHOULD be configurable, SHOULD have a default of 500 ms, and MUST NOT be configurable to be less than 500 ms.
如果ICE用于建立某种类型的非实时会话,并且没有已知在部署ICE的网络上工作的固定速率,则Ta和RTO将恢复为更保守的值。Ta应可配置,应具有500 ms的默认值,且不得配置为小于500 ms。
In addition, the retransmission timer for the STUN transactions, RTO, SHOULD be configurable and during the gathering phase, SHOULD have a default of:
此外,STUN事务的重传计时器RTO应是可配置的,并且在收集阶段,其默认值应为:
RTO = MAX (500ms, Ta * (number of pairs))
RTO=最大值(500毫秒,Ta*(对数))
where the number of pairs refers to the number of pairs of candidates with STUN or TURN servers.
where the number of pairs refers to the number of pairs of candidates with STUN or TURN servers.translate error, please retry
For connectivity checks, RTO SHOULD be configurable and SHOULD have a default of:
对于连接性检查,RTO应该是可配置的,并且应该具有默认值:
RTO = MAX (500ms, Ta*N * (Num-Waiting + Num-In-Progress))
RTO = MAX (500ms, Ta*N * (Num-Waiting + Num-In-Progress))
The example is based on the simplified topology of Figure 8.
该示例基于图8的简化拓扑。
+-----+ | | |STUN | | Srvr| +-----+ | +---------------------+ | | | Internet | | | | | +---------------------+ | | | | +---------+ | | NAT | | +---------+ | | | | | | | +-----+ +-----+ | | | | | L | | R | | | | | +-----+ +-----+
+-----+ | | |STUN | | Srvr| +-----+ | +---------------------+ | | | Internet | | | | | +---------------------+ | | | | +---------+ | | NAT | | +---------+ | | | | | | | +-----+ +-----+ | | | | | L | | R | | | | | +-----+ +-----+
Figure 8: Example Topology
图8:示例拓扑
Two agents, L and R, are using ICE. Both are full-mode ICE implementations and use aggressive nomination when they are controlling. Both agents have a single IPv4 address. For agent L, it is 10.0.1.1 in private address space [RFC1918], and for agent R, 192.0.2.1 on the public Internet. Both are configured with the same STUN server (shown in this example for simplicity, although in
两名特工,L和R,正在使用冰。两者都是全模式ICE实现,在控制时使用主动提名。两个代理都有一个IPv4地址。对于代理L,它在专用地址空间[RFC1918]中为10.0.1.1;对于代理R,它在公共Internet上为192.0.2.1。两者都使用相同的STUN服务器进行配置(本例中所示为简单起见,尽管
practice the agents do not need to use the same STUN server), which is listening for STUN Binding requests at an IP address of 192.0.2.2 and port 3478. TURN servers are not used in this example. Agent L is behind a NAT, and agent R is on the public Internet. The NAT has an endpoint independent mapping property and an address dependent filtering property. The public side of the NAT has an IP address of 192.0.2.3.
练习代理不需要使用相同的STUN服务器),该服务器正在侦听IP地址为192.0.2.2和端口3478的STUN绑定请求。本例中未使用TURN服务器。代理L在NAT后面,代理R在公共互联网上。NAT具有与端点无关的映射属性和与地址相关的筛选属性。NAT的公共端的IP地址为192.0.2.3。
To facilitate understanding, transport addresses are listed using variables that have mnemonic names. The format of the name is entity-type-seqno, where entity refers to the entity whose IP address the transport address is on, and is one of "L", "R", "STUN", or "NAT". The type is either "PUB" for transport addresses that are public, and "PRIV" for transport addresses that are private. Finally, seq-no is a sequence number that is different for each transport address of the same type on a particular entity. Each variable has an IP address and port, denoted by varname.IP and varname.PORT, respectively, where varname is the name of the variable.
为了便于理解,使用具有助记名称的变量列出传输地址。名称的格式为实体类型seqno,其中实体指传输地址所在IP地址的实体,是“L”、“R”、“STUN”或“NAT”之一。对于公共的传输地址,类型为“PUB”,对于私有的传输地址,类型为“PRIV”。最后,seq no是一个序列号,对于特定实体上相同类型的每个传输地址,序列号是不同的。每个变量都有一个IP地址和端口,分别由varname.IP和varname.port表示,其中varname是变量的名称。
The STUN server has advertised transport address STUN-PUB-1 (which is 192.0.2.2:3478).
STUN服务器已公布传输地址STUN-PUB-1(即192.0.2.2:3478)。
In the call flow itself, STUN messages are annotated with several attributes. The "S=" attribute indicates the source transport address of the message. The "D=" attribute indicates the destination transport address of the message. The "MA=" attribute is used in STUN Binding response messages and refers to the mapped address. "USE-CAND" implies the presence of the USE-CANDIDATE attribute.
在调用流本身中,STUN消息用几个属性进行注释。“S=”属性表示消息的源传输地址。“D=”属性表示消息的目标传输地址。“MA=”属性用于STUN绑定响应消息,并引用映射的地址。“USE-CAND”表示存在USE-CANDIDATE属性。
The call flow examples omit STUN authentication operations and RTCP, and focus on RTP for a single media stream between two full implementations.
调用流示例省略了STUN身份验证操作和RTCP,重点是两个完整实现之间单个媒体流的RTP。
L NAT STUN R |RTP STUN alloc. | | |(1) STUN Req | | | |S=$L-PRIV-1 | | | |D=$STUN-PUB-1 | | | |------------->| | | | |(2) STUN Req | | | |S=$NAT-PUB-1 | | | |D=$STUN-PUB-1 | | | |------------->| |
L NAT STUN R |RTP STUN alloc. | | |(1) STUN Req | | | |S=$L-PRIV-1 | | | |D=$STUN-PUB-1 | | | |------------->| | | | |(2) STUN Req | | | |S=$NAT-PUB-1 | | | |D=$STUN-PUB-1 | | | |------------->| |
| |(3) STUN Res | | | |S=$STUN-PUB-1 | | | |D=$NAT-PUB-1 | | | |MA=$NAT-PUB-1 | | | |<-------------| | |(4) STUN Res | | | |S=$STUN-PUB-1 | | | |D=$L-PRIV-1 | | | |MA=$NAT-PUB-1 | | | |<-------------| | | |(5) Offer | | | |------------------------------------------->| | | | |RTP STUN alloc. | | |(6) STUN Req | | | |S=$R-PUB-1 | | | |D=$STUN-PUB-1 | | | |<-------------| | | |(7) STUN Res | | | |S=$STUN-PUB-1 | | | |D=$R-PUB-1 | | | |MA=$R-PUB-1 | | | |------------->| |(8) answer | | | |<-------------------------------------------| | |(9) Bind Req | |Begin | |S=$R-PUB-1 | |Connectivity | |D=L-PRIV-1 | |Checks | |<----------------------------| | |Dropped | | |(10) Bind Req | | | |S=$L-PRIV-1 | | | |D=$R-PUB-1 | | | |USE-CAND | | | |------------->| | | | |(11) Bind Req | | | |S=$NAT-PUB-1 | | | |D=$R-PUB-1 | | | |USE-CAND | | | |---------------------------->| | |(12) Bind Res | | | |S=$R-PUB-1 | | | |D=$NAT-PUB-1 | | | |MA=$NAT-PUB-1 | | | |<----------------------------|
| |(3) STUN Res | | | |S=$STUN-PUB-1 | | | |D=$NAT-PUB-1 | | | |MA=$NAT-PUB-1 | | | |<-------------| | |(4) STUN Res | | | |S=$STUN-PUB-1 | | | |D=$L-PRIV-1 | | | |MA=$NAT-PUB-1 | | | |<-------------| | | |(5) Offer | | | |------------------------------------------->| | | | |RTP STUN alloc. | | |(6) STUN Req | | | |S=$R-PUB-1 | | | |D=$STUN-PUB-1 | | | |<-------------| | | |(7) STUN Res | | | |S=$STUN-PUB-1 | | | |D=$R-PUB-1 | | | |MA=$R-PUB-1 | | | |------------->| |(8) answer | | | |<-------------------------------------------| | |(9) Bind Req | |Begin | |S=$R-PUB-1 | |Connectivity | |D=L-PRIV-1 | |Checks | |<----------------------------| | |Dropped | | |(10) Bind Req | | | |S=$L-PRIV-1 | | | |D=$R-PUB-1 | | | |USE-CAND | | | |------------->| | | | |(11) Bind Req | | | |S=$NAT-PUB-1 | | | |D=$R-PUB-1 | | | |USE-CAND | | | |---------------------------->| | |(12) Bind Res | | | |S=$R-PUB-1 | | | |D=$NAT-PUB-1 | | | |MA=$NAT-PUB-1 | | | |<----------------------------|
|(13) Bind Res | | | |S=$R-PUB-1 | | | |D=$L-PRIV-1 | | | |MA=$NAT-PUB-1 | | | |<-------------| | | |RTP flows | | | | |(14) Bind Req | | | |S=$R-PUB-1 | | | |D=$NAT-PUB-1 | | | |<----------------------------| |(15) Bind Req | | | |S=$R-PUB-1 | | | |D=$L-PRIV-1 | | | |<-------------| | | |(16) Bind Res | | | |S=$L-PRIV-1 | | | |D=$R-PUB-1 | | | |MA=$R-PUB-1 | | | |------------->| | | | |(17) Bind Res | | | |S=$NAT-PUB-1 | | | |D=$R-PUB-1 | | | |MA=$R-PUB-1 | | | |---------------------------->| | | | |RTP flows
|(13) Bind Res | | | |S=$R-PUB-1 | | | |D=$L-PRIV-1 | | | |MA=$NAT-PUB-1 | | | |<-------------| | | |RTP flows | | | | |(14) Bind Req | | | |S=$R-PUB-1 | | | |D=$NAT-PUB-1 | | | |<----------------------------| |(15) Bind Req | | | |S=$R-PUB-1 | | | |D=$L-PRIV-1 | | | |<-------------| | | |(16) Bind Res | | | |S=$L-PRIV-1 | | | |D=$R-PUB-1 | | | |MA=$R-PUB-1 | | | |------------->| | | | |(17) Bind Res | | | |S=$NAT-PUB-1 | | | |D=$R-PUB-1 | | | |MA=$R-PUB-1 | | | |---------------------------->| | | | |RTP flows
Figure 9: Example Flow
图9:示例流
First, agent L obtains a host candidate from its local IP address (not shown), and from that, sends a STUN Binding request to the STUN server to get a server reflexive candidate (messages 1-4). Recall that the NAT has the address and port independent mapping property. Here, it creates a binding of NAT-PUB-1 for this UDP request, and this becomes the server reflexive candidate for RTP.
首先,代理L从其本地IP地址(未显示)获取主机候选,并从该地址向STUN服务器发送STUN绑定请求以获取服务器自反候选(消息1-4)。回想一下,NAT具有独立于地址和端口的映射属性。在这里,它为这个UDP请求创建一个NAT-PUB-1绑定,这将成为RTP的服务器自反候选。
Agent L sets a type preference of 126 for the host candidate and 100 for the server reflexive. The local preference is 65535. Based on this, the priority of the host candidate is 2130706431 and for the server reflexive candidate is 1694498815. The host candidate is assigned a foundation of 1, and the server reflexive, a foundation of 2. It chooses its server reflexive candidate as the default candidate, and encodes it into the m and c lines. The resulting offer (message 5) looks like (lines folded for clarity):
代理L为主机候选设置126的类型首选项,为服务器自反设置100的类型首选项。当地人的偏好是65535。基于此,主机候选的优先级为2130706431,服务器自反候选的优先级为1694498815。主机候选者的基础是1,服务器自反性是2的基础。它选择其服务器自反候选作为默认候选,并将其编码为m和c行。最终的报价(消息5)看起来像(为了清晰起见,折线):
v=0 o=jdoe 2890844526 2890842807 IN IP4 $L-PRIV-1.IP s= c=IN IP4 $NAT-PUB-1.IP t=0 0 a=ice-pwd:asd88fgpdd777uzjYhagZg a=ice-ufrag:8hhY m=audio $NAT-PUB-1.PORT RTP/AVP 0 b=RS:0 b=RR:0 a=rtpmap:0 PCMU/8000 a=candidate:1 1 UDP 2130706431 $L-PRIV-1.IP $L-PRIV-1.PORT typ host a=candidate:2 1 UDP 1694498815 $NAT-PUB-1.IP $NAT-PUB-1.PORT typ srflx raddr $L-PRIV-1.IP rport $L-PRIV-1.PORT
v=0 o=jdoe 2890844526 2890842807 IN IP4 $L-PRIV-1.IP s= c=IN IP4 $NAT-PUB-1.IP t=0 0 a=ice-pwd:asd88fgpdd777uzjYhagZg a=ice-ufrag:8hhY m=audio $NAT-PUB-1.PORT RTP/AVP 0 b=RS:0 b=RR:0 a=rtpmap:0 PCMU/8000 a=candidate:1 1 UDP 2130706431 $L-PRIV-1.IP $L-PRIV-1.PORT typ host a=candidate:2 1 UDP 1694498815 $NAT-PUB-1.IP $NAT-PUB-1.PORT typ srflx raddr $L-PRIV-1.IP rport $L-PRIV-1.PORT
The offer, with the variables replaced with their values, will look like (lines folded for clarity):
将变量替换为其值的报价将如下所示(为清晰起见,折线):
v=0 o=jdoe 2890844526 2890842807 IN IP4 10.0.1.1 s= c=IN IP4 192.0.2.3 t=0 0 a=ice-pwd:asd88fgpdd777uzjYhagZg a=ice-ufrag:8hhY m=audio 45664 RTP/AVP 0 b=RS:0 b=RR:0 a=rtpmap:0 PCMU/8000 a=candidate:1 1 UDP 2130706431 10.0.1.1 8998 typ host a=candidate:2 1 UDP 1694498815 192.0.2.3 45664 typ srflx raddr 10.0.1.1 rport 8998
v=0 o=jdoe 2890844526 2890842807 IN IP4 10.0.1.1 s= c=IN IP4 192.0.2.3 t=0 0 a=ice-pwd:asd88fgpdd777uzjYhagZg a=ice-ufrag:8hhY m=audio 45664 RTP/AVP 0 b=RS:0 b=RR:0 a=rtpmap:0 PCMU/8000 a=candidate:1 1 UDP 2130706431 10.0.1.1 8998 typ host a=candidate:2 1 UDP 1694498815 192.0.2.3 45664 typ srflx raddr 10.0.1.1 rport 8998
This offer is received at agent R. Agent R will obtain a host candidate, and from it, obtain a server reflexive candidate (messages 6-7). Since R is not behind a NAT, this candidate is identical to its host candidate, and they share the same base. It therefore discards this redundant candidate and ends up with a single host candidate. With identical type and local preferences as L, the priority for this candidate is 2130706431. It chooses a foundation of 1 for its single candidate. Its resulting answer looks like:
此报价在代理R处收到。代理R将获得主机候选,并从中获得服务器自反候选(消息6-7)。因为R不在NAT后面,所以该候选者与其宿主候选者相同,并且它们共享相同的基础。因此,它将丢弃此冗余候选主机,并最终得到一个主机候选主机。对于与L相同的类型和本地首选项,此候选项的优先级为2130706431。它为单个候选人选择了1的基础。其结果如下所示:
v=0 o=bob 2808844564 2808844564 IN IP4 $R-PUB-1.IP s= c=IN IP4 $R-PUB-1.IP t=0 0 a=ice-pwd:YH75Fviy6338Vbrhrlp8Yh a=ice-ufrag:9uB6 m=audio $R-PUB-1.PORT RTP/AVP 0 b=RS:0 b=RR:0 a=rtpmap:0 PCMU/8000 a=candidate:1 1 UDP 2130706431 $R-PUB-1.IP $R-PUB-1.PORT typ host
v=0 o=bob 2808844564 2808844564 IN IP4 $R-PUB-1.IP s= c=IN IP4 $R-PUB-1.IP t=0 0 a=ice-pwd:YH75Fviy6338Vbrhrlp8Yh a=ice-ufrag:9uB6 m=audio $R-PUB-1.PORT RTP/AVP 0 b=RS:0 b=RR:0 a=rtpmap:0 PCMU/8000 a=candidate:1 1 UDP 2130706431 $R-PUB-1.IP $R-PUB-1.PORT typ host
With the variables filled in:
填写变量后:
v=0 o=bob 2808844564 2808844564 IN IP4 192.0.2.1 s= c=IN IP4 192.0.2.1 t=0 0 a=ice-pwd:YH75Fviy6338Vbrhrlp8Yh a=ice-ufrag:9uB6 m=audio 3478 RTP/AVP 0 b=RS:0 b=RR:0 a=rtpmap:0 PCMU/8000 a=candidate:1 1 UDP 2130706431 192.0.2.1 3478 typ host
v=0 o=bob 2808844564 2808844564 IN IP4 192.0.2.1 s= c=IN IP4 192.0.2.1 t=0 0 a=ice-pwd:YH75Fviy6338Vbrhrlp8Yh a=ice-ufrag:9uB6 m=audio 3478 RTP/AVP 0 b=RS:0 b=RR:0 a=rtpmap:0 PCMU/8000 a=candidate:1 1 UDP 2130706431 192.0.2.1 3478 typ host
Since neither side indicated that it is lite, the agent that sent the offer that began ICE processing (agent L) becomes the controlling agent.
由于双方均未表明其为lite,发送开始ICE处理的报价的代理(代理L)成为控制代理。
Agents L and R both pair up the candidates. They both initially have two pairs. However, agent L will prune the pair containing its server reflexive candidate, resulting in just one. At agent L, this pair has a local candidate of $L_PRIV_1 and remote candidate of $R_PUB_1, and has a candidate pair priority of 4.57566E+18 (note that an implementation would represent this as a 64-bit integer so as not to lose precision). At agent R, there are two pairs. The highest priority has a local candidate of $R_PUB_1 and remote candidate of $L_PRIV_1 and has a priority of 4.57566E+18, and the second has a local candidate of $R_PUB_1 and remote candidate of $NAT_PUB_1 and priority 3.63891E+18.
L探员和R探员都把候选人配对。它们最初都有两对。但是,代理L将删减包含其服务器自反候选项的对,结果只有一个。在代理L处,该对具有$L_PRIV_1的本地候选和$R_PUB_1的远程候选,并且具有4.57566E+18的候选对优先级(注意,为了不丢失精度,实现将其表示为64位整数)。在代理R,有两对。最高优先级的本地候选者为$R_PUB_1,远程候选者为$L_PRIV_1,优先级为4.57566E+18,第二个优先级的本地候选者为$R_PUB_1,远程候选者为$NAT_PUB_1,优先级为3.63891E+18。
Agent R begins its connectivity check (message 9) for the first pair (between the two host candidates). Since R is the controlled agent for this session, the check omits the USE-CANDIDATE attribute. The
代理R开始对第一对(两个候选主机之间)进行连接检查(消息9)。由于R是此会话的受控代理,因此该检查将忽略USE-CANDIDATE属性。这个
host candidate from agent L is private and behind a NAT, and thus this check won't be successful, because the packet cannot be routed from R to L.
来自代理L的候选主机是私有的,位于NAT之后,因此该检查不会成功,因为数据包无法从R路由到L。
When agent L gets the answer, it performs its one and only connectivity check (messages 10-13). It implements the aggressive nomination algorithm, and thus includes a USE-CANDIDATE attribute in this check. Since the check succeeds, agent L creates a new pair, whose local candidate is from the mapped address in the Binding response (NAT-PUB-1 from message 13) and whose remote candidate is the destination of the request (R-PUB-1 from message 10). This is added to the valid list. In addition, it is marked as selected since the Binding request contained the USE-CANDIDATE attribute. Since there is a selected candidate in the Valid list for the one component of this media stream, ICE processing for this stream moves into the Completed state. Agent L can now send media if it so chooses.
当代理L得到答案时,它将执行其唯一的连接检查(消息10-13)。它实现了主动提名算法,因此在该检查中包含一个USE-CANDIDATE属性。由于检查成功,代理L创建了一个新的对,其本地候选地址来自绑定响应中的映射地址(来自消息13的NAT-PUB-1),远程候选地址是请求的目的地(来自消息10的R-PUB-1)。这将添加到有效列表中。此外,由于绑定请求包含USE-CANDIDATE属性,因此它被标记为selected。由于该媒体流的一个组件的有效列表中存在选定的候选,因此该流的ICE处理进入完成状态。代理L现在可以发送媒体,如果它选择的话。
Soon after receipt of the STUN Binding request from agent L (message 11), agent R will generate its triggered check. This check happens to match the next one on its check list -- from its host candidate to agent L's server reflexive candidate. This check (messages 14-17) will succeed. Consequently, agent R constructs a new candidate pair using the mapped address from the response as the local candidate (R-PUB-1) and the destination of the request (NAT-PUB-1) as the remote candidate. This pair is added to the Valid list for that media stream. Since the check was generated in the reverse direction of a check that contained the USE-CANDIDATE attribute, the candidate pair is marked as selected. Consequently, processing for this stream moves into the Completed state, and agent R can also send media.
在收到来自代理L的STUN绑定请求后不久(消息11),代理R将生成其触发的检查。这个检查恰好与它的检查列表上的下一个匹配——从它的主机候选者到代理L的服务器自反候选者。此检查(消息14-17)将成功。因此,代理R使用来自响应的映射地址作为本地候选(R-PUB-1)和请求的目的地(NAT-PUB-1)作为远程候选来构造新的候选对。此对将添加到该媒体流的有效列表中。由于该检查是在包含USE-CANDIDATE属性的检查的相反方向生成的,因此候选对被标记为选中。因此,对该流的处理进入完成状态,并且代理R也可以发送媒体。
There are several types of attacks possible in an ICE system. This section considers these attacks and their countermeasures. These countermeasures include:
ICE系统中可能存在几种类型的攻击。本节讨论这些攻击及其对策。这些对策包括:
o Using ICE in conjunction with secure signaling techniques, such as SIPS.
o 将ICE与安全信号技术(如SIPS)结合使用。
o Limiting the total number of connectivity checks to 100, and optionally limiting the number of candidates they'll accept in an offer or answer.
o 将连接检查的总数限制为100,并有选择地限制他们将在报价或答复中接受的候选人数量。
An attacker might attempt to disrupt the STUN connectivity checks. Ultimately, all of these attacks fool an agent into thinking something incorrect about the results of the connectivity checks. The possible false conclusions an attacker can try and cause are:
攻击者可能试图中断昏迷连接检查。最终,所有这些攻击都会欺骗代理,使其认为连接检查的结果不正确。攻击者可能尝试得出的错误结论如下:
False Invalid: An attacker can fool a pair of agents into thinking a candidate pair is invalid, when it isn't. This can be used to cause an agent to prefer a different candidate (such as one injected by the attacker) or to disrupt a call by forcing all candidates to fail.
False Invalid:攻击者可以愚弄一对代理,使其认为候选对无效,而实际情况并非如此。这可用于使代理选择不同的候选对象(例如攻击者注入的候选对象),或通过强制所有候选对象失败来中断调用。
False Valid: An attacker can fool a pair of agents into thinking a candidate pair is valid, when it isn't. This can cause an agent to proceed with a session, but then not be able to receive any media.
False Valid:攻击者可以欺骗一对代理,使其认为候选对是有效的,而实际情况并非如此。这可能会导致代理继续会话,但随后无法接收任何媒体。
False Peer Reflexive Candidate: An attacker can cause an agent to discover a new peer reflexive candidate, when it shouldn't have. This can be used to redirect media streams to a Denial-of-Service (DoS) target or to the attacker, for eavesdropping or other purposes.
False Peer Reflective Candidate(错误的对等自反候选):攻击者可以使代理发现一个新的对等自反候选,而它本不应该发现。这可用于将媒体流重定向到拒绝服务(DoS)目标或攻击者,用于窃听或其他目的。
False Valid on False Candidate: An attacker has already convinced an agent that there is a candidate with an address that doesn't actually route to that agent (for example, by injecting a false peer reflexive candidate or false server reflexive candidate). It must then launch an attack that forces the agents to believe that this candidate is valid.
False Valid on False候选对象:攻击者已使代理确信存在一个地址不实际路由到该代理的候选对象(例如,通过注入虚假对等自反候选对象或虚假服务器自反候选对象)。然后它必须发起攻击,迫使特工相信该候选人是有效的。
If an attacker can cause a false peer reflexive candidate or false valid on a false candidate, it can launch any of the attacks described in [RFC5389].
如果攻击者可以导致虚假对等自反候选或虚假候选上的虚假有效,则可以发起[RFC5389]中描述的任何攻击。
To force the false invalid result, the attacker has to wait for the connectivity check from one of the agents to be sent. When it is, the attacker needs to inject a fake response with an unrecoverable error response, such as a 400. However, since the candidate is, in fact, valid, the original request may reach the peer agent, and result in a success response. The attacker needs to force this packet or its response to be dropped, through a DoS attack, layer 2 network disruption, or other technique. If it doesn't do this, the success response will also reach the originator, alerting it to a possible attack. Fortunately, this attack is mitigated completely through the STUN short-term credential mechanism. The attacker needs to inject a fake response, and in order for this response to be processed, the attacker needs the password. If the offer/answer
要强制生成错误的无效结果,攻击者必须等待其中一个代理发送连接检查。如果是,攻击者需要使用不可恢复的错误响应(如400)注入假响应。然而,由于候选者实际上是有效的,原始请求可能到达对等代理,并导致成功响应。攻击者需要通过DoS攻击、第2层网络中断或其他技术强制丢弃此数据包或其响应。如果它不这样做,成功响应也将到达发起人,提醒其可能受到攻击。幸运的是,这种攻击通过STUN短期凭证机制得到了完全缓解。攻击者需要注入假响应,并且为了处理此响应,攻击者需要密码。如果提议/答复
signaling is secured, the attacker will not have the password and its response will be discarded.
如果信号是安全的,攻击者将不会拥有密码,其响应将被丢弃。
Forcing the fake valid result works in a similar way. The agent needs to wait for the Binding request from each agent, and inject a fake success response. The attacker won't need to worry about disrupting the actual response since, if the candidate is not valid, it presumably wouldn't be received anyway. However, like the fake invalid attack, this attack is mitigated by the STUN short-term credential mechanism in conjunction with a secure offer/answer exchange.
强制假有效结果的工作方式与此类似。代理需要等待来自每个代理的绑定请求,并注入一个虚假的成功响应。攻击者不必担心干扰实际响应,因为如果候选者无效,它可能无论如何都不会被接收。但是,与伪无效攻击一样,STUN短期凭证机制结合安全的提供/应答交换可以缓解此攻击。
Forcing the false peer reflexive candidate result can be done either with fake requests or responses, or with replays. We consider the fake requests and responses case first. It requires the attacker to send a Binding request to one agent with a source IP address and port for the false candidate. In addition, the attacker must wait for a Binding request from the other agent, and generate a fake response with a XOR-MAPPED-ADDRESS attribute containing the false candidate. Like the other attacks described here, this attack is mitigated by the STUN message integrity mechanisms and secure offer/answer exchanges.
强制虚假对等自反候选结果可以通过虚假请求或响应或重播来完成。我们认为假冒请求和响应案例首先。它要求攻击者向一个代理发送绑定请求,其中包含假候选的源IP地址和端口。此外,攻击者必须等待来自另一个代理的绑定请求,并使用包含假候选的XOR-MAPPED-ADDRESS属性生成假响应。与此处描述的其他攻击一样,此攻击通过STUN消息完整性机制和安全的提供/应答交换得到缓解。
Forcing the false peer reflexive candidate result with packet replays is different. The attacker waits until one of the agents sends a check. It intercepts this request, and replays it towards the other agent with a faked source IP address. It must also prevent the original request from reaching the remote agent, either by launching a DoS attack to cause the packet to be dropped, or forcing it to be dropped using layer 2 mechanisms. The replayed packet is received at the other agent, and accepted, since the integrity check passes (the integrity check cannot and does not cover the source IP address and port). It is then responded to. This response will contain a XOR-MAPPED-ADDRESS with the false candidate, and will be sent to that false candidate. The attacker must then receive it and relay it towards the originator.
用数据包重播强制得到错误的对等自反候选结果是不同的。攻击者等待其中一个代理发送检查。它截取该请求,并使用伪造的源IP地址向另一个代理重播该请求。它还必须防止原始请求到达远程代理,或者发起DoS攻击以导致数据包被丢弃,或者使用第2层机制强制丢弃数据包。由于完整性检查通过(完整性检查不能也不包括源IP地址和端口),因此在另一个代理接收并接受重播的数据包。然后对其进行响应。此响应将包含一个带有假候选的XOR映射地址,并将发送给该假候选。然后,攻击者必须接收并将其转发给发起人。
The other agent will then initiate a connectivity check towards that false candidate. This validation needs to succeed. This requires the attacker to force a false valid on a false candidate. Injecting of fake requests or responses to achieve this goal is prevented using the integrity mechanisms of STUN and the offer/answer exchange. Thus, this attack can only be launched through replays. To do that, the attacker must intercept the check towards this false candidate, and replay it towards the other agent. Then, it must intercept the response and replay that back as well.
然后,另一个代理将启动针对该错误候选的连接检查。这种验证需要成功。这要求攻击者对错误的候选对象强制执行false valid。使用STUN和提供/应答交换的完整性机制可以防止为实现此目标而注入虚假请求或响应。因此,此攻击只能通过重播发起。要做到这一点,攻击者必须截获针对该虚假候选的检查,并向其他代理重播该检查。然后,它必须截取响应并将其回放。
This attack is very hard to launch unless the attacker is identified by the fake candidate. This is because it requires the attacker to intercept and replay packets sent by two different hosts. If both agents are on different networks (for example, across the public Internet), this attack can be hard to coordinate, since it needs to occur against two different endpoints on different parts of the network at the same time.
除非攻击者被假候选人识别,否则很难发起此攻击。这是因为它要求攻击者拦截和重放由两个不同主机发送的数据包。如果两个代理位于不同的网络上(例如,通过公共互联网),则这种攻击可能很难协调,因为它需要同时针对网络不同部分上的两个不同端点进行攻击。
If the attacker itself is identified by the fake candidate, the attack is easier to coordinate. However, if SRTP is used [RFC3711], the attacker will not be able to play the media packets, but will only be able to discard them, effectively disabling the media stream for the call. However, this attack requires the agent to disrupt packets in order to block the connectivity check from reaching the target. In that case, if the goal is to disrupt the media stream, it's much easier to just disrupt it with the same mechanism, rather than attack ICE.
如果攻击者本身被伪造的候选者识别,则攻击更容易协调。但是,如果使用SRTP[RFC3711],攻击者将无法播放媒体数据包,而只能丢弃它们,从而有效地禁用呼叫的媒体流。但是,此攻击要求代理中断数据包,以阻止连接检查到达目标。在这种情况下,如果目标是中断媒体流,那么使用相同的机制中断媒体流比攻击ICE容易得多。
ICE endpoints make use of STUN Binding requests for gathering server reflexive candidates from a STUN server. These requests are not authenticated in any way. As a consequence, there are numerous techniques an attacker can employ to provide the client with a false server reflexive candidate:
ICE端点利用STUN绑定请求从STUN服务器收集服务器自反候选。这些请求没有以任何方式进行身份验证。因此,攻击者可以利用多种技术向客户端提供虚假的服务器自反候选服务器:
o An attacker can compromise the DNS, causing DNS queries to return a rogue STUN server address. That server can provide the client with fake server reflexive candidates. This attack is mitigated by DNS security, though DNS-SEC is not required to address it.
o 攻击者可以破坏DNS,导致DNS查询返回恶意STUN服务器地址。该服务器可以向客户端提供虚假的服务器自反候选。此攻击通过DNS安全性得到缓解,但不需要DNS-SEC来解决。
o An attacker that can observe STUN messages (such as an attacker on a shared network segment, like WiFi) can inject a fake response that is valid and will be accepted by the client.
o 能够观察到STUN消息的攻击者(例如共享网段上的攻击者,如WiFi)可以注入有效且会被客户端接受的虚假响应。
o An attacker can compromise a STUN server by means of a virus, and cause it to send responses with incorrect mapped addresses.
o 攻击者可以通过病毒危害STUN服务器,并使其发送具有错误映射地址的响应。
A false mapped address learned by these attacks will be used as a server reflexive candidate in the ICE exchange. For this candidate to actually be used for media, the attacker must also attack the connectivity checks, and in particular, force a false valid on a false candidate. This attack is very hard to launch if the false address identifies a fourth party (neither the offerer, answerer, nor attacker), since it requires attacking the checks generated by each agent in the session, and is prevented by SRTP if it identifies the attacker themself.
通过这些攻击获得的错误映射地址将用作ICE交换中的服务器自反候选地址。要使此候选对象实际用于媒体,攻击者还必须攻击连接检查,尤其是对假候选对象强制执行假有效。如果虚假地址识别第四方(无论是提供方、应答方还是攻击者),则很难发起此攻击,因为它需要攻击会话中每个代理生成的检查,并且如果SRTP识别攻击者自己,则SRTP可以阻止此攻击。
If the attacker elects not to attack the connectivity checks, the worst it can do is prevent the server reflexive candidate from being used. However, if the peer agent has at least one candidate that is reachable by the agent under attack, the STUN connectivity checks themselves will provide a peer reflexive candidate that can be used for the exchange of media. Peer reflexive candidates are generally preferred over server reflexive candidates. As such, an attack solely on the STUN address gathering will normally have no impact on a session at all.
如果攻击者选择不攻击连接性检查,那么它所能做的最糟糕的事情就是阻止服务器自反候选服务器被使用。但是,如果对等代理具有至少一个可由受攻击的代理访问的候选,则STUN连接检查本身将提供可用于媒体交换的对等自反候选。对等自反候选者通常优于服务器自反候选者。因此,仅针对昏迷地址收集的攻击通常不会对会话产生任何影响。
An attacker might attempt to disrupt the gathering of relayed candidates, forcing the client to believe it has a false relayed candidate. Exchanges with the TURN server are authenticated using a long-term credential. Consequently, injection of fake responses or requests will not work. In addition, unlike Binding requests, Allocate requests are not susceptible to replay attacks with modified source IP addresses and ports, since the source IP address and port are not utilized to provide the client with its relayed candidate.
攻击者可能试图中断中继候选对象的收集,迫使客户端相信它有一个错误的中继候选对象。使用长期凭证对与TURN服务器的交换进行身份验证。因此,虚假响应或请求的注入将不起作用。此外,与绑定请求不同,分配请求不易受到修改源IP地址和端口的重播攻击,因为源IP地址和端口不用于向客户端提供其中继候选。
However, TURN servers are susceptible to DNS attacks, or to viruses aimed at the TURN server, for purposes of turning it into a zombie or rogue server. These attacks can be mitigated by DNS-SEC and through good box and software security on TURN servers.
但是,TURN服务器容易受到DNS攻击或针对TURN服务器的病毒的攻击,从而将其变成僵尸或流氓服务器。DNS-SEC和TURN服务器上良好的机箱和软件安全性可以缓解这些攻击。
Even if an attacker has caused the client to believe in a false relayed candidate, the connectivity checks cause such a candidate to be used only if they succeed. Thus, an attacker must launch a false valid on a false candidate, per above, which is a very difficult attack to coordinate.
即使攻击者使客户端相信错误的中继候选者,连接检查也会导致只有在成功时才使用此类候选者。因此,根据上文,攻击者必须对错误的候选对象启动false valid,这是一种很难协调的攻击。
An attacker that can modify or disrupt the offer/answer exchanges themselves can readily launch a variety of attacks with ICE. They could direct media to a target of a DoS attack, they could insert themselves into the media stream, and so on. These are similar to the general security considerations for offer/answer exchanges, and the security considerations in RFC 3264 [RFC3264] apply. These require techniques for message integrity and encryption for offers and answers, which are satisfied by the SIPS mechanism [RFC3261] when SIP is used. As such, the usage of SIPS with ICE is RECOMMENDED.
能够修改或破坏提供/应答交换的攻击者可以使用ICE随时发起各种攻击。他们可以将媒体指向DoS攻击的目标,他们可以将自己插入媒体流,等等。这些与提供/应答交换的一般安全注意事项类似,RFC 3264[RFC3264]中的安全注意事项适用。这些要求提供和应答的消息完整性和加密技术,当使用SIP时,SIPS机制[RFC3261]可以满足这些要求。因此,建议使用含冰的SIP。
In addition to attacks where the attacker is a third party trying to insert fake offers, answers, or stun messages, there are several attacks possible with ICE when the attacker is an authenticated and valid participant in the ICE exchange.
除了攻击者是第三方试图插入虚假报价、应答或昏迷消息的攻击外,当攻击者是ICE交换中经过身份验证且有效的参与者时,ICE还可能发生多起攻击。
The voice hammer attack is an amplification attack. In this attack, the attacker initiates sessions to other agents, and maliciously includes the IP address and port of a DoS target as the destination for media traffic signaled in the SDP. This causes substantial amplification; a single offer/answer exchange can create a continuing flood of media packets, possibly at high rates (consider video sources). This attack is not specific to ICE, but ICE can help provide remediation.
语音锤攻击是一种放大攻击。在此攻击中,攻击者发起与其他代理的会话,并恶意将DoS目标的IP地址和端口作为SDP中发出信号的媒体流量的目标。这导致大量放大;单次提供/应答交换可能会以很高的速率(考虑视频源)持续产生大量媒体数据包。这种攻击不是针对ICE的,但ICE可以帮助提供补救措施。
Specifically, if ICE is used, the agent receiving the malicious SDP will first perform connectivity checks to the target of media before sending media there. If this target is a third-party host, the checks will not succeed, and media is never sent.
具体而言,如果使用ICE,则接收恶意SDP的代理将首先对媒体目标执行连接检查,然后再将媒体发送到目标。如果此目标是第三方主机,检查将不会成功,并且永远不会发送媒体。
Unfortunately, ICE doesn't help if its not used, in which case an attacker could simply send the offer without the ICE parameters. However, in environments where the set of clients is known, and is limited to ones that support ICE, the server can reject any offers or answers that don't indicate ICE support.
不幸的是,如果不使用ICE,则ICE没有任何帮助,在这种情况下,攻击者可以在不使用ICE参数的情况下发送报价。但是,在已知客户端集且仅限于支持ICE的客户端集的环境中,服务器可以拒绝任何不表示支持ICE的提议或答复。
The STUN amplification attack is similar to the voice hammer. However, instead of voice packets being directed to the target, STUN connectivity checks are directed to the target. The attacker sends an offer with a large number of candidates, say, 50. The answerer receives the offer, and starts its checks, which are directed at the target, and consequently, never generate a response. The answerer will start a new connectivity check every Ta ms (say, Ta=20ms). However, the retransmission timers are set to a large number due to the large number of candidates. As a consequence, packets will be sent at an interval of one every Ta milliseconds, and then with increasing intervals after that. Thus, STUN will not send packets at a rate faster than media would be sent, and the STUN packets persist only briefly, until ICE fails for the session. Nonetheless, this is an amplification mechanism.
眩晕放大攻击类似于声音锤。但是,不是将语音数据包定向到目标,而是将STUN连接检查定向到目标。攻击者发送了一个包含大量候选人的报价,例如50人。回答者收到提议,并开始检查,这是针对目标的,因此,永远不会产生响应。应答者将每Ta毫秒(例如,Ta=20ms)开始一次新的连接检查。然而,由于候选数量较多,重传定时器被设置为较大的数字。因此,数据包将以每Ta毫秒一次的间隔发送,然后再以增加的间隔发送。因此,STUN发送数据包的速度不会快于发送媒体的速度,并且STUN数据包只会短暂持续,直到ICE会话失败。尽管如此,这是一种放大机制。
It is impossible to eliminate the amplification, but the volume can be reduced through a variety of heuristics. Agents SHOULD limit the
消除放大是不可能的,但可以通过各种启发式方法减少体积。代理应限制
total number of connectivity checks they perform to 100. Additionally, agents MAY limit the number of candidates they'll accept in an offer or answer.
它们执行的连接检查总数为100。此外,代理商可能会限制他们在报价或答复中接受的候选人数量。
Frequently, protocols that wish to avoid these kinds of attacks force the initiator to wait for a response prior to sending the next message. However, in the case of ICE, this is not possible. It is not possible to differentiate the following two cases:
通常,希望避免此类攻击的协议会迫使启动器在发送下一条消息之前等待响应。然而,在冰的情况下,这是不可能的。无法区分以下两种情况:
o There was no response because the initiator is being used to launch a DoS attack against an unsuspecting target that will not respond.
o 没有响应,因为发起程序正被用来对一个毫无戒心、不会响应的目标发起DoS攻击。
o There was no response because the IP address and port are not reachable by the initiator.
o 没有响应,因为启动器无法访问IP地址和端口。
In the second case, another check should be sent at the next opportunity, while in the former case, no further checks should be sent.
在第二种情况下,应在下一次机会发送另一张支票,而在前一种情况下,不应发送进一步的支票。
Application Layer Gateways (ALGs) are functions present in a NAT device that inspect the contents of packets and modify them, in order to facilitate NAT traversal for application protocols. Session Border Controllers (SBCs) are close cousins of ALGs, but are less transparent since they actually exist as application layer SIP intermediaries. ICE has interactions with SBCs and ALGs.
应用层网关(ALG)是NAT设备中存在的功能,用于检查数据包的内容并对其进行修改,以促进应用协议的NAT遍历。会话边界控制器(SBC)是ALG的近亲,但透明度较低,因为它们实际上是作为应用层SIP中介存在的。ICE与SBC和ALG相互作用。
If an ALG is SIP aware but not ICE aware, ICE will work through it as long as the ALG correctly modifies the SDP. A correct ALG implementation behaves as follows:
如果ALG可识别SIP但不可识别ICE,则只要ALG正确修改SDP,ICE将通过它工作。正确的ALG实现的行为如下:
o The ALG does not modify the m and c lines or the rtcp attribute if they contain external addresses.
o ALG不会修改m和c行或rtcp属性(如果它们包含外部地址)。
o If the m and c lines contain internal addresses, the modification depends on the state of the ALG:
o 如果m和c行包含内部地址,则修改取决于ALG的状态:
If the ALG already has a binding established that maps an external port to an internal IP address and port matching the values in the m and c lines or rtcp attribute, the ALG uses that binding instead of creating a new one.
如果ALG已经建立了将外部端口映射到内部IP地址的绑定,并且端口与m和c行或rtcp属性中的值相匹配,则ALG将使用该绑定,而不是创建新的绑定。
If the ALG does not already have a binding, it creates a new one and modifies the SDP, rewriting the m and c lines and rtcp attribute.
如果ALG还没有绑定,它将创建一个新绑定并修改SDP,重写m和c行以及rtcp属性。
Unfortunately, many ALGs are known to work poorly in these corner cases. ICE does not try to work around broken ALGs, as this is outside the scope of its functionality. ICE can help diagnose these conditions, which often show up as a mismatch between the set of candidates and the m and c lines and rtcp attributes. The ice-mismatch attribute is used for this purpose.
不幸的是,许多ALG在这些极端情况下工作不好。ICE不会尝试处理损坏的ALG,因为这超出了其功能范围。ICE可以帮助诊断这些情况,这些情况通常表现为候选集与m和c行以及rtcp属性之间的不匹配。ice不匹配属性用于此目的。
ICE works best through ALGs when the signaling is run over TLS. This prevents the ALG from manipulating the SDP messages and interfering with ICE operation. Implementations that are expected to be deployed behind ALGs SHOULD provide for TLS transport of the SDP.
当信号通过TLS传输时,ICE通过ALG工作得最好。这可防止ALG操纵SDP消息并干扰ICE操作。预期部署在ALG后面的实现应提供SDP的TLS传输。
If an SBC is SIP aware but not ICE aware, the result depends on the behavior of the SBC. If it is acting as a proper Back-to-Back User Agent (B2BUA), the SBC will remove any SDP attributes it doesn't understand, including the ICE attributes. Consequently, the call will appear to both endpoints as if the other side doesn't support ICE. This will result in ICE being disabled, and media flowing through the SBC, if the SBC has requested it. If, however, the SBC passes the ICE attributes without modification, yet modifies the default destination for media (contained in the m and c lines and rtcp attribute), this will be detected as an ICE mismatch, and ICE processing is aborted for the call. It is outside of the scope of ICE for it to act as a tool for "working around" SBCs. If one is present, ICE will not be used and the SBC techniques take precedence.
如果SBC感知SIP但不感知ICE,则结果取决于SBC的行为。如果SBC作为正确的背对背用户代理(B2BUA),SBC将删除它不了解的任何SDP属性,包括ICE属性。因此,调用将在两个端点上显示,就好像另一端不支持ICE一样。如果SBC已请求,这将导致ICE被禁用,介质流经SBC。但是,如果SBC在未修改的情况下传递ICE属性,但修改了媒体的默认目标(包含在m和c行以及rtcp属性中),这将被检测为ICE不匹配,并且ICE处理将中止调用。作为“围绕”SBC开展工作的工具,不属于ICE的范围。如果存在,则不会使用ICE,且SBC技术优先。
This specification defines four new attributes, PRIORITY, USE-CANDIDATE, ICE-CONTROLLED, and ICE-CONTROLLING.
本规范定义了四个新属性:优先级、候选用途、ICE控制和ICE控制。
The PRIORITY attribute indicates the priority that is to be associated with a peer reflexive candidate, should one be discovered by this check. It is a 32-bit unsigned integer, and has an attribute value of 0x0024.
PRIORITY属性表示如果通过此检查发现对等自反候选项,则将与该候选项关联的优先级。它是一个32位无符号整数,属性值为0x0024。
The USE-CANDIDATE attribute indicates that the candidate pair resulting from this check should be used for transmission of media. The attribute has no content (the Length field of the attribute is zero); it serves as a flag. It has an attribute value of 0x0025.
USE-CANDIDATE属性表示此检查产生的候选对应用于媒体传输。该属性没有内容(该属性的长度字段为零);它是一面旗帜。它的属性值为0x0025。
The ICE-CONTROLLED attribute is present in a Binding request and indicates that the client believes it is currently in the controlled role. The content of the attribute is a 64-bit unsigned integer in network byte order, which contains a random number used for tie-breaking of role conflicts.
ICE-CONTROLED属性存在于绑定请求中,表示客户端认为它当前处于受控角色。该属性的内容是一个网络字节顺序的64位无符号整数,其中包含一个用于角色冲突中断的随机数。
The ICE-CONTROLLING attribute is present in a Binding request and indicates that the client believes it is currently in the controlling role. The content of the attribute is a 64-bit unsigned integer in network byte order, which contains a random number used for tie-breaking of role conflicts.
ICE-CONTROLING属性存在于绑定请求中,表示客户端认为它当前处于控制角色。该属性的内容是一个网络字节顺序的64位无符号整数,其中包含一个用于角色冲突中断的随机数。
This specification defines a single error response code:
本规范定义了单个错误响应代码:
487 (Role Conflict): The Binding request contained either the ICE-CONTROLLING or ICE-CONTROLLED attribute, indicating a role that conflicted with the server. The server ran a tie-breaker based on the tie-breaker value in the request and determined that the client needs to switch roles.
487(角色冲突):绑定请求包含ICE-CONTROLING或ICE-CONTROLED属性,指示与服务器冲突的角色。服务器根据请求中的tie breaker值运行tie breaker,并确定客户端需要切换角色。
This section discusses issues relevant to network operators looking to deploy ICE.
本节讨论与希望部署ICE的网络运营商相关的问题。
ICE was designed to work with existing NAT and firewall equipment. Consequently, it is not necessary to replace or reconfigure existing firewall and NAT equipment in order to facilitate deployment of ICE. Indeed, ICE was developed to be deployed in environments where the Voice over IP (VoIP) operator has no control over the IP network infrastructure, including firewalls and NAT.
ICE设计用于现有NAT和防火墙设备。因此,无需更换或重新配置现有防火墙和NAT设备,以便于ICE的部署。事实上,ICE被开发用于IP语音(VoIP)运营商无法控制IP网络基础设施(包括防火墙和NAT)的环境中。
That said, ICE works best in environments where the NAT devices are "behave" compliant, meeting the recommendations defined in [RFC4787] and [RFC5766]. In networks with behave-compliant NAT, ICE will work without the need for a TURN server, thus improving voice quality, decreasing call setup times, and reducing the bandwidth demands on the network operator.
也就是说,ICE在NAT设备“行为”兼容的环境中工作得最好,满足[RFC4787]和[RFC5766]中定义的建议。在具有behave compliant NAT的网络中,ICE将在不需要TURN服务器的情况下工作,从而提高语音质量,减少呼叫建立时间,并降低网络运营商的带宽需求。
Deployment of ICE can have several interactions with available network capacity that operators should take into consideration.
ICE的部署可能会与运营商应考虑的可用网络容量发生多次交互。
First and foremost, ICE makes use of TURN and STUN servers, which would typically be located in the network operator's data centers. The STUN servers require relatively little bandwidth. For each component of each media stream, there will be one or more STUN
首先,ICE使用TURN和STUN服务器,这些服务器通常位于网络运营商的数据中心。STUN服务器需要的带宽相对较少。对于每个媒体流的每个组件,将有一个或多个眩晕
transactions from each client to the STUN server. In a basic voice-only IPv4 VoIP deployment, there will be four transactions per call (one for RTP and one for RTCP, for both caller and callee). Each transaction is a single request and a single response, the former being 20 bytes long, and the latter, 28. Consequently, if a system has N users, and each makes four calls in a busy hour, this would require N*1.7bps. For one million users, this is 1.7 Mbps, a very small number (relatively speaking).
从每个客户端到STUN服务器的事务。在基本的纯语音IPv4 VoIP部署中,每个呼叫将有四个事务(一个用于RTP,一个用于RTCP,用于呼叫者和被呼叫者)。每个事务都是一个请求和一个响应,前者长20字节,后者长28字节。因此,如果一个系统有N个用户,并且每个用户在繁忙时间内打4个电话,则需要N*1.7bps。对于一百万用户来说,这是1.7Mbps,这是一个非常小的数字(相对而言)。
TURN traffic is more substantial. The TURN server will see traffic volume equal to the STUN volume (indeed, if TURN servers are deployed, there is no need for a separate STUN server), in addition to the traffic for the actual media traffic. The amount of calls requiring TURN for media relay is highly dependent on network topologies, and can and will vary over time. In a network with 100% behave-compliant NAT, it is exactly zero. At time of writing, large-scale consumer deployments were seeing between 5 and 10 percent of calls requiring TURN servers. Considering a voice-only deployment using G.711 (so 80 kbps in each direction), with .2 erlangs during the busy hour, this is N*3.2 kbps. For a population of one million users, this is 3.2 Gbps, assuming a 10% usage of TURN servers.
转弯流量更大。除了实际媒体流量之外,TURN服务器将看到与STUN流量相等的流量(实际上,如果部署TURN服务器,则不需要单独的STUN服务器)。需要轮换媒体中继的呼叫量高度依赖于网络拓扑,并且会随着时间的推移而变化。在具有100%行为兼容NAT的网络中,它正好为零。在撰写本文时,大规模的消费者部署中,有5%到10%的呼叫需要TURN服务器。考虑到使用G.711的纯语音部署(每个方向80 kbps),在繁忙时间使用0.2个Erlang,这是N*3.2 kbps。假设TURN服务器的使用率为10%,对于100万用户来说,这是3.2 Gbps。
The process of gathering of candidates and performing of connectivity checks can be bandwidth intensive. ICE has been designed to pace both of these processes. The gathering phase and the connectivity check phase are meant to generate traffic at roughly the same bandwidth as the media traffic itself. This was done to ensure that, if a network is designed to support multimedia traffic of a certain type (voice, video, or just text), it will have sufficient capacity to support the ICE checks for that media. Of course, the ICE checks will cause a marginal increase in the total utilization; however, this will typically be an extremely small increase.
收集候选对象和执行连接检查的过程可能会占用大量带宽。ICE的设计目的是加快这两个过程。收集阶段和连接检查阶段旨在以与媒体流量本身大致相同的带宽生成流量。这样做是为了确保,如果网络设计为支持某种类型的多媒体通信(语音、视频或文本),那么它将有足够的容量支持该媒体的ICE检查。当然,ICE检查将导致总利用率的边际增加;然而,这通常是一个非常小的增长。
Congestion due to the gathering and check phases has proven to be a problem in deployments that did not utilize pacing. Typically, access links became congested as the endpoints flooded the network with checks as fast as they can send them. Consequently, network operators should make sure that their ICE implementations support the pacing feature. Though this pacing does increase call setup times, it makes ICE network friendly and easier to deploy.
由于收集和检查阶段而导致的拥塞已被证明是不使用起搏的部署中的一个问题。通常,当端点以尽可能快的速度向网络发送检查时,访问链路会变得拥挤。因此,网络运营商应确保其ICE实施支持起搏功能。虽然这种调整确实增加了呼叫设置时间,但它使ICE网络更友好,更易于部署。
STUN keepalives (in the form of STUN Binding Indications) are sent in the middle of a media session. However, they are sent only in the absence of actual media traffic. In deployments that are not
Stun KeaPiVes(以Stun绑定指示的形式)在媒体会话的中间发送。但是,它们仅在没有实际媒体流量的情况下发送。在不适用的部署中
utilizing Voice Activity Detection (VAD), the keepalives are never used and there is no increase in bandwidth usage. When VAD is being used, keepalives will be sent during silence periods. This involves a single packet every 15-20 seconds, far less than the packet every 20-30 ms that is sent when there is voice. Therefore, keepalives don't have any real impact on capacity planning.
利用语音活动检测(VAD),keepalives从未被使用,带宽使用率也没有增加。使用VAD时,将在静默期间发送keepalives。这涉及到每15-20秒发送一个数据包,远远少于有语音时每20-30毫秒发送一个数据包。因此,keepalives对容量规划没有任何实际影响。
Deployments utilizing a mix of ICE and ICE-lite interoperate perfectly. They have been explicitly designed to do so, without loss of function.
混合使用ICE和ICE lite的部署可以完美地互操作。它们被明确设计为这样做,而不会失去功能。
However, ICE-lite can only be deployed in limited use cases. Those cases, and the caveats involved in doing so, are documented in Appendix A.
然而,ICE-lite只能在有限的用例中部署。附录A中记录了这些情况以及相关注意事项。
ICE utilizes end-to-end connectivity checks, and places much of the processing in the endpoints. This introduces a challenge to the network operator -- how can they troubleshoot ICE deployments? How can they know how ICE is performing?
ICE利用端到端连接检查,并将大部分处理放在端点中。这给网络运营商带来了一个挑战——他们如何对ICE部署进行故障排除?他们怎么知道冰是如何运行的?
ICE has built-in features to help deal with these problems. SIP servers on the signaling path, typically deployed in the data centers of the network operator, will see the contents of the offer/answer exchanges that convey the ICE parameters. These parameters include the type of each candidate (host, server reflexive, or relayed), along with their related addresses. Once ICE processing has completed, an updated offer/answer exchange takes place, signaling the selected address (and its type). This updated re-INVITE is performed exactly for the purposes of educating network equipment (such as a diagnostic tool attached to a SIP server) about the results of ICE processing.
ICE的内置功能有助于解决这些问题。信令路径上的SIP服务器(通常部署在网络运营商的数据中心)将看到传递ICE参数的提供/应答交换的内容。这些参数包括每个候选服务器的类型(主机、服务器自反或中继)及其相关地址。ICE处理完成后,将进行更新的报价/应答交换,并发送所选地址(及其类型)的信号。执行此更新的重新邀请完全是为了教育网络设备(例如连接到SIP服务器的诊断工具)有关ICE处理结果。
As a consequence, through the logs generated by the SIP server, a network operator can observe what types of candidates are being used for each call, and what address was selected by ICE. This is the primary information that helps evaluate how ICE is performing.
因此,通过SIP服务器生成的日志,网络运营商可以观察每个呼叫使用的候选类型,以及ICE选择的地址。这是帮助评估ICE性能的主要信息。
ICE relies on several pieces of data being configured into the endpoints. This configuration data includes timers, credentials for TURN servers, and hostnames for STUN and TURN servers. ICE itself does not provide a mechanism for this configuration. Instead, it is assumed that this information is attached to whatever mechanism is
ICE依赖于将多个数据段配置到端点。此配置数据包括计时器、TURN服务器的凭据以及STUN和TURN服务器的主机名。ICE本身不提供这种配置的机制。相反,假设此信息附加到任何机制
used to configure all of the other parameters in the endpoint. For SIP phones, standard solutions such as the configuration framework [SIP-UA-FRMWK] have been defined.
用于配置端点中的所有其他参数。对于SIP电话,已经定义了标准解决方案,如配置框架[SIP-UA-FRMWK]。
This specification registers new SDP attributes, four new STUN attributes, and one new STUN error response.
此规范注册了新的SDP属性、四个新的STUN属性和一个新的STUN错误响应。
This specification defines seven new SDP attributes per the procedures of Section 8.2.4 of [RFC4566]. The required information for the registrations is included here.
本规范根据[RFC4566]第8.2.4节的程序定义了七个新的SDP属性。此处包含注册所需的信息。
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
联系人姓名:Jonathan Rosenberg,jdrosen@jdrosen.net.
Attribute Name: candidate
属性名称:候选者
Long Form: candidate
长表格:候选人
Type of Attribute: media-level
属性类型:媒体级别
Charset Considerations: The attribute is not subject to the charset attribute.
字符集注意事项:该属性不受字符集属性的约束。
Purpose: This attribute is used with Interactive Connectivity Establishment (ICE), and provides one of many possible candidate addresses for communication. These addresses are validated with an end-to-end connectivity check using Session Traversal Utilities for NAT (STUN)).
目的:此属性与交互式连接建立(ICE)一起使用,并为通信提供许多可能的候选地址之一。这些地址通过使用NAT会话遍历实用程序(STUN)的端到端连接检查进行验证。
Appropriate Values: See Section 15 of RFC 5245.
适当值:见RFC 5245第15节。
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
联系人姓名:Jonathan Rosenberg,jdrosen@jdrosen.net.
Attribute Name: remote-candidates
属性名称:远程候选
Long Form: remote-candidates
长表格:远程候选人
Type of Attribute: media-level
属性类型:媒体级别
Charset Considerations: The attribute is not subject to the charset attribute.
字符集注意事项:该属性不受字符集属性的约束。
Purpose: This attribute is used with Interactive Connectivity Establishment (ICE), and provides the identity of the remote candidates that the offerer wishes the answerer to use in its answer.
目的:此属性与交互式连接建立(ICE)一起使用,并提供报价人希望应答人在其答案中使用的远程候选人的身份。
Appropriate Values: See Section 15 of RFC 5245.
适当值:见RFC 5245第15节。
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
联系人姓名:Jonathan Rosenberg,jdrosen@jdrosen.net.
Attribute Name: ice-lite
属性名称:冰晶
Long Form: ice-lite
长形:冰晶
Type of Attribute: session-level
属性类型:会话级别
Charset Considerations: The attribute is not subject to the charset attribute.
字符集注意事项:该属性不受字符集属性的约束。
Purpose: This attribute is used with Interactive Connectivity Establishment (ICE), and indicates that an agent has the minimum functionality required to support ICE inter-operation with a peer that has a full implementation.
目的:此属性与交互式连接建立(ICE)一起使用,表示代理具有支持ICE与具有完整实现的对等方交互操作所需的最低功能。
Appropriate Values: See Section 15 of RFC 5245.
适当值:见RFC 5245第15节。
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
联系人姓名:Jonathan Rosenberg,jdrosen@jdrosen.net.
Attribute Name: ice-mismatch
属性名称:ice不匹配
Long Form: ice-mismatch
长形:冰失配
Type of Attribute: session-level
属性类型:会话级别
Charset Considerations: The attribute is not subject to the charset attribute.
字符集注意事项:该属性不受字符集属性的约束。
Purpose: This attribute is used with Interactive Connectivity Establishment (ICE), and indicates that an agent is ICE capable, but did not proceed with ICE due to a mismatch of candidates with the default destination for media signaled in the SDP.
目的:此属性与交互式连接建立(ICE)一起使用,表示代理具有ICE功能,但由于候选对象与SDP中发送信号的媒体的默认目标不匹配,因此未继续使用ICE。
Appropriate Values: See Section 15 of RFC 5245.
适当值:见RFC 5245第15节。
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
联系人姓名:Jonathan Rosenberg,jdrosen@jdrosen.net.
Attribute Name: ice-pwd
属性名称:ice pwd
Long Form: ice-pwd
长格式:ice pwd
Type of Attribute: session- or media-level
属性类型:会话或媒体级别
Charset Considerations: The attribute is not subject to the charset attribute.
字符集注意事项:该属性不受字符集属性的约束。
Purpose: This attribute is used with Interactive Connectivity Establishment (ICE), and provides the password used to protect STUN connectivity checks.
目的:此属性与交互式连接建立(ICE)一起使用,并提供用于保护STUN连接检查的密码。
Appropriate Values: See Section 15 of RFC 5245.
适当值:见RFC 5245第15节。
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
联系人姓名:Jonathan Rosenberg,jdrosen@jdrosen.net.
Attribute Name: ice-ufrag
属性名称:冰抹布
Long Form: ice-ufrag
长形:冰抹布
Type of Attribute: session- or media-level
属性类型:会话或媒体级别
Charset Considerations: The attribute is not subject to the charset attribute.
字符集注意事项:该属性不受字符集属性的约束。
Purpose: This attribute is used with Interactive Connectivity Establishment (ICE), and provides the fragments used to construct the username in STUN connectivity checks.
用途:此属性与交互式连接建立(ICE)一起使用,并提供用于在STUN连接检查中构造用户名的片段。
Appropriate Values: See Section 15 of RFC 5245.
适当值:见RFC 5245第15节。
Contact Name: Jonathan Rosenberg, jdrosen@jdrosen.net.
联系人姓名:Jonathan Rosenberg,jdrosen@jdrosen.net.
Attribute Name: ice-options
属性名称:ice选项
Long Form: ice-options
长格式:ice选项
Type of Attribute: session-level
属性类型:会话级别
Charset Considerations: The attribute is not subject to the charset attribute.
字符集注意事项:该属性不受字符集属性的约束。
Purpose: This attribute is used with Interactive Connectivity Establishment (ICE), and indicates the ICE options or extensions used by the agent.
用途:此属性与交互式连接建立(ICE)一起使用,并指示代理使用的ICE选项或扩展。
Appropriate Values: See Section 15 of RFC 5245.
适当值:见RFC 5245第15节。
This section registers four new STUN attributes per the procedures in [RFC5389].
本节根据[RFC5389]中的程序注册四个新的眩晕属性。
0x0024 PRIORITY 0x0025 USE-CANDIDATE 0x8029 ICE-CONTROLLED 0x802A ICE-CONTROLLING
0x0024优先级0x0025使用候选0x8029冰控0x802A冰控
This section registers one new STUN error response code per the procedures in [RFC5389].
本节根据[RFC5389]中的程序注册一个新的STUN错误响应代码。
487 Role Conflict: The client asserted an ICE role (controlling or controlled) that is in conflict with the role of the server.
487角色冲突:客户端断言了与服务器角色冲突的ICE角色(控制或受控)。
The IAB has studied the problem of "Unilateral Self-Address Fixing", which is the general process by which a agent attempts to determine its address in another realm on the other side of a NAT through a collaborative protocol reflection mechanism [RFC3424]. ICE is an example of a protocol that performs this type of function. Interestingly, the process for ICE is not unilateral, but bilateral, and the difference has a significant impact on the issues raised by IAB. Indeed, ICE can be considered a B-SAF (Bilateral Self-Address Fixing) protocol, rather than an UNSAF protocol. Regardless, the IAB has mandated that any protocols developed for this purpose document a specific set of considerations. This section meets those requirements.
IAB研究了“单边自地址固定”问题,这是一个一般过程,通过该过程,代理试图通过协作协议反射机制确定其在NAT另一侧另一领域的地址[RFC3424]。ICE是执行此类功能的协议的一个示例。有趣的是,ICE的过程不是单边的,而是双边的,这种差异对IAB提出的问题有重大影响。事实上,ICE可以被视为B-SAF(双边自地址固定)协议,而不是UNSAF协议。无论如何,IAB已规定为此目的制定的任何协议都应记录一组特定的注意事项。本节满足这些要求。
>From RFC 3424, any UNSAF proposal must provide:
>根据RFC 3424,任何UNSAF提案必须提供:
Precise definition of a specific, limited-scope problem that is to be solved with the UNSAF proposal. A short-term fix should not be generalized to solve other problems; this is why "short-term fixes usually aren't".
精确定义一个具体的、范围有限的问题,该问题将通过UNSAF提案解决。短期解决方案不应泛化为解决其他问题;这就是为什么“短期修复通常不会”。
The specific problems being solved by ICE are:
ICE正在解决的具体问题有:
Provide a means for two peers to determine the set of transport addresses that can be used for communication.
为两个对等方提供一种方法,以确定可用于通信的传输地址集。
Provide a means for a agent to determine an address that is reachable by another peer with which it wishes to communicate.
为代理提供一种方法,以确定其希望与之通信的另一对等方可访问的地址。
>From RFC 3424, any UNSAF proposal must provide:
>根据RFC 3424,任何UNSAF提案必须提供:
Description of an exit strategy/transition plan. The better short-term fixes are the ones that will naturally see less and less use as the appropriate technology is deployed.
退出战略/过渡计划的说明。更好的短期修复方法是,随着适当技术的部署,自然会看到越来越少的使用。
ICE itself doesn't easily get phased out. However, it is useful even in a globally connected Internet, to serve as a means for detecting whether a router failure has temporarily disrupted connectivity, for example. ICE also helps prevent certain security attacks that have nothing to do with NAT. However, what ICE does is help phase out other UNSAF mechanisms. ICE effectively selects amongst those mechanisms, prioritizing ones that are better, and deprioritizing ones that are worse. Local IPv6 addresses can be preferred. As NATs begin to dissipate as IPv6 is introduced, server reflexive and relayed candidates (both forms of UNSAF addresses) simply never get used, because higher-priority connectivity exists to the native host candidates. Therefore, the servers get used less and less, and can eventually be remove when their usage goes to zero.
冰本身不容易被淘汰。然而,它甚至在全球连接的互联网中也很有用,例如,它可以作为检测路由器故障是否暂时中断了连接的手段。ICE还有助于防止某些与NAT无关的安全攻击。然而,ICE所做的是帮助逐步淘汰UNSAF的其他机制。ICE有效地在这些机制中进行选择,优先考虑更好的机制,而不优先考虑更差的机制。可以首选本地IPv6地址。随着IPv6的引入,NAT开始消失,服务器自反和中继候选(两种形式的UNSAF地址)根本就不会被使用,因为本地候选主机存在更高优先级的连接。因此,服务器的使用率越来越低,当其使用率为零时,最终可以将其删除。
Indeed, ICE can assist in the transition from IPv4 to IPv6. It can be used to determine whether to use IPv6 or IPv4 when two dual-stack hosts communicate with SIP (IPv6 gets used). It can also allow a network with both 6to4 and native v6 connectivity to determine which address to use when communicating with a peer.
事实上,ICE可以帮助从IPv4过渡到IPv6。当两个双栈主机与SIP通信(使用IPv6)时,它可用于确定是使用IPv6还是IPv4。它还允许同时具有6to4和本机v6连接的网络确定在与对等方通信时使用哪个地址。
>From RFC 3424, any UNSAF proposal must provide:
>根据RFC 3424,任何UNSAF提案必须提供:
Discussion of specific issues that may render systems more "brittle". For example, approaches that involve using data at multiple network layers create more dependencies, increase debugging challenges, and make it harder to transition.
讨论可能使系统更“脆弱”的具体问题。例如,涉及在多个网络层使用数据的方法会产生更多的依赖性,增加调试挑战,并使转换更加困难。
ICE actually removes brittleness from existing UNSAF mechanisms. In particular, classic STUN (as described in RFC 3489 [RFC3489]) has several points of brittleness. One of them is the discovery process that requires an agent to try to classify the type of NAT it is behind. This process is error-prone. With ICE, that discovery process is simply not used. Rather than unilaterally assessing the validity of the address, its validity is dynamically determined by measuring connectivity to a peer. The process of determining connectivity is very robust.
冰实际上消除了现有UNSAF机制的脆性。特别是,经典STUN(如RFC 3489[RFC3489]中所述)具有多个脆性点。其中之一是发现过程,需要代理尝试对其背后的NAT类型进行分类。这个过程容易出错。对于ICE来说,这一发现过程根本不用。与其单方面评估地址的有效性,不如通过测量与对等方的连接来动态确定地址的有效性。确定连通性的过程非常稳健。
Another point of brittleness in classic STUN and any other unilateral mechanism is its absolute reliance on an additional server. ICE makes use of a server for allocating unilateral addresses, but allows agents to directly connect if possible. Therefore, in some cases, the failure of a STUN server would still allow for a call to progress when ICE is used.
经典STUN和任何其他单边机制的另一个弱点是它对额外服务器的绝对依赖。ICE使用服务器来分配单边地址,但如果可能,允许代理直接连接。因此,在某些情况下,当使用ICE时,STUN服务器的故障仍然允许进行调用。
Another point of brittleness in classic STUN is that it assumes that the STUN server is on the public Internet. Interestingly, with ICE, that is not necessary. There can be a multitude of STUN servers in a variety of address realms. ICE will discover the one that has provided a usable address.
经典STUN的另一个弱点是它假设STUN服务器位于公共互联网上。有趣的是,对于冰来说,这是不必要的。在各种地址域中可以有大量的STUN服务器。ICE将发现提供了可用地址的地址。
The most troubling point of brittleness in classic STUN is that it doesn't work in all network topologies. In cases where there is a shared NAT between each agent and the STUN server, traditional STUN may not work. With ICE, that restriction is removed.
经典STUN中最令人不安的脆弱之处在于它并不适用于所有网络拓扑。在每个代理和STUN服务器之间存在共享NAT的情况下,传统的STUN可能无法工作。有了冰,这一限制就消除了。
Classic STUN also introduces some security considerations. Fortunately, those security considerations are also mitigated by ICE.
Classic STUN还引入了一些安全注意事项。幸运的是,ICE也减轻了这些安全考虑。
Consequently, ICE serves to repair the brittleness introduced in classic STUN, and does not introduce any additional brittleness into the system.
因此,ICE用于修复经典STUN中引入的脆性,并且不会在系统中引入任何额外的脆性。
The penalty of these improvements is that ICE increases session establishment times.
这些改进的缺点是ICE增加了会话建立时间。
From RFC 3424, any UNSAF proposal must provide:
根据RFC 3424,任何UNSAF提案必须提供:
... requirements for longer term, sound technical solutions -- contribute to the process of finding the right longer term solution.
... 对长期、可靠的技术解决方案的要求——有助于找到正确的长期解决方案。
Our conclusions from RFC 3489 remain unchanged. However, we feel ICE actually helps because we believe it can be part of the long-term solution.
我们从RFC 3489得出的结论保持不变。然而,我们觉得冰确实有帮助,因为我们相信它可以成为长期解决方案的一部分。
From RFC 3424, any UNSAF proposal must provide:
根据RFC 3424,任何UNSAF提案必须提供:
Discussion of the impact of the noted practical issues with existing, deployed NA[P]Ts and experience reports.
与现有的、已部署的NA[P]Ts和经验报告讨论指出的实际问题的影响。
A number of NAT boxes are now being deployed into the market that try to provide "generic" ALG functionality. These generic ALGs hunt for IP addresses, either in text or binary form within a packet, and rewrite them if they match a binding. This interferes with classic STUN. However, the update to STUN [RFC5389] uses an encoding that hides these binary addresses from generic ALGs.
许多NAT盒现在正部署到市场上,试图提供“通用”ALG功能。这些通用ALG在数据包中搜索文本或二进制形式的IP地址,如果它们与绑定匹配,则重写它们。这会干扰经典的晕眩。但是,对STUN[RFC5389]的更新使用了一种对通用ALG隐藏这些二进制地址的编码。
Existing NAPT boxes have non-deterministic and typically short expiration times for UDP-based bindings. This requires implementations to send periodic keepalives to maintain those bindings. ICE uses a default of 15 s, which is a very conservative estimate. Eventually, over time, as NAT boxes become compliant to behave [RFC4787], this minimum keepalive will become deterministic and well-known, and the ICE timers can be adjusted. Having a way to discover and control the minimum keepalive interval would be far better still.
现有的NAPT框对于基于UDP的绑定具有不确定性且通常很短的过期时间。这需要实现定期发送keepalives来维护这些绑定。ICE使用默认值15秒,这是一个非常保守的估计。最终,随着时间的推移,随着NAT盒变得符合行为[RFC4787],这个最小保持寿命将变得确定且众所周知,并且ICE计时器可以调整。有办法发现并控制最小保留间隔会更好。
The authors would like to thank Dan Wing, Eric Rescorla, Flemming Andreasen, Rohan Mahy, Dean Willis, Eric Cooper, Jason Fischl, Douglas Otis, Tim Moore, Jean-Francois Mule, Kevin Johns, Jonathan Lennox, and Francois Audet for their comments and input. A special thanks goes to Bill May, who suggested several of the concepts in this specification, Philip Matthews, who suggested many of the key performance optimizations in this specification, Eric Rescorla, who drafted the text in the introduction, and Magnus Westerlund, for doing several detailed reviews on the various revisions of this specification.
作者要感谢Dan Wing、Eric Rescorla、Flemming Andreasen、Rohan Mahy、Dean Willis、Eric Cooper、Jason Fischl、Douglas Otis、Tim Moore、Jean-Francois Mule、Kevin Johns、Jonathan Lennox和Francois Audet的评论和意见。特别感谢Bill May,他提出了本规范中的几个概念,Philip Matthews,他提出了本规范中的许多关键性能优化,Eric Rescorla,他起草了引言中的文本,以及Magnus Westerlund,对本规范的各种修订进行几次详细审查。
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC2119]Bradner,S.,“RFC中用于表示需求水平的关键词”,BCP 14,RFC 2119,1997年3月。
[RFC3605] Huitema, C., "Real Time Control Protocol (RTCP) attribute in Session Description Protocol (SDP)", RFC 3605, October 2003.
[RFC3605]Huitema,C.,“会话描述协议(SDP)中的实时控制协议(RTCP)属性”,RFC3605,2003年10月。
[RFC3261] Rosenberg, J., Schulzrinne, H., Camarillo, G., Johnston, A., Peterson, J., Sparks, R., Handley, M., and E. Schooler, "SIP: Session Initiation Protocol", RFC 3261, June 2002.
[RFC3261]Rosenberg,J.,Schulzrinne,H.,Camarillo,G.,Johnston,A.,Peterson,J.,Sparks,R.,Handley,M.,和E.Schooler,“SIP:会话启动协议”,RFC 3261,2002年6月。
[RFC3264] Rosenberg, J. and H. Schulzrinne, "An Offer/Answer Model with Session Description Protocol (SDP)", RFC 3264, June 2002.
[RFC3264]Rosenberg,J.和H.Schulzrinne,“具有会话描述协议(SDP)的提供/应答模型”,RFC 3264,2002年6月。
[RFC3556] Casner, S., "Session Description Protocol (SDP) Bandwidth Modifiers for RTP Control Protocol (RTCP) Bandwidth", RFC 3556, July 2003.
[RFC3556]Casner,S.,“RTP控制协议(RTCP)带宽的会话描述协议(SDP)带宽修饰符”,RFC 3556,2003年7月。
[RFC3312] Camarillo, G., Marshall, W., and J. Rosenberg, "Integration of Resource Management and Session Initiation Protocol (SIP)", RFC 3312, October 2002.
[RFC3312]Camarillo,G.,Marshall,W.,和J.Rosenberg,“资源管理和会话启动协议(SIP)的集成”,RFC 3312,2002年10月。
[RFC4032] Camarillo, G. and P. Kyzivat, "Update to the Session Initiation Protocol (SIP) Preconditions Framework", RFC 4032, March 2005.
[RFC4032]Camarillo,G.和P.Kyzivat,“会话启动协议(SIP)先决条件框架的更新”,RFC 4032,2005年3月。
[RFC3262] Rosenberg, J. and H. Schulzrinne, "Reliability of Provisional Responses in Session Initiation Protocol (SIP)", RFC 3262, June 2002.
[RFC3262]Rosenberg,J.和H.Schulzrinne,“会话启动协议(SIP)中临时响应的可靠性”,RFC 32622,2002年6月。
[RFC4566] Handley, M., Jacobson, V., and C. Perkins, "SDP: Session Description Protocol", RFC 4566, July 2006.
[RFC4566]Handley,M.,Jacobson,V.,和C.Perkins,“SDP:会话描述协议”,RFC4566,2006年7月。
[RFC4091] Camarillo, G. and J. Rosenberg, "The Alternative Network Address Types (ANAT) Semantics for the Session Description Protocol (SDP) Grouping Framework", RFC 4091, June 2005.
[RFC4091]Camarillo,G.和J.Rosenberg,“会话描述协议(SDP)分组框架的替代网络地址类型(ANAT)语义”,RFC 4091,2005年6月。
[RFC4092] Camarillo, G. and J. Rosenberg, "Usage of the Session Description Protocol (SDP) Alternative Network Address Types (ANAT) Semantics in the Session Initiation Protocol (SIP)", RFC 4092, June 2005.
[RFC4092]Camarillo,G.和J.Rosenberg,“会话描述协议(SDP)替代网络地址类型(ANAT)语义在会话启动协议(SIP)中的使用”,RFC 4092,2005年6月。
[RFC3484] Draves, R., "Default Address Selection for Internet Protocol version 6 (IPv6)", RFC 3484, February 2003.
[RFC3484]Draves,R.,“互联网协议版本6(IPv6)的默认地址选择”,RFC 3484,2003年2月。
[RFC5234] Crocker, D., Ed., and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, January 2008.
[RFC5234]Crocker,D.,Ed.,和P.Overell,“语法规范的扩充BNF:ABNF”,STD 68,RFC 5234,2008年1月。
[RFC5389] Rosenberg, J., Mahy, R., Matthews, P., and D. Wing, "Session Traversal Utilities for NAT (STUN)", RFC 5389, October 2008.
[RFC5389]Rosenberg,J.,Mahy,R.,Matthews,P.,和D.Wing,“NAT的会话遍历实用程序(STUN)”,RFC 5389,2008年10月。
[RFC5766] Mahy, R., Matthews, P., and J. Rosenberg, "Traversal Using Relays around NAT (TURN): Relay Extensions to Session Traversal Utilities for NAT (STUN)", RFC 5766, April 2010.
[RFC5766]Mahy,R.,Matthews,P.,和J.Rosenberg,“使用NAT周围的中继进行遍历(TURN):NAT(STUN)会话遍历实用程序的中继扩展”,RFC 5766,2010年4月。
[RFC5768] Rosenberg, J., "Indicating Support for Interactive Connectivity Establishment (ICE) in the Session Initiation Protocol (SIP)", RFC 5768, April 2010.
[RFC5768]Rosenberg,J.,“表示支持会话启动协议(SIP)中的交互式连接建立(ICE)”,RFC 5768,2010年4月。
[RFC3489] Rosenberg, J., Weinberger, J., Huitema, C., and R. Mahy, "STUN - Simple Traversal of User Datagram Protocol (UDP) Through Network Address Translators (NATs)", RFC 3489, March 2003.
[RFC3489]Rosenberg,J.,Weinberger,J.,Huitema,C.,和R.Mahy,“STUN-通过网络地址转换器(NAT)简单遍历用户数据报协议(UDP)”,RFC 3489,2003年3月。
[RFC3235] Senie, D., "Network Address Translator (NAT)-Friendly Application Design Guidelines", RFC 3235, January 2002.
[RFC3235]Senie,D.,“网络地址转换器(NAT)-友好的应用程序设计指南”,RFC 32352002年1月。
[RFC3303] Srisuresh, P., Kuthan, J., Rosenberg, J., Molitor, A., and A. Rayhan, "Middlebox communication architecture and framework", RFC 3303, August 2002.
[RFC3303]Srisuresh,P.,Kuthan,J.,Rosenberg,J.,Molitor,A.,和A.Rayhan,“中间箱通信架构和框架”,RFC 33032002年8月。
[RFC3725] Rosenberg, J., Peterson, J., Schulzrinne, H., and G. Camarillo, "Best Current Practices for Third Party Call Control (3pcc) in the Session Initiation Protocol (SIP)", BCP 85, RFC 3725, April 2004.
[RFC3725]Rosenberg,J.,Peterson,J.,Schulzrinne,H.,和G.Camarillo,“会话启动协议(SIP)中第三方呼叫控制(3pcc)的当前最佳实践”,BCP 85,RFC 37252004年4月。
[RFC3102] Borella, M., Lo, J., Grabelsky, D., and G. Montenegro, "Realm Specific IP: Framework", RFC 3102, October 2001.
[RFC3102]Borella,M.,Lo,J.,Grabelsky,D.,和G.黑山,“特定领域知识产权:框架”,RFC 3102,2001年10月。
[RFC3103] Borella, M., Grabelsky, D., Lo, J., and K. Taniguchi, "Realm Specific IP: Protocol Specification", RFC 3103, October 2001.
[RFC3103]Borella,M.,Grabelsky,D.,Lo,J.,和K.Taniguchi,“领域特定IP:协议规范”,RFC 3103,2001年10月。
[RFC3424] Daigle, L. and IAB, "IAB Considerations for UNilateral Self-Address Fixing (UNSAF) Across Network Address Translation", RFC 3424, November 2002.
[RFC3424]Daigle,L.和IAB,“网络地址转换中单边自地址固定(UNSAF)的IAB考虑”,RFC 34242002年11月。
[RFC3550] Schulzrinne, H., Casner, S., Frederick, R., and V. Jacobson, "RTP: A Transport Protocol for Real-Time Applications", STD 64, RFC 3550, July 2003.
[RFC3550]Schulzrinne,H.,Casner,S.,Frederick,R.,和V.Jacobson,“RTP:实时应用的传输协议”,STD 64,RFC 35502003年7月。
[RFC3711] Baugher, M., McGrew, D., Naslund, M., Carrara, E., and K. Norrman, "The Secure Real-time Transport Protocol (SRTP)", RFC 3711, March 2004.
[RFC3711]Baugher,M.,McGrew,D.,Naslund,M.,Carrara,E.,和K.Norrman,“安全实时传输协议(SRTP)”,RFC 37112004年3月。
[RFC3056] Carpenter, B. and K. Moore, "Connection of IPv6 Domains via IPv4 Clouds", RFC 3056, February 2001.
[RFC3056]Carpenter,B.和K.Moore,“通过IPv4云连接IPv6域”,RFC 3056,2001年2月。
[RFC3389] Zopf, R., "Real-time Transport Protocol (RTP) Payload for Comfort Noise (CN)", RFC 3389, September 2002.
[RFC3389]Zopf,R.,“舒适噪声(CN)的实时传输协议(RTP)有效载荷”,RFC 3389,2002年9月。
[RFC3960] Camarillo, G. and H. Schulzrinne, "Early Media and Ringing Tone Generation in the Session Initiation Protocol (SIP)", RFC 3960, December 2004.
[RFC3960]Camarillo,G.和H.Schulzrinne,“会话启动协议(SIP)中的早期媒体和铃声生成”,RFC 39602004年12月。
[RFC2475] Blake, S., Black, D., Carlson, M., Davies, E., Wang, Z., and W. Weiss, "An Architecture for Differentiated Services", RFC 2475, December 1998.
[RFC2475]Blake,S.,Black,D.,Carlson,M.,Davies,E.,Wang,Z.,和W.Weiss,“差异化服务架构”,RFC 24751998年12月。
[RFC1918] Rekhter, Y., Moskowitz, R., Karrenberg, D., Groot, G., and E. Lear, "Address Allocation for Private Internets", BCP 5, RFC 1918, February 1996.
[RFC1918]Rekhter,Y.,Moskowitz,R.,Karrenberg,D.,Groot,G.,和E.Lear,“私人互联网地址分配”,BCP 5,RFC 1918,1996年2月。
[RFC4787] Audet, F. and C. Jennings, "Network Address Translation (NAT) Behavioral Requirements for Unicast UDP", BCP 127, RFC 4787, January 2007.
[RFC4787]Audet,F.和C.Jennings,“单播UDP的网络地址转换(NAT)行为要求”,BCP 127,RFC 4787,2007年1月。
[SDP-PRECON] Andreasen, F., Camarillo, G., Oran, D., and D. Wing, "Connectivity Preconditions for Session Description Protocol Media Streams", Work in Progress, March 2010.
[SDP-PRECO]Andreasen,F.,Camarillo,G.,Oran,D.,和D.Wing,“会话描述协议媒体流的连接先决条件”,正在进行的工作,2010年3月。
[NO-OP-RTP] Andreasen, F., Oran, D., and D. Wing, "A No-Op Payload Format for RTP", Work in Progress, May 2007.
[NO-OP-RTP]Andreasen,F.,Oran,D.,和D.Wing,“RTP的无操作有效载荷格式”,正在进行的工作,2007年5月。
[RFC5761] Perkins, C. and M. Westerlund, "Multiplexing RTP Data and Control Packets on a Single Port", RFC 5761, April 2010.
[RFC5761]Perkins,C.和M.Westerlund,“在单个端口上多路传输RTP数据和控制数据包”,RFC 5761,2010年4月。
[RFC4340] Kohler, E., Handley, M., and S. Floyd, "Datagram Congestion Control Protocol (DCCP)", RFC 4340, March 2006.
[RFC4340]Kohler,E.,Handley,M.和S.Floyd,“数据报拥塞控制协议(DCCP)”,RFC 43402006年3月。
[RFC4103] Hellstrom, G. and P. Jones, "RTP Payload for Text Conversation", RFC 4103, June 2005.
[RFC4103]Hellstrom,G.和P.Jones,“文本对话的RTP有效负载”,RFC 4103,2005年6月。
[RFC5626] Jennings, C., Mahy, R., and F. Audet, "Managing Client-Initiated Connections in the Session Initiation Protocol (SIP)", RFC 5626, October 2009.
[RFC5626]Jennings,C.,Mahy,R.,和F.Audet,“在会话启动协议(SIP)中管理客户端启动的连接”,RFC 5626,2009年10月。
[RFC5382] Guha, S., Biswas, K., Ford, B., Sivakumar, S., and P. Srisuresh, "NAT Behavioral Requirements for TCP", BCP 142, RFC 5382, October 2008.
[RFC5382]Guha,S.,Biswas,K.,Ford,B.,Sivakumar,S.,和P.Srisuresh,“TCP的NAT行为要求”,BCP 142,RFC 5382,2008年10月。
[SIP-UA-FRMWK] Petrie, D. and S. Channabasappa, Ed., "A Framework for Session Initiation Protocol User Agent Profile Delivery", Work in Progress, February 2010.
[SIP-UA-FRMWK]Petrie,D.和S.Channabasappa,Ed.,“会话启动协议用户代理配置文件交付框架”,正在进行的工作,2010年2月。
[ICE-TCP] Perreault, S., Ed. and J. Rosenberg, "TCP Candidates with Interactive Connectivity Establishment (ICE)", Work in Progress, October 2009.
[ICE-TCP]Perreault,S.,Ed.和J.Rosenberg,“具有交互式连接建立(ICE)的TCP候选者”,正在进行的工作,2009年10月。
ICE allows for two types of implementations. A full implementation supports the controlling and controlled roles in a session, and can also perform address gathering. In contrast, a lite implementation is a minimalist implementation that does little but respond to STUN checks.
ICE允许两种类型的实现。完整实现支持会话中的控制角色和受控角色,还可以执行地址收集。相比之下,lite实现是一种极简的实现,它只对眩晕检查做出响应。
Because ICE requires both endpoints to support it in order to bring benefits to either endpoint, incremental deployment of ICE in a network is more complicated. Many sessions involve an endpoint that is, by itself, not behind a NAT and not one that would worry about NAT traversal. A very common case is to have one endpoint that requires NAT traversal (such as a VoIP hard phone or soft phone) make a call to one of these devices. Even if the phone supports a full ICE implementation, ICE won't be used at all if the other device doesn't support it. The lite implementation allows for a low-cost entry point for these devices. Once they support the lite implementation, full implementations can connect to them and get the full benefits of ICE.
因为ICE需要两个端点都支持它,以便为任一端点带来好处,所以在网络中增量部署ICE更加复杂。许多会话都涉及一个端点,该端点本身不在NAT后面,也不担心NAT遍历。一种非常常见的情况是,有一个需要NAT遍历的端点(如VoIP硬电话或软电话)呼叫其中一个设备。即使手机支持完整的ICE实现,如果其他设备不支持ICE,也不会使用ICE。lite实现为这些设备提供了一个低成本的入口点。一旦它们支持lite实现,完整的实现就可以连接到它们并获得ICE的全部好处。
Consequently, a lite implementation is only appropriate for devices that will *always* be connected to the public Internet and have a public IP address at which it can receive packets from any correspondent. ICE will not function when a lite implementation is placed behind a NAT.
因此,lite实现仅适用于将*始终*连接到公共互联网并具有公共IP地址的设备,在该地址上,lite可以从任何通信方接收数据包。当lite实现置于NAT之后时,ICE将不起作用。
ICE allows a lite implementation to have a single IPv4 host candidate and several IPv6 addresses. In that case, candidate pairs are selected by the controlling agent using a static algorithm, such as the one in RFC 3484, which is recommended by this specification. However, static mechanisms for address selection are always prone to error, since they cannot ever reflect the actual topology and can never provide actual guarantees on connectivity. They are always heuristics. Consequently, if an agent is implementing ICE just to select between its IPv4 and IPv6 addresses, and none of its IP addresses are behind NAT, usage of full ICE is still RECOMMENDED in order to provide the most robust form of address selection possible.
ICE允许lite实现具有单个IPv4候选主机和多个IPv6地址。在这种情况下,控制代理使用静态算法选择候选对,如本规范推荐的RFC 3484中的算法。然而,地址选择的静态机制总是容易出错,因为它们无法反映实际的拓扑结构,也无法提供实际的连接性保证。它们总是启发式的。因此,如果代理实现ICE只是为了在其IPv4和IPv6地址之间进行选择,而其IP地址中没有一个位于NAT之后,则仍然建议使用完整ICE,以便提供最可靠的地址选择形式。
It is important to note that the lite implementation was added to this specification to provide a stepping stone to full implementation. Even for devices that are always connected to the public Internet with just a single IPv4 address, a full implementation is preferable if achievable. A full implementation will reduce call setup times, since ICE's aggressive mode can be used. Full implementations also obtain the security benefits of ICE unrelated to NAT traversal; in particular, the voice hammer attack described in Section 18 is prevented only for full implementations,
重要的是要注意,lite实现被添加到本规范中,以提供完整实现的垫脚石。即使对于总是只使用一个IPv4地址连接到公共Internet的设备,如果可以实现完整的实现,也更可取。由于可以使用ICE的攻击模式,因此完整的实施将减少呼叫设置时间。完整的实现还可以获得与NAT遍历无关的ICE的安全优势;特别是,第18节中描述的语音锤攻击仅在完全实施时才被阻止,
not lite. Finally, it is often the case that a device that finds itself with a public address today will be placed in a network tomorrow where it will be behind a NAT. It is difficult to definitively know, over the lifetime of a device or product, that it will always be used on the public Internet. Full implementation provides assurance that communications will always work.
不是lite。最后,通常情况下,一个设备发现自己今天有一个公共广播,明天将被放置在网络中,它将在NAT后面。在设备或产品的整个生命周期内,很难确定它是否会一直在公共互联网上使用。全面实施确保通信始终有效。
ICE contains a number of normative behaviors that may themselves be simple, but derive from complicated or non-obvious thinking or use cases that merit further discussion. Since these design motivations are not neccesary to understand for purposes of implementation, they are discussed here in an appendix to the specification. This section is non-normative.
ICE包含许多规范性行为,这些行为本身可能很简单,但源自复杂或不明显的思考或用例,值得进一步讨论。由于这些设计动机在实现时不需要理解,因此在本规范的附录中对其进行了讨论。本节是非规范性的。
STUN transactions used to gather candidates and to verify connectivity are paced out at an approximate rate of one new transaction every Ta milliseconds. Each transaction, in turn, has a retransmission timer RTO that is a function of Ta as well. Why are these transactions paced, and why are these formulas used?
用于收集候选对象和验证连接性的STUN事务以大约每Ta毫秒一个新事务的速率进行排定。反过来,每个事务都有一个重传计时器RTO,它也是Ta的一个函数。为什么这些交易有节奏,为什么使用这些公式?
Sending of these STUN requests will often have the effect of creating bindings on NAT devices between the client and the STUN servers. Experience has shown that many NAT devices have upper limits on the rate at which they will create new bindings. Experiments have shown that once every 20 ms is well supported, but not much lower than that. This is why Ta has a lower bound of 20 ms. Furthermore, transmission of these packets on the network makes use of bandwidth and needs to be rate limited by the agent. Deployments based on earlier draft versions of this document tended to overload rate-constrained access links and perform poorly overall, in addition to negatively impacting the network. As a consequence, the pacing ensures that the NAT device does not get overloaded and that traffic is kept at a reasonable rate.
发送这些STUN请求通常会在客户端和STUN服务器之间的NAT设备上创建绑定。经验表明,许多NAT设备创建新绑定的速率都有上限。实验表明,每20毫秒一次是很好的支持,但不会比这低很多。这就是Ta的下限为20 ms的原因。此外,这些数据包在网络上的传输利用了带宽,需要由代理进行速率限制。基于本文档早期草稿版本的部署除了对网络产生负面影响外,往往会使速率受限的访问链路过载,总体性能较差。因此,起搏可确保NAT设备不会过载,并且通信量保持在合理的速率。
The definition of a "reasonable" rate is that STUN should not use more bandwidth than the RTP itself will use, once media starts flowing. The formula for Ta is designed so that, if a STUN packet were sent every Ta seconds, it would consume the same amount of bandwidth as RTP packets, summed across all media streams. Of course, STUN has retransmits, and the desire is to pace those as well. For this reason, RTO is set such that the first retransmit on the first transaction happens just as the first STUN request on the last transaction occurs. Pictorially:
“合理”速率的定义是,一旦媒体开始流动,STUN不应使用比RTP本身更多的带宽。Ta的公式设计为,如果每Ta秒发送一个STUN数据包,它将消耗与RTP数据包相同的带宽量,在所有媒体流中求和。当然,STUN也有重传,我们的愿望是加快这些重传的速度。因此,RTO的设置使得第一个事务上的第一次重新传输与最后一个事务上的第一次STUN请求一样发生。形象地:
First Packets Retransmits
第一包重传
| | | | -------+------ -------+------ / \ / \ / \ / \
| | | | -------+------ -------+------ / \ / \ / \ / \
+--+ +--+ +--+ +--+ +--+ +--+ |A1| |B1| |C1| |A2| |B2| |C2| +--+ +--+ +--+ +--+ +--+ +--+
+--+ +--+ +--+ +--+ +--+ +--+ |A1| |B1| |C1| |A2| |B2| |C2| +--+ +--+ +--+ +--+ +--+ +--+
---+-------+-------+-------+-------+-------+------------ Time 0 Ta 2Ta 3Ta 4Ta 5Ta
---+-------+-------+-------+-------+-------+------------ Time 0 Ta 2Ta 3Ta 4Ta 5Ta
In this picture, there are three transactions that will be sent (for example, in the case of candidate gathering, there are three host candidate/STUN server pairs). These are transactions A, B, and C. The retransmit timer is set so that the first retransmission on the first transaction (packet A2) is sent at time 3Ta.
在该图中,将发送三个事务(例如,在候选收集的情况下,有三个主机候选/STUN服务器对)。这些是事务A、B和C。重传定时器被设置为在时间3Ta发送第一事务(分组A2)上的第一次重传。
Subsequent retransmits after the first will occur even less frequently than Ta milliseconds apart, since STUN uses an exponential back-off on its retransmissions.
第一次之后的后续重传发生频率甚至低于Ta毫秒,因为STUN在重传时使用指数后退。
Section 4.1.3 talks about eliminating candidates that have the same transport address and base. However, candidates with the same transport addresses but different bases are not redundant. When can an agent have two candidates that have the same IP address and port, but different bases? Consider the topology of Figure 10:
第4.1.3节讨论了删除具有相同运输地址和基地的候选人。但是,具有相同传输地址但不同基的候选者不是冗余的。代理何时可以有两个具有相同IP地址和端口但基础不同的候选?考虑图10的拓扑结构:
+----------+ | STUN Srvr| +----------+ | | ----- // \\ | | | B:net10 | | | \\ // ----- | | +----------+ | NAT | +----------+ | | ----- // \\ | A | |192.168/16 | | | \\ // ----- | | |192.168.1.100 ----- +----------+ // \\ +----------+ | | | | | | | Offerer |---------| C:net10 |-----------| Answerer | | |10.0.1.100| | 10.0.1.101 | | +----------+ \\ // +----------+ -----
+----------+ | STUN Srvr| +----------+ | | ----- // \\ | | | B:net10 | | | \\ // ----- | | +----------+ | NAT | +----------+ | | ----- // \\ | A | |192.168/16 | | | \\ // ----- | | |192.168.1.100 ----- +----------+ // \\ +----------+ | | | | | | | Offerer |---------| C:net10 |-----------| Answerer | | |10.0.1.100| | 10.0.1.101 | | +----------+ \\ // +----------+ -----
Figure 10: Identical Candidates with Different Bases
图10:具有不同基础的相同候选人
In this case, the offerer is multihomed. It has one IP address, 10.0.1.100, on network C, which is a net 10 private network. The answerer is on this same network. The offerer is also connected to network A, which is 192.168/16. The offerer has an IP address of 192.168.1.100 on this network. There is a NAT on this network, natting into network B, which is another net 10 private network, but not connected to network C. There is a STUN server on network B.
在这种情况下,报价人是多址的。它在网络C上有一个IP地址10.0.1.100,这是一个Net10专用网络。回答者在同一个网络上。报价人还连接到网络A,网络A为192.168/16。报价人在此网络上的IP地址为192.168.1.100。在这个网络上有一个NAT,NAT进入网络B,这是另一个Net10专用网络,但没有连接到网络C。网络B上有一个STUN服务器。
The offerer obtains a host candidate on its IP address on network C (10.0.1.100:2498) and a host candidate on its IP address on network A
报价人在网络C(10.0.1.100:2498)的IP地址上获得一个候选主机,在网络a的IP地址上获得一个候选主机
(192.168.1.100:3344). It performs a STUN query to its configured STUN server from 192.168.1.100:3344. This query passes through the NAT, which happens to assign the binding 10.0.1.100:2498. The STUN server reflects this in the STUN Binding response. Now, the offerer has obtained a server reflexive candidate with a transport address that is identical to a host candidate (10.0.1.100:2498). However, the server reflexive candidate has a base of 192.168.1.100:3344, and the host candidate has a base of 10.0.1.100:2498.
(192.168.1.100:3344). 它从192.168.1.100:3344对其配置的STUN服务器执行STUN查询。该查询通过NAT,NAT碰巧分配了绑定10.0.1.100:2498。STUN服务器在STUN绑定响应中反映了这一点。现在,报价人获得了一个传输地址与主机候选地址相同的服务器自反候选(10.0.1.100:2498)。但是,服务器自反候选者的基数为192.168.1.100:3344,主机候选者的基数为10.0.1.100:2498。
The candidate attribute contains two values that are not used at all by ICE itself -- <rel-addr> and <rel-port>. Why is it present?
The candidate attribute contains two values that are not used at all by ICE itself -- <rel-addr> and <rel-port>. Why is it present?
There are two motivations for its inclusion. The first is diagnostic. It is very useful to know the relationship between the different types of candidates. By including it, an agent can know which relayed candidate is associated with which reflexive candidate, which in turn is associated with a specific host candidate. When checks for one candidate succeed and not for others, this provides useful diagnostics on what is going on in the network.
将其包括在内有两个动机。第一个是诊断性的。了解不同类型候选人之间的关系非常有用。通过包含它,代理可以知道哪个中继候选者与哪个反射候选者相关联,而反射候选者又与特定的主机候选者相关联。当对一个候选人的检查成功而对其他候选人的检查不成功时,这将对网络中发生的情况提供有用的诊断。
The second reason has to do with off-path Quality of Service (QoS) mechanisms. When ICE is used in environments such as PacketCable 2.0, proxies will, in addition to performing normal SIP operations, inspect the SDP in SIP messages, and extract the IP address and port for media traffic. They can then interact, through policy servers, with access routers in the network, to establish guaranteed QoS for the media flows. This QoS is provided by classifying the RTP traffic based on 5-tuple, and then providing it a guaranteed rate, or marking its Diffserv codepoints appropriately. When a residential NAT is present, and a relayed candidate gets selected for media, this relayed candidate will be a transport address on an actual TURN server. That address says nothing about the actual transport address in the access router that would be used to classify packets for QoS treatment. Rather, the server reflexive candidate towards the TURN server is needed. By carrying the translation in the SDP, the proxy can use that transport address to request QoS from the access router.
第二个原因与非路径服务质量(QoS)机制有关。当ICE用于PacketCable 2.0等环境时,代理除了执行正常的SIP操作外,还会检查SIP消息中的SDP,并提取媒体流量的IP地址和端口。然后,它们可以通过策略服务器与网络中的访问路由器交互,为媒体流建立有保证的QoS。通过基于5元组对RTP流量进行分类,然后为其提供保证速率,或适当标记其Diffserv码点,可以提供这种QoS。当一个住宅NAT存在,并且一个中继候选者被选择作为媒体时,这个中继候选者将是一个实际TURN服务器上的传输地址。该地址没有说明访问路由器中的实际传输地址,该地址将用于对数据包进行分类以进行QoS处理。相反,需要转向服务器的服务器自反候选者。通过在SDP中携带转换,代理可以使用该传输地址从接入路由器请求QoS。
ICE requires the usage of message integrity with STUN using its short-term credential functionality. The actual short-term credential is formed by exchanging username fragments in the SDP offer/answer exchange. The need for this mechanism goes beyond just security; it is actually required for correct operation of ICE in the first place.
ICE需要使用STUN的短期凭证功能来使用消息完整性。实际的短期凭证是通过在SDP提供/应答交换中交换用户名片段形成的。对这一机制的需要不仅仅是安全;实际上,首先需要正确操作ICE。
Consider agents L, R, and Z. L and R are within private enterprise 1, which is using 10.0.0.0/8. Z is within private enterprise 2, which is also using 10.0.0.0/8. As it turns out, R and Z both have IP address 10.0.1.1. L sends an offer to Z. Z, in its answer, provides L with its host candidates. In this case, those candidates are 10.0.1.1:8866 and 10.0.1.1:8877. As it turns out, R is in a session at that same time, and is also using 10.0.1.1:8866 and 10.0.1.1:8877 as host candidates. This means that R is prepared to accept STUN messages on those ports, just as Z is. L will send a STUN request to 10.0.1.1:8866 and another to 10.0.1.1:8877. However, these do not go to Z as expected. Instead, they go to R! If R just replied to them, L would believe it has connectivity to Z, when in fact it has connectivity to a completely different user, R. To fix this, the STUN short-term credential mechanisms are used. The username fragments are sufficiently random that it is highly unlikely that R would be using the same values as Z. Consequently, R would reject the STUN request since the credentials were invalid. In essence, the STUN username fragments provide a form of transient host identifiers, bound to a particular offer/answer session.
考虑代理L、R和Z.L和R在私有企业1中,使用的是100.0.0/8。Z在private enterprise 2中,它也使用10.0.0.0/8。事实证明,R和Z的IP地址都是10.0.1.1。L向Z发出邀请,Z在其答复中向L提供其东道主候选人。在本例中,这些候选者是10.0.1.1:8866和10.0.1.1:8877。事实证明,R同时在一个会话中,并且还使用10.0.1.1:8866和10.0.1.1:8877作为主机候选。这意味着R准备接受这些端口上的STUN消息,就像Z一样。我将向10.0.1.1:8866发送眩晕请求,并向10.0.1.1:8877发送另一个眩晕请求。但是,这些并不像预期的那样到达Z。相反,他们去了R!如果R只是回复他们,我会相信它与Z有连接,而实际上它与一个完全不同的用户R有连接。为了解决这个问题,使用了STUN短期凭证机制。用户名片段具有足够的随机性,因此R不太可能使用与Z相同的值。因此,R将拒绝STUN请求,因为凭据无效。本质上,STUN用户名片段提供了一种形式的临时主机标识符,绑定到特定的提供/应答会话。
An unfortunate consequence of the non-uniqueness of IP addresses is that, in the above example, R might not even be an ICE agent. It could be any host, and the port to which the STUN packet is directed could be any ephemeral port on that host. If there is an application listening on this socket for packets, and it is not prepared to handle malformed packets for whatever protocol is in use, the operation of that application could be affected. Fortunately, since the ports exchanged in SDP are ephemeral and usually drawn from the dynamic or registered range, the odds are good that the port is not used to run a server on host R, but rather is the agent side of some protocol. This decreases the probability of hitting an allocated port, due to the transient nature of port usage in this range. However, the possibility of a problem does exist, and network deployers should be prepared for it. Note that this is not a problem specific to ICE; stray packets can arrive at a port at any time for any type of protocol, especially ones on the public Internet. As such, this requirement is just restating a general design guideline for Internet applications -- be prepared for unknown packets on any port.
IP地址非唯一性的一个不幸结果是,在上面的示例中,R甚至可能不是ICE代理。它可以是任何主机,STUN数据包指向的端口可以是该主机上的任何临时端口。如果有一个应用程序在此套接字上侦听数据包,并且它不准备为正在使用的任何协议处理格式错误的数据包,则该应用程序的操作可能会受到影响。幸运的是,由于SDP中交换的端口是短暂的,并且通常来自动态范围或注册范围,因此该端口不用于在主机R上运行服务器,而是用于某些协议的代理端的可能性很大。这降低了命中分配端口的概率,因为在此范围内端口使用的瞬态特性。但是,确实存在问题的可能性,网络部署人员应该对此做好准备。请注意,这不是ICE特有的问题;对于任何类型的协议,特别是公共互联网上的协议,杂散数据包可以随时到达端口。因此,这一要求只是重申了互联网应用程序的一般设计准则——为任何端口上的未知数据包做好准备。
The priority for a candidate pair has an odd form. It is:
候选对的优先级为奇数形式。它是:
pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0)
pair priority = 2^32*MIN(G,D) + 2*MAX(G,D) + (G>D?1:0)
Why is this? When the candidate pairs are sorted based on this value, the resulting sorting has the MAX/MIN property. This means that the pairs are first sorted based on decreasing value of the minimum of the two priorities. For pairs that have the same value of the minimum priority, the maximum priority is used to sort amongst them. If the max and the min priorities are the same, the controlling agent's priority is used as the tie-breaker in the last part of the expression. The factor of 2*32 is used since the priority of a single candidate is always less than 2*32, resulting in the pair priority being a "concatenation" of the two component priorities. This creates the MAX/MIN sorting. MAX/MIN ensures that, for a particular agent, a lower-priority candidate is never used until all higher-priority candidates have been tried.
为什么会这样?基于此值对候选对进行排序时,生成的排序具有MAX/MIN属性。这意味着首先根据两个优先级中最小值的递减值对这些对进行排序。对于具有相同最小优先级值的对,使用最大优先级在它们之间进行排序。如果最大优先级和最小优先级相同,则在表达式的最后一部分中,控制代理的优先级将用作连接断路器。由于单个候选的优先级始终小于2×32,因此使用2×32的因子,导致成对优先级是两个组件优先级的“串联”。这将创建最大/最小排序。MAX/MIN可确保,对于特定代理,在所有高优先级候选都已尝试之前,不会使用低优先级候选。
The a=remote-candidates attribute exists to eliminate a race condition between the updated offer and the response to the STUN Binding request that moved a candidate into the Valid list. This race condition is shown in Figure 11. On receipt of message 4, agent L adds a candidate pair to the valid list. If there was only a single media stream with a single component, agent L could now send an updated offer. However, the check from agent R has not yet generated a response, and agent R receives the updated offer (message 7) before getting the response (message 9). Thus, it does not yet know that this particular pair is valid. To eliminate this condition, the actual candidates at R that were selected by the offerer (the remote candidates) are included in the offer itself, and the answerer delays its answer until those pairs validate.
a=remote candidates属性的存在是为了消除更新后的报价与将候选人移动到有效列表中的STUN绑定请求响应之间的竞争条件。此竞争条件如图11所示。在收到消息4时,代理L将候选对添加到有效列表中。如果只有一个媒体流和一个组件,代理L现在可以发送更新的报价。但是,来自代理R的检查尚未生成响应,并且代理R在获得响应(消息9)之前收到更新的报价(消息7)。因此,它还不知道这一对是否有效。为了消除这种情况,报价人在R选择的实际候选人(远程候选人)被包括在报价中,而应答人延迟其回答,直到这些对生效。
Agent A Network Agent B |(1) Offer | | |------------------------------------------>| |(2) Answer | | |<------------------------------------------| |(3) STUN Req. | | |------------------------------------------>| |(4) STUN Res. | | |<------------------------------------------| |(5) STUN Req. | | |<------------------------------------------| |(6) STUN Res. | | |-------------------->| | | |Lost | |(7) Offer | | |------------------------------------------>| |(8) STUN Req. | | |<------------------------------------------| |(9) STUN Res. | | |------------------------------------------>| |(10) Answer | | |<------------------------------------------|
Agent A Network Agent B |(1) Offer | | |------------------------------------------>| |(2) Answer | | |<------------------------------------------| |(3) STUN Req. | | |------------------------------------------>| |(4) STUN Res. | | |<------------------------------------------| |(5) STUN Req. | | |<------------------------------------------| |(6) STUN Res. | | |-------------------->| | | |Lost | |(7) Offer | | |------------------------------------------>| |(8) STUN Req. | | |<------------------------------------------| |(9) STUN Res. | | |------------------------------------------>| |(10) Answer | | |<------------------------------------------|
Figure 11: Race Condition Flow
图11:竞争条件流
Once media begins flowing on a candidate pair, it is still necessary to keep the bindings alive at intermediate NATs for the duration of the session. Normally, the media stream packets themselves (e.g., RTP) meet this objective. However, several cases merit further discussion. Firstly, in some RTP usages, such as SIP, the media streams can be "put on hold". This is accomplished by using the SDP "sendonly" or "inactive" attributes, as defined in RFC 3264 [RFC3264]. RFC 3264 directs implementations to cease transmission of media in these cases. However, doing so may cause NAT bindings to timeout, and media won't be able to come off hold.
一旦媒体开始在候选对上流动,在会话期间仍有必要在中间NAT上保持绑定活动。通常,媒体流分组本身(例如,RTP)满足该目标。然而,有几个案例值得进一步讨论。首先,在一些RTP使用中,例如SIP,媒体流可以被“搁置”。这是通过使用SDP“sendonly”或“inactive”属性实现的,如RFC 3264[RFC3264]中所定义。在这些情况下,RFC 3264指示实现停止媒体传输。但是,这样做可能会导致NAT绑定超时,并且媒体将无法停止。
Secondly, some RTP payload formats, such as the payload format for text conversation [RFC4103], may send packets so infrequently that the interval exceeds the NAT binding timeouts.
其次,一些RTP有效负载格式,例如文本会话的有效负载格式[RFC4103],可能很少发送数据包,以至于间隔超过NAT绑定超时。
Thirdly, if silence suppression is in use, long periods of silence may cause media transmission to cease sufficiently long for NAT bindings to time out.
第三,如果使用静默抑制,长时间的静默可能会导致媒体传输停止足够长的时间,使NAT绑定超时。
For these reasons, the media packets themselves cannot be relied upon. ICE defines a simple periodic keepalive utilizing STUN Binding indications. This makes its bandwidth requirements highly predictable, and thus amenable to QoS reservations.
由于这些原因,不能依赖媒体包本身。ICE利用眩晕绑定指示定义了一个简单的周期性保持期。这使得其带宽需求具有高度可预测性,因此可以满足QoS保留。
Section 4.1.2 describes procedures for computing the priority of candidate based on its type and local preferences. That section requires that the type preference for peer reflexive candidates always be higher than server reflexive. Why is that? The reason has to do with the security considerations in Section 18. It is much easier for an attacker to cause an agent to use a false server reflexive candidate than it is for an attacker to cause an agent to use a false peer reflexive candidate. Consequently, attacks against address gathering with Binding requests are thwarted by ICE by preferring the peer reflexive candidates.
第4.1.2节描述了根据候选类型和本地偏好计算候选优先级的程序。该部分要求对等自反候选的类型首选项始终高于服务器自反。为什么呢?原因与第18节中的安全考虑有关。攻击者使代理使用虚假的服务器自反候选比使代理使用虚假的对等自反候选容易得多。因此,ICE通过选择对等自反候选来阻止针对绑定请求的地址收集的攻击。
Section 11.1 describes rules for sending media. Both agents can send media once ICE checks complete, without waiting for an updated offer. Indeed, the only purpose of the updated offer is to "correct" the SDP so that the default destination for media matches where media is being sent based on ICE procedures (which will be the highest-priority nominated candidate pair).
第11.1节描述了发送媒体的规则。ICE检查完成后,两个代理都可以发送媒体,而无需等待更新的报价。事实上,更新后的报价的唯一目的是“纠正”SDP,以便媒体的默认目的地与根据ICE程序发送媒体的位置相匹配(这将是最高优先级的提名候选对)。
This begs the question -- why is the updated offer/answer exchange needed at all? Indeed, in a pure offer/answer environment, it would not be. The offerer and answerer will agree on the candidates to use through ICE, and then can begin using them. As far as the agents themselves are concerned, the updated offer/answer provides no new information. However, in practice, numerous components along the signaling path look at the SDP information. These include entities performing off-path QoS reservations, NAT traversal components such as ALGs and Session Border Controllers (SBCs), and diagnostic tools that passively monitor the network. For these tools to continue to function without change, the core property of SDP -- that the existing, pre-ICE definitions of the addresses used for media -- the m and c lines and the rtcp attribute -- must be retained. For this reason, an updated offer must be sent.
这就引出了一个问题——为什么需要更新的报价/应答交换?事实上,在一个纯粹的提供/回答环境中,情况并非如此。报价人和应答人将通过ICE就候选人达成一致,然后可以开始使用他们。就代理商本身而言,更新后的报价/答复未提供任何新信息。然而,在实践中,沿着信令路径的许多组件查看SDP信息。这些包括执行非路径QoS保留的实体、NAT穿越组件(如ALG和会话边界控制器(SBC))以及被动监视网络的诊断工具。为了使这些工具在不改变的情况下继续工作,必须保留SDP的核心属性——即媒体地址的现有、ICE之前的定义——m和c行以及rtcp属性。因此,必须发送更新的报价。
Media keepalives are described in Section 10. These keepalives make use of STUN when both endpoints are ICE capable. However, rather than using a Binding request transaction (which generates a response), the keepalives use an Indication. Why is that?
第10节介绍了媒体保留期。当两个端点都支持ICE时,这些KeepAlive将使用STUN。但是,keepalives不使用绑定请求事务(生成响应),而是使用指示。为什么呢?
The primary reason has to do with network QoS mechanisms. Once media begins flowing, network elements will assume that the media stream has a fairly regular structure, making use of periodic packets at fixed intervals, with the possibility of jitter. If an agent is sending media packets, and then receives a Binding request, it would need to generate a response packet along with its media packets. This will increase the actual bandwidth requirements for the 5-tuple carrying the media packets, and introduce jitter in the delivery of those packets. Analysis has shown that this is a concern in certain layer 2 access networks that use fairly tight packet schedulers for media.
主要原因与网络QoS机制有关。一旦媒体开始流动,网络元件将假定媒体流具有相当规则的结构,以固定的间隔使用周期性分组,并且可能存在抖动。如果代理发送媒体数据包,然后接收到绑定请求,则需要生成一个响应数据包及其媒体数据包。这将增加承载媒体分组的5元组的实际带宽需求,并在这些分组的传递中引入抖动。分析表明,在某些第2层接入网络中,这是一个问题,这些网络对媒体使用相当紧凑的数据包调度器。
Additionally, using a Binding Indication allows integrity to be disabled, allowing for better performance. This is useful for large-scale endpoints, such as PSTN gateways and SBCs.
此外,使用绑定指示允许禁用完整性,从而实现更好的性能。这对于大规模端点(如PSTN网关和SBC)非常有用。
When ICE runs between two peers, one agent acts as controlled, and the other as controlling. Rules are defined as a function of implementation type and offerer/answerer to determine who is controlling and who is controlled. However, the specification mentions that, in some cases, both sides might believe they are controlling, or both sides might believe they are controlled. How can this happen?
当ICE在两个对等方之间运行时,一个代理作为受控代理,另一个作为控制代理。规则定义为实施类型和报价人/应答人的函数,以确定谁在控制谁在控制。然而,规范提到,在某些情况下,双方都可能认为自己在控制,或者双方都可能认为自己被控制。这怎么会发生?
The condition when both agents believe they are controlled shows up in third party call control cases. Consider the following flow:
在第三方呼叫控制案例中,两个代理都认为自己受到控制的情况会出现。考虑以下流程:
A Controller B |(1) INV() | | |<-------------| | |(2) 200(SDP1) | | |------------->| | | |(3) INV() | | |------------->| | |(4) 200(SDP2) | | |<-------------| |(5) ACK(SDP2) | | |<-------------| | | |(6) ACK(SDP1) | | |------------->|
A Controller B |(1) INV() | | |<-------------| | |(2) 200(SDP1) | | |------------->| | | |(3) INV() | | |------------->| | |(4) 200(SDP2) | | |<-------------| |(5) ACK(SDP2) | | |<-------------| | | |(6) ACK(SDP1) | | |------------->|
Figure 12: Role Conflict Flow
图12:角色冲突流
This flow is a variation on flow III of RFC 3725 [RFC3725]. In fact, it works better than flow III since it produces fewer messages. In this flow, the controller sends an offerless INVITE to agent A, which
该流量是RFC 3725[RFC3725]流量III的变体。事实上,它比flow III工作得更好,因为它生成的消息更少。在此流中,控制器向代理A发送一个无要约邀请,代理A
responds with its offer, SDP1. The agent then sends an offerless INVITE to agent B, which it responds to with its offer, SDP2. The controller then uses the offer from each agent to generate the answers. When this flow is used, ICE will run between agents A and B, but both will believe they are in the controlling role. With the role conflict resolution procedures, this flow will function properly when ICE is used.
以其报价SDP1回应。然后,代理向代理B发送一个无报价邀请,并用其报价SDP2响应该邀请。然后,控制器使用来自每个代理的报价来生成答案。当使用该流时,ICE将在代理A和代理B之间运行,但两者都认为它们处于控制角色。通过角色冲突解决程序,当使用ICE时,此流程将正常运行。
At this time, there are no documented flows that can result in the case where both agents believe they are controlled. However, the conflict resolution procedures allow for this case, should a flow arise that would fit into this category.
目前,没有文件记录的流程会导致两个代理都认为自己受到控制的情况。然而,冲突解决程序考虑到这种情况,如果出现符合这一类别的流程。
Author's Address
作者地址
Jonathan Rosenberg jdrosen.net Monmouth, NJ US
Jonathan Rosenberg jdrosen.net美国新泽西州蒙茅斯
Email: jdrosen@jdrosen.net URI: http://www.jdrosen.net
Email: jdrosen@jdrosen.net URI: http://www.jdrosen.net