From 4016dc25feb66c1ea46249b707ce36dc84451570 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Wed, 17 Jun 2020 16:48:57 +0200 Subject: [PATCH] fix loopback mode more see comments in #666, #657 was wrong --- src/web_app/js/loopback.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/web_app/js/loopback.js b/src/web_app/js/loopback.js index 2e1ab95ad..58a2cdc06 100644 --- a/src/web_app/js/loopback.js +++ b/src/web_app/js/loopback.js @@ -61,19 +61,17 @@ function setupLoopback(wssUrl, roomId) { return; } if (message.type === 'offer') { - var loopbackAnswer = wssMessage.msg; - loopbackAnswer = loopbackAnswer.replace('"offer"', '"answer"'); - loopbackAnswer = - loopbackAnswer.replace('a=ice-options:google-ice\\r\\n', ''); + message.type = 'answer'; + message.sdp = message.sdp + .replace('a=ice-options:google-ice\r\n', '') // As of Chrome M51, an additional crypto method has been added when // using SDES. This works in a P2P due to the negotiation phase removes // this line but for loopback where we reuse the offer, that is skipped // and remains in the answer and breaks the call. // https://bugs.chromium.org/p/chromium/issues/detail?id=616263 // https://bugs.chromium.org/p/chromium/issues/detail?id=1077740 - loopbackAnswer = loopbackAnswer - .replace(/a=crypto:[1-9]+ .*/g, ''); - sendLoopbackMessage(JSON.parse(loopbackAnswer)); + .replace(/a=crypto:[1-9]+ .*\r\n/g, ''); + sendLoopbackMessage(message); } else if (message.type === 'candidate') { sendLoopbackMessage(message); }