├── .gitignore ├── .gitpod.yml ├── package.json ├── LICENSE ├── bin ├── index.js └── utils │ └── optimize.sh ├── example-env ├── README.md └── README.md.old /.gitignore: -------------------------------------------------------------------------------- 1 | apply-config.sh 2 | node_modules 3 | env-test -------------------------------------------------------------------------------- /.gitpod.yml: -------------------------------------------------------------------------------- 1 | # This configuration file was automatically generated by Gitpod. 2 | # Please adjust to your needs (see https://www.gitpod.io/docs/config-gitpod-file) 3 | # and commit this file to your remote git repository to share the goodness with others. 4 | 5 | tasks: 6 | - init: npm install 7 | 8 | 9 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "bigbluebutton-optimize", 3 | "version": "2.1.12", 4 | "description": "You can easily optimize your BigBlueButton server", 5 | "bin": { 6 | "bbb-optimize": "./bin/index.js" 7 | }, 8 | "scripts": {}, 9 | "author": { 10 | "name": "HigherEdLab.com", 11 | "email": "support@higheredlab.com", 12 | "url": "https://higheredlab.com/" 13 | }, 14 | "maintainers": [ 15 | { 16 | "name": "HigherEdLab.com", 17 | "email": "support@higheredlab.com", 18 | "url": "https://higheredlab.com/" 19 | } 20 | ], 21 | "homepage": "https://github.com/manishkatyan/bbb-optimize#readme", 22 | "repository": { 23 | "type": "git", 24 | "url": "https://github.com/manishkatyan/bbb-optimize.git" 25 | }, 26 | "dependencies": { 27 | "fs-extra": "^10.0.1", 28 | "yargs": "^17.3.1" 29 | }, 30 | "license": "MIT", 31 | "keywords": [ 32 | "optimize", 33 | "bigbluebutton-optimize", 34 | "bigbluebutton" 35 | ] 36 | } 37 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Manish Katyan 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /bin/index.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | const { spawn } = require("child_process"); 4 | const yargs = require('yargs/yargs') 5 | const { hideBin } = require('yargs/helpers'); 6 | const fs = require('fs-extra') 7 | const argv = yargs(hideBin(process.argv)).argv 8 | let PATH = '/usr/lib/node_modules/bigbluebutton-optimize' 9 | 10 | try { 11 | if( ! argv["env-file"] ){ 12 | const error = ` 13 | bbb-optimize utility. 14 | 15 | bbb-analytics [--env-file] 16 | 17 | --env-file Path of env file` 18 | console.log(error) 19 | process.exit() 20 | } 21 | 22 | if (argv["env-file"]) { 23 | excuteCmd([`${PATH}/bin/utils/optimize.sh`, fs.realpathSync( argv["env-file"])]) 24 | } 25 | 26 | } catch (error) { 27 | console.log(error) 28 | } 29 | 30 | function excuteCmd(cmd) { 31 | const runScript = spawn("bash", cmd); 32 | runScript.stdout.on("data", data => { 33 | console.log(`${data}`); 34 | }); 35 | runScript.stderr.on("data", data => { 36 | console.log(`${data}`); 37 | }); 38 | runScript.on('error', (error) => { 39 | console.log(`error: ${error.message}`); 40 | }); 41 | } -------------------------------------------------------------------------------- /example-env: -------------------------------------------------------------------------------- 1 | #Branding options 2 | #Set welcome message 3 | DEFAULT_WELCOME_MESSAGE= 4 | 5 | #set welcome message footer 6 | DEFAULT_WELCOME_MESSAGE_FOOTER= 7 | 8 | 9 | # logo that will appier in bigbluebutton; default=/var/www/bigbluebutton-default/logo.png 10 | DEFAULT_LOGO= 11 | 12 | # Favicon that will appier in bigbluebutton; default=/var/www/bigbluebutton-default/favicon.ico 13 | DEFAULT_FAVICON= 14 | 15 | # default.pdf that will appier in bigbluebutton; default=/var/www/bigbluebutton-default/default.pdf 16 | DEFAULT_PRESENTATION= 17 | 18 | #Set title and it will be set as BigBlueButton meeting tab name 19 | CLIENT_TITLE= 20 | APP_NAME= 21 | 22 | #Set copyright 23 | COPY_RIGHT= 24 | 25 | #Help link, That will appier in BigBlueButton help button 26 | HELP_LINK= 27 | 28 | #default false 29 | ALLOW_MODS_TO_UNMUTE_USERS= 30 | 31 | #If set true only moderator can see all users webcam, viewer can see only his and moderator webcam; default false 32 | WEBCAM_ONLY_FOR_MODERATOR= 33 | #Mute the session on start; default false 34 | MUTE_ON_START= 35 | #Keep the meeting events; default false 36 | DEFAULT_KEEP_EVENTS= 37 | #Set the max users that can join a single BigBlueButton session; default 0 38 | #If set to 0, There will not be any limit 39 | DEFAULT_MAX_USERS= 40 | 41 | #Allow users to join the same session using multiple devices; default false 42 | ALLOW_DUPLICATE_USER_ID= 43 | 44 | # Param to end the meeting when there are no moderators after a certain period of time. 45 | # Needed for classes where teacher gets disconnected and can't get back in. Prevents 46 | # students from running amok; default false 47 | END_WHEN_NO_MODERATOR= 48 | 49 | # Number of minutes to wait for moderator rejoin before end meeting (if `END_WHEN_NO_MODERATOR=true` ); default 2 50 | END_WHEN_NO_MODERATOR_DELAY= 51 | 52 | #Disable the recording even if record=true passed in create call; default false 53 | DISABLE_RECORDING= 54 | 55 | #Enable the shared notes; default false 56 | ENABLE_SHARED_NOTES= 57 | 58 | # Number of minutes that Learning Dashboard will be available after the end of the meeting 59 | # if 0, the Learning Dashboard will keep available permanently; default 2 60 | LEARNING_DASHBOARD_CLEANUP_DELAY= 61 | 62 | # Default duration of the meeting in minutes. If set to 0 the meeting does'nt end. 63 | #default 0 64 | MEETING_DURATION= 65 | 66 | #default value is true 67 | ENABLE_LISTEN_ONLY_MODE= 68 | 69 | #default value is false 70 | SKIP_AUDIO_CHECK=true 71 | 72 | #default value is false 73 | ENABLE_DICTATION= 74 | 75 | #Minimize the chat section on start; default value is false 76 | CHAT_START_CLOSED= 77 | 78 | #Default lock settings 79 | LOCK_PRIVATE_CHAT= 80 | LOCK_PUBLIC_CHAT= 81 | LOCK_SHARED_NOTES= 82 | LOCK_MICROPHONE= 83 | LOCK_WEBCAM= 84 | HIDE_USER_LIST= 85 | 86 | #Set the log level for bbb; possible values are: INFO, DEBUG, WARN, ERROR,; default DBUG 87 | LOG_LEVEL= 88 | 89 | #Enable mediasoup for webcam and screensharing instread of kurento 90 | ENABLE_MEDIASOUP= 91 | 92 | #Enable multiple kurento for better performance 93 | ENABLE_MULTIPLE_KURENTO= 94 | 95 | #Set the default webcam resolution as low 96 | LOWER_WEBCAM_RESOLUTION= 97 | 98 | #Enable recording optimization for ios devices 99 | OPTIMIZE_RECORDING_FOR_IOS= 100 | FIX_1007_AND_1020= 101 | 102 | #If FIX_1007_AND_1020 is set to true, the add Your bbb server PUBLIC_IP 103 | PUBLIC_IP= 104 | 105 | -------------------------------------------------------------------------------- /bin/utils/optimize.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ENV_FILE=$1 4 | 5 | set -a 6 | 7 | source <(cat $ENV_FILE | \ 8 | sed -e '/^#/d;/^\s*$/d' -e "s/'/'\\\''/g" -e "s/=\(.*\)/='\1'/g") 9 | set +a 10 | 11 | if [ ! -z "$ENABLE_MULTIPLE_KURENTO" ]; then 12 | # Pull in the helper functions for configuring BigBlueButton 13 | source /etc/bigbluebutton/bbb-conf/apply-lib.sh 14 | echo "Running three parallel Kurento media server" 15 | enableMultipleKurentos 16 | fi 17 | 18 | if [ ! -z "$DEFAULT_WELCOME_MESSAGE" ]; then 19 | echo "Setting Welcome message: $DEFAULT_WELCOME_MESSAGE" 20 | sed -i "s/defaultWelcomeMessage=.*/defaultWelcomeMessage=$DEFAULT_WELCOME_MESSAGE/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 21 | fi 22 | 23 | if [ ! -z "$DEFAULT_WELCOME_MESSAGE_FOOTER" ]; then 24 | echo "Setting Welcome message footer: $DEFAULT_WELCOME_MESSAGE_FOOTER" 25 | sed -i "s/defaultWelcomeMessageFooter=.*/defaultWelcomeMessageFooter=$DEFAULT_WELCOME_MESSAGE_FOOTER/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 26 | fi 27 | 28 | 29 | if [ ! -z "$ALLOW_MODS_TO_UNMUTE_USERS" ]; then 30 | echo "Let Moderators unmute users: $ALLOW_MODS_TO_UNMUTE_USERS" 31 | sed -i "s/allowModsToUnmuteUsers=.*/allowModsToUnmuteUsers=$ALLOW_MODS_TO_UNMUTE_USERS/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 32 | fi 33 | 34 | if [ ! -z "$WEBCAM_ONLY_FOR_MODERATOR" ]; then 35 | echo "See other viewers webcams: $WEBCAM_ONLY_FOR_MODERATOR" 36 | sed -i "s/webcamsOnlyForModerator=.*/webcamsOnlyForModerator=$WEBCAM_ONLY_FOR_MODERATOR/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 37 | fi 38 | 39 | if [ ! -z "$MUTE_ON_START" ]; then 40 | echo "Mute the class on start: $MUTE_ON_START" 41 | sed -i "s/muteOnStart=.*/muteOnStart=$MUTE_ON_START/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 42 | fi 43 | 44 | if [ ! -z "$DEFAULT_KEEP_EVENTS" ]; then 45 | echo "Saves meeting events even if the meeting is not recorded: $DEFAULT_KEEP_EVENTS" 46 | sed -i "s/defaultKeepEvents=.*/defaultKeepEvents=$DEFAULT_KEEP_EVENTS/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 47 | fi 48 | 49 | if [ ! -z "$DEFAULT_MAX_USERS" ]; then 50 | echo "Maximum users per class: $DEFAULT_MAX_USERS" 51 | sed -i "s/defaultMaxUsers=.*/defaultMaxUsers=$DEFAULT_MAX_USERS/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 52 | fi 53 | 54 | if [ ! -z "$LOCK_PRIVATE_CHAT" ]; then 55 | echo "Disable private chat:$LOCK_PRIVATE_CHAT " 56 | sed -i "s/lockSettingsDisablePrivateChat=.*/lockSettingsDisablePrivateChat=$LOCK_PRIVATE_CHAT/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 57 | fi 58 | 59 | if [ ! -z "$LOCK_PUBLIC_CHAT" ]; then 60 | echo "Disable public chat: $LOCK_PUBLIC_CHAT" 61 | sed -i "s/lockSettingsDisablePublicChat=.*/lockSettingsDisablePublicChat=$LOCK_PUBLIC_CHAT/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 62 | fi 63 | 64 | if [ ! -z "$LOCK_SHARED_NOTES" ]; then 65 | echo "Disable shared note: $LOCK_SHARED_NOTES" 66 | sed -i "s/lockSettingsDisableNote=.*/lockSettingsDisableNote=$LOCK_SHARED_NOTES/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 67 | fi 68 | 69 | if [ ! -z "$LOCK_MICROPHONE" ]; then 70 | echo "Enable mic: $LOCK_MICROPHONE"; 71 | sed -i "s/lockSettingsDisableMic=.*/lockSettingsDisableMic=$LOCK_MICROPHONE/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 72 | fi 73 | 74 | if [ ! -z "$HIDE_USER_LIST" ]; then 75 | echo "See other users in the Users list: $HIDE_USER_LIST" 76 | sed -i "s/lockSettingsHideUserList=.*/lockSettingsHideUserList=$HIDE_USER_LIST/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 77 | fi 78 | 79 | if [ ! -z "$LOCK_WEBCAM" ]; then 80 | echo "Prevent viewers from sharing webcams: $LOCK_WEBCAM" 81 | sed -i "s/lockSettingsDisableCam=.*/lockSettingsDisableCam=$LOCK_WEBCAM/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 82 | fi 83 | 84 | if [ ! -z "$ALLOW_DUPLICATE_USER_ID" ]; then 85 | echo "Prevent users from joining classes from multiple devices: $ALLOW_DUPLICATE_USER_ID" 86 | sed -i "s/allowDuplicateExtUserid=.*/allowDuplicateExtUserid=$ALLOW_DUPLICATE_USER_ID/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 87 | fi 88 | 89 | if [ ! -z "$END_WHEN_NO_MODERATOR" ]; then 90 | echo "End the meeting when there are no moderators after a certain period of time: $END_WHEN_NO_MODERATOR" 91 | sed -i "s/endWhenNoModerator=.*/endWhenNoModerator=$END_WHEN_NO_MODERATOR/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 92 | fi 93 | 94 | if [ ! -z $END_WHEN_NO_MODERATOR_DELAY ]; then 95 | echo "End meeting duration when there are no moderators after a certain period of time: $END_WHEN_NO_MODERATOR_DELAY" 96 | sed -i "s/endWhenNoModeratorDelayInMinutes=.*/endWhenNoModeratorDelayInMinutes=$END_WHEN_NO_MODERATOR_DELAY/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 97 | fi 98 | 99 | if [ ! -z $LOG_LEVEL ]; then 100 | echo "Set log level to $LOG_LEVEL" 101 | sed -i "s/appLogLevel=.*/appLogLevel=$LOG_LEVEL/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 102 | fi 103 | 104 | if [ ! -z "$DISABLE_RECORDING" ]; then 105 | echo "Disable recording: $DISABLE_RECORDING" 106 | sed -i "s/disableRecordingDefault=.*/disableRecordingDefault=$DISABLE_RECORDING/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 107 | fi 108 | 109 | if [ ! -z $MEETING_DURATION ]; then 110 | echo "Set maximum meeting duration: $MEETING_DURATION" 111 | sed -i "s/defaultMeetingDuration=.*/defaultMeetingDuration=$MEETING_DURATION/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 112 | fi 113 | 114 | if [ ! -z $LEARNING_DASHBOARD_CLEANUP_DELAY ]; then 115 | echo "Keep Learning Dashboard data: $LEARNING_DASHBOARD_CLEANUP_DELAY" 116 | sed -i "s/learningDashboardCleanupDelayInMinutes=.*/learningDashboardCleanupDelayInMinutes=$LEARNING_DASHBOARD_CLEANUP_DELAY/g" /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 117 | fi 118 | 119 | if [ ! -z "$ENABLE_LISTEN_ONLY_MODE" ]; then 120 | echo "Enable listen only mode: $ENABLE_LISTEN_ONLY_MODE" 121 | sed -i "s/listenOnlyMode:.*/listenOnlyMode: $ENABLE_LISTEN_ONLY_MODE/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 122 | fi 123 | 124 | if [ ! -z "$SKIP_AUDIO_CHECK" ]; then 125 | echo "Enable audio check: $SKIP_AUDIO_CHECK" 126 | sed -i "s/skipCheck:.*/skipCheck: $SKIP_AUDIO_CHECK/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 127 | fi 128 | 129 | if [ ! -z "$ENABLE_DICTATION" ]; then 130 | echo "Enable dictation: $ENABLE_DICTATION" 131 | sed -i "s/enableDictation:.*/enableDictation: $ENABLE_DICTATION/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 132 | fi 133 | 134 | if [ ! -z "$CHAT_START_CLOSED" ]; then 135 | echo "Close chat on start: $CHAT_START_CLOSED" 136 | sed -i "s/startClosed:.*/startClosed: $CHAT_START_CLOSED/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 137 | fi 138 | 139 | if [ ! -z "$CLIENT_TITLE" ]; then 140 | echo "Set Client Title: $CLIENT_TITLE" 141 | sed -i "s/clientTitle:.*/clientTitle: $CLIENT_TITLE/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 142 | fi 143 | 144 | if [ ! -z "$APP_NAME" ]; then 145 | echo "Set App Title: $APP_NAME" 146 | sed -i "s/appName:.*/appName: $APP_NAME/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 147 | fi 148 | 149 | if [ ! -z "$COPY_RIGHT" ]; then 150 | echo "Set Copyright: $COPY_RIGHT" 151 | sed -i "s/copyright:.*/copyright: $COPY_RIGHT/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 152 | fi 153 | 154 | if [ ! -z "$HELP_LINK" ]; then 155 | echo "Set Helplink: $HELP_LINK" 156 | sed -i "s/helpLink:.*/helpLink: $HELP_LINK/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 157 | fi 158 | 159 | 160 | if [ "$FIX_AUDIO_ERROR" = true ]; then 161 | if [ ! -z $PUBLIC_IP ]; then 162 | echo "Fix for 1007 and 1020 - https://github.com/manishkatyan/bbb-optimize#fix-1007-and-1020-errors" 163 | xmlstarlet edit --inplace --update '//profile/settings/param[@name="ext-rtp-ip"]/@value' --value "\$\${external_rtp_ip}" /opt/freeswitch/etc/freeswitch/sip_profiles/external.xml 164 | xmlstarlet edit --inplace --update '//profile/settings/param[@name="ext-sip-ip"]/@value' --value "\$\${external_sip_ip}" /opt/freeswitch/etc/freeswitch/sip_profiles/external.xml 165 | xmlstarlet edit --inplace --update '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "external_rtp_ip=")]/@data' --value "external_rtp_ip=$PUBLIC_IP" /opt/freeswitch/etc/freeswitch/vars.xml 166 | xmlstarlet edit --inplace --update '//X-PRE-PROCESS[@cmd="set" and starts-with(@data, "external_sip_ip=")]/@data' --value "external_sip_ip=$PUBLIC_IP" /opt/freeswitch/etc/freeswitch/vars.xml 167 | else 168 | echo "Invalid PUBLIC_IP" 169 | fi 170 | fi 171 | 172 | 173 | if [ ! -z $DEFAULT_LOGO ]; then 174 | echo "copying logo.png" 175 | cp -r $DEFAULT_LOGO /var/www/bigbluebutton-default/ 176 | echo "copying logo.png for player" 177 | cp -r $DEFAULT_LOGO /var/bigbluebutton/playback/presentation/2.3/static/media/logo* 178 | fi 179 | 180 | if [ ! -z $DEFAULT_FAVICON ]; then 181 | echo "copying favicon.ico" 182 | cp -r $DEFAULT_FAVICON /var/www/bigbluebutton-default/ 183 | cp -r $DEFAULT_FAVICON /var/bigbluebutton/playback/presentation/2.3/favicon.ico 184 | cp -r $DEFAULT_FAVICON /var/bigbluebutton/learning-dashboard/favicon.ico 185 | fi 186 | 187 | if [ ! -z $DEFAULT_PRESENTATION ]; then 188 | echo "copying default presenttaion" 189 | cp -r $DEFAULT_PRESENTATION /var/www/bigbluebutton-default/ 190 | fi 191 | 192 | 193 | if [ ! -z "$ENABLE_SHARED_NOTES" ]; then 194 | echo "Enable shared notes: $ENABLE_SHARED_NOTES" 195 | yq w -i /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml public.note.enabled $ENABLE_SHARED_NOTES 196 | fi 197 | 198 | if [ "$OPTIMIZE_RECORDING_FOR_IOS" = true ]; then 199 | echo " Use MP4 format for playback of recordings: $OPTIMIZE_RECORDING_FOR_IOS" 200 | sed -i "s/- webm/# - webm/g" /usr/local/bigbluebutton/core/scripts/presentation.yml 201 | sed -i "s/# - mp4/- mp4/g" /usr/local/bigbluebutton/core/scripts/presentation.yml 202 | fi 203 | if [ "$OPTIMIZE_RECORDING_FOR_IOS" = false ]; then 204 | echo " Use MP4 format for playback of recordings: $OPTIMIZE_RECORDING_FOR_IOS" 205 | sed -i "s/# - webm/- webm/g" /usr/local/bigbluebutton/core/scripts/presentation.yml 206 | sed -i "s/- mp4/# - mp4/g" /usr/local/bigbluebutton/core/scripts/presentation.yml 207 | fi 208 | 209 | if [ "$ENABLE_MEDIASOUP" = true ]; then 210 | echo "Enable mediasoup: $ENABLE_MEDIASOUP" 211 | yq w -i /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml public.kurento.signalCandidates false 212 | sed -i "s/#mediaServer: Kurento/mediaServer: mediasoup/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 213 | sed -i "s/#videoMediaServer: Kurento/videoMediaServer: mediasoup/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 214 | sed -i "s/#listenOnlyMediaServer: Kurento/listenOnlyMediaServer: mediasoup/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 215 | fi 216 | 217 | if [ "$ENABLE_MEDIASOUP" = false ]; then 218 | echo "Enable mediasoup: $ENABLE_MEDIASOUP" 219 | yq w -i /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml public.kurento.signalCandidates false 220 | sed -i "s/mediaServer: mediasoup/#mediaServer: Kurento/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 221 | sed -i "s/videoMediaServer: mediasoup/#videoMediaServer: Kurento/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 222 | sed -i "s/listenOnlyMediaServer: mediasoup/#listenOnlyMediaServer: Kurento/g" /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 223 | fi 224 | 225 | if [ ! -z "$WEBCAM_RESOLUTION" ]; then 226 | echo "Set default webcam profile as : $WEBCAM_RESOLUTION" 227 | #Set everything false 228 | yq w -i /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 'public.kurento.cameraProfiles.(id==low).default' false 229 | yq w -i /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 'public.kurento.cameraProfiles.(id==medium).default' false 230 | yq w -i /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 'public.kurento.cameraProfiles.(id==high).default' false 231 | yq w -i /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml 'public.kurento.cameraProfiles.(id==hd).default' false 232 | 233 | #set webcam resolution 234 | yq w -i /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml "public.kurento.cameraProfiles.(id==$WEBCAM_RESOLUTION).default" true 235 | fi 236 | echo "" 237 | echo "====== Please restart the BigBlueButton ======" 238 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # BigBlueButton Optimize 2 | 3 | You can easily optimize your BigBlueButton server to meet your specific requirements for branding and feature customizations. 4 | 5 | 6 | GitHub package.json version 7 | 8 | 9 | Monthly download on NPM 10 | 11 | 12 |

