| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | # Custom High Performance Jitsi conf | 
					
						
							| 
									
										
										
										
											2025-02-20 09:26:11 +00:00
										 |  |  | # SwITNet Ltd © - 2025, https://switnet.net/ | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | # GPLv3 or later. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-17 14:37:39 +00:00
										 |  |  | while getopts m: option | 
					
						
							|  |  |  | do | 
					
						
							|  |  |  | 	case "${option}" | 
					
						
							|  |  |  | 	in | 
					
						
							|  |  |  | 		m) MODE=${OPTARG};; | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | 		\?) echo "Usage: sudo bash ./$0 [-m debug]" && exit;; | 
					
						
							| 
									
										
										
										
											2020-12-17 14:37:39 +00:00
										 |  |  | 	esac | 
					
						
							|  |  |  | done | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | #DEBUG | 
					
						
							|  |  |  | if [ "$MODE" = "debug" ]; then | 
					
						
							|  |  |  | set -x | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | #Check if user is root | 
					
						
							|  |  |  | if ! [ "$(id -u)" = 0 ]; then | 
					
						
							|  |  |  |    echo "You need to be root or have privileges!" | 
					
						
							|  |  |  |    exit 0 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | wait_seconds() { | 
					
						
							|  |  |  | secs=$(($1)) | 
					
						
							|  |  |  | while [ $secs -gt 0 ]; do | 
					
						
							|  |  |  |    echo -ne "$secs\033[0K\r" | 
					
						
							|  |  |  |    sleep 1 | 
					
						
							|  |  |  |    : $((secs--)) | 
					
						
							|  |  |  | done | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  | set_once() { | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | if ! grep -q "$(awk '!/^ *#/ && NF {print}' "$2"|grep "$(awk -F '=' '{print$1}' <<< "$1")")" ; then | 
					
						
							|  |  |  |   echo "Setting $1 on $2..." | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  |   echo "$1" | tee -a "$2" | 
					
						
							|  |  |  | else | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |   echo " \"$(echo "$1"|awk -F '=' '{print$1}')\" seems present, skipping setting this variable" | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  | fi | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | # True if $1 is greater than $2 | 
					
						
							|  |  |  | version_gt() { test "$(printf '%s\n' "$@" | sort -V | head -n 1)" != "$1"; } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | LTS_REL="$(lsb_release -d | awk '{print$4}')" | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)" | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | JVB_LOG_POP="/etc/jitsi/videobridge/logging.properties" | 
					
						
							|  |  |  | JVB_RC="/usr/share/jitsi-videobridge/lib/videobridge.rc" | 
					
						
							|  |  |  | JICOFO_LOG_POP="/etc/jitsi/videobridge/logging.properties" | 
					
						
							|  |  |  | MEET_LOG_CONF="/usr/share/jitsi-meet/logging_config.js" | 
					
						
							|  |  |  | MEET_CONF="/etc/jitsi/meet/$DOMAIN-config.js" | 
					
						
							|  |  |  | MEET_CONF_HP="/etc/jitsi/meet/${DOMAIN}-chp-config.js" | 
					
						
							| 
									
										
										
										
											2020-12-17 12:47:10 +00:00
										 |  |  | INT_CONF_JS="/etc/jitsi/meet/${DOMAIN}-interface_config.js" | 
					
						
							|  |  |  | INT_CONF_JS_HP="/etc/jitsi/meet/${DOMAIN}-chp-interface_config.js" | 
					
						
							| 
									
										
										
										
											2022-04-13 04:16:09 +00:00
										 |  |  | WS_CONF="/etc/nginx/sites-available/$DOMAIN.conf" | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | CHAT_DISABLED="TBD" | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | if [ -f "$MEET_CONF_HP" ] || [ -f "$INT_CONF_JS_HP" ]; then | 
					
						
							| 
									
										
										
										
											2021-01-05 23:52:26 +00:00
										 |  |  | echo "
 | 
					
						
							|  |  |  | This script can't be run multiple times on the same system, | 
					
						
							|  |  |  | idempotence not guaranteed, exiting..."
 | 
					
						
							|  |  |  | exit | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | if [ -z "$LTS_REL" ] || [ -z "$DOMAIN" ];then | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | echo "This system isn't suitable to configure." | 
					
						
							|  |  |  | exit | 
					
						
							|  |  |  |   else | 
					
						
							|  |  |  | echo "This system seems suitable to configure..." | 
					
						
							|  |  |  | fi | 
					
						
							| 
									
										
										
										
											2020-12-20 06:40:03 +00:00
										 |  |  | echo "What does this script do?
 | 
					
						
							|  |  |  | Overview: | 
					
						
							|  |  |  |  - Disables swap partition | 
					
						
							|  |  |  |  - Tunes, | 
					
						
							|  |  |  |    * Some kernel networking settings | 
					
						
							|  |  |  |    * nginx connections number | 
					
						
							|  |  |  |    * jvb2 logging | 
					
						
							|  |  |  |    * jicofo logging | 
					
						
							|  |  |  |    * meet logging | 
					
						
							| 
									
										
										
										
											2021-01-05 23:52:26 +00:00
										 |  |  |  - Modify UX by changing session configuration & toolbar. | 
					
						
							|  |  |  |  - Disable browsers not compatible with CHP, | 
					
						
							|  |  |  |    * Safari | 
					
						
							|  |  |  |    * Firefox* | 
					
						
							|  |  |  | "
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-06 17:39:53 +00:00
										 |  |  | echo "# Note: As for January 2021 Firefox can't handle correctly widescreen sizing
 | 
					
						
							|  |  |  | # on lower resolution than HD (nHD & qHD), setting as incompatible for now. | 
					
						
							|  |  |  | # (If you know this is no longer the case. Please report it to \ | 
					
						
							| 
									
										
										
										
											2023-11-07 20:42:50 +00:00
										 |  |  | https://forge.switnet.net/switnet/quick-jibri-installer/issues) | 
					
						
							| 
									
										
										
										
											2021-01-05 23:52:26 +00:00
										 |  |  | "
 | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #Tools to consider | 
					
						
							|  |  |  | ##Profiling | 
					
						
							|  |  |  | #https://github.com/jvm-profiling-tools/async-profiler | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | while [[ "$CONTINUE_HP" != "yes" && "$CONTINUE_HP" != "no" ]] | 
					
						
							|  |  |  |     do | 
					
						
							|  |  |  |     read -p "> Do you want to continue?: (yes or no)"$'\n' -r CONTINUE_HP | 
					
						
							|  |  |  |     if [ "$CONTINUE_HP" = "no" ]; then | 
					
						
							|  |  |  |             echo "See you next time!..." | 
					
						
							|  |  |  |             exit | 
					
						
							|  |  |  |     elif [ "$CONTINUE_HP" = "yes" ]; then | 
					
						
							|  |  |  |             echo "Good, then let's get it done..." | 
					
						
							|  |  |  |     fi | 
					
						
							|  |  |  | done | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | # Video resolution selector | 
					
						
							|  |  |  | echo "
 | 
					
						
							|  |  |  | #-------------------------------------------------- | 
					
						
							|  |  |  | # Conference widescreen video resolution. | 
					
						
							|  |  |  | #-------------------------------------------------- | 
					
						
							|  |  |  | "
 | 
					
						
							|  |  |  | echo "If you are using a high volume of users we recommend to use nHD (640x360),
 | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  | or at most qHD (960x540) resolution as default, since bandwith increase | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | exponentially with the more concurrent users on a meeting. | 
					
						
							|  |  |  | Either way, choose your desired video resolution. | 
					
						
							|  |  |  | "
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | PS3='Select the desired resolution for high performance mode: ' | 
					
						
							|  |  |  | options=("nHD - 640x360" "qHD - 960x540" "HD - 1280x720") | 
					
						
							|  |  |  | select opt in "${options[@]}" | 
					
						
							|  |  |  | do | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |     case "$opt" in | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  |         "nHD - 640x360") | 
					
						
							|  |  |  |             echo -e "\n  > Setting 640x360 resolution.\n" | 
					
						
							|  |  |  |             VID_RES="360" | 
					
						
							|  |  |  |             break | 
					
						
							|  |  |  |             ;; | 
					
						
							|  |  |  |         "qHD - 960x540") | 
					
						
							|  |  |  |             echo -e "\n  > Setting 960x540 resolution.\n" | 
					
						
							|  |  |  |             VID_RES="540" | 
					
						
							|  |  |  |             break | 
					
						
							|  |  |  |             ;; | 
					
						
							|  |  |  |         "HD - 1280x720") | 
					
						
							|  |  |  |             echo -e "\n  > Setting 1280x720 resolution.\n" | 
					
						
							|  |  |  |             VID_RES="720" | 
					
						
							|  |  |  |             break | 
					
						
							|  |  |  |             ;; | 
					
						
							|  |  |  |         *) echo "Invalid option $REPLY, choose 1, 2 or 3";; | 
					
						
							|  |  |  |     esac | 
					
						
							|  |  |  | done | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | echo "
 | 
					
						
							|  |  |  | # Disable Chat? | 
					
						
							|  |  |  | > In case you have your own chat solution for the meetings you might | 
					
						
							|  |  |  | wanna disable Jitsi's chat from the toolbox. | 
					
						
							|  |  |  | "
 | 
					
						
							|  |  |  | while [[ "$CHAT_DISABLED" != "yes" && \
 | 
					
						
							|  |  |  |          "$CHAT_DISABLED" != "no" && \
 | 
					
						
							|  |  |  |          "$CHAT_DISABLED" != "" ]] | 
					
						
							|  |  |  | do | 
					
						
							|  |  |  | echo "> Do you want to disable jitsi's built-in chat?: (yes or no)" | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | read -p "(Also you can leave empty to disable)"$'\n' -r CHAT_DISABLED | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | if [ "$CHAT_DISABLED" = "no" ]; then | 
					
						
							|  |  |  | 	echo -e "-- Jitsi's built-in chat will be kept active.\n" | 
					
						
							|  |  |  | elif [ "$CHAT_DISABLED" = "yes" ] || [ -z "$CHAT_DISABLED" ]; then | 
					
						
							|  |  |  | 	echo -e "-- Jitsi's built-in chat will be disabled. \n" | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | done | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-05-14 01:21:18 +00:00
										 |  |  | ## JMS system tune up | 
					
						
							|  |  |  | if [ "$MODE" = "debug" ]; then | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |     bash "$PWD"/jms-stu.sh -m debug | 
					
						
							| 
									
										
										
										
											2021-05-14 01:21:18 +00:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |     bash "$PWD"/jms-stu.sh | 
					
						
							| 
									
										
										
										
											2021-05-14 01:21:18 +00:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #JVB2 | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  | ##Loose up logging | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | # https://community.jitsi.org/t/23641/13 | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | sed -i "/java.util.logging.FileHandler.level/s|ALL|WARNING|g" "$JVB_LOG_POP" | 
					
						
							|  |  |  | sed -i "s|^.level=INFO|.level=WARNING|" "$JVB_LOG_POP" | 
					
						
							|  |  |  | sed -i "/VIDEOBRIDGE_MAX_MEMORY=/i \ VIDEOBRIDGE_MAX_MEMORY=8192m" "$JVB_RC" | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #JICOFO | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | sed -i "/java.util.logging.FileHandler.level/s|ALL|OFF|g" "$JICOFO_LOG_POP" | 
					
						
							|  |  |  | sed -i "s|^.level=INFO|.level=WARNING|" "$JICOFO_LOG_POP" | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #MEET | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | sed -i "s|defaultLogLevel:.*|defaultLogLevel: 'error',|" "$MEET_LOG_CONF" | 
					
						
							|  |  |  | sed -i "/TraceablePeerConnection.js/s|info|error|" "$MEET_LOG_CONF" | 
					
						
							|  |  |  | sed -i "/CallStats.js/s|info|error|" "$MEET_LOG_CONF" | 
					
						
							|  |  |  | sed -i "/strophe.util.js/s|log|error|" "$MEET_LOG_CONF" | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							|  |  |  | #UX - Room settings and interface | 
					
						
							| 
									
										
										
										
											2020-12-20 06:40:03 +00:00
										 |  |  | ## config.js | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | cp "$MEET_CONF" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "s|// disableAudioLevels:.*|disableAudioLevels: true,|" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "s|enableNoAudioDetection:.*|enableNoAudioDetection: false,|" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "s|enableNoisyMicDetection:.*|enableNoisyMicDetection: false,|" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "s|startAudioMuted:.*|startAudioMuted: 5,|" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "s|// startVideoMuted:.*|startVideoMuted: 5,|" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "s|startWithVideoMuted: true,|startWithVideoMuted: false,|" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "s|channelLastN:.*|channelLastN: 10,|" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "s|// enableLayerSuspension:.*|enableLayerSuspension: true,|" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "s|// apiLogLevels:.*|apiLogLevels: \['warn', 'error'],|" "$MEET_CONF_HP" | 
					
						
							| 
									
										
										
										
											2020-12-17 12:47:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | if [ "$VID_RES" = "360" ]; then | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | sed -i "/Start QJI/,/End QJI/d" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \/\/ Start QJI - Set resolution and widescreen format" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ resolution: 360," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ constraints: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ aspectRatio: 16 \/ 9," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ video: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ height: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 360," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 360," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 180" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ width: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 640," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 640," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 320" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ }," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \/\/ End QJI" "$MEET_CONF_HP" | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | fi | 
					
						
							|  |  |  | if [ "$VID_RES" = "540" ]; then | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | sed -i "/Start QJI/,/End QJI/d" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \/\/ Start QJI - Set resolution and widescreen format" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ resolution: 540," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ constraints: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ aspectRatio: 16 \/ 9," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ video: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ height: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 540," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 540," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 180" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ width: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 960," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 960," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 320" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ }," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \/\/ End QJI" "$MEET_CONF_HP" | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | fi | 
					
						
							|  |  |  | if [ "$VID_RES" = "720" ]; then | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | sed -i "/Start QJI/,/End QJI/d" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \/\/ Start QJI - Set resolution and widescreen format" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ resolution: 720," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ constraints: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ aspectRatio: 16 \/ 9," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ video: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ height: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 720," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 720," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 180" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ width: {" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ideal: 1280," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ max: 1280," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ min: 320" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ \ \ \ \ }" "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \ \ \ \ \ }," "$MEET_CONF_HP" | 
					
						
							|  |  |  | sed -i "/Enable \/ disable simulcast support/i \/\/ End QJI" "$MEET_CONF_HP" | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-20 06:40:03 +00:00
										 |  |  | ## interface_config.js | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | cp "$INT_CONF_JS" "$INT_CONF_JS_HP" | 
					
						
							|  |  |  | sed -i "s|CONNECTION_INDICATOR_DISABLED:.*|CONNECTION_INDICATOR_DISABLED: true,|" "$INT_CONF_JS_HP" | 
					
						
							|  |  |  | sed -i "s|DISABLE_DOMINANT_SPEAKER_INDICATOR:.*|DISABLE_DOMINANT_SPEAKER_INDICATOR: true,|" "$INT_CONF_JS_HP" | 
					
						
							|  |  |  | sed -i "s|DISABLE_FOCUS_INDICATOR:.*|DISABLE_FOCUS_INDICATOR: false,|" "$INT_CONF_JS_HP" | 
					
						
							|  |  |  | sed -i "s|DISABLE_JOIN_LEAVE_NOTIFICATIONS:.*|DISABLE_JOIN_LEAVE_NOTIFICATIONS: true,|" "$INT_CONF_JS_HP" | 
					
						
							|  |  |  | sed -i "s|DISABLE_VIDEO_BACKGROUND:.*|DISABLE_VIDEO_BACKGROUND: true,|" "$INT_CONF_JS_HP" | 
					
						
							|  |  |  | sed -i "s|OPTIMAL_BROWSERS: \[.*|OPTIMAL_BROWSERS: \[ 'chrome', 'chromium', 'electron' \],|" "$INT_CONF_JS_HP" | 
					
						
							|  |  |  | sed -i "s|UNSUPPORTED_BROWSERS: .*|UNSUPPORTED_BROWSERS: \[ 'nwjs', 'safari', 'firefox' \],|" "$INT_CONF_JS_HP" | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-20 06:40:03 +00:00
										 |  |  | ### Toolbars | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  | if version_gt "$(apt-show-versions jitsi-meet|awk '{print$2}')" "2.0.5390-3" ; then | 
					
						
							|  |  |  |   #New toolbar in config.js | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |   sed -i "/\/\/ toolbarButtons:/i \ \ \ \ toolbarButtons:: \[" "$MEET_CONF_HP" | 
					
						
							|  |  |  |   sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'microphone', 'camera', 'desktop', 'fullscreen'," "$MEET_CONF_HP" | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  |   if [ -z "$CHAT_DISABLED" ] || [ "$CHAT_DISABLED" = "yes" ]; then | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |     sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'recording'," "$MEET_CONF_HP" | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  |   else | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |     sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'chat', 'recording'," "$MEET_CONF_HP" | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  |   fi | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |   sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'livestreaming', 'etherpad', 'settings', 'raisehand'," "$MEET_CONF_HP" | 
					
						
							|  |  |  |   sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'videoquality', 'filmstrip', 'feedback'," "$MEET_CONF_HP" | 
					
						
							|  |  |  |   sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \ \ \ \ 'tileview', 'download', 'help', 'mute-everyone', 'mute-video-everyone', 'security'" "$MEET_CONF_HP" | 
					
						
							|  |  |  |   sed -i "/\/\/ toolbarButtons:/i \ \ \ \ \]," "$MEET_CONF_HP" | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | else | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  |   #Old toolbar in interface.js (soon deprecated on newer versions) | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |   sed -i "/^\s*TOOLBAR_BUTTONS*\]$/ s|^|//|; /^\s*TOOLBAR_BUTTONS/, /\],$/ s|^|//|" "$INT_CONF_JS_HP" | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |   sed -i "/\/\/    TOOLBAR_BUTTONS/i \ \ \ \ TOOLBAR_BUTTONS: \[" "$INT_CONF_JS_HP" | 
					
						
							|  |  |  |   sed -i "/\/\/    TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'microphone', 'camera', 'desktop', 'fullscreen'," "$INT_CONF_JS_HP" | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  |   if [ -z "$CHAT_DISABLED" ] || [ "$CHAT_DISABLED" = "yes" ]; then | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |     sed -i "/\/\/    TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'recording'," "$INT_CONF_JS_HP" | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  |   else | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |     sed -i "/\/\/    TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'fodeviceselection', 'hangup', 'profile', 'chat', 'recording'," "$INT_CONF_JS_HP" | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  |   fi | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  |   sed -i "/\/\/    TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'livestreaming', 'etherpad', 'settings', 'raisehand'," "$INT_CONF_JS_HP" | 
					
						
							|  |  |  |   sed -i "/\/\/    TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'videoquality', 'filmstrip', 'feedback'," "$INT_CONF_JS_HP" | 
					
						
							|  |  |  |   sed -i "/\/\/    TOOLBAR_BUTTONS/i \ \ \ \ \ \ \ \ 'tileview', 'download', 'help', 'mute-everyone', 'mute-video-everyone', 'security'" "$INT_CONF_JS_HP" | 
					
						
							|  |  |  |   sed -i "/\/\/    TOOLBAR_BUTTONS/i \ \ \ \ \]," "$INT_CONF_JS_HP" | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | #Check config file | 
					
						
							|  |  |  | echo -e "\n# Checking $MEET_CONF file for errors\n" | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | CHECKJS_MEET_CHP="$(esvalidate "$MEET_CONF_HP"| cut -d ":" -f2)" | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | if [ -z "$CHECKJS_MEET_CHP" ]; then | 
					
						
							|  |  |  | echo -e "\n# The $MEET_CONF_HP configuration seems correct. =)\n" | 
					
						
							|  |  |  | else | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  | echo -e "\n  Watch out!, there seems to be an issue on $MEET_CONF_HP line:
 | 
					
						
							|  |  |  |     $CHECKJS_MEET_CHP | 
					
						
							|  |  |  |   Most of the times this is due upstream changes, please report to | 
					
						
							| 
									
										
										
										
											2023-11-07 20:42:50 +00:00
										 |  |  |   https://forge.switnet.net/switnet/quick-jibri-installer/issues\n"
 | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | fi | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | CHECKJS_INT_CHP="$(esvalidate "$INT_CONF_JS_HP"| cut -d ":" -f2)" | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | if [ -z "$CHECKJS_INT_CHP" ]; then | 
					
						
							|  |  |  | echo -e "\n# The $INT_CONF_JS_HP configuration seems correct. =)\n" | 
					
						
							|  |  |  | else | 
					
						
							| 
									
										
										
										
											2021-04-26 20:58:23 +00:00
										 |  |  | echo -e "\n  Watch out!, there seems to be an issue on $INT_CONF_JS_HP line:
 | 
					
						
							|  |  |  |     $CHECKJS_INT_CHP | 
					
						
							|  |  |  |   Most of the times this is due upstream changes, please report to | 
					
						
							| 
									
										
										
										
											2023-11-07 20:42:50 +00:00
										 |  |  |   https://forge.switnet.net/switnet/quick-jibri-installer/issues\n"
 | 
					
						
							| 
									
										
										
										
											2021-01-05 08:05:32 +00:00
										 |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-05-21 01:07:02 +00:00
										 |  |  | sed -i "s|$MEET_CONF|$MEET_CONF_HP|g" "$WS_CONF" | 
					
						
							|  |  |  | sed -i "s|$INT_CONF_JS|$INT_CONF_JS_HP|" "$WS_CONF" | 
					
						
							| 
									
										
										
										
											2020-12-17 14:37:39 +00:00
										 |  |  | nginx -t | 
					
						
							|  |  |  | #systemctl restart nginx | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-12-15 13:54:48 +00:00
										 |  |  | echo "Done!, yeah, that quick ;)" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | echo "Rebooting in..." | 
					
						
							|  |  |  | wait_seconds 15 | 
					
						
							|  |  |  | reboot |