diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js index f07188bedb..05501193b7 100644 --- a/html5/verto/js/src/jquery.FSRTC.js +++ b/html5/verto/js/src/jquery.FSRTC.js @@ -430,7 +430,8 @@ offerSDP: { type: "offer", sdp: self.remoteSDP - } + }, + turnServer: self.options.turnServer }); onStreamSuccess(self, stream); @@ -625,6 +626,7 @@ }, constraints: self.constraints, iceServers: self.options.iceServers, + turnServer: self.options.turnServer }); onStreamSuccess(self, stream); @@ -674,13 +676,15 @@ function FSRTCPeerConnection(options) { var gathering = false, done = false; var config = {}; - var default_ice = { - urls: ['stun:stun.l.google.com:19302'] - }; + var default_ice = [{ urls: ['stun:stun.l.google.com:19302'] }]; + + if (self.options.turnServer) { + default_ice.push(self.options.turnServer) + } if (options.iceServers) { if (typeof(options.iceServers) === "boolean") { - config.iceServers = [default_ice]; + config.iceServers = default_ice; } else { config.iceServers = options.iceServers; } diff --git a/html5/verto/js/src/jquery.jsonrpcclient.js b/html5/verto/js/src/jquery.jsonrpcclient.js index 702998cc58..7f5a68753a 100644 --- a/html5/verto/js/src/jquery.jsonrpcclient.js +++ b/html5/verto/js/src/jquery.jsonrpcclient.js @@ -322,6 +322,10 @@ self.options.onWSClose(self); } + if (self.ws_cnt > 10) { + self.options.socketUrl = self.options.socketFallbackUrl; + } + console.error("Websocket Lost " + self.ws_cnt + " sleep: " + self.ws_sleep + "msec"); self.to = setTimeout(function() { diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index 20befd92d6..50fda9149a 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -110,6 +110,8 @@ login: verto.options.login, passwd: verto.options.passwd, socketUrl: verto.options.socketUrl, + socketFallbackUrl: verto.options.socketFallbackUrl, + turnServer: verto.options.turnServer, loginParams: verto.options.loginParams, userVariables: verto.options.userVariables, sessid: verto.sessid, @@ -2076,10 +2078,11 @@ videoParams: dialog.params.videoParams, audioParams: verto.options.audioParams, iceServers: verto.options.iceServers, - screenShare: dialog.screenShare, - useCamera: dialog.useCamera, - useMic: dialog.useMic, - useSpeak: dialog.useSpeak + screenShare: dialog.screenShare, + useCamera: dialog.useCamera, + useMic: dialog.useMic, + useSpeak: dialog.useSpeak, + turnServer: verto.options.turnServer }); dialog.rtc.verto = dialog.verto; diff --git a/html5/verto/verto_communicator/src/config.json.sample b/html5/verto/verto_communicator/src/config.json.sample index a905c6161d..ae044c8e1c 100644 --- a/html5/verto/verto_communicator/src/config.json.sample +++ b/html5/verto/verto_communicator/src/config.json.sample @@ -9,5 +9,11 @@ "autologin": "true", "autocall": "3500", "googlelogin": "true", - "wsURL": "wss://gamma.tollfreegateway.com/wss2" + "wsURL": "wss://gamma.tollfreegateway.com/wss2", + "socketFallbackUrl": "wss://gamma.tollfreegateway.com/wss2", + "turnServer": { + "urls": "turn:someturnserver.com:443?transport=tcp", + "credential": "1234", + "username": "username" + } } diff --git a/html5/verto/verto_communicator/src/vertoService/services/configService.js b/html5/verto/verto_communicator/src/vertoService/services/configService.js index 9fd789e81f..05b0b2cbe8 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/configService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/configService.js @@ -41,6 +41,14 @@ vertoService.service('config', ['$rootScope', '$http', '$location', 'storage', ' verto.data.googleclientid = data.googleclientid; } + if (data.wsFallbackURL) { + verto.data.wsFallbackURL = data.wsFallbackURL; + } + + if (data.turnServer) { + verto.data.turnServer = data.turnServer; + } + angular.extend(verto.data, data); /** diff --git a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js index 808aba539c..b885f47154 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js @@ -175,6 +175,8 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora password: $cookieStore.get('verto_demo_passwd') || "1234", hostname: window.location.hostname, wsURL: ("wss://" + window.location.hostname + ":8082"), + socketFallbackUrl: null, + turnServer: null, resCheckEnded: false }; @@ -733,6 +735,8 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora login: data.login + '@' + data.hostname, passwd: data.password, socketUrl: data.wsURL, + socketFallbackUrl: data.socketFallbackUrl, + turnServer: data.turnServer, tag: "webcam", ringFile: "sounds/bell_ring2.wav", audioParams: {