|
@@ -32,6 +32,7 @@ import SpeakerStatsCollector from './modules/statistics/SpeakerStatsCollector';
|
32
|
32
|
import Statistics from './modules/statistics/statistics';
|
33
|
33
|
import Transcriber from './modules/transcription/transcriber';
|
34
|
34
|
import GlobalOnErrorHandler from './modules/util/GlobalOnErrorHandler';
|
|
35
|
+import RandomUtil from './modules/util/RandomUtil';
|
35
|
36
|
import ComponentsVersions from './modules/version/ComponentsVersions';
|
36
|
37
|
import VideoSIPGW from './modules/videosipgw/VideoSIPGW';
|
37
|
38
|
import * as VideoSIPGWConstants from './modules/videosipgw/VideoSIPGWConstants';
|
|
@@ -222,6 +223,43 @@ export default function JitsiConference(options) {
|
222
|
223
|
// FIXME convert JitsiConference to ES6 - ASAP !
|
223
|
224
|
JitsiConference.prototype.constructor = JitsiConference;
|
224
|
225
|
|
|
226
|
+/**
|
|
227
|
+ * Create a resource for the a jid. We use the room nickname (the resource part
|
|
228
|
+ * of the occupant JID, see XEP-0045) as the endpoint ID in colibri. We require
|
|
229
|
+ * endpoint IDs to be 8 hex digits because in some cases they get serialized
|
|
230
|
+ * into a 32bit field.
|
|
231
|
+ *
|
|
232
|
+ * @param {string} jid - The id set onto the XMPP connection.
|
|
233
|
+ * @param {boolean} isAuthenticatedUser - Whether or not the user has connected
|
|
234
|
+ * to the XMPP service with a password.
|
|
235
|
+ * @returns {string}
|
|
236
|
+ * @static
|
|
237
|
+ */
|
|
238
|
+JitsiConference.resourceCreator = function(jid, isAuthenticatedUser) {
|
|
239
|
+ let mucNickname;
|
|
240
|
+
|
|
241
|
+ if (isAuthenticatedUser) {
|
|
242
|
+ // For authenticated users generate a random ID.
|
|
243
|
+ mucNickname = RandomUtil.randomHexString(8).toLowerCase();
|
|
244
|
+ } else {
|
|
245
|
+ // We try to use the first part of the node (which for anonymous users
|
|
246
|
+ // on prosody is a UUID) to match the previous behavior (and maybe make
|
|
247
|
+ // debugging easier).
|
|
248
|
+ mucNickname = Strophe.getNodeFromJid(jid).substr(0, 8)
|
|
249
|
+ .toLowerCase();
|
|
250
|
+
|
|
251
|
+ // But if this doesn't have the required format we just generate a new
|
|
252
|
+ // random nickname.
|
|
253
|
+ const re = /[0-9a-f]{8}/g;
|
|
254
|
+
|
|
255
|
+ if (!re.test(mucNickname)) {
|
|
256
|
+ mucNickname = RandomUtil.randomHexString(8).toLowerCase();
|
|
257
|
+ }
|
|
258
|
+ }
|
|
259
|
+
|
|
260
|
+ return mucNickname;
|
|
261
|
+};
|
|
262
|
+
|
225
|
263
|
/**
|
226
|
264
|
* Initializes the conference object properties
|
227
|
265
|
* @param options {object}
|
|
@@ -240,7 +278,11 @@ JitsiConference.prototype._init = function(options = {}) {
|
240
|
278
|
|
241
|
279
|
const { config } = this.options;
|
242
|
280
|
|
243
|
|
- this.room = this.xmpp.createRoom(this.options.name, config);
|
|
281
|
+ this.room = this.xmpp.createRoom(
|
|
282
|
+ this.options.name,
|
|
283
|
+ config,
|
|
284
|
+ JitsiConference.resourceCreator
|
|
285
|
+ );
|
244
|
286
|
|
245
|
287
|
// Connection interrupted/restored listeners
|
246
|
288
|
this._onIceConnectionInterrupted
|
|
@@ -364,8 +406,11 @@ JitsiConference.prototype.join = function(password) {
|
364
|
406
|
* and (2) has a <tt>cancel</tt> method that allows the caller to interrupt the
|
365
|
407
|
* process.
|
366
|
408
|
*/
|
367
|
|
-JitsiConference.prototype.authenticateAndUpgradeRole = function(...args) {
|
368
|
|
- return authenticateAndUpgradeRole.apply(this, args);
|
|
409
|
+JitsiConference.prototype.authenticateAndUpgradeRole = function(options) {
|
|
410
|
+ return authenticateAndUpgradeRole.call(this, {
|
|
411
|
+ ...options,
|
|
412
|
+ onCreateResource: JitsiConference.resourceCreator
|
|
413
|
+ });
|
369
|
414
|
};
|
370
|
415
|
|
371
|
416
|
/**
|