<!ENTITY w3-webrtc-draft "<span class='ref'><linkurl='http://www.w3.org/TR/2013/WD-webrtc-20130910/'>WebRTC 1.0: Real-time Communication Between Browsers</link></span><note>WebRTC 1.0: Real-time Communication Between Browsers <<linkurl='http://www.w3.org/TR/2013/WD-webrtc-20130910/'>http://www.w3.org/TR/2013/WD-webrtc-20130910/</link>>.</note>" >
<abstract>This specification defines how to use the ICE-UDP Jingle transport method to send media data using WebRTC DataChannels, so technically uses DTLS/SCTP on top of the Interactive Connectivity Establishment (ICE) methodology, which provides robust NAT traversal for media traffic.</abstract>
<p>This document specifies a method for establishing a direct connection using SCTP channels over DTLS. As WebRTC supports the SCTP partial reliability extension (see &rfc3758;), the connection established can either be reliable or partial-reliable. However due to the wider use (e.g. &xep0234;) and easier maintenance, this transport method defines the mandatory use of reliable and in-order-delivery datachannels (thus a streaming transport). If the need for partial-reliability is there, a second specification for datagram type datachannels might be created. The establishment of this connection is managed by &xep0176;. The establishment of security provided by DTLS is described in &xep0320;.</p>
</section1>
<section1topic='Use Cases'anchor='usecases'>
<p>There are several use cases. Given below are a few examples:</p>
<ol>
<li>Two parties engaged in a WebRTC-based video conference want to share a file via &xep0234;</li>
<li>A browser application that uses XMPP for communication wants to support file-transfer</li>
<li>A browser based application wants to send a file to a non-browser client</li>
<p>In accordance with Section 10 of <cite>XEP-0166</cite>, this document specifies the following information related to the Jingle DTLS/SCTP transport method:</p>
<ol>
<li><p>The transport negotiation process is defined in the <linkurl='#protocol'>Protocol Description</link> section of this document.</p></li>
<li><p>The semantics of the &SCTPMAP; element are defined in the <linkurl='#protocol-syntax'>Syntax</link> section of this document.</p></li>
<p>This protocol requires the Stream Control Transmission Protocol (SCTP) to run within the security context of the Datagram Transport Layer Security (DTLS) protocol. As determined by <cite>RTCWeb Data Channels</cite> running SCTP on top of DTLS is preferred, as in this order the control messages are encrypted as well and the DTLS channel can be shared with several applications</p>
<p>In order for the initiator in a Jingle exchange to start the negotiation, it sends a Jingle "session-initiate" stanza that includes at least one content type, as described in <cite>XEP-0166</cite>. If the initiator wishes to negotiate the SCTP transport method for an application format, it MUST include a &SCTPMAP; child element qualified by the 'urn:xmpp:jingle:transports:dtls-sctp:1' namespace &VNOTE;. The &TRANSPORT; element SHOULD in turn contain one &CANDIDATE; element for each of the initiator's higher-priority transport candidates as determined in accordance with the ICE methodology, but MAY instead be empty (with each candidate to be sent as the payload of a transport-info message).</p>
<p>As seen in the example, there is no notion about DataChannel internals. The only things negotiated here are the port on which the SCTP Stream runs and the name of the DataChannel. Further negotiation is happening through the &webrtc-protocol;, thus the DataChannel is identified through the content name.</p>
<p>For some uses like negotiated datachannels, it might be required to explicitly signal the channel properties. This is done by including a <channel/> element qualified by the 'urn:xmpp:jingle:transports:webrtc-datachannel:0' namespace &VNOTE; as child of the &TRANSPORT; for each channel that has to be signaled. An abbreviated example follows:</p>
<p>The values and names for the &SCTPMAP; element are taken from the corresponding SDP. The attributes of the <sctpmap/> element are as follows.</p>
<p>The attributes of the <channel/> element map directly to the attributes of the <linkurl="http://www.w3.org/TR/2013/WD-webrtc-20130910/#dictionary-rtcdatachannelinit-members">RTCDataChannelInit</link> dictionary as defined in &w3-webrtc-draft;.</p>
<p>As described in <cite>XEP-0166</cite>, to acknowledge receipt of the session initiation request, the responder immediately returns an IQ-result.</p>
<examplecaption="Responder acknowledges receipt of session-initiate request"><![CDATA[
<p>Depending on the application type, a user agent controlled by a human user might need to wait for the user to affirm a desire to proceed with the session before continuing. When the user agent has received such affirmation (or if the user agent can automatically proceed for any reason, e.g. because no human intervention is expected or because a human user has configured the user agent to automatically accept sessions with a given entity), it returns a Jingle session-accept message. This message MUST contain a &TRANSPORT; element qualified by the 'urn:xmpp:jingle:transports:ice-udp:1' namespace, which SHOULD in turn contain one &SCTPMAP; element qualified by the 'urn:xmpp:jingle:transports:dtls-sctp:1' namespace for the channel used by the responder.</p>
<p>Note: See the <linkurl='#security'>Security Considerations</link> section of this document regarding the exposure of IP addresses by the responder's client.</p>
<examplecaption="Responder accepts the session request"><![CDATA[
<section2topic='Adding a new channel'anchor='protocol-add'>
<p>Even after media has begun to flow, either party MAY continue to send additional channels to the other party (e.g., because the user wants to transmit a new file). Such events are shared by sending a content-add message.</p>
<examplecaption="Initiator sends a content-add"><![CDATA[