13 | 14 | ## ✨ Features 15 | 16 | - **Branding** 17 | - **Session settings** 18 | - **Lock settings** 19 | - **Audio and Video optimization** 20 | 21 |

22 | 23 | ## 🖐 Requirements 24 | 25 | To install this package, you would need a BigBlueButton 2.4.x server. 26 | 27 |

28 | 29 | ## ⏳ Installation 30 | 31 | ```bash 32 | # Install bbb-opimize CLI globally 33 | npm i -g bigbluebutton-optimize 34 | 35 | #Run optimization. Replace ENV_FILE with your env file 36 | bbb-optimize --env-file=ENV_FILE 37 | 38 | #Restart the bbb 39 | bbb-conf --restart 40 | ``` 41 | 42 | ## Example env file 43 | 44 | ```bash 45 | #Set welcome message 46 | DEFAULT_WELCOME_MESSAGE=Welcome to my awesome session 47 | 48 | # Change default bigbluebutton logo; default=/var/www/bigbluebutton-default/logo.png 49 | DEFAULT_LOGO=/root/branding/logo.png 50 | 51 | # Change default bigbluebutton favicon; default=/var/www/bigbluebutton-default/favicon.ico 52 | DEFAULT_FAVICON=/root/branding/favicon.ico 53 | 54 | #Mute the session on start; default false 55 | MUTE_ON_START=true 56 | 57 | #lock settings 58 | LOCK_PRIVATE_CHAT=true 59 | 60 | #Enable mediasoup for webcam and screensharing instread of kurento 61 | ENABLE_MEDIASOUP=true 62 | 63 | ``` 64 | 65 | ## Available optimization options 66 | 67 | ### Branding 68 | 69 | ```bash 70 | 71 | # If the message contains characters not in ISO-8859-1 character sets 72 | # they must be properly escaped to unicode characters. An easy way to 73 | # do this is running the native2ascii command setting UTF8 encoding and 74 | # passing this file's path as input and output parameters, e.g.: 75 | # 76 | # native2ascii -encoding UTF8 bigbluebutton.properties bigbluebutton.properties 77 | DEFAULT_WELCOME_MESSAGE=Hello Welcome to My Conference 78 | 79 | DEFAULT_WELCOME_MESSAGE_FOOTER=Message footer 80 | 81 | # Change default bigbluebutton logo; default /var/www/bigbluebutton-default/logo.png 82 | DEFAULT_LOGO=/var/www/bigbluebutton-default/logo.png 83 | 84 | # Change default bigbluebutton favicon; default /var/www/bigbluebutton-default/favicon.ico 85 | DEFAULT_FAVICON=/var/www/bigbluebutton-default/favicon.ico 86 | 87 | # Change default bigbluebutton presentation; default /var/www/bigbluebutton-default/default.pdf 88 | DEFAULT_PRESENTATION= /var/www/bigbluebutton-default/default.pdf 89 | 90 | #Set title and it will be set as your bigbluebutton meeting tab name 91 | CLIENT_TITLE=Class ++ 92 | APP_NAME=Class ++ 93 | 94 | #Set copyright 95 | COPY_RIGHT=©2022 example.com 96 | 97 | #Change default help link for your bigbluebutton session 98 | HELP_LINK=https:\/\/www.example.com\/help 99 | ``` 100 | 101 | ### Session settings 102 | 103 | ```bash 104 | #Enable this to allow moderators to unmute viwers 105 | ALLOW_MODS_TO_UNMUTE_USERS=false 106 | 107 | # Allow webcams streaming reception only to and from moderators 108 | WEBCAM_ONLY_FOR_MODERATOR=false 109 | 110 | #Mute the session on start 111 | MUTE_ON_START=false 112 | 113 | #Keep the meeting events 114 | DEFAULT_KEEP_EVENTS=false 115 | 116 | #Set the max users that can join a single BigBlueButton session 117 | #If set to 0, There will not be any limit 118 | DEFAULT_MAX_USERS=0 119 | 120 | #Allow users to join the same session using multiple devices 121 | ALLOW_DUPLICATE_USER_ID=false 122 | 123 | # Param to end the meeting when there are no moderators after a certain period of time. 124 | # Needed for classes where teacher gets disconnected and can't get back in. Prevents 125 | # students from running amok 126 | END_WHEN_NO_MODERATOR=false 127 | 128 | # Number of minutes to wait for moderator rejoin before end meeting (if `END_WHEN_NO_MODERATOR=true` ) 129 | END_WHEN_NO_MODERATOR_DELAY=2 130 | 131 | #Disable the recording even if record=true passed in create call 132 | DISABLE_RECORDING=false 133 | 134 | #Enable the shared notes 135 | ENABLE_SHARED_NOTES=false 136 | 137 | # Number of minutes that Learning Dashboard will be available after the end of the meeting 138 | # if 0, the Learning Dashboard will keep available permanently; 139 | LEARNING_DASHBOARD_CLEANUP_DELAY=2 140 | 141 | # Default duration of the meeting in minutes. If set to 0 the meeting does'nt end. 142 | MEETING_DURATION=0 143 | 144 | #Enable listen only mode 145 | ENABLE_LISTEN_ONLY_MODE=true 146 | 147 | #Set this to true to skip audio check after joining the session 148 | SKIP_AUDIO_CHECK=false 149 | 150 | #Set this true to enable dictation 151 | ENABLE_DICTATION=false 152 | ``` 153 | 154 | ### Lock settings 155 | 156 | ```bash 157 | #Default lock settings 158 | 159 | #Lock the private chat 160 | LOCK_PRIVATE_CHAT=false 161 | 162 | #Lock the public chat 163 | LOCK_PUBLIC_CHAT=false 164 | 165 | #Lock the shared notes 166 | LOCK_SHARED_NOTES=false 167 | 168 | #Lock the mic 169 | LOCK_MICROPHONE=false 170 | 171 | #Lock the webcam 172 | LOCK_WEBCAM=false 173 | 174 | #If enabled, viewers will not able to see other viewers 175 | HIDE_USER_LIST=false 176 | ``` 177 | 178 | ### Audio and Video optimization 179 | 180 | ```bash 181 | #Enable mediasoup for webcam and screensharing instread of kurento 182 | ENABLE_MEDIASOUP=false 183 | 184 | #Enable multiple kurento for better performance 185 | ENABLE_MULTIPLE_KURENTO=false 186 | 187 | #Set the default webcam resolution, Allowd values are low, medium, high, hd 188 | WEBCAM_RESOLUTION=medium 189 | 190 | #Enable recording optimization for ios devices 191 | OPTIMIZE_RECORDING_FOR_IOS=true 192 | 193 | 194 | #Enable this to fix audio issues such as 1007, 1020. 195 | #Reference: https://github.com/manishkatyan/bbb-optimize/tree/v1#fix-1007-and-1020-errors 196 | FIX_AUDIO_ERROR=true 197 | 198 | #If FIX_AUDIO_ERROR is set to true, then set your bbb server's PUBLIC_IP 199 | PUBLIC_IP= 200 | 201 | ``` 202 | 203 | ### Miscellaneous settings 204 | 205 | ```bash 206 | #Minimize the chat section on start 207 | CHAT_START_CLOSED=false 208 | #Set the log level for bbb; possible values are: INFO, DEBUG, WARN, ERROR,; default DBUG 209 | LOG_LEVEL=DEBUG 210 | ``` 211 | 212 |

