No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

xep-0278.xml 33KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. <!ENTITY CHANNEL "&lt;channel/&gt;">
  5. <!ENTITY RELAY "&lt;relay/&gt;">
  6. <!ENTITY STUN "&lt;stun/&gt;">
  7. <!ENTITY TURN "&lt;turn/&gt;">
  8. <!ENTITY SERVICES "&lt;services/&gt;">
  9. <!ENTITY TRACKER "&lt;tracker/&gt;">
  10. %ents;
  11. ]>
  12. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  13. <xep>
  14. <header>
  15. <title>Jingle Relay Nodes</title>
  16. <abstract>This documents specifies how Jingle Clients can interact with Jingle Relay Nodes Services and how XMPP entities can provide, search and list available Jingle Relay Nodes.</abstract>
  17. &LEGALNOTICE;
  18. <number>0278</number>
  19. <status>Experimental</status>
  20. <type>Standards Track</type>
  21. <sig>Standards</sig>
  22. <approver>Council</approver>
  23. <dependencies>
  24. <spec>XMPP Core</spec>
  25. <spec>XEP-0166</spec>
  26. <spec>XEP-0177</spec>
  27. </dependencies>
  28. <supersedes/>
  29. <supersededby/>
  30. <shortname>jinglenodes</shortname>
  31. <author>
  32. <firstname>Thiago</firstname>
  33. <surname>Camargo</surname>
  34. <email>thiago@xmppjingle.com</email>
  35. <jid>barata7@gmail.com</jid>
  36. </author>
  37. <revision>
  38. <version>0.3</version>
  39. <date>2017-09-14</date>
  40. <initials>tc</initials>
  41. <remark><p>Added TURN Credentials Service Support.</p></remark>
  42. </revision>
  43. <revision>
  44. <version>0.2</version>
  45. <date>2011-06-21</date>
  46. <initials>tc</initials>
  47. <remark><p>Added STUN Service Tracking Support. Removed Public IP requirement for Relay Service.</p></remark>
  48. </revision>
  49. <revision>
  50. <version>0.1</version>
  51. <date>2010-03-05</date>
  52. <initials>psa</initials>
  53. <remark><p>Initial published version.</p></remark>
  54. </revision>
  55. <revision>
  56. <version>0.0.1</version>
  57. <date>2009-12-17</date>
  58. <initials>tc</initials>
  59. <remark><p>First draft.</p></remark>
  60. </revision>
  61. </header>
  62. <section1 topic="Introduction" anchor="intro">
  63. <p>Jingle Nodes is an XMPP Based Relay Service providing standard UDP/TCP Relay, but negotiated via XMPP. Jingle Relay Nodes are intend to provide easy to use Jingle Relay Type Candidates that can be used in ICE-UDP, RAW-UDP, TCP Jingle Sessions. Relay Candidates can provide NAT Traversal for Jingle users with or without STUN/TURN Support. The main benefits of Jingle Relay Nodes is the easy to use candidates, Jingle Clients can became a Node and Jingle Relay Nodes are published via XMPP, meaning every Client or Server can also act as a tracker of another Nodes and STUN Servers.</p>
  64. </section1>
  65. <section1 topic="Requirements" anchor="reqs">
  66. <p>Jingle Relay Nodes MUST be binded directly to a Public IP address without firewall for traffic on the port range reserved to be used by relay candidates. This is the main and unique requirement for a peer provide Relay Nodes Service.
  67. All signalling, request, response and publishing is done via XMPP, not requiring any extra stack or protocol in the Client or Server, for usage and discoveral of Nodes.</p>
  68. </section1>
  69. <section1 topic="Terminology" anchor="terminology">
  70. <section2 topic="Glossary" anchor="terms-glossary">
  71. <dl>
  72. <di>
  73. <dt>Relay</dt>
  74. <dd>Relays are mainly used to transfer traffic to servers located on a NAT:ed (masqueraded) network, where the IP addresses on the NAT:ed network cannot be accessed from the outside. When you use an IP address that is for local use only, you must use NAT and relays because these IP addresses cannot be accessed in any other way. Relays can also be used for non-NAT:ed networks.</dd>
  75. </di>
  76. <di>
  77. <dt>Jingle Relay Node</dt>
  78. <dd>Is an instance of a Relay Service that is negotiable via XMPP, following the procedures described on this Extension.</dd>
  79. </di>
  80. <di>
  81. <dt>Tracker</dt>
  82. <dd>Is the entity that trackers Jingle Relay Nodes and also publishes the list upon request. Potentially all Jingle Clients might act as a Node Tracker.</dd>
  83. </di>
  84. <di>
  85. <dt>Channel</dt>
  86. <dd>Is the UDP/TCP Relay Channel, provided by the a Jingle Relay Node. The channel act as a NAT Traversal Channel in order to delivery and receive media.</dd>
  87. </di>
  88. <di>
  89. <dt>Requester</dt>
  90. <dd>Is the Jingle Client that makes requests and make use of a Channel. The Requester receives a relay <link url="#transports">Transport Candidate</link> that can be used with &xep0176; or &xep0177;.</dd>
  91. </di>
  92. </dl>
  93. </section2>
  94. <section2 topic="Conventions" anchor="terms-conventions">
  95. <p>In diagrams, the following conventions are used:</p>
  96. <ul>
  97. <li>Single-dashed lines (---) represent Jingle stanzas that are sent via the XMPP signalling channel.</li>
  98. <li>Double-dashed lines (===) represent media packets that are sent via the data channel, which typically is not an XMPP channel (although the <cite>Jingle In-Band Bytestreams Transport Method</cite> is an exception) but instead is a direct or mediated channel between the endpoints.</li>
  99. </ul>
  100. </section2>
  101. </section1>
  102. <section1 topic="Flow Example" anchor="rules">
  103. <p>After the Jingle Clients gets succesfully connected to the XMPP Server, it MAY want to start discoverying available Relay Services in order to cache some entries. Having cached Relay Service Addresses is recommended as it speeds up the session setup time as the Client don't need to search for available Relay Services right before a session is started or received.</p>
  104. <section2 topic="Jingle Client Checks for Tracker or Relay Services on its own Server Domain" anchor="clientcheckownserver">
  105. <p>A Jingle Client MAY start the search for Relay Services by querying his own XMPP Server Domain.</p>
  106. <p>
  107. <em>Note: This is a good implementation practice.</em>
  108. </p>
  109. <example caption="Service List Request"><![CDATA[
  110. <iq from='romeo@montague.lit/orchard'
  111. id='uw72g176'
  112. to='montague.lit'
  113. type='get'>
  114. <services xmlns='http://jabber.org/protocol/jinglenodes'/>
  115. </iq>
  116. ]]></example>
  117. <example caption="Tracker Returned Known Public Relay Services"><![CDATA[
  118. <iq from='montague.lit'
  119. id='uw72g176'
  120. to='romeo@montague.lit/orchard'
  121. type='result'>
  122. <services xmlns='http://jabber.org/protocol/jinglenodes'>
  123. <relay policy='public' address='montague.lit' protocol='udp'/>
  124. <tracker policy='public' address='capulet.lit' protocol='udp'/>
  125. <turn policy='public' address='stun.capulet.lit' protocol='udp'/>
  126. <stun policy='public' address='200.111.111.111' port='3857' protocol='udp'/>
  127. </services>
  128. </iq>
  129. ]]></example>
  130. <p><em>In this example 'montague.lit' XMPP Domain a Relay Service and a Tracker Service. The Relay Service can be contacted in order to retrieve Relay Channels. The Tracker Service can be contacted in order to retrieve its known services.</em></p>
  131. </section2>
  132. <section2 topic="Jingle Client Searches for Services on a Retrieved Tracker Service" anchor="clientcheckownserver">
  133. <p>A Jingle Client MAY NOT be satisfied with only one Relay Service entry found. So it keeps the search on the known Tracker Services.</p>
  134. <example caption="Service List Request"><![CDATA[
  135. <iq from='romeo@montague.lit/orchard'
  136. id='uw72g177'
  137. to='capulet.lit'
  138. type='get'>
  139. <services xmlns='http://jabber.org/protocol/jinglenodes'/>
  140. </iq>
  141. ]]></example>
  142. <example caption="Tracker Returned Known Public Relay Services"><![CDATA[
  143. <iq from='capulet.lit'
  144. id='uw72g177'
  145. to='romeo@montague.lit/orchard'
  146. type='result'>
  147. <services xmlns='http://jabber.org/protocol/jinglenodes'/>
  148. </iq>
  149. ]]></example>
  150. <p><em>In this example 'capulet.lit' returned an empty service list, meaning that it does NOT known ANY Relay or Tracker Services.</em></p>
  151. </section2>
  152. <section2 topic="Jingle Client Searches for Services on online Roster Entries" anchor="clientcheckownserver">
  153. <p>A Jingle Client MAY NOT be satisfied with only one Relay Service entry found. So it keeps the search on his Roster Items until find the desired amount of Relay Services, or while it does NOT exceed a search depth or ANY other Client implementation policy. The Client SHOULD keep a list of visited Tracker Services in order to avoid searching twice in same Service Entity.</p>
  154. <example caption="Service List Request"><![CDATA[
  155. <iq from='romeo@montague.lit/orchard'
  156. id='uw72g177'
  157. to='juliet@capulet.lit/balcony'
  158. type='get'>
  159. <services xmlns='http://jabber.org/protocol/jinglenodes'/>
  160. </iq>
  161. ]]></example>
  162. <example caption="Tracker Returned Known Public Relay Services"><![CDATA[
  163. <iq from='juliet@capulet.lit/balcony'
  164. id='uw72g177'
  165. to='romeo@montague.lit/orchard'
  166. type='result'>
  167. <services xmlns='http://jabber.org/protocol/jinglenodes'>
  168. <relay policy='roster' address='juliet@capulet.lit/balcony' protocol='udp'/>
  169. </services>
  170. </iq>
  171. ]]></example>
  172. <p>In this example 'juliet@capulet.lit/balcony' returned a Relay Service entry that is restricted to its roster. This Service is usable as the requester has 'juliet@capulet.lit/balcony' on its roster. Although, services with policy 'roster' MUST NOT be listed in Tracker Responses expects in Tracker Responses that comes from the Service Entity itself, in this case 'juliet@capulet.lit/balcony'.</p>
  173. <p><em>In the presented example 'romeo@montague.lit/orchard' knows that 'juliet@capulet.lit/balcony' provides Relay Service, but if another entity requests 'romeo@montague.lit/orchard' its known services, it MUST NOT include 'juliet@capulet.lit/balcony' as it is a roster restricted entry.</em></p>
  174. </section2>
  175. <section2 topic="Jingle Client Consuming the Relay Service" anchor="clientconsumingrelay">
  176. <p>A Jingle Client with Internet connectivity wheter with direct access to a public IP or not, can potentially provide the Relay Service becaming itself a Jingle Relay Node. The service can intend to provide a public service, or a restricted services based on user preferences, like buddylist, whitelist, blacklist, domain, etc...</p>
  177. <p>
  178. <em>Note: It is NOT mandatory to became a Jingle Relay Node it is OPTIONAL and SHOULD be done ONLY under user awareness and concentiment.</em>
  179. </p>
  180. <example caption="UDP Relay Channel request"><![CDATA[
  181. <iq from='romeo@montague.lit/orchard'
  182. id='uw72g176'
  183. to='juliet@capulet.lit/balcony'
  184. type='get'>
  185. <channel xmlns='http://jabber.org/protocol/jinglenodes#channel' protocol='udp'/>
  186. </iq>
  187. ]]></example>
  188. <example caption="Candidate Returned by a Node with channel bandwidth throttle"><![CDATA[
  189. <iq from='juliet@capulet.lit/balcony'
  190. id='uw72g176'
  191. to='romeo@montague.lit/orchard'
  192. type='result'>
  193. <channel component='1'
  194. id='el0747fg11'
  195. host='200.20.2.10'
  196. localport='35800'
  197. remoteport='35802'
  198. protocol='udp'
  199. maxkbps='120'
  200. expire='60'/>
  201. </iq>
  202. ]]></example>
  203. <p><em>After receiving the &CHANNEL; the requester MUST send his stream to 'host' and 'localport' pair and send a &CANDIDATE; containing the 'host' and 'remoteport' values.</em></p>
  204. </section2>
  205. <section2 topic="Jingle Client Consuming TURN Credentials Service" anchor="clientconsumingturncredentials">
  206. <p>A Jingle Client can request volative TURN credentials, to be used in cases where connectivity check is a requirement. Like, for example, WebRTC. The concept and mechanism is quite similar to the RFC draft <link url='https://tools.ietf.org/html/draft-uberti-behave-turn-rest-00'>REST API For Access To TURN Services'.</link></p>
  207. <p>TURN provides an access control mechanism described in &rfc5389;, where long-term credentials are provided as part of the TURN protocol. Therefore the credentials provided in this Jingle Nodes mechanism are time-limited, but SHOULD be used as long-term credentials, when authentication against a TURN Server.
  208. </p>
  209. <p>
  210. <em>Note: There is no need to run TURN server or support within a Jingle Relay. This mechanism allows decoupled deployment of distributed TURN Servers, without the requirement of database based authentication. </em>
  211. </p>
  212. <example caption="TURN Credentials request"><![CDATA[
  213. <iq from='romeo@montague.lit/orchard'
  214. id='uw72g176'
  215. to='juliet@capulet.lit/balcony'
  216. type='get'>
  217. <turn xmlns='http://jabber.org/protocol/jinglenodes#turncredentials' protocol='udp'/>
  218. </iq>
  219. ]]></example>
  220. <example caption="TUNR Credentials Returned by the service"><![CDATA[
  221. <iq from='juliet@capulet.lit/balcony'
  222. id='uw72g176'
  223. to='romeo@montague.lit/orchard'
  224. type='result'>
  225. <turn ttl='60000'
  226. uri='turn:200.20.2.10:1984?transport=udp'
  227. username='1433895918506:romeocapulet'
  228. password='1Dj9XZ5fwvKS6YoQZOoORcFnXaI='
  229. />
  230. </iq>
  231. ]]></example>
  232. </section2>
  233. </section1>
  234. <section1 topic="Services Definitions" anchor="servicesdefinition">
  235. <section2 topic="Relay Channel Service" anchor="relaychannelservice">
  236. <p>A Relay Channel Service is responsible for providing the actual Relay Services. It will receive Channel Requests, allocate the Relay Channel and return the ready to use details. If a Jingle Client knows the service address of one valid and reliable Relay Service, that is enough for place and receive Jingle Calls and transmit both ways media streams based on UDP.</p>
  237. <p>Relay Channel Services support can be discovered by searching using <link url='#trackerservice'>Tracker Services</link>. It can also be discovered by <link url='#support'>service discovery described in this document</link>.</p>
  238. <p>
  239. <em>Note: Jingle Relay Channels can be used with RAW-UDP and ICE-UDP Jingle Transports.</em>
  240. </p>
  241. </section2>
  242. <section2 topic="Tracker Service" anchor="trackerservice">
  243. <p>A Tracker Service is responsible for providing addresses of known Relay Channel Services and other Tracker Services as well.</p>
  244. <section3 topic="Services Types" anchor="servicetypes">
  245. <p>Tracker entries MUST contain a 'type' attribute that represents the usage policy according to the table below:</p>
  246. <table caption="Types of Service Usage Policy">
  247. <tr>
  248. <th>Type</th>
  249. <th>Definition</th>
  250. </tr>
  251. <tr>
  252. <td>public</td>
  253. <td>Relays Services that are meant and opened for public usage, SHOULD use the type 'public'. Meaning that every user can make use of its services. This type SHOULD be published by Tracker Services.</td>
  254. </tr>
  255. <tr>
  256. <td>roster</td>
  257. <td>Relay Services that only provides Channels for users that are in it own roster, SHOULD use the type 'roster'. Meaning that only presence subscribed buddies can make use of its service. Common usage is XMPP Clients with Relay Services Capabilities. This type SHOULD NOT be published by Tracker Services as if it is roster only, the requester SHOULD have the entity already added to his roster, which also mean that it SHOULD be discoverable on roster level.</td>
  258. </tr>
  259. </table>
  260. </section3>
  261. </section2>
  262. </section1>
  263. <section1 topic="Formal Definition" anchor="def">
  264. <section2 topic="Channel Element" anchor="def-channel">
  265. <p>The &CHANNEL; element MUST be empty.</p>
  266. <p>The attributes of the &CHANNEL; element are as follows.</p>
  267. <table caption="Attributes of Channel Element">
  268. <tr>
  269. <th>Attribute</th>
  270. <th>Definition</th>
  271. <th>Inclusion</th>
  272. </tr>
  273. <tr>
  274. <td>id</td>
  275. <td>A random candidate identifier generated by the Relay Service, which effectively maps to the created Channel; this SHOULD match the XML Nmtoken production <note>See &lt;<link url='http://www.w3.org/TR/2000/WD-xml-2e-20000814#NT-Nmtoken'>http://www.w3.org/TR/2000/WD-xml-2e-20000814#NT-Nmtoken</link>&gt;</note> so that XML character escaping is not needed for characters such as '&amp;'. In some situations the Jingle session identifier might have security implications. See &rfc4086; regarding requirements for randomness.</td>
  276. <td>REQUIRED on response, NOT RECOMMENDED on requests</td>
  277. </tr>
  278. <tr>
  279. <td>host</td>
  280. <td>The IP address or Host address of the Relay Channel.</td>
  281. <td>REQUIRED on response</td>
  282. </tr>
  283. <tr>
  284. <td>localport</td>
  285. <td>The port number to be used by the channel requester.</td>
  286. <td>REQUIRED on response</td>
  287. </tr>
  288. <tr>
  289. <td>remoteport</td>
  290. <td>The port number to be offered to the remote party.</td>
  291. <td>REQUIRED on response</td>
  292. </tr>
  293. <tr>
  294. <td>protocol</td>
  295. <td>The protocol supported by the retrieved channel.</td>
  296. <td>REQUIRED on response</td>
  297. </tr>
  298. <tr>
  299. <td>maxkbps</td>
  300. <td>The maximum bandwidth supported by the channel.</td>
  301. <td>OPTIONAL on response, NOT RECOMMENDED on requests.</td>
  302. </tr>
  303. <tr>
  304. <td>expire</td>
  305. <td>The maximum amount of seconds that the channel can stay without receiving packets, without being deactivated and closed.</td>
  306. <td>REQUIRED</td>
  307. </tr>
  308. </table>
  309. <section3 topic="Host Attribute" anchor="def-host">
  310. <p>The value of the 'host' attribute MUST be one IP address or a DNS resolvable address. That is the address to be used on candidate offering and also the IP to be used when sending out the media traffic.</p>
  311. </section3>
  312. <section3 topic="Localport Attribute" anchor="def-localport">
  313. <p>The value of the 'localport' attribute MUST be a valid IP Port number. This port MUST be used as the media traffic destination port of the channel requester. Session Initiator and responder MUST NOT offer this port.</p>
  314. <p>The rule is simple and unique, the requester of the channel MUST send the media streams to 'localport' and use 'remoteport' in the 'candidate' element to be offered in the Jingle Session.</p>
  315. <p>For transparent compatibility with major RTP Proxy Deployments, an RCTP Port is allocated and defined by default at Localport Attribute Value plus one. (Localport + 1)</p>
  316. </section3>
  317. <section3 topic='Remoteport Attribute' anchor='def-remoteport'>
  318. <p>The value of the 'remoteport' attribute MUST be a valid IP Port number. This port MUST be used as media traffic destination port of the other party. Channel requester MUST use this port value in the candidate offer in combination with the 'host' attribute. Channel requester MUST NOT send any media stream to this port.</p>
  319. <p>For transparent compatibility with major RTP Proxy Deployments, an RCTP Port is allocated and defined by default at Remoteport Attribute Value plus one. (Localport + 1)</p>
  320. </section3>
  321. <section3 topic='Protocol Attribute' anchor='def-protocol'>
  322. <p>The value of the 'protocol' attribute MUST be a valid protocol value: 'udp' or 'tcp' as also defined in the <link url='#schema'>XML Schema</link></p>
  323. </section3>
  324. <section3 topic='Maxkbps Attribute' anchor='def-maxkbps'>
  325. <p>The value of the 'maxkbps' attribute MUST be a valid integer value representing the maximum kilobits per seconds the channel supports. This attribute is optional and MAY be used in Relay Channel with bandwidth limitation.</p>
  326. </section3>
  327. <section3 topic='Expire Attribute' anchor='def-expire'>
  328. <p>The value of the 'expire' attribute MUST be a valid integer value representing the maximum seconds that the channel can stay without receiving any traffic without being deactivated and closed. This attribute is required and SHOULD be used in all Relay Channels.</p>
  329. </section3>
  330. </section2>
  331. <section2 topic="Services Element" anchor="def-services">
  332. <p>The &SERVICES; element MAY be empty or contain &RELAY;, &STUN; and/or &TRACKER; elements.</p>
  333. <p>The attributes of the &RELAY; and &TRACKER; element are as follows.</p>
  334. <table caption="Attributes of Relay and Tracker Elements">
  335. <tr>
  336. <th>Attribute</th>
  337. <th>Definition</th>
  338. <th>Inclusion</th>
  339. </tr>
  340. <tr>
  341. <td>policy</td>
  342. <td>The policy of the service. If the service is public, MUST be 'public' if it is restricted to roster, MUST be 'roster'.</td>
  343. <td>REQUIRED</td>
  344. </tr>
  345. <tr>
  346. <td>address</td>
  347. <td>For Relay and Tracker Services the JID. For STUN Service the IP or Host address.</td>
  348. <td>REQUIRED</td>
  349. </tr>
  350. <tr>
  351. <td>protocol</td>
  352. <td>The protocol supported by the retrieved service.</td>
  353. <td>REQUIRED</td>
  354. </tr>
  355. <tr>
  356. <td>port</td>
  357. <td>The port number of the STUN service. This field is only used in STUN Service entries.</td>
  358. <td>REQUIRED for STUN entries</td>
  359. </tr>
  360. </table>
  361. </section2>
  362. <section2 topic="TURN Credentials Service Element" anchor="def-turn-credentials">
  363. <p>The attributes of the &TURN; element are as follows.</p>
  364. <table caption="Attributes of TURN Elements">
  365. <tr>
  366. <th>Attribute</th>
  367. <th>Definition</th>
  368. <th>Inclusion</th>
  369. </tr>
  370. <tr>
  371. <td>ttl</td>
  372. <td>The duration in seconds for which the provided credentials are valid.</td>
  373. <td>REQUIRED</td>
  374. </tr>
  375. <tr>
  376. <td>uri</td>
  377. <td>The TURN Server URI.</td>
  378. <td>REQUIRED</td>
  379. </tr>
  380. <tr>
  381. <td>username</td>
  382. <td>The username to be used on TURN authentication. THe recommended format is a colon-delimited concatenation of expiration timestamp and the requester bare JID.</td>
  383. <td>REQUIRED</td>
  384. </tr>
  385. <tr>
  386. <td>password</td>
  387. <td>The ppassword to be used on TURN authentication. Is the result of 'base64(hmac(secret_key, username))'. Where 'secret_key' is shared between the TURN server and entity providing the credentials.</td>
  388. <td>REQUIRED</td>
  389. </tr>
  390. </table>
  391. <section3 topic="Ttl Attribute" anchor="def-ttlattribute">
  392. <p>The duration in seconds for which the provided credentials are valid. The usual and recommended value is 86400 seconds (one day).</p>
  393. </section3>
  394. <section3 topic="URI Attribute" anchor="def-uriattribute">
  395. <p>The TURN Server URI as described in <link url="https://tools.ietf.org/html/draft-petithuguenin-behave-turn-uris-03">I-D.petithuguenin-behave-turn-uris</link></p>
  396. </section3>
  397. <section3 topic="Username Attribute" anchor="def-ttlattribute">
  398. <p>WebRTC's TURN request uses the 'username' value for its USERNAME and PASSWORD attributes, for the input to the MESSAGE-INTEGRITY hash.</p>
  399. </section3>
  400. <section3 topic="Password Attribute" anchor="def-ttlattribute">
  401. <p>Along with 'username', WebRTC's TURN request uses the 'password' value for its USERNAME and PASSWORD attributes, for the input to the MESSAGE-INTEGRITY hash.</p>
  402. </section3>
  403. </section2>
  404. </section1>
  405. <section1 topic="Determining Support" anchor="support">
  406. <p>To advertise its support for the Jingle Nodes support, when replying to &xep0030; information requests an entity MUST return URNs for any version of this protocol that the entity supports -- e.g., "http://jabber.org/protocol/jinglenodes" for this version&VNOTE;.</p>
  407. <p>If the entity supports, Jingle Nodes as a Tracker, it MUST reply to &xep0030; with "http://jabber.org/protocol/jinglenodes". If it also provides the Jingle Nodes Relay Services, it MUST reply with the URN "http://jabber.org/protocol/jinglenodes#channel".</p>
  408. <p>For optimization purpose the Client SHOULD check for Jingle Nodes support based on entity presence capabilities &xep0115;, which SHOULD contain the keywork "jn-v0".</p>
  409. <example caption="Service discovery information request"><![CDATA[
  410. <iq from='romeo@montague.lit/orchard'
  411. id='uw72g176'
  412. to='juliet@capulet.lit/balcony'
  413. type='get'>
  414. <query xmlns='http://jabber.org/protocol/disco#info'/>
  415. </iq>
  416. ]]></example>
  417. <example caption="Service discovery information response"><![CDATA[
  418. <iq from='juliet@capulet.lit/balcony'
  419. id='uw72g176'
  420. to='romeo@montague.lit/orchard'
  421. type='result'>
  422. <query xmlns='http://jabber.org/protocol/disco#info'>
  423. <feature var='http://jabber.org/protocol/jinglenodes'/>
  424. <feature var='http://jabber.org/protocol/jinglenodes#channel'/>
  425. <feature var='http://jabber.org/protocol/jinglenodes#turncredentials'/>
  426. </query>
  427. </iq>
  428. ]]></example>
  429. <p>In order for an application to determine whether an entity supports this protocol, where possible it SHOULD use the dynamic, presence-based profile of service discovery defined in &xep0115;. However, if an application has not received entity capabilities information from an entity, it SHOULD use explicit service discovery instead.</p>
  430. </section1>
  431. <section1 topic="Recommended Use Cases" anchor="usecases">
  432. <section2 topic="Jingle Client with RAW-UDP Transport without any NAT detection mechanism" anchor="rawudpnostun">
  433. <p>A Jingle Client with only RAW-UDP support and any NAT detection mechanism can make use of Jingle Nodes. Although the traversal is not guarantee due problem with NAT configuration or firewalls, this method is fairly efficient as most SIP legacy services still provides their services in a similar way, meaning that this has the exactly same accertivity and reliability than regular SIP Services. This method is extremelly useful specially for simple platforms like mobile and clients in early stage of development that still wants to offer voice and video support.</p>
  434. <p>
  435. <em>Note: This use case is also similar to a Jingle to SIP Interoperability Service.</em>
  436. </p>
  437. </section2>
  438. <section2 topic="Jingle Client that uses WebRTC with TURN required" anchor="webrtcturn">
  439. <p>A Jingle Client that uses WebRTC, therefore requiring a TURN Server and its credentials to successfully alocate channels. This specification describes a simple way of discovering TURN Services and retrieving credentials to successfully allocate channels.
  440. This also simplifies deployment and distribution of TURN servers, since its stateless authentication does not require connectivity to database authoriztion services.</p>
  441. </section2>
  442. <section2 topic="Jingle Client with ICE-UDP Transport with STUN support but no TURN support" anchor="iceudpnoturn">
  443. <p>A Jingle Client with STUN support but no TURN support can use Relay Node Services as the fallback candidate instead of a TURN candidate. For instance, after a connectivity check proccess, none of the direct candidates worked. The Client can use the Relay Node Candidate as the fallback candidate(the lowest priority candidate).</p>
  444. </section2>
  445. <section2 topic="Jingle Client with ICE-UDP Transport with STUN and TURN support" anchor="iceudpstunturn">
  446. <p>A Jingle Client with STUN and TURN support still might need a Relay Candidate, specially as TURN servers are not widely deployed and don't have any mechanism to publish available services for users. TURN servers also requires specific UDP traffic in specific port ranges which can be blocked by users networks. In this case is very useful to have an extra fallback candidate that can be negotiated via XMPP rather than over UDP.</p>
  447. <p>
  448. <em>Note: Jingle Relay Nodes Services are much more likely to be found and be available than TURN servers, as users can also provide Jingle Relay Nodes services themselves or provide a list of known and available services, in this last case behaving a tracker. Is very likely that Jingle Relay Nodes will be available and discovered more easily and often than TURN servers.</em>
  449. </p>
  450. </section2>
  451. <section2 topic="XMPP Client or Component in a Public IP" anchor="clientonpublicip">
  452. <p>A XMPP Client or Component with direct access to a public IP can potentially provide the UDP Relay Service becaming itself a Jingle Relay Node. The service can intend to provide a public service, or a restricted services based on user preferences, like buddylist, whitelist, blacklist, domain, etc...</p>
  453. <p>
  454. <em>Note: It is NOT mandatory to became a Jingle Relay Node. This is OPTIONAL and SHOULD be done with user awareness and concentiment.</em>
  455. </p>
  456. </section2>
  457. </section1>
  458. <section1 topic="Implementation Notes" anchor="impl">
  459. <p>When using a candidate provided by a Jingle Relay Service, the Jingle Client MUST set the candidate attribute to 'relay'. In order to make sure the other client won't allocate another channel as well. Which would lead in audio connectivity issues. In brief, if the caller is using a Relay Candidate the calle MUST NOT use another Relay Candidate discovered by itself. If a caller is not using a Relay Candidate(which can be determined by the candidate 'type' attribute) the callee MAY use a Relay Candidate in order to ensure communication.</p>
  460. </section1>
  461. <section1 topic="Security Considerations" anchor="security">
  462. <p>Relay Channels auto expires MUST expire on traffic inactivity. The inactivity timeout recommended is 60 seconds.</p>
  463. <p>It is heavily recommended that the Super Node implements throttle:</p>
  464. <ul>
  465. <li>Based on JID, allowing the control of how many concurrent channels an specific JID can have.</li>
  466. <li>Based on JID, allowing the control of how many channel requests an specific JID can request in a time period.</li>
  467. <li>Based on Bandwidth, allowing the control of how much bandwidth a channel can use. The maximum bandwidth SHOULD be included on the candidate element provided by a Super Node on the attribute maxkbps. If no attribute is present, it means that it has no bandwidth control.</li>
  468. </ul>
  469. <example caption="Channel Returned by a Node with bandwidth throttle (stub)"><![CDATA[
  470. <channel component='1'
  471. id='el0747fg11'
  472. host='200.20.2.10'
  473. localport='35800'
  474. remoteport='35802'
  475. protocol='udp'
  476. maxkbps='120'/>
  477. ]]></example>
  478. </section1>
  479. <section1 topic='XML Schema' anchor='schema'>
  480. <code><![CDATA[
  481. <?xml version='1.0' encoding='UTF-8'?>
  482. <xs:schema
  483. xmlns:xs='http://www.w3.org/2001/XMLSchema'
  484. targetNamespace='http://jabber.org/protocol/jinglenodes'
  485. xmlns='http://jabber.org/protocol/jinglenodes'
  486. elementFormDefault='qualified'>
  487. <xs:element name='channel'>
  488. <xs:attribute name='id' type='xs:string' use='required'/>
  489. <xs:attribute name='host' type='xs:string' use='required'/>
  490. <xs:attribute name='localport' type='xs:string' use='required'/>
  491. <xs:attribute name='remoteport' type='xs:string' use='required'/>
  492. <xs:attribute name='protocol' use='required'>
  493. <xs:simpleType>
  494. <xs:restriction base='xs:NCName'>
  495. <xs:enumeration value='udp'/>
  496. <xs:enumeration value='tcp'/>
  497. </xs:restriction>
  498. </xs:simpleType>
  499. </xs:attribute>
  500. <xs:attribute name='maxkbps' type='xs:string' use='optional'/>
  501. <xs:attribute name='expire' type='xs:string' use='required'/>
  502. </xs:element>
  503. <xs:element name='turn'>
  504. <xs:attribute name='ttl' type='xs:string' use='required'/>
  505. <xs:attribute name='uri' type='xs:string' use='required'/>
  506. <xs:attribute name='username' type='xs:string' use='required'/>
  507. <xs:attribute name='password' type='xs:string' use='required'/>
  508. </xs:element>
  509. <xs:element name='services'>
  510. <xs:complexType>
  511. <xs:sequence>
  512. <xs:element name='relay'
  513. type='serviceElementType'
  514. minOccurs='0'
  515. maxOccurs='unbounded'/>
  516. <xs:element name='tracker'
  517. type='serviceElementType'
  518. minOccurs='0'
  519. maxOccurs='unbounded'/>
  520. <xs:element name='stun'
  521. type='serviceElementType'
  522. minOccurs='0'
  523. maxOccurs='unbounded'/>
  524. <xs:element name='turn'
  525. type='serviceElementType'
  526. minOccurs='0'
  527. maxOccurs='unbounded'/>
  528. </xs:sequence>
  529. </xs:complexType>
  530. </xs:element>
  531. <xs:complexType name='serviceElementType'>
  532. <xs:simpleContent>
  533. <xs:extension base='empty'>
  534. <xs:attribute name='address' type='xs:string' use='required'/>
  535. <xs:attribute name='port' type='xs:string' use='optional'/>
  536. <xs:attribute name='policy' use='required'>
  537. <xs:simpleType>
  538. <xs:restriction base='xs:NCName'>
  539. <xs:enumeration value='public'/>
  540. <xs:enumeration value='roster'/>
  541. </xs:restriction>
  542. </xs:simpleType>
  543. </xs:attribute>
  544. <xs:attribute name='protocol' use='required'>
  545. <xs:simpleType>
  546. <xs:restriction base='xs:NCName'>
  547. <xs:enumeration value='udp'/>
  548. <xs:enumeration value='tcp'/>
  549. </xs:restriction>
  550. </xs:simpleType>
  551. </xs:attribute>
  552. </xs:extension>
  553. </xs:simpleContent>
  554. </xs:complexType>
  555. <xs:simpleType name='empty'>
  556. <xs:restriction base='xs:string'>
  557. <xs:enumeration value=''/>
  558. </xs:restriction>
  559. </xs:simpleType>
  560. </xs:schema>
  561. ]]></code>
  562. </section1>
  563. </xep>