|
@@ -21,7 +21,7 @@ function createExpBackoffTimer(step) {
|
21
|
21
|
};
|
22
|
22
|
}
|
23
|
23
|
|
24
|
|
-function Moderator(roomName, xmpp, emitter, settings) {
|
|
24
|
+function Moderator(roomName, xmpp, emitter, settings, options) {
|
25
|
25
|
this.roomName = roomName;
|
26
|
26
|
this.xmppService = xmpp;
|
27
|
27
|
this.getNextTimeout = createExpBackoffTimer(1000);
|
|
@@ -29,11 +29,13 @@ function Moderator(roomName, xmpp, emitter, settings) {
|
29
|
29
|
// External authentication stuff
|
30
|
30
|
this.externalAuthEnabled = false;
|
31
|
31
|
this.settings = settings;
|
|
32
|
+ this.options = options;
|
|
33
|
+
|
32
|
34
|
// Sip gateway can be enabled by configuring Jigasi host in config.js or
|
33
|
35
|
// it will be enabled automatically if focus detects the component through
|
34
|
36
|
// service discovery.
|
35
|
|
- this.sipGatewayEnabled = this.xmppService.options.hosts &&
|
36
|
|
- this.xmppService.options.hosts.call_control !== undefined;
|
|
37
|
+ this.sipGatewayEnabled = this.options.connection.hosts &&
|
|
38
|
+ this.options.connection.hosts.call_control !== undefined;
|
37
|
39
|
|
38
|
40
|
this.eventEmitter = emitter;
|
39
|
41
|
|
|
@@ -94,10 +96,10 @@ Moderator.prototype.getFocusUserJid = function () {
|
94
|
96
|
|
95
|
97
|
Moderator.prototype.getFocusComponent = function () {
|
96
|
98
|
// Get focus component address
|
97
|
|
- var focusComponent = this.xmppService.options.hosts.focus;
|
|
99
|
+ var focusComponent = this.options.connection.hosts.focus;
|
98
|
100
|
// If not specified use default: 'focus.domain'
|
99
|
101
|
if (!focusComponent) {
|
100
|
|
- focusComponent = 'focus.' + this.xmppService.options.hosts.domain;
|
|
102
|
+ focusComponent = 'focus.' + this.options.connection.hosts.domain;
|
101
|
103
|
}
|
102
|
104
|
return focusComponent;
|
103
|
105
|
};
|
|
@@ -109,7 +111,6 @@ Moderator.prototype.createConferenceIq = function () {
|
109
|
111
|
// Session Id used for authentication
|
110
|
112
|
var sessionId = this.settings.getSessionId();
|
111
|
113
|
var machineUID = this.settings.getUserId();
|
112
|
|
- var options = this.xmppService.options;
|
113
|
114
|
|
114
|
115
|
logger.info(
|
115
|
116
|
"Session ID: " + sessionId + " machine UID: " + machineUID);
|
|
@@ -123,48 +124,49 @@ Moderator.prototype.createConferenceIq = function () {
|
123
|
124
|
if (sessionId) {
|
124
|
125
|
elem.attrs({ 'session-id': sessionId});
|
125
|
126
|
}
|
126
|
|
- if (options.hosts !== undefined && options.hosts.bridge !== undefined) {
|
|
127
|
+ if (this.options.connection.hosts !== undefined
|
|
128
|
+ && this.options.connection.hosts.bridge !== undefined) {
|
127
|
129
|
elem.c(
|
128
|
130
|
'property', {
|
129
|
131
|
name: 'bridge',
|
130
|
|
- value: options.hosts.bridge
|
|
132
|
+ value: this.options.connection.hosts.bridge
|
131
|
133
|
}).up();
|
132
|
134
|
}
|
133
|
|
- if (options.enforcedBridge !== undefined) {
|
|
135
|
+ if (this.options.connection.enforcedBridge !== undefined) {
|
134
|
136
|
elem.c(
|
135
|
137
|
'property', {
|
136
|
138
|
name: 'enforcedBridge',
|
137
|
|
- value: options.enforcedBridge
|
|
139
|
+ value: this.options.connection.enforcedBridge
|
138
|
140
|
}).up();
|
139
|
141
|
}
|
140
|
142
|
// Tell the focus we have Jigasi configured
|
141
|
|
- if (options.hosts !== undefined &&
|
142
|
|
- options.hosts.call_control !== undefined) {
|
|
143
|
+ if (this.options.connection.hosts !== undefined &&
|
|
144
|
+ this.options.connection.hosts.call_control !== undefined) {
|
143
|
145
|
elem.c(
|
144
|
146
|
'property', {
|
145
|
147
|
name: 'call_control',
|
146
|
|
- value: options.hosts.call_control
|
|
148
|
+ value: this.options.connection.hosts.call_control
|
147
|
149
|
}).up();
|
148
|
150
|
}
|
149
|
|
- if (options.channelLastN !== undefined) {
|
|
151
|
+ if (this.options.conference.channelLastN !== undefined) {
|
150
|
152
|
elem.c(
|
151
|
153
|
'property', {
|
152
|
154
|
name: 'channelLastN',
|
153
|
|
- value: options.channelLastN
|
|
155
|
+ value: this.options.conference.channelLastN
|
154
|
156
|
}).up();
|
155
|
157
|
}
|
156
|
|
- if (options.adaptiveLastN !== undefined) {
|
|
158
|
+ if (this.options.conference.adaptiveLastN !== undefined) {
|
157
|
159
|
elem.c(
|
158
|
160
|
'property', {
|
159
|
161
|
name: 'adaptiveLastN',
|
160
|
|
- value: options.adaptiveLastN
|
|
162
|
+ value: this.options.conference.adaptiveLastN
|
161
|
163
|
}).up();
|
162
|
164
|
}
|
163
|
|
- if (options.disableAdaptiveSimulcast !== undefined ||
|
164
|
|
- options.disableSimulcast) {
|
|
165
|
+ if (this.options.conference.disableAdaptiveSimulcast !== undefined ||
|
|
166
|
+ this.options.conference.disableSimulcast) {
|
165
|
167
|
// disableSimulcast implies disableAdaptiveSimulcast.
|
166
|
|
- var value = options.disableSimulcast ? true :
|
167
|
|
- options.disableAdaptiveSimulcast;
|
|
168
|
+ var value = this.options.conference.disableSimulcast ? true :
|
|
169
|
+ this.options.conference.disableAdaptiveSimulcast;
|
168
|
170
|
elem.c(
|
169
|
171
|
'property', {
|
170
|
172
|
name: 'disableAdaptiveSimulcast',
|
|
@@ -172,35 +174,35 @@ Moderator.prototype.createConferenceIq = function () {
|
172
|
174
|
}).up();
|
173
|
175
|
}
|
174
|
176
|
// TODO: re-enable once rtx is stable
|
175
|
|
- //if (options.disableRtx !== undefined) {
|
|
177
|
+ //if (this.options.conference.disableRtx !== undefined) {
|
176
|
178
|
elem.c(
|
177
|
179
|
'property', {
|
178
|
180
|
name: 'disableRtx',
|
179
|
|
- //value: options.disableRtx
|
|
181
|
+ //value: this.options.conference.disableRtx
|
180
|
182
|
value: true
|
181
|
183
|
}).up();
|
182
|
184
|
//}
|
183
|
|
- if (options.openSctp !== undefined) {
|
|
185
|
+ if (this.options.conference.openSctp !== undefined) {
|
184
|
186
|
elem.c(
|
185
|
187
|
'property', {
|
186
|
188
|
name: 'openSctp',
|
187
|
|
- value: options.openSctp
|
|
189
|
+ value: this.options.conference.openSctp
|
188
|
190
|
}).up();
|
189
|
191
|
}
|
190
|
|
- if (options.startAudioMuted !== undefined)
|
|
192
|
+ if (this.options.conference.startAudioMuted !== undefined)
|
191
|
193
|
{
|
192
|
194
|
elem.c(
|
193
|
195
|
'property', {
|
194
|
196
|
name: 'startAudioMuted',
|
195
|
|
- value: options.startAudioMuted
|
|
197
|
+ value: this.options.conference.startAudioMuted
|
196
|
198
|
}).up();
|
197
|
199
|
}
|
198
|
|
- if (options.startVideoMuted !== undefined)
|
|
200
|
+ if (this.options.conference.startVideoMuted !== undefined)
|
199
|
201
|
{
|
200
|
202
|
elem.c(
|
201
|
203
|
'property', {
|
202
|
204
|
name: 'startVideoMuted',
|
203
|
|
- value: options.startVideoMuted
|
|
205
|
+ value: this.options.conference.startVideoMuted
|
204
|
206
|
}).up();
|
205
|
207
|
}
|
206
|
208
|
|
|
@@ -272,7 +274,7 @@ Moderator.prototype.parseConfigOptions = function (resultIq) {
|
272
|
274
|
*/
|
273
|
275
|
Moderator.prototype.allocateConferenceFocus = function (callback) {
|
274
|
276
|
// Try to use focus user JID from the config
|
275
|
|
- this.setFocusUserJid(this.xmppService.options.focusUserJid);
|
|
277
|
+ this.setFocusUserJid(this.options.connection.focusUserJid);
|
276
|
278
|
// Send create conference IQ
|
277
|
279
|
var self = this;
|
278
|
280
|
this.connection.sendIQ(
|
|
@@ -331,7 +333,7 @@ Moderator.prototype._allocateConferenceFocusError = function (error, callback) {
|
331
|
333
|
if ($(error).find('>error>not-authorized').length) {
|
332
|
334
|
logger.warn("Unauthorized to start the conference", error);
|
333
|
335
|
var toDomain = Strophe.getDomainFromJid(error.getAttribute('to'));
|
334
|
|
- if (toDomain !== self.xmppService.options.hosts.anonymousdomain) {
|
|
336
|
+ if (toDomain !== self.options.connection.hosts.anonymousdomain) {
|
335
|
337
|
//FIXME "is external" should come either from the focus or config.js
|
336
|
338
|
self.externalAuthEnabled = true;
|
337
|
339
|
}
|