From 6113113af9a9fa9a41aa41726545c715bbff0666 Mon Sep 17 00:00:00 2001
From: Mario Jr <mariogasparoni@gmail.com>
Date: Fri, 11 Dec 2020 00:31:10 -0300
Subject: [PATCH] Add option to disable traceSip logs

Audio client logs already cover audio session progress the way we need.
This avoids keepAlive and other unnecessary messages to be logged in browser's console.
If setting is not present, default value is set to false.
---
 bigbluebutton-html5/imports/api/audio/client/bridge/sip.js | 2 ++
 bigbluebutton-html5/private/config/settings.yml            | 2 ++
 2 files changed, 4 insertions(+)

diff --git a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js
index be47da7855..6c73ed582f 100755
--- a/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js
+++ b/bigbluebutton-html5/imports/api/audio/client/bridge/sip.js
@@ -35,6 +35,7 @@ const ICE_GATHERING_TIMEOUT = MEDIA.iceGatheringTimeout || 5000;
 const BRIDGE_NAME = 'sip';
 const WEBSOCKET_KEEP_ALIVE_INTERVAL = MEDIA.websocketKeepAliveInterval || 0;
 const WEBSOCKET_KEEP_ALIVE_DEBOUNCE = MEDIA.websocketKeepAliveDebounce || 10;
+const TRACE_SIP = MEDIA.traceSip || false;
 
 const getAudioSessionNumber = () => {
   let currItem = parseInt(sessionStorage.getItem(AUDIO_SESSION_NUM_KEY), 10);
@@ -372,6 +373,7 @@ class SIPSession {
           connectionTimeout: USER_AGENT_CONNECTION_TIMEOUT_MS,
           keepAliveInterval: WEBSOCKET_KEEP_ALIVE_INTERVAL,
           keepAliveDebounce: WEBSOCKET_KEEP_ALIVE_DEBOUNCE,
+          traceSip: TRACE_SIP,
         },
         sessionDescriptionHandlerFactoryOptions: {
           peerConnectionConfiguration: {
diff --git a/bigbluebutton-html5/private/config/settings.yml b/bigbluebutton-html5/private/config/settings.yml
index a44fbc7abb..27c43d077c 100755
--- a/bigbluebutton-html5/private/config/settings.yml
+++ b/bigbluebutton-html5/private/config/settings.yml
@@ -301,6 +301,8 @@ public:
     #Debounce time (seconds) for sending SIP.js's websocket keep alive message.
     #If not set, default value is 10.
     websocketKeepAliveDebounce: 10
+    #Trace sip/audio messages in browser. If not set, default value is false.
+    traceSip: false
   presentation:
     defaultPresentationFile: default.pdf
     panZoomThrottle: 32
-- 
GitLab