diff --git a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js index 382e52aca3b14e87261b15bce0b92d37ed78a07f..0ce2c76a243d8387f63bd605ef4730454724feb7 100755 --- a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js +++ b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js @@ -11,19 +11,22 @@ const MEDIA_TAG = MEDIA.mediaTag; const CALL_TRANSFER_TIMEOUT = MEDIA.callTransferTimeout; const CALL_HANGUP_TIMEOUT = MEDIA.callHangupTimeout; const CALL_HANGUP_MAX_RETRIES = MEDIA.callHangupMaximumRetries; +const RELAY_ONLY_ON_RECONNECT = MEDIA.relayOnlyOnReconnect; const IPV4_FALLBACK_DOMAIN = Meteor.settings.public.app.ipv4FallbackDomain; const ICE_NEGOTIATION_FAILED = ['iceConnectionFailed']; const CALL_CONNECT_TIMEOUT = 15000; const ICE_NEGOTIATION_TIMEOUT = 20000; class SIPSession { - constructor(user, userData, protocol, hostname, baseCallStates, baseErrorCodes) { + constructor(user, userData, protocol, hostname, + baseCallStates, baseErrorCodes, reconnectAttempt) { this.user = user; this.userData = userData; this.protocol = protocol; this.hostname = hostname; this.baseCallStates = baseCallStates; this.baseErrorCodes = baseErrorCodes; + this.reconnectAttempt = reconnectAttempt; } static parseDTMF(message) { @@ -216,6 +219,7 @@ class SIPSession { turnServers: turn, hackPlanBUnifiedPlanTranslation: isSafari, hackAddAudioTransceiver: isSafariWebview, + relayOnlyOnReconnect: this.reconnectAttempt && RELAY_ONLY_ON_RECONNECT, }); const handleUserAgentConnection = () => { @@ -479,7 +483,7 @@ export default class SIPBridge extends BaseAudioBridge { let { hostname } = this; this.activeSession = new SIPSession(this.user, this.userData, this.protocol, - hostname, this.baseCallStates, this.baseErrorCodes); + hostname, this.baseCallStates, this.baseErrorCodes, false); const callback = (message) => { if (message.status === this.baseCallStates.failed) { @@ -503,7 +507,7 @@ export default class SIPBridge extends BaseAudioBridge { if (shouldTryReconnect) { const fallbackExtension = this.activeSession.inEchoTest ? extension : undefined; this.activeSession = new SIPSession(this.user, this.userData, this.protocol, - hostname, this.baseCallStates, this.baseErrorCodes); + hostname, this.baseCallStates, this.baseErrorCodes, true); this.activeSession.joinAudio({ isListenOnly, extension: fallbackExtension, inputStream }, callback) .then((value) => { resolve(value); diff --git a/bigbluebutton-html5/private/config/settings.yml b/bigbluebutton-html5/private/config/settings.yml index c562cc30b08656460d3084ebb4d7957f00a0f8e8..f361b4b74cf81310f99ca5e9f572592bc03ec235 100755 --- a/bigbluebutton-html5/private/config/settings.yml +++ b/bigbluebutton-html5/private/config/settings.yml @@ -172,6 +172,7 @@ public: callHangupTimeout: 2000 callHangupMaximumRetries: 10 echoTestNumber: '9196' + relayOnlyOnReconnect: true presentation: defaultPresentationFile: default.pdf panZoomThrottle: 32 diff --git a/bigbluebutton-html5/public/compatibility/sip.js b/bigbluebutton-html5/public/compatibility/sip.js index ddea0ad180f227fc59abe81bb7528f70ba60df18..c898a47e6e407c8171a4da7aefde347f9a9db1d1 100755 --- a/bigbluebutton-html5/public/compatibility/sip.js +++ b/bigbluebutton-html5/public/compatibility/sip.js @@ -9569,6 +9569,7 @@ UA.prototype.loadConfig = function(configuration) { hackStripTcp: false, hackPlanBUnifiedPlanTranslation: false, hackAddAudioTransceiver: false, + relayOnlyOnReconnect: false, contactTransport: 'ws', forceRport: false, @@ -9965,6 +9966,12 @@ UA.prototype.getConfigurationCheck = function () { } }, + relayOnlyOnReconnect: function(relayOnlyOnReconnect) { + if (typeof relayOnlyOnReconnect === 'boolean') { + return relayOnlyOnReconnect; + } + }, + forceRport: function(forceRport) { if (typeof forceRport === 'boolean') { return forceRport; @@ -11476,6 +11483,10 @@ MediaHandler.prototype = Object.create(SIP.MediaHandler.prototype, { sdpSemantics:'plan-b' }; + if (config.relayOnlyOnReconnect) { + connConfig.iceTransportPolicy = 'relay'; + } + if (config.rtcpMuxPolicy) { connConfig.rtcpMuxPolicy = config.rtcpMuxPolicy; }