|
@@ -54,17 +54,16 @@ function ColibriFocus(connection, bridgejid) {
|
54
|
54
|
* Default channel expire value in seconds.
|
55
|
55
|
* @type {number}
|
56
|
56
|
*/
|
57
|
|
- this.channelExpire = 60;
|
|
57
|
+ this.channelExpire
|
|
58
|
+ = ('number' === typeof(config.channelExpire))
|
|
59
|
+ ? config.channelExpire
|
|
60
|
+ : 15;
|
58
|
61
|
|
59
|
62
|
// media types of the conference
|
60
|
63
|
if (config.openSctp)
|
61
|
|
- {
|
62
|
64
|
this.media = ['audio', 'video', 'data'];
|
63
|
|
- }
|
64
|
65
|
else
|
65
|
|
- {
|
66
|
66
|
this.media = ['audio', 'video'];
|
67
|
|
- }
|
68
|
67
|
|
69
|
68
|
this.connection.jingle.sessions[this.sid] = this;
|
70
|
69
|
this.mychannel = [];
|
|
@@ -202,29 +201,38 @@ ColibriFocus.prototype._makeConference = function () {
|
202
|
201
|
elem.c('conference', {xmlns: 'http://jitsi.org/protocol/colibri'});
|
203
|
202
|
|
204
|
203
|
this.media.forEach(function (name) {
|
205
|
|
- var isData = name === 'data';
|
206
|
|
- var channel = isData ? 'sctpconnection' : 'channel';
|
|
204
|
+ var elemName;
|
|
205
|
+ var elemAttrs = { initiator: 'true', expire: self.channelExpire };
|
|
206
|
+
|
|
207
|
+ if ('data' === name)
|
|
208
|
+ {
|
|
209
|
+ elemName = 'sctpconnection';
|
|
210
|
+ elemAttrs['port'] = 5000;
|
|
211
|
+ }
|
|
212
|
+ else
|
|
213
|
+ {
|
|
214
|
+ elemName = 'channel';
|
|
215
|
+ if ('video' === name)
|
|
216
|
+ {
|
|
217
|
+ // last-n
|
|
218
|
+ var lastN = config.channelLastN;
|
|
219
|
+ if ('undefined' !== typeof(lastN))
|
|
220
|
+ elemAttrs['last-n'] = lastN;
|
|
221
|
+ }
|
|
222
|
+ }
|
207
|
223
|
|
208
|
224
|
elem.c('content', {name: name});
|
209
|
225
|
|
210
|
|
- elem.c(channel, {
|
211
|
|
- initiator: 'true',
|
212
|
|
- expire: '15',
|
213
|
|
- endpoint: self.myMucResource
|
214
|
|
- });
|
215
|
|
- if (isData)
|
216
|
|
- elem.attrs({port: 5000});
|
217
|
|
- elem.up();// end of channel
|
|
226
|
+ elem.c(elemName, elemAttrs);
|
|
227
|
+ elem.attrs({ endpoint: self.myMucResource });
|
|
228
|
+ elem.up();// end of channel/sctpconnection
|
218
|
229
|
|
219
|
230
|
for (var j = 0; j < self.peers.length; j++) {
|
220
|
|
- elem.c(channel, {
|
221
|
|
- initiator: 'true',
|
222
|
|
- expire: '15',
|
223
|
|
- endpoint: self.peers[j].substr(1 + self.peers[j].lastIndexOf('/'))
|
224
|
|
- });
|
225
|
|
- if (isData)
|
226
|
|
- elem.attrs({port: 5000});
|
227
|
|
- elem.up(); // end of channel
|
|
231
|
+ var peer = self.peers[j];
|
|
232
|
+
|
|
233
|
+ elem.c(elemName, elemAttrs);
|
|
234
|
+ elem.attrs({ endpoint: peer.substr(1 + peer.lastIndexOf('/')) });
|
|
235
|
+ elem.up(); // end of channel/sctpconnection
|
228
|
236
|
}
|
229
|
237
|
elem.up(); // end of content
|
230
|
238
|
});
|
|
@@ -233,7 +241,7 @@ ColibriFocus.prototype._makeConference = function () {
|
233
|
241
|
localSDP.media.forEach(function (media, channel) {
|
234
|
242
|
var name = SDPUtil.parse_mline(media.split('\r\n')[0]).media;
|
235
|
243
|
elem.c('content', {name: name});
|
236
|
|
- elem.c('channel', {initiator: 'false', expire: '15'});
|
|
244
|
+ elem.c('channel', {initiator: 'false', expire: self.channelExpire});
|
237
|
245
|
|
238
|
246
|
// FIXME: should reuse code from .toJingle
|
239
|
247
|
var mline = SDPUtil.parse_mline(media.split('\r\n')[0]);
|
|
@@ -247,7 +255,7 @@ ColibriFocus.prototype._makeConference = function () {
|
247
|
255
|
|
248
|
256
|
elem.up(); // end of channel
|
249
|
257
|
for (j = 0; j < self.peers.length; j++) {
|
250
|
|
- elem.c('channel', {initiator: 'true', expire:'15' }).up();
|
|
258
|
+ elem.c('channel', {initiator: 'true', expire: self.channelExpire }).up();
|
251
|
259
|
}
|
252
|
260
|
elem.up(); // end of content
|
253
|
261
|
});
|
|
@@ -662,24 +670,33 @@ ColibriFocus.prototype.addNewParticipant = function (peer) {
|
662
|
670
|
var localSDP = new SDP(this.peerconnection.localDescription.sdp);
|
663
|
671
|
localSDP.media.forEach(function (media, channel) {
|
664
|
672
|
var name = SDPUtil.parse_mid(SDPUtil.find_line(media, 'a=mid:'));
|
665
|
|
- elem.c('content', {name: name});
|
666
|
|
- if (name !== 'data')
|
667
|
|
- {
|
668
|
|
- elem.c('channel', {
|
|
673
|
+ var elemName;
|
|
674
|
+ var elemAttrs
|
|
675
|
+ = {
|
669
|
676
|
initiator: 'true',
|
670
|
677
|
expire: self.channelExpire,
|
671
|
678
|
endpoint: peer.substr(1 + peer.lastIndexOf('/'))
|
672
|
|
- });
|
|
679
|
+ };
|
|
680
|
+
|
|
681
|
+ if ('data' == name)
|
|
682
|
+ {
|
|
683
|
+ elemName = 'sctpconnection';
|
|
684
|
+ elemAttrs['port'] = 5000;
|
673
|
685
|
}
|
674
|
686
|
else
|
675
|
687
|
{
|
676
|
|
- elem.c('sctpconnection', {
|
677
|
|
- endpoint: peer.substr(1 + peer.lastIndexOf('/')),
|
678
|
|
- initiator: 'true',
|
679
|
|
- expire: self.channelExpire,
|
680
|
|
- port: 5000
|
681
|
|
- });
|
|
688
|
+ elemName = 'channel';
|
|
689
|
+ if ('video' === name)
|
|
690
|
+ {
|
|
691
|
+ // last-n
|
|
692
|
+ var lastN = config.channelLastN;
|
|
693
|
+ if ('undefined' !== typeof(lastN))
|
|
694
|
+ elemAttrs['last-n'] = lastN;
|
|
695
|
+ }
|
682
|
696
|
}
|
|
697
|
+
|
|
698
|
+ elem.c('content', {name: name});
|
|
699
|
+ elem.c(elemName, elemAttrs);
|
683
|
700
|
elem.up(); // end of channel/sctpconnection
|
684
|
701
|
elem.up(); // end of content
|
685
|
702
|
});
|
|
@@ -1186,4 +1203,5 @@ ColibriFocus.prototype.setRTCPTerminationStrategy = function (strategyFQN) {
|
1186
|
1203
|
console.error('got error', err);
|
1187
|
1204
|
}
|
1188
|
1205
|
);
|
|
1206
|
+};
|
1189
|
1207
|
|