Additional optimization

213 | 214 | ### Stream better quality audio 215 | Edit `/usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml` and make the following changes 216 | ```sh 217 | maxaveragebitrate: "256000" 218 | maxplaybackrate: "48000" 219 | ``` 220 | 221 | Edit `/opt/freeswitch/etc/freeswitch/autoload_configs/conference.conf.xml` and make the follwoing changes 222 | ```sh 223 | 224 | 225 | 226 | ``` 227 | 228 | Edit `/opt/freeswitch/etc/freeswitch/dialplan/default/bbb_conference.xml` and copy-and-paste the code below, removing the existig code 229 | ```xml 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | ``` 257 | 258 | Edit `/opt/freeswitch/etc/freeswitch/autoload_configs/opus.conf.xml` and copy-and-paste the code below, removing the existig code 259 | 260 | ```xml 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | ``` 280 | 281 | [Reference](https://groups.google.com/g/bigbluebutton-setup/c/3Y7VBllwpX0/m/41X9j8bvCAAJ) 282 | 283 | 284 | ### Secure recordings 285 | 286 | With default BBB installation, anyone can share playback recording of your classes on Facebook or WhatsApp for everyone to view. 287 | 288 | To secure your recordings, you can make it accessible only from a certain domain. For example, allow recordings to be accessed from theh domain of your Moodle site. 289 | 290 | 291 | For BBB version greater that 2.3 or 2.4: 292 | 293 | ```bash 294 | #edit /etc/bigbluebutton/nginx/playback.nginx 295 | 296 | location /playback/presentation/2.3 { 297 | root /var/bigbluebutton; 298 | try_files $uri /playback/presentation/2.3/index.html; 299 | 300 | # Restrict access 301 | valid_referers server_names 302 | bbb.youdomain.com; 303 | if ($invalid_referer) { 304 | return 404; 305 | } 306 | # End - Restrict access 307 | 308 | } 309 | 310 | ``` 311 | 312 | For BBB 2.2: 313 | 314 | ```bash 315 | # edit /etc/bigbluebutton/nginx/presentation.nginx 316 | 317 | location /playback/presentation { 318 | root /var/bigbluebutton; 319 | index index.html index.htm; 320 | 321 | # Restrict access 322 | valid_referers server_names 323 | bbb.youdomain.com; 324 | if ($invalid_referer) { 325 | return 404; 326 | } 327 | # End - Restrict access 328 | } 329 | 330 | ``` 331 | 332 | 333 | ### No logs 334 | 335 | #### 1. BigBlueButton logging 336 | ``` 337 | # BigBlueButton logs location: /var/log/bigbluebutton/bbb-web.log. To limit this log, set 338 | # (1) change appLogLevel from DEBUG to ERROR 339 | vi /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 340 | # (2) change each logger level to ERROR (default INFO and DEBUG) 341 | vi /usr/share/bbb-web/WEB-INF/classes/logback.xml 342 | 343 | # To avoid logging ip-addresses in bbb-webrtc-sfu change log > level to error (default verbose) 344 | vi /usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml 345 | 346 | # To change logs level for chat usage and chat messages, change loglevel to ERROR 347 | vi /etc/bbb-transcode-akka/application.conf (default INFO) 348 | vi /etc/bbb-transcode-akka/logback.xml (default INFO, DEBUG, WARN] 349 | vi /etc/bbb-apps-akka/application.conf (default DEBUG) 350 | vi /etc/bbb-apps-akka/logback.xml (default INFO DEBUG) 351 | ``` 352 | 353 | #### 2. Nginx 354 | ``` 355 | # Nginx logs - change access log 356 | vi /etc/nginx/nginx.conf 357 | access_log /dev/null; (default /var/log/nginx/access.log) 358 | 359 | # Nginx logs - change access log 360 | vi /etc/nginx/sites-available/bigbluebutton 361 | access_log /dev/null; (default /var/log/nginx/bigbluebutton.access.log) 362 | ``` 363 | 364 | #### 3. Freeswitch 365 | ``` 366 | # Freeswitch logs - change loglevel and stdout-loglevel to ERROR (default DEBUG) 367 | vi /etc/bbb-fsesl-akka/application.conf 368 | 369 | # Freeswitch logs - change logger to ERROR (default INFO, DEBUG, WARN) 370 | vi /etc/bbb-fsesl-akka/logback.xml 371 | ``` 372 | 373 | #### 4. Red5 374 | ``` 375 | # red5 - change root > level to ERROR and each logger to ERROR (default INFO) 376 | vi /etc/red5/logback.xml 377 | ``` 378 | #### 5. Kurento 379 | ``` 380 | # export GST_DEBUG="1 ..." (Default is 3; Set it to 1, that is for Error) 381 | vi /etc/default/kurento-media-server 382 | ``` 383 | 384 | #### 6. Greenlight 385 | 386 | ``` 387 | vi .env 388 | 389 | # Comment the following live to send logs to log/production.log 390 | # RAILS_LOG_TO_STDOUT=true 391 | 392 | # Create symlink, replacing $GREENLIGHTDIR with the absolute path where Greenlight is installed. 393 | ln -s /dev/null $GREENLIGHTDIR/log/production.log 394 | ``` 395 | 396 | #### 7. Scalelite 397 | The Scalelite API container is logging user activities. For example: Who joined which meeting. 398 | This logfile will never be deleted automatically and it will get quite large, if scalelite is serving many users. 399 | Hence, delete logs via cronjobs. 400 | 401 | ``` 402 | # Login as root 403 | crontab -e 404 | 405 | # add to delete all Docker-Container-Logfiles. At 03:00 every sunday and thursday. 406 | 0 3 * * 0,4 truncate -s 0 /var/lib/docker/containers/*/*-json.log 407 | ``` 408 | 409 | #### 8. Coturn 410 | ``` 411 | ln -s /dev/null /var/log/coturn.log 412 | ``` 413 | 414 | #### 9. Rotate Logs 415 | If you want to keep logs, you can set days for which logs should be kept on the BBB server. 416 | ``` 417 | # Change log_history to 7 days (or as appropriate) 418 | vi /etc/cron.daily/bigluebutton 419 | 420 | # Change rotate to 7 (days) or as appropriate (this rotates log for /var/log/bigbluebutton/(bbb-rap-worker.log|sanity.log) 421 | vi /etc/logrotate.d/bbb-record-core.logrotate 422 | 423 | # Change rotate to 7 (days) or as appropriate (this rotates log for /var/log/bbb-webrtc-sfu/) 424 | vi bbb-webrtc-sfu.logrotate 425 | 426 | # Change MaxHistory to 7 (days) or as appropriate (this rotates log for /var/log/bigbluebutton/bbb-web.log) 427 | vi /usr/share/bbb-web/WEB-INF/classes/logback.xml 428 | ``` 429 | 430 | ### No Syslog entries 431 | ```ssh 432 | # Edit /usr/lib/systemd/system/bbb-htlm5.service 433 | StandardOutput=null 434 | # Restart 435 | systemctl daemon-reload 436 | ``` 437 | 438 | 439 | ### Set server Timezone 440 | 441 | ```bash 442 | # Current timezone 443 | timedatectl 444 | 445 | # List of available timezone 446 | timedatectl list-timezones 447 | 448 | # Set new timezone by replacing Asia/Kolkata with your timezone 449 | timedatectl set-timezone Asia/Kolkata 450 | ``` 451 | 452 | ### Restart BBB everyday 453 | 454 | ```bash 455 | crontab -e 456 | 457 | #restart bbb at 2 AM everyday 458 | 00 2 * * * /usr/bin/bbb-conf --restart 459 | ``` 460 | 461 | ## 🚀 Stress-free BigBlueButton hosting! Start free Trial 462 | 463 | **Save big with our affordable BigBlueButton hosting.** 464 | 465 | - Bare metal servers for HD video 466 | - 40% lower hosting costs 467 | - Top-rated tech support, 100% uptime 468 | - Upgrade / cancel anytime 469 | - 2 weeks free trial; No credit card needed 470 | 471 | Start Free Trial 472 | 473 |

