|
@@ -179,24 +179,6 @@ SDP.prototype.toJingle = function (elem, thecreator) {
|
179
|
179
|
bundle.splice(bundle.indexOf(mid), 1);
|
180
|
180
|
}
|
181
|
181
|
}
|
182
|
|
- // Sctp
|
183
|
|
- if (SDPUtil.find_line(this.media[i], 'a=sctpmap:').length)
|
184
|
|
- {
|
185
|
|
- for (j = 0; j < mline.fmt.length; j++)
|
186
|
|
- {
|
187
|
|
- var sctpmap = SDPUtil.find_line(
|
188
|
|
- this.media[i], 'a=sctpmap:' + mline.fmt[j]);
|
189
|
|
- if (sctpmap)
|
190
|
|
- {
|
191
|
|
- elem.c('sctp',
|
192
|
|
- {
|
193
|
|
- xmlns: 'http://jitsi.org/ns/sctp',
|
194
|
|
- port : SDPUtil.parse_sctpmap(sctpmap)
|
195
|
|
- });
|
196
|
|
- elem.up();
|
197
|
|
- }
|
198
|
|
- }
|
199
|
|
- }
|
200
|
182
|
|
201
|
183
|
if (SDPUtil.find_line(this.media[i], 'a=rtpmap:').length)
|
202
|
184
|
{
|
|
@@ -327,6 +309,26 @@ SDP.prototype.TransportToJingle = function (mediaindex, elem) {
|
327
|
309
|
var self = this;
|
328
|
310
|
elem.c('transport');
|
329
|
311
|
|
|
312
|
+ // XEP-0343 DTLS/SCTP
|
|
313
|
+ if (SDPUtil.find_line(this.media[mediaindex], 'a=sctpmap:').length)
|
|
314
|
+ {
|
|
315
|
+ var sctpmap = SDPUtil.find_line(
|
|
316
|
+ this.media[i], 'a=sctpmap:', self.session);
|
|
317
|
+ if (sctpmap)
|
|
318
|
+ {
|
|
319
|
+ var sctpAttrs = SDPUtil.parse_sctpmap(sctpmap);
|
|
320
|
+ elem.c('sctpmap',
|
|
321
|
+ {
|
|
322
|
+ xmlns: 'urn:xmpp:jingle:transports:dtls-sctp:1',
|
|
323
|
+ number: sctpAttrs[0], /* SCTP port */
|
|
324
|
+ protocol: sctpAttrs[1], /* protocol */
|
|
325
|
+ });
|
|
326
|
+ // Optional stream count attribute
|
|
327
|
+ if (sctpAttrs.length > 2)
|
|
328
|
+ elem.attrs({ streams: sctpAttrs[2]});
|
|
329
|
+ elem.up();
|
|
330
|
+ }
|
|
331
|
+ }
|
330
|
332
|
// XEP-0320
|
331
|
333
|
var fingerprints = SDPUtil.find_lines(this.media[mediaindex], 'a=fingerprint:', this.session);
|
332
|
334
|
fingerprints.forEach(function(line) {
|
|
@@ -461,11 +463,8 @@ SDP.prototype.jingle2media = function (content) {
|
461
|
463
|
ssrc = desc.attr('ssrc'),
|
462
|
464
|
self = this,
|
463
|
465
|
tmp;
|
464
|
|
- var sctp = null;
|
465
|
|
- if (!desc.length)
|
466
|
|
- {
|
467
|
|
- sctp = content.find('sctp');
|
468
|
|
- }
|
|
466
|
+ var sctp = content.find(
|
|
467
|
+ '>transport>sctpmap[xmlns="urn:xmpp:jingle:transports:dtls-sctp:1"]');
|
469
|
468
|
|
470
|
469
|
tmp = { media: desc.attr('media') };
|
471
|
470
|
tmp.port = '1';
|
|
@@ -474,14 +473,14 @@ SDP.prototype.jingle2media = function (content) {
|
474
|
473
|
tmp.port = '0';
|
475
|
474
|
}
|
476
|
475
|
if (content.find('>transport>fingerprint').length || desc.find('encryption').length) {
|
477
|
|
- if (sctp)
|
|
476
|
+ if (sctp.length)
|
478
|
477
|
tmp.proto = 'DTLS/SCTP';
|
479
|
478
|
else
|
480
|
479
|
tmp.proto = 'RTP/SAVPF';
|
481
|
480
|
} else {
|
482
|
481
|
tmp.proto = 'RTP/AVPF';
|
483
|
482
|
}
|
484
|
|
- if (!sctp)
|
|
483
|
+ if (!sctp.length)
|
485
|
484
|
{
|
486
|
485
|
tmp.fmt = desc.find('payload-type').map(
|
487
|
486
|
function () { return this.getAttribute('id'); }).get();
|
|
@@ -489,12 +488,19 @@ SDP.prototype.jingle2media = function (content) {
|
489
|
488
|
}
|
490
|
489
|
else
|
491
|
490
|
{
|
492
|
|
- media += 'm=application 1 DTLS/SCTP ' + sctp.attr('port') + '\r\n';
|
493
|
|
- media += 'a=sctpmap:' + sctp.attr('port') + ' webrtc-datachannel\r\n';
|
|
491
|
+ media += 'm=application 1 DTLS/SCTP ' + sctp.attr('number') + '\r\n';
|
|
492
|
+ media += 'a=sctpmap:' + sctp.attr('number') +
|
|
493
|
+ ' ' + sctp.attr('protocol');
|
|
494
|
+
|
|
495
|
+ var streamCount = sctp.attr('streams');
|
|
496
|
+ if (streamCount)
|
|
497
|
+ media += ' ' + streamCount + '\r\n';
|
|
498
|
+ else
|
|
499
|
+ media += '\r\n';
|
494
|
500
|
}
|
495
|
501
|
|
496
|
502
|
media += 'c=IN IP4 0.0.0.0\r\n';
|
497
|
|
- if (!sctp)
|
|
503
|
+ if (!sctp.length)
|
498
|
504
|
media += 'a=rtcp:1 IN IP4 0.0.0.0\r\n';
|
499
|
505
|
tmp = content.find('>transport[xmlns="urn:xmpp:jingle:transports:ice-udp:1"]');
|
500
|
506
|
if (tmp.length) {
|