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-0349.xml 17KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  1. <?xml version='1.0' encoding='UTF-8'?>
  2. <!DOCTYPE xep SYSTEM 'xep.dtd' [
  3. <!ENTITY % ents SYSTEM 'xep.ent'>
  4. %ents;
  5. ]>
  6. <?xml-stylesheet type='text/xsl' href='xep.xsl'?>
  7. <xep>
  8. <header>
  9. <title>Rayo Clustering</title>
  10. <abstract>This specification describes an extension to the Rayo protocol to support clustering of Rayo servers and their presentation as a unified service.</abstract>
  11. &LEGALNOTICE;
  12. <number>0349</number>
  13. <status>Deferred</status>
  14. <type>Standards Track</type>
  15. <sig>Standards</sig>
  16. <approver>Council</approver>
  17. <dependencies>
  18. <spec>XMPP Core</spec>
  19. <spec>XEP-0327 Rayo</spec>
  20. </dependencies>
  21. <supersedes/>
  22. <supersededby/>
  23. <shortname>NOT_YET_ASSIGNED</shortname>
  24. <author>
  25. <firstname>Ben</firstname>
  26. <surname>Langfeld</surname>
  27. <email>ben@langfeld.me</email>
  28. <jid>ben@langfeld.me</jid>
  29. <uri>http://langfeld.me</uri>
  30. </author>
  31. <author>
  32. <firstname>Martín</firstname>
  33. <surname>Pérez</surname>
  34. <email>mperez@tropo.com</email>
  35. <uri>http://tropo.com</uri>
  36. </author>
  37. <revision>
  38. <version>0.2</version>
  39. <date>2017-09-11</date>
  40. <initials>XEP Editor (jwi)</initials>
  41. <remark>Defer due to lack of activity.</remark>
  42. </revision>
  43. <revision>
  44. <version>0.1</version>
  45. <date>2014-06-18</date>
  46. <initials>editorc(mam)</initials>
  47. <remark><p>Initial published version approved by the XMPP Council.</p></remark>
  48. </revision>
  49. <revision>
  50. <version>0.0.1</version>
  51. <date>2014-04-18</date>
  52. <initials>bl</initials>
  53. <remark><p>First draft.</p></remark>
  54. </revision>
  55. </header>
  56. <section1 topic='Introduction' anchor='intro'>
  57. <p>&xep0327; documents the behaviour of an individual Rayo server and its interaction with a client. Two of the goals of Rayo, however, are to support clustering of servers and multi-tenancy. This specification outlines how that is to be achieved.</p>
  58. </section1>
  59. <section1 topic='Requirements' anchor='reqs'>
  60. <p>This specification is required to provide a framework for implementation of the following goals:</p>
  61. <ul>
  62. <li>Routing of Rayo messages between clients and server nodes in a cluster.</li>
  63. <li>Load balancing of calls between multiple clients and server nodes in a cluster.</li>
  64. <li>Failover of calls between clients and server nodes, and management of the cluster.</li>
  65. <li>Enforcement of security and multi-tenancy concerns.</li>
  66. </ul>
  67. </section1>
  68. <section1 topic='Terminology' anchor='terms'>
  69. <section2 topic='Glossary' anchor='terms-glossary'>
  70. <dl>
  71. <di>
  72. <dt>Cluster</dt>
  73. <dd>A collection of one or more Nodes which are coordinated by one or more Gateways.</dd>
  74. </di>
  75. <di>
  76. <dt>Gateway</dt>
  77. <dd>
  78. The Rayo Gateway is the main element that differentiates a Rayo Cluster from a stand-alone Rayo deployment. The Rayo Gateway is an intermediate component that is in charge of coordinating the communication from clients to Rayo Nodes and from Rayo Nodes to clients. When a cluster contains multiple gateways, the protocol for coordination of multiple gateways is considered implementation specific.
  79. </dd>
  80. </di>
  81. <di>
  82. <dt>Node</dt>
  83. <dd>The Rayo Node is an individual instance of a Rayo server from &xep0327;, which presents call control capability via Rayo on top of a signaling protocol such as SIP or Jingle. It presents as a member of the cluster under the management of the Gateway(s).</dd>
  84. </di>
  85. <di>
  86. <dt>Third-party XMPP server</dt>
  87. <dd>An arbitrary third-party XMPP server used for registration of Rayo clients. MAY form part of the cluster.</dd>
  88. </di>
  89. </dl>
  90. </section2>
  91. <section2 topic='Conventions' anchor='terms-conventions'>
  92. <p>In examples, the following JIDs are used:</p>
  93. <ul>
  94. <li><strong>juliet@capulet.lit/balcony, romeo@montague.lit/orchard</strong> - Potential controlling parties</li>
  95. <li><strong>shakespeare.lit</strong> - The root domain of the Rayo service, presented as the external interface of the Gateway(s).</li>
  96. <li><strong>gateway.shakespeare.lit</strong> - The internal domain of the Gateway(s).</li>
  97. <li><strong>node1.shakespeare.lit</strong> - The domain of a Node in the Cluster.</li>
  98. </ul>
  99. </section2>
  100. </section1>
  101. <section1 topic='Session Flow' anchor='session'>
  102. <p>All communication between the Rayo Gateways and Clients, and the Gateways and Nodes MUST be conformant with &xep0327; or any extensions defined in this specification. A conformant Rayo Gateway MUST NOT derive any critical functionality through proprietary knowledge of the Nodes it is managing.</p>
  103. <section2 topic='Message Routing' anchor='session-message-routing'>
  104. <p>The Rayo Gateway communicates both with Rayo Nodes and third-party XMPP servers through S2S XMPP connections. To differentiate the messages that come from Rayo Nodes and from client applications, the Rayo Gateway MUST present two separate domains, an internal (for communication with cluster nodes) and an external (for communication with Rayo clients) interface. In cases of multiple gateways, the internal and external domains MUST be the same, and DNS SHOULD be used for load-balancing.</p>
  105. <p>Inbound call flow is:</p>
  106. <ol>
  107. <li>The Rayo Node generates events for the call as usual, beginning with an offer event.</li>
  108. <li>The Rayo Node sends the event to the Rayo Gateway using the internal interface.</li>
  109. <li>The Rayo Gateway receives events on its internal interface, decides on the correct client to route the event to (the calls DCP or its set of PCPs).</li>
  110. <li>The Rayo Gateway forwards the event to relevant clients via the external interface, replacing the presence "to" and "from" attributes. The "to" attribute is the client's jid and the "from" is based on the Rayo Gateway's external interface.</li>
  111. <li>The client(s) receive the event, responding to the Gateway. The Gateway correspondingly rewrites commands received from the client to the relevant Node for each call, and responses to those commands in reverse.</li>
  112. </ol>
  113. <example caption="Simple inbound call scenario"><![CDATA[
  114. <presence from='9f00061@node1.shakespeare.lit'
  115. to='gateway.shakespeare.lit'>
  116. <c xmlns='http://jabber.org/protocol/caps'
  117. hash='sha-1'
  118. node='urn:xmpp:rayo:call:1'
  119. ver='QgayPKawpkPSDYmwT/WM94uAlu0='/>
  120. <offer xmlns='urn:xmpp:rayo:1'
  121. to='tel:+18003211212'
  122. from='tel:+13058881212'/>
  123. </presence>
  124. <presence from='9f00061@shakespeare.lit'
  125. to='juliet@capulet.lit/balcony'>
  126. <c xmlns='http://jabber.org/protocol/caps'
  127. hash='sha-1'
  128. node='urn:xmpp:rayo:call:1'
  129. ver='QgayPKawpkPSDYmwT/WM94uAlu0='/>
  130. <offer xmlns='urn:xmpp:rayo:1'
  131. to='tel:+18003211212'
  132. from='tel:+13058881212'/>
  133. </presence>
  134. <iq from='juliet@capulet.lit/balcony'
  135. to='9f00061@shakespeare.lit'
  136. type='set'
  137. id='hd721'>
  138. <accept xmlns='urn:xmpp:rayo:1'/>
  139. </iq>
  140. <iq from='gateway.shakespeare.lit'
  141. to='9f00061@node1.shakespeare.lit'
  142. type='set'
  143. id='hd721'>
  144. <accept xmlns='urn:xmpp:rayo:1'/>
  145. </iq>
  146. <iq from='9f00061@node1.shakespeare.lit'
  147. to='gateway.shakespeare.lit'
  148. type='result'
  149. id='hd721'/>
  150. <iq from='9f00061@shakespeare.lit'
  151. to='juliet@capulet.lit/balcony'
  152. type='result'
  153. id='hd721'/>
  154. <iq from='juliet@capulet.lit/balcony'
  155. to='9f00061@shakespeare.lit'
  156. type='set'
  157. id='f3wh8'>
  158. <hangup xmlns='urn:xmpp:rayo:1'/>
  159. </iq>
  160. <iq from='gateway.shakespeare.lit'
  161. to='9f00061@node1.shakespeare.lit'
  162. type='set'
  163. id='f3wh8'>
  164. <hangup xmlns='urn:xmpp:rayo:1'/>
  165. </iq>
  166. <iq from='9f00061@node1.shakespeare.lit'
  167. to='gateway.shakespeare.lit'
  168. type='result'
  169. id='f3wh8'/>
  170. <iq from='9f00061@shakespeare.lit'
  171. to='juliet@capulet.lit/balcony'
  172. type='result'
  173. id='f3wh8'/>
  174. <presence from='9f00061@node1.shakespeare.lit'
  175. to='gateway.shakespeare.lit'
  176. type='unavailable'>
  177. <end xmlns='urn:xmpp:rayo:1'>
  178. <hangup-command/>
  179. </end>
  180. </presence>
  181. <presence from='9f00061@shakespeare.lit'
  182. to='juliet@capulet.lit/balcony'
  183. type='unavailable'>
  184. <end xmlns='urn:xmpp:rayo:1'>
  185. <hangup-command/>
  186. </end>
  187. </presence>
  188. ]]></example>
  189. <p>Outbound call flow is:</p>
  190. <ol>
  191. <li>A client sends a dial command to the Rayo Cluster, arriving on the external interface of a Gateway.</li>
  192. <li>The Rayo Gateway finds an available Rayo Node and forwards the command to it, replacing the "from" attribute with its own internal interface and the "to" attribute based on the Node's domain.</li>
  193. <li>The Rayo Node receives the dial command, processes the outbound call and returns responses/events to the Gateway for rewriting to the client.</li>
  194. </ol>
  195. <example caption="Simple outbound call scenario"><![CDATA[
  196. <iq from='juliet@capulet.lit/balcony'
  197. to='shakespeare.lit'
  198. type='set'
  199. id='h7ed2'>
  200. <dial xmlns='urn:xmpp:rayo:1'
  201. to='tel:+13055195825'
  202. from='tel:+14152226789'/>
  203. </iq>
  204. <iq from='gateway.shakespeare.lit'
  205. to='node1.shakespeare.lit'
  206. type='set'
  207. id='h7ed2'>
  208. <dial xmlns='urn:xmpp:rayo:1'
  209. to='tel:+13055195825'
  210. from='tel:+14152226789'/>
  211. </iq>
  212. <iq from='node1.shakespeare.lit'
  213. to='gateway.shakespeare.lit'
  214. type='result'
  215. id='h7ed2'>
  216. <ref xmlns='urn:xmpp:rayo:1' uri='xmpp:9f00061@shakespeare.lit'/>
  217. </iq>
  218. <iq from='shakespeare.lit'
  219. to='juliet@capulet.lit/balcony'
  220. type='result'
  221. id='h7ed2'>
  222. <ref xmlns='urn:xmpp:rayo:1' uri='xmpp:9f00061@shakespeare.lit'/>
  223. </iq>
  224. <presence from='9f00061@node1.shakespeare.lit'
  225. to='gateway.shakespeare.lit'>
  226. <ringing xmlns='urn:xmpp:rayo:1'/>
  227. </presence>
  228. <presence from='9f00061@shakespeare.lit'
  229. to='juliet@capulet.lit/balcony'>
  230. <ringing xmlns='urn:xmpp:rayo:1'/>
  231. </presence>
  232. <presence from='9f00061@node1.shakespeare.lit'
  233. to='gateway.shakespeare.lit'>
  234. <answered xmlns='urn:xmpp:rayo:1'/>
  235. </presence>
  236. <presence from='9f00061@shakespeare.lit'
  237. to='juliet@capulet.lit/balcony'>
  238. <answered xmlns='urn:xmpp:rayo:1'/>
  239. </presence>
  240. <iq from='juliet@capulet.lit/balcony'
  241. to='9f00061@shakespeare.lit'
  242. type='set'
  243. id='f3wh8'>
  244. <hangup xmlns='urn:xmpp:rayo:1'/>
  245. </iq>
  246. <iq from='gateway.shakespeare.lit'
  247. to='9f00061@node1.shakespeare.lit'
  248. type='set'
  249. id='f3wh8'>
  250. <hangup xmlns='urn:xmpp:rayo:1'/>
  251. </iq>
  252. <iq from='9f00061@node1.shakespeare.lit'
  253. to='gateway.shakespeare.lit'
  254. type='result'
  255. id='f3wh8'/>
  256. <iq from='9f00061@shakespeare.lit'
  257. to='juliet@capulet.lit/balcony'
  258. type='result'
  259. id='f3wh8'/>
  260. <presence from='9f00061@node1.shakespeare.lit'
  261. to='gateway.shakespeare.lit'
  262. type='unavailable'>
  263. <end xmlns='urn:xmpp:rayo:1'>
  264. <hangup-command/>
  265. </end>
  266. </presence>
  267. <presence from='9f00061@shakespeare.lit'
  268. to='juliet@capulet.lit/balcony'
  269. type='unavailable'>
  270. <end xmlns='urn:xmpp:rayo:1'>
  271. <hangup-command/>
  272. </end>
  273. </presence>
  274. ]]></example>
  275. </section2>
  276. <section2 topic='Load balancing' anchor='session-load-balancing'>
  277. <p>The Gateway(s) in a Cluster are responsible for managing the routing of calls between relevant nodes and clients, and SHOULD retain knowledge of the presence of each for this purpose. Nodes and Clients SHOULD NOT be aware of each others identity of presence, and SHOULD only communicate with the Gateway(s).</p>
  278. <p>The Gateway(s) in a Cluster MUST attempt to evenly balance outbound calls among Nodes; at a minimum they MUST implement round-robin dispatch of dial commands. Gateways MAY attempt load-based distribution by monitoring the number of active sessions (inbound and outbound) per Node and distributing accordingly.</p>
  279. <p>The rules by which the PCPs for an inbound call are determined is implementation specific. In cases where a server permits registration of multiple JIDs as PCPs, it MAY opt to load-balance offers between them by an unspecified algorithm, though it may not assume any knowledge of the clients outside of this specification or &xep0327;.</p>
  280. <p>In order for a Rayo Node to be considered available for processing dial requests, it MUST first notify the Gateway that it is available for such by sending directed presence to the Gateway internal interface with a &lt;show/&gt; element containing 'chat' as in the example:</p>
  281. <example caption="Node presents itself as available to the Rayo Gateway"><![CDATA[
  282. <presence from='node1.shakespeare.lit'
  283. to='gateway.shakespeare.lit'>
  284. <c xmlns='http://jabber.org/protocol/caps'
  285. hash='sha-1'
  286. node='urn:xmpp:rayo:node:1'
  287. ver='QgayPKawpkPSDYmwT/WM94uAlu0='/>
  288. <show>chat</show>
  289. </presence>
  290. ]]></example>
  291. <p>Conversely, when a Rayo Node wishes not to process dial requests, it SHOULD send directed presence to the Gateway with a &lt;show/&gt; element containing 'dnd' as in the example:</p>
  292. <example caption="Node presents itself as unavailable to the Rayo Gateway"><![CDATA[
  293. <presence from='node1.shakespeare.lit'
  294. to='gateway.shakespeare.lit'>
  295. <c xmlns='http://jabber.org/protocol/caps'
  296. hash='sha-1'
  297. node='urn:xmpp:rayo:node:1'
  298. ver='QgayPKawpkPSDYmwT/WM94uAlu0='/>
  299. <show>dnd</show>
  300. </presence>
  301. ]]></example>
  302. </section2>
  303. <section2 topic='Failover' anchor='session-failover'>
  304. <p>A Rayo Gateway MAY transparently retry failed operations like dial requests, or MAY automatically remove from rotation the Rayo Nodes that fail to satisfy such requests repeatedly.</p>
  305. </section2>
  306. <section2 topic='Security' anchor='session-security'>
  307. <p>The Rayo Gateway MUST validate permissions on incoming Rayo commands from Clients (check that they are one of the call's DCP/PCP as appropriate to the rules defined in &xep0327;). The Rayo Gateway MUST enforce its own rules on Node membership of the Cluster, ensuring communication via its internal interface with only trusted Nodes. The rules by which inbound calls are permitted are implementation specific. When configured as members of a cluster, Rayo Nodes SHOULD accept communication *only* with the gateway.</p>
  308. </section2>
  309. </section1>
  310. <section1 topic='Determining Support' anchor='support'>
  311. <p>Rayo gateways MUST advertise support for "urn:xmpp:rayo:1" on their external interface, and "urn:xmpp:rayo:gateway:1" on their internal interface. Rayo nodes MUST advertise support for "urn:xmpp:rayo:node:1", indicating that they may be used as part of a cluster, and additionally "urn:xmpp:rayo:1" if they may also be used separately from the cluster.</p>
  312. </section1>
  313. <section1 topic='Security Considerations' anchor='security'>
  314. <section2 topic='Denial of Service' anchor='security-dos'>
  315. <p>Rayo sessions can be resource-intensive. Therefore, it is possible to launch a denial-of-service attack against an entity by burdening it with too many Rayo sessions. Care must be taken to accept sessions only from known entities and only if the entity's device is able to process such sessions.</p>
  316. </section2>
  317. <section2 topic='Communication Through Gateways' anchor='security-gateways'>
  318. <p>Rayo communications can be enabled through gateways to non-XMPP networks, whose security characteristics can be quite different from those of XMPP networks. For example, on some SIP networks authentication is optional and "from" addresses can be easily forged. Care must be taken in communicating through such gateways.</p>
  319. </section2>
  320. <section2 topic='Information Exposure' anchor='security-info'>
  321. <p>Mere negotiation of a Rayo session can expose sensitive information about the parties (e.g. IP addresses). Care must be taken in communicating such information, and end-to-end encryption should be used if the parties do not trust the intermediate servers or gateways.</p>
  322. </section2>
  323. </section1>
  324. <section1 topic='IANA Considerations' anchor='iana'>
  325. <p>This document requires no interaction with &IANA;.</p>
  326. </section1>
  327. <section1 topic='XMPP Registrar Considerations' anchor='registrar'>
  328. <section2 topic='Protocol Namespaces' anchor='registrar-ns'>
  329. <p>This specification defines the following XML namespaces:</p>
  330. <ul>
  331. <li>urn:xmpp:rayo:gateway:1</li>
  332. <li>urn:xmpp:rayo:node:1</li>
  333. </ul>
  334. <p>The &REGISTRAR; includes the foregoing namespaces in its registry at &NAMESPACES;, as governed by &xep0053;.</p>
  335. </section2>
  336. <section2 topic='Namespace Versioning' anchor='registrar-versioning'>
  337. <p>If the protocol defined in this specification undergoes a major revision that is not fully backward-compatible with an older version, or that contains significant new features, the XMPP Registrar shall increment the protocol version number found at the end of the XML namespaces defined herein, as described in Section 4 of <cite>XEP-0053</cite>.</p>
  338. </section2>
  339. </section1>
  340. <section1 topic='Acknowledgements' anchor='acknowledgements'>
  341. <p>The authors would like to acknowledge the input of teams at Tropo, Mojo Lingo and Grasshopper in the development of the specification.</p>
  342. <p>Specific individuals who have contributed to the specification or to software significant to its completion include:</p>
  343. <ul>
  344. <li>Ben Langfeld</li>
  345. <li>Chris Rienzo</li>
  346. <li>Martín Pérez</li>
  347. </ul>
  348. </section1>
  349. </xep>