474 | 475 | ## 📝 License 476 | 477 | [MIT License](LICENSE.md) 478 | 479 | Copyright (c) [HigherEdLab.com](https://higheredlab.com/) 480 | -------------------------------------------------------------------------------- /README.md.old: -------------------------------------------------------------------------------- 1 | # bbb-optimize 2 | 3 | Here are techniques to optimize and smoothly run your BigBlueButton server, including increasing recording processing speed, dynamic video profile, pagination, improving audio quality, fixing 1007/1020 errors and using apply-config.sh. 4 | 5 | Don't forget to restart your BigBlueButton server after making these changes 6 | 7 | ```sh 8 | bbb-conf --restart 9 | ``` 10 | 11 | ## Manage customizations 12 | 13 | Keep all customizations of BigBlueButton server in apply-config.sh so that (1) all your BBB servers have same customizations without any errors, and (2) you don't lose them while upgrading. 14 | 15 | We use XMLStarlet to update xml files and sed to update text files. 16 | 17 | ```sh 18 | sudo apt-get update -y 19 | sudo apt-get install -y xmlstarlet 20 | git clone https://github.com/manishkatyan/bbb-optimize.git 21 | cd bbb-optimize 22 | cp apply-config-sample.sh apply-config.sh 23 | 24 | # Edit apply-config.sh to set PUBLIC_IP to the public IP of your BBB server 25 | 26 | # Apply changes and restart BBB 27 | ./replace-config.sh 28 | ``` 29 | 30 | Edit `apply-config.sh` as appropriate. Comments with each of the customizations will help you understand that the implication of each of them and you will be able to change the default values. 31 | 32 | ## Match with your branding 33 | 34 | ```sh 35 | # added to apply-config-sample.sh. So no need to copy manually. 36 | # cp default.pdf /var/www/bigbluebutton-default/ 37 | # cp favicon.ico /var/www/bigbluebutton-default/ 38 | 39 | bbb-conf --restart 40 | ``` 41 | 42 | You can update default BigBlueButton setup to match with your branding in the following ways: 43 | 44 | 1. Default PDF that would appear in the presentation area 45 | 2. Logo (favicon format) that would appear as favicon 46 | 3. Application name that would appear in "About" - right side menu 47 | 4. Welcome message that would appear on the public chat area 48 | 5. index.html that shows up when a user logs-out of a class. Create your own version and put it in `/var/www/bigbluebutton-default/` 49 | 50 | In addition, you can change the following items in apply-config.sh: 51 | 52 | 1. clientTitle 53 | 2. appName 54 | 3. copyright 55 | 4. helpLink 56 | 57 | ## Disable Shared Notes and Lower Webcam resolution 58 | 59 | ```sh 60 | # Edit /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml and note > enabled > false 61 | 62 | # Edit /usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml and set cameraProfiles > id: Low > default: true and cameraProfiles > id: Medium > default: false 63 | ``` 64 | 65 | For K21 students, usually we disable Shared Notes, more to prevent users from writing inappropriate messages than to performance enhancement. 66 | 67 | We also lower default webcam resolution. 68 | 69 | ## Change recording processing speed 70 | 71 | ```sh 72 | vi /usr/local/bigbluebutton/core/lib/recordandplayback/generators/video.rb 73 | ``` 74 | 75 | Make the following changes on line 58 and line 124 to speed up recording processing time by 5-6 times: 76 | `-quality realtime -speed 5 -tile-columns 2 -threads 4` 77 | 78 | [Reference](https://github.com/bigbluebutton/bigbluebutton/issues/8770) 79 | 80 | Please keep in mind that it uses a more CPU which can affect the performance of live on-going classes on BigBlueButton. 81 | 82 | Hence, its better to change the schedule of processing internal for recordings along with this change. 83 | 84 | ## Use MP4 format for playback of recordings 85 | 86 | The presentation playback format encodes the video shared during the session (webcam and screen share) as .webm (VP8) files. 87 | 88 | You can change the format to MP4 for two reasons: (1) increase recording processing speed, and (2) enable playback of recordings on iOS devices. 89 | 90 | Edit `/usr/local/bigbluebutton/core/scripts/presentation.yml` and uncomment the entry for mp4. 91 | video_formats: 92 | 93 | ```sh 94 | #- webm 95 | - mp4 96 | ``` 97 | 98 | ## Dynamic Video Profile 99 | 100 | aka automatic bitrate/frame rate throttling. To control camera framerate and bitrate that scales according to the number of cameras in a meeting. 101 | To decrease server AND client CPU/bandwidth usage for meetings with many cameras. Leads to significant difference in responsiveness, CPU usage and bandwidth usage (for the better) with this PR. 102 | 103 | Edit `/usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml` and set 104 | 105 | ```sh 106 | cameraQualityThresholds: 107 | enabled: true 108 | ``` 109 | 110 | ## Video Pagination 111 | 112 | You can control the number of webcams visible to meeting participants at a single time. 113 | 114 | Edit `/usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml` and set 115 | 116 | ```sh 117 | pagination: 118 | enabled: true 119 | ``` 120 | 121 | ## Stream better quality audio 122 | 123 | Edit `/usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml` and make the following changes 124 | 125 | ```sh 126 | maxaveragebitrate: "256000" 127 | maxplaybackrate: "48000" 128 | ``` 129 | 130 | Edit `/opt/freeswitch/etc/freeswitch/autoload_configs/conference.conf.xml` and make the follwoing changes 131 | 132 | ```sh 133 | 134 | 135 | 136 | ``` 137 | 138 | Edit `/opt/freeswitch/etc/freeswitch/dialplan/default/bbb_conference.xml` and copy-and-paste the code below, removing the existig code 139 | 140 | ```xml 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | ``` 168 | 169 | Edit `/opt/freeswitch/etc/freeswitch/autoload_configs/opus.conf.xml` and copy-and-paste the code below, removing the existig code 170 | 171 | ```xml 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | ``` 191 | 192 | [Reference](https://groups.google.com/g/bigbluebutton-setup/c/3Y7VBllwpX0/m/41X9j8bvCAAJ) 193 | 194 | ## Run three parallel Kurento media servers 195 | 196 | Available in BigBluebutton 2.2.24 (and later releases of 2.2.x) 197 | 198 | Running three parallel Kurento media servers (KMS) – one dedicated to each type of media stream – increases the stability of media handling as the load for starting/stopping media streams spreads over three separate KMS processes. Also, it increases the reliability of media handling as a crash (and automatic restart) by one KMS will not affect the two. 199 | 200 | In our experience, we have see CPU usage spread across 3 KMS servers, resulting in better user experience. Hence, we highly recommend it. 201 | 202 | The change required to enable 3 KMS is part of our apply-config-sample.sh included with this project. 203 | 204 | ## Optimize NodeJS 205 | 206 | The configuration change below can result in 40% improvement in NodeJS performance, allowing you to host up to 40% more concurrent users per server. 207 | 208 | ```sh 209 | vi /usr/share/meteor/bundle/systemd_start.sh 210 | 211 | # Replace the last line by PORT=3000 /usr/share/$NODE_VERSION/bin/node --max-old-space-size=4096 --max_semi_space_size=128 main.js 212 | 213 | service bbb-html5 restart 214 | ``` 215 | 216 | Thanks to [Stefan L. for sharing](https://github.com/bigbluebutton/bigbluebutton/issues/11183) 217 | 218 | ## Optimize Recording 219 | 220 | ### Process multiple recordings 221 | 222 | Make changes described in this PR: [Add option to rap-process-worker to accept a filtering pattern](https://github.com/bigbluebutton/bigbluebutton/pull/8394) 223 | 224 | ```sh 225 | Edit /usr/lib/systemd/system/bbb-rap-process-worker.service and set the command to: ExecStart=/usr/local/bigbluebutton/core/scripts/rap-process-worker.rb -p "[0-4]$" 226 | Copy /usr/lib/systemd/system/bbb-rap-process-worker.service to /usr/lib/systemd/system/bbb-rap-process-worker-2.service 227 | Edit /usr/lib/systemd/system/bbb-rap-process-worker-2.service and set the command to ExecStart=/usr/local/bigbluebutton/core/scripts/rap-process-worker.rb -p "[5-9]$" 228 | Edit /usr/lib/systemd/system/bbb-record-core.target and add bbb-rap-process-worker-2.service to the list of services in Wants 229 | Edit /usr/bin/bbb-record, search for bbb-rap-process-worker.service and add bbb-rap-process-worker-2.service next to it to monitor 230 | ``` 231 | 232 | You will also need to copy the updated version of `rap-process-worker.rb` from [here](https://github.com/daronco/bigbluebutton/blob/9e5c386e6f89303c3f15f4552a8302d2e278d057/record-and-playback/core/scripts/rap-process-worker.rb) to the following location `/usr/local/bigbluebutton/core/scripts` 233 | 234 | Ensure the right file permission `chmod +x rap-process-worker.rb` 235 | 236 | After making the changes above restart recording process: 237 | 238 | ```sh 239 | systemctl daemon-reload 240 | systemctl stop bbb-rap-process-worker.service bbb-record-core.timer 241 | systemctl start bbb-record-core.timer 242 | ``` 243 | 244 | To verify that the above changes have taken in place, execute the following: 245 | 246 | ```sh 247 | ps aux | grep rap-process-worker 248 | ``` 249 | 250 | You should see the following two processes: 251 | 252 | ```sh 253 | /usr/bin/ruby /usr/local/bigbluebutton/core/scripts/rap-process-worker.rb -p [5-9]$ 254 | /usr/bin/ruby /usr/local/bigbluebutton/core/scripts/rap-process-worker.rb -p [0-4]$ 255 | ``` 256 | 257 | In case you don't see above two processes running, it's likely that you don't have any recording to process. You may want to record a test class using API-MATE and check if the above two processes start running after the end of the test class. 258 | 259 | ### Import already published recordings from one scalelite to another 260 | 261 | To migrate existing, already published recordings, from one Scalelite server to another Scalelite server, follow the steps below: 262 | 263 | - make a tar file from the old folder with a path in the form `presentation//...` 264 | - copy this tar file to `/mnt/scalelite-recordings/var/bigbluebutton/spool/` on the New scalelite server 265 | - After a short while (a few minutes) the recording is automatically imported to the published folder by `scalelite-recording-importer` Docker service 266 | 267 | ### Secure recordings 268 | 269 | With default BBB installation, anyone can share playback recording of your classes on Facebook or WhatsApp for everyone to view. 270 | 271 | To secure your recordings, you can make it accessible only from a certain domain. For example, allow recordings to be accessed from theh domain of your Moodle site. 272 | 273 | ```sh 274 | # edit /etc/bigbluebutton/nginx/presentation.nginx 275 | 276 | location /playback/presentation { 277 | root /var/bigbluebutton; 278 | index index.html index.htm; 279 | 280 | # Restrict access 281 | valid_referers server_names 282 | bbb.youdomain.com; 283 | if ($invalid_referer) { 284 | return 404; 285 | } 286 | # End - Restrict access 287 | } 288 | 289 | ``` 290 | 291 | ### Troubleshooting 292 | 293 | To investigate the processing of a particular recording, you can look at the log files. 294 | 295 | The `/var/log/bigbluebutton/bbb-rap-worker` log is a general log file that can be used to find which section of the recording processing is failing. It also logs a message if a recording process is skipped because the moderator did not push the record button. 296 | 297 | To investigate an error for a particular recording, check the following log files: 298 | 299 | ```sh 300 | /var/log/bigbluebutton/archive-.log 301 | /var/log/bigbluebutton//process-.log 302 | /var/log/bigbluebutton//publish-.log 303 | ``` 304 | 305 | #### Check Free Disk Space 306 | 307 | One common issue with recording is that your server is running out of free disk space. Here is how to check for disk space usage: 308 | 309 | ```sh 310 | apt install ncdu 311 | cd /var/bigbluebutton/published/presentation/ 312 | # On Scalelite server, check /mnt/scalelite-recordings/var/bigbluebutton/published/presentation for recordings 313 | ncdu 314 | ``` 315 | 316 | You should also check disk space used by log files in `/var/log/bigbluebutton` and `/opt/freeswitch/log`. 317 | 318 | ## Fix 1007 and 1020 errors 319 | 320 | Follow the steps below to resolve 1007/1020 errors that your users may resport in case they are behind a firewall. 321 | 322 | #### 1. Update `external.xml` and `vars.xml` 323 | 324 | Edit `/opt/freeswitch/etc/freeswitch/sip_profiles/external.xml` and change 325 | 326 | ```xml 327 | 328 | 329 | ``` 330 | 331 | To 332 | 333 | ```xml 334 | 335 | 336 | ``` 337 | 338 | Edit `/opt/freeswitch/etc/freeswitch/vars.xml`, and change 339 | 340 | ```xml 341 | 342 | 343 | ``` 344 | 345 | To 346 | 347 | ```xml 348 | 349 | 350 | ``` 351 | 352 | #### 2. Verify Turn server is accessible 353 | 354 | Verify Turn server is accessible from your BBB serve. If you receive code 0x0001c means STUN is not working. Log into your BBB server and execute the following command: 355 | 356 | ```sh 357 | sudo apt install stun-client 358 | stun 359 | ``` 360 | 361 | Here is another way to test whether your Stun server is accessible from your BBB server. 362 | 363 | Localport could be any available UDP port on your BBB server. 3478 is the port for the Stun server. 364 | 365 | ```sh 366 | sudo apt-get install -y stuntman-client 367 | 368 | stunclient --mode full --localport 30000 3478 369 | 370 | ``` 371 | 372 | Your output should be something like the following: 373 | 374 | ```sh 375 | Binding test: success 376 | Local address: :30000 377 | Mapped address: :30000 378 | Behavior test: success 379 | Nat behavior: Direct Mapping 380 | Filtering test: success 381 | Nat filtering: Endpoint Independent Filtering 382 | ``` 383 | 384 | Configure BigBlueButton to use the coturn server by following the instruction [here](https://docs.bigbluebutton.org/admin/setup-turn-server.html#configure-bigbluebutton-to-use-your-turn-server) 385 | 386 | #### 3. Install Turn (Coturn) server: 387 | 388 | Follow the instructions [here](https://docs.bigbluebutton.org/admin/setup-turn-server.html) to install Turn server and configure `/etc/turnserver.conf` as mentioned below. 389 | 390 | ```sh 391 | listening-port=3478 # stun server 392 | tls-listening-port=443 # turn server 393 | realm=FQDN of Turn server 394 | ``` 395 | 396 | We use ports 443 for Coturn server. Since the Coturn server does not run with root authorizations by default, it must not bind its services to privileged ports (port range <1024). Hence, edit the file `/lib/systemd/system/coturn.service` by executing `systemctl edit --full coturn` and add the following in `[Service]` section 397 | 398 | If the TURN server is used by many users concurrently, it might hit the open file-handles limit. Therefore it is recommended to increase this limit by adding `LimitNOFILE=1048576` in the same file. 399 | 400 | ```sh 401 | AmbientCapabilities=CAP_NET_BIND_SERVICE 402 | LimitNOFILE=1048576 403 | # After saving, execute `systemctl daemon-reload` 404 | # In case file /lib/systemd/system/coturn.service doesn’t exist, follow the tip here: https://stackoverflow.com/questions/47189606/configuration-coturn-on-ubuntu-not-working 405 | ``` 406 | 407 | Change ownership of certificates 408 | 409 | ```sh 410 | # Change turn.higheredlab.com to FQDN of your coturn server 411 | chown -hR turnserver:turnserver /etc/letsencrypt/archive/turn.higheredlab.com/ 412 | chown -hR turnserver:turnserver /etc/letsencrypt/live/turn.higheredlab.com/ 413 | ``` 414 | 415 | Ensure that the coturn has binded to port 443 with netstat -antp | grep 443. Also restart your TURN server and ensure that coturn is running (and binding to port 443 after restart). 416 | 417 | Ensure that the ufw firewall on your Turn server allows the following ports: 80, 443, 3478 and 49152:65535/udp. After running certbot, you can disable port 80. 418 | 419 | To make coturn automatically restart at reboot: `systemctl enable coturn` 420 | 421 | To start coturn server: `systemctl start coturn` 422 | 423 | To check the status of coturn server: `systemctl status coturn` 424 | 425 | To view logs in real-time: `journalctl -u coturn -f` 426 | 427 | You can force using the TURN on Firefox browser. Open a Firefox tab and type `about:config`. Search for `media.peerconnection.ice.relay_only`. Set it to true. At this moment Firefox only use TURN relay. Now join a BigBlueButton session for this Firefox browser to see Turn server in action. 428 | In another tab on Firefox, type `about:webrtc` to see the status of webrtc. Click on `show details` to see the url of stun/turn server being used with `success` message. 429 | 430 | Using Chrome to test: Type `chrome://webrtc-internals` in a Chrome browser. Reference: `https://testrtc.com/find-webrtc-active-connection/` 431 | 432 | To see logs for testing purpose, you can manually start coturn server as follows: `turnserver -c /etc/turnserver.conf` 433 | 434 | #### 4. Set external IP in WebRtcEndpoint.conf.ini 435 | 436 | Edit `/etc/kurento/modules/kurento/WebRtcEndpoint.conf.ini` 437 | 438 | Mention external or public IP address of the media server by uncommenting the line below. Doing so has the advantage of not needing to configure STUN/TURN for the media server. 439 | 440 | ```sh 441 | externalIPv4=Public-IP-of-BBB-Server 442 | ``` 443 | 444 | STUN/TURN are needed only when the media server sits behind a NAT and needs to find out its own external IP address. However, if you set a static external IP address as mentioned above, then there is no need for the STUN/TURN auto-discovery. Hence, comment the following: using turn.higheredlab.com (IP address) 445 | 446 | ```sh 447 | #stunServerAddress=95.217.128.91 448 | #stunServerPort=3478 449 | ``` 450 | 451 | #### 5. Verify your media negotiation timeouts. 452 | 453 | Recommend setting is to set `baseTimeout` to `60000` in `/usr/share/meteor/bundle/programs/server/assets/app/config/settings.yml` 454 | 455 | #### 6. Verify Turn is working 456 | 457 | Visit `https://webrtc.github.io/samples/src/content/peerconnection/trickle-ice/` to check whether your Turn sevrer is working and enter the details below. Change Turn server URL to your Turn server URL. 458 | 459 | ```sh 460 | STUN or TURN URI: turn:turn.higheredlab.com:443?transport=tcp 461 | TURN username: 462 | TURN password: xxxx 463 | ``` 464 | 465 | Execute the code below to generate username and password. Replace `f23xxxea3841c9b91e9accccddde850c61` with the `static-auth-secret` from `/etc/turnserver.conf` file on the turn server. 466 | 467 | ```sh 468 | secret=f23xxxea3841c9b91e9accccddde850c61 && \ 469 | time=$(date +%s) && \ 470 | expiry=8400 && \ 471 | username=$(( $time + $expiry )) &&\ 472 | echo username:$username && \ 473 | echo password : $(echo -n $username | openssl dgst -binary -sha1 -hmac $secret | openssl base64) 474 | ``` 475 | 476 | Then click `Add Server` and then `Gather candidates` button. If you have done everything correctly, you should see `Done` as the final result. If you do not get any response or if you see any error messages, please double check if you have diligently followed above steps. 477 | 478 | ## Change favicon of Greenlight 479 | 480 | ```sh 481 | cd greenlight 482 | mkdir cpp 483 | #copy your favicon to greenlight/cpp 484 | vi docker-compose.yml 485 | #add the following line to volumes block and restart greenlight 486 | - ${PWD}/cpp/favicon.ico:/usr/src/app/app/assets/images/favicon.ico 487 | docker-compose down 488 | docker-compose up -d 489 | ``` 490 | 491 | If you have installed Greenlight along with BigBlueButton (bbb-install.sh with -g flag), follow the steps above to change the favicon. Be careful with space and syntax, while adding the line above to volumes block in docker-compose.yml 492 | 493 | ## Change logo and copyright of Recordings 494 | 495 | ```sh 496 | # copy your logo.png to /var/bigbluebutton/playback/presentation/2.0 497 | # edit defaultCopyright in /var/bigbluebutton/playback/presentation/2.0/playback.js 498 | ``` 499 | 500 | Do you want to see your logo in recording playback? Simply copy your logo to thr playback directory as mentioned above. 501 | 502 | Do you want to remove copyright message "Recorded with BigBlueButton"? Edit variable defaultCopyright in playback.js. 503 | 504 | ## GDPR 505 | 506 | ### No recording 507 | 508 | ```sh 509 | # edit /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 510 | disableRecordingDefault=true 511 | breakoutRoomsRecord=false 512 | ``` 513 | 514 | When a room is created in BigBlueButton that allows recordings (i.e., the recording button is visible) BigBlueButton will record the entire session. This is independent of the recording-button actually being pressed or not. A simpler solution is to stop recordings altogether. 515 | 516 | ### No logs 517 | 518 | #### 1. BigBlueButton logging 519 | 520 | ``` 521 | # BigBlueButton logs location: /var/log/bigbluebutton/bbb-web.log. To limit this log, set 522 | # (1) change appLogLevel from DEBUG to ERROR 523 | vi /usr/share/bbb-web/WEB-INF/classes/bigbluebutton.properties 524 | # (2) change each logger level to ERROR (default INFO and DEBUG) 525 | vi /usr/share/bbb-web/WEB-INF/classes/logback.xml 526 | 527 | # To avoid logging ip-addresses in bbb-webrtc-sfu change log > level to error (default verbose) 528 | vi /usr/local/bigbluebutton/bbb-webrtc-sfu/config/default.yml 529 | 530 | # To change logs level for chat usage and chat messages, change loglevel to ERROR 531 | vi /etc/bbb-transcode-akka/application.conf (default INFO) 532 | vi /etc/bbb-transcode-akka/logback.xml (default INFO, DEBUG, WARN] 533 | vi /etc/bbb-apps-akka/application.conf (default DEBUG) 534 | vi /etc/bbb-apps-akka/logback.xml (default INFO DEBUG) 535 | ``` 536 | 537 | #### 2. Nginx 538 | 539 | ``` 540 | # Nginx logs - change access log 541 | vi /etc/nginx/nginx.conf 542 | access_log /dev/null; (default /var/log/nginx/access.log) 543 | 544 | # Nginx logs - change access log 545 | vi /etc/nginx/sites-available/bigbluebutton 546 | access_log /dev/null; (default /var/log/nginx/bigbluebutton.access.log) 547 | ``` 548 | 549 | #### 3. Freeswitch 550 | 551 | ``` 552 | # Freeswitch logs - change loglevel and stdout-loglevel to ERROR (default DEBUG) 553 | vi /etc/bbb-fsesl-akka/application.conf 554 | 555 | # Freeswitch logs - change logger to ERROR (default INFO, DEBUG, WARN) 556 | vi /etc/bbb-fsesl-akka/logback.xml 557 | ``` 558 | 559 | #### 4. Red5 560 | 561 | ``` 562 | # red5 - change root > level to ERROR and each logger to ERROR (default INFO) 563 | vi /etc/red5/logback.xml 564 | ``` 565 | 566 | #### 5. Kurento 567 | 568 | ``` 569 | # export GST_DEBUG="1 ..." (Default is 3; Set it to 1, that is for Error) 570 | vi /etc/default/kurento-media-server 571 | ``` 572 | 573 | #### 6. Greenlight 574 | 575 | ``` 576 | vi .env 577 | 578 | # Comment the following live to send logs to log/production.log 579 | # RAILS_LOG_TO_STDOUT=true 580 | 581 | # Create symlink, replacing $GREENLIGHTDIR with the absolute path where Greenlight is installed. 582 | ln -s /dev/null $GREENLIGHTDIR/log/production.log 583 | ``` 584 | 585 | #### 7. Scalelite 586 | 587 | The Scalelite API container is logging user activities. For example: Who joined which meeting. 588 | This logfile will never be deleted automatically and it will get quite large, if scalelite is serving many users. 589 | Hence, delete logs via cronjobs. 590 | 591 | ``` 592 | # Login as root 593 | crontab -e 594 | 595 | # add to delete all Docker-Container-Logfiles. At 03:00 every sunday and thursday. 596 | 0 3 * * 0,4 truncate -s 0 /var/lib/docker/containers/*/*-json.log 597 | ``` 598 | 599 | #### 8. Coturn 600 | 601 | ``` 602 | ln -s /dev/null /var/log/coturn.log 603 | ``` 604 | 605 | #### 9. Rotate Logs 606 | 607 | If you want to keep logs, you can set days for which logs should be kept on the BBB server. 608 | 609 | ``` 610 | # Change log_history to 7 days (or as appropriate) 611 | vi /etc/cron.daily/bigluebutton 612 | 613 | # Change rotate to 7 (days) or as appropriate (this rotates log for /var/log/bigbluebutton/(bbb-rap-worker.log|sanity.log) 614 | vi /etc/logrotate.d/bbb-record-core.logrotate 615 | 616 | # Change rotate to 7 (days) or as appropriate (this rotates log for /var/log/bbb-webrtc-sfu/) 617 | vi bbb-webrtc-sfu.logrotate 618 | 619 | # Change MaxHistory to 7 (days) or as appropriate (this rotates log for /var/log/bigbluebutton/bbb-web.log) 620 | vi /usr/share/bbb-web/WEB-INF/classes/logback.xml 621 | ``` 622 | 623 | ### No Syslog entries 624 | 625 | ```ssh 626 | # Edit /usr/lib/systemd/system/bbb-htlm5.service 627 | StandardOutput=null 628 | # Restart 629 | systemctl daemon-reload 630 | ``` 631 | 632 | ## Change processing interval for recordings 633 | 634 | Normally, the BigBlueButton server begins processing the data recorded in a session soon after the session finishes. However, you can change the timing for processing by stopping recordings process before beginning of classes and restarting it after ending of classes. 635 | 636 | ```sh 637 | crontab -e 638 | 639 | # Add the following entries 640 | # Stop recording at 7 AM during week days 641 | 0 7 * * 1-5 systemctl stop bbb-rap-process-worker.service bbb-record-core.timer 642 | # Start recording at 6 PM during week days; bbb-record-core will automatically launch all workers required for processing 643 | 0 18 * * 1-5 systemctl start bbb-record-core.timer 644 | ``` 645 | 646 | You should change the timezone of your BBB server to that of your users for accurate cron job scheduling above. 647 | 648 | ```sh 649 | # Current timezone 650 | timedatectl 651 | 652 | # List of available timezone 653 | timedatectl list-timezones 654 | 655 | # Set new timezone by replacing Asia/Kolkata with your timezone 656 | timedatectl set-timezone Asia/Kolkata 657 | ``` 658 | 659 | ## Reboot BBB server 660 | 661 | Rebooting BBB server every night would take care of any zombie process or memory leaks. 662 | 663 | ```sh 664 | crontab -e 665 | 666 | # reboot every night at 10 PM 667 | 0 22 * * * /sbin/shutdown -r +5 668 | ``` 669 | 670 | ## Experimental 671 | 672 | We are still testing the tips below. Use at your own discretion. 673 | 674 | ### Greenlight: Error 675 | 676 | Do you get the following error in Greenlight: `Server Error - Invalid BigBlueButton Endpoint and Secret` 677 | 678 | Of course you should verify that you have given correct BBB URL and Secret in .env file of Greenlight. 679 | 680 | In addition, you can try the following tip: 681 | 682 | When BigBlueButton is running on a server, various component of BigBlueButton need to make connections to itself using the external hostname. Programs running within the BigBlueButton server that try to connect to the external hostname should reach BigBlueButton itself. 683 | 684 | To enable the BigBlueButton server to connect to itself using the external hostname, edit file /etc/hosts and add the line 685 | EXTERNAL_IP_ADDRESS EXTERNAL_HOST_NAME 686 | 687 | where EXTERNAL_IP_ADDRESS with the external IP of your firewall and EXTERNAL_HOST_NAME with the external hostname of your firewall. For example, the addition to /etc/hosts would be 172.34.56.78 bigbluebutton.example.com 688 | 689 | [Reference](https://github.com/bigbluebutton/greenlight/issues/970#issuecomment-742610399) 690 | 691 | ## BigBlueButton Tech Support 692 | 693 | Are you facing difficulties with your BigBlueButton server? 694 | 695 | Lean on our expertise to smoothly run your BigBlueButton server. 696 | 697 | Get 24×7 connected with our Tech team. On facing any difficulties, just message us and we’ll promptly fix it. 698 | 699 | Start today with a monthly subscription for $59 per BBB server. 700 | 701 | [Learn More](https://higheredlab.com/bigbluebutton-support/) about the scope of Tech support. 702 | 703 | ## More on BigBlueButton 704 | 705 | Check-out the following apps to further extend features of BBB. 706 | 707 | ### [bbb-jamboard](https://github.com/manishkatyan/bbb-jamboard) 708 | 709 | The default whiteboard of BigBlueButton has limited features including no eraser. Many teachers wish to have a more features-rich whiteboard that would help them better in conducting online classes. 710 | 711 | With BBB-Jamboard, you can easily integrate Google Jamboard into your BigBlueButton server. 712 | 713 | Jamboard is a digital interactive whiteboard developed by Google and can be used in stead of the default BugBlueButton whiteboard. Google Jamboard has the eraser feature that has often been requested by BigBlueButton users. 714 | 715 | ### [bbb-twilio](https://github.com/manishkatyan/bbb-twilio) 716 | 717 | Integrate Twilio into BigBlueButton so that users can join a meeting with a dial-in number. You can get local numbers for almost all the countries. 718 | 719 | ### [bbb-mp4](https://github.com/manishkatyan/bbb-mp4) 720 | 721 | With this app, you can convert a BigBlueButton recording into MP4 video and upload to S3. You can covert multiple MP4 videos in parallel or automate the conversion process. 722 | 723 | ### [bbb-streaming](https://github.com/manishkatyan/bbb-streaming) 724 | 725 | Livestream your BigBlueButton classes on Youtube or Facebook to thousands of your users. 726 | 727 | ### [100 Most Googled Questions on BigBlueButton](https://higheredlab.com/bigbluebutton-guide/) 728 | 729 | Everything you need to know about BigBlueButton including pricing, comparison with Zoom, Moodle integrations, scaling, and dozens of troubleshooting. 730 | --------------------------------------------------------------------------------