Uses the type of the turn coming from the server turn or turns.

This commit is contained in:
Damian Minkov 2014-08-29 16:03:04 +03:00
parent 9d98b3a29e
commit d148161a42
1 changed files with 4 additions and 2 deletions

View File

@ -253,7 +253,8 @@ Strophe.addConnectionPlugin('jingle', {
$(res).find('>services>service').each(function (idx, el) {
el = $(el);
var dict = {};
switch (el.attr('type')) {
var type = el.attr('type');
switch (type) {
case 'stun':
dict.url = 'stun:' + el.attr('host');
if (el.attr('port')) {
@ -262,7 +263,8 @@ Strophe.addConnectionPlugin('jingle', {
iceservers.push(dict);
break;
case 'turn':
dict.url = 'turn:';
case 'turns':
dict.url = type + ':';
if (el.attr('username')) { // https://code.google.com/p/webrtc/issues/detail?id=1508
if (navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./) && parseInt(navigator.userAgent.match(/Chrom(e|ium)\/([0-9]+)\./)[2], 10) < 28) {
dict.url += el.attr('username') + '@';