2024-08-29 04:45:19 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# Quick Jigasi Installer with VOSK backend - *buntu (LTS) based systems.
|
|
|
|
# SwITNet Ltd © - 2024, https://switnet.net/
|
|
|
|
# GPLv3 or later.
|
|
|
|
|
|
|
|
#Check if user is root
|
|
|
|
if ! [ "$(id -u)" = 0 ]; then
|
|
|
|
echo "You need to be root or have sudo privileges!"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
exit_if_not_installed() {
|
|
|
|
if [ "$(dpkg-query -W -f='${Status}' "$1" 2>/dev/null | grep -c "ok installed")" != "1" ]; then
|
|
|
|
echo " This instance doesn't have $1 installed, exiting..."
|
|
|
|
echo " If you think this is an error, please report to:
|
|
|
|
-> https://forge.switnet.net/switnet/quick-jibri-installer/issues "
|
|
|
|
exit
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
clear
|
|
|
|
echo ''
|
|
|
|
echo '########################################################################'
|
|
|
|
echo ' Jigasi Transcript addon'
|
|
|
|
echo '########################################################################'
|
|
|
|
echo ' by Software, IT & Networks Ltd'
|
|
|
|
echo ''
|
|
|
|
|
|
|
|
exit_if_not_installed jitsi-meet
|
|
|
|
|
2024-08-30 00:51:27 +00:00
|
|
|
DOMAIN="$(find /etc/prosody/conf.d/ -name \*.lua|awk -F'.cfg' '!/localhost/{print $1}'|xargs basename)"
|
|
|
|
JIG_TRANSC_PASWD="$(tr -dc "a-zA-Z0-9#*=" < /dev/urandom | fold -w 16 | head -n1)"
|
2024-08-29 04:45:19 +00:00
|
|
|
JIG_SIP_PROP="/etc/jitsi/jigasi/sip-communicator.properties"
|
2024-08-30 00:51:27 +00:00
|
|
|
export DOMAIN
|
|
|
|
export JIG_TRANSC_PASWD
|
2024-08-29 04:45:19 +00:00
|
|
|
|
|
|
|
apt-get -q2 update
|
|
|
|
|
2024-08-30 00:51:27 +00:00
|
|
|
# Disable SIP account prompt by default
|
2024-08-29 04:45:19 +00:00
|
|
|
echo "jigasi jigasi/sip-account string ''" | debconf-set-selections
|
|
|
|
echo "jigasi jigasi/sip-password password ''" | debconf-set-selections
|
|
|
|
|
|
|
|
echo "Installing Jigasi, SIP configuration disabled by default."
|
|
|
|
apt-get -y install gettext-base jigasi docker.io
|
|
|
|
|
|
|
|
echo "Please select a language for the VOSK transcription model:"
|
|
|
|
echo "1) Chinese"
|
|
|
|
echo "2) English"
|
|
|
|
echo "3) French"
|
|
|
|
echo "4) German"
|
|
|
|
echo "5) Hindi"
|
|
|
|
echo "6) Japanese"
|
|
|
|
echo "7) Russian"
|
|
|
|
echo "8) Spanish"
|
|
|
|
|
2024-08-30 00:51:27 +00:00
|
|
|
read -p "Enter the number corresponding to your language choice: " -r lang_choice
|
2024-08-29 04:45:19 +00:00
|
|
|
|
|
|
|
case $lang_choice in
|
|
|
|
1)
|
|
|
|
echo "You selected Chinese."
|
|
|
|
VOSK_DOCKER_MODEL="alphacep/kaldi-cn"
|
|
|
|
;;
|
|
|
|
2)
|
|
|
|
echo "You selected English."
|
|
|
|
VOSK_DOCKER_MODEL="alphacep/kaldi-en"
|
|
|
|
;;
|
|
|
|
3)
|
|
|
|
echo "You selected French."
|
|
|
|
VOSK_DOCKER_MODEL="alphacep/kaldi-fr"
|
|
|
|
;;
|
|
|
|
4)
|
|
|
|
echo "You selected German."
|
|
|
|
VOSK_DOCKER_MODEL="alphacep/kaldi-de"
|
|
|
|
;;
|
|
|
|
5)
|
|
|
|
echo "You selected Hindi."
|
|
|
|
VOSK_DOCKER_MODEL="alphacep/kaldi-hi"
|
|
|
|
;;
|
|
|
|
6)
|
|
|
|
echo "You selected Japanese."
|
|
|
|
VOSK_DOCKER_MODEL="alphacep/kaldi-ja"
|
|
|
|
;;
|
|
|
|
7)
|
|
|
|
echo "You selected Russian."
|
|
|
|
VOSK_DOCKER_MODEL="alphacep/kaldi-ru"
|
|
|
|
;;
|
|
|
|
8)
|
|
|
|
echo "You selected Spanish."
|
|
|
|
VOSK_DOCKER_MODEL="alphacep/kaldi-es"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "Invalid selection. Please choose a number between 1 and 8."
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Running selected VOSK docker model.
|
2024-08-30 00:51:27 +00:00
|
|
|
docker run -d --restart always -p 2700:2700 ${VOSK_DOCKER_MODEL}:latest
|
2024-08-29 04:45:19 +00:00
|
|
|
|
|
|
|
echo "Setting up Jigasi transcript with current platform..."
|
|
|
|
|
|
|
|
# Jitsi Meet
|
|
|
|
echo "> Patching Jitsi Meet's config.js for Transcription support."
|
2024-08-30 00:51:27 +00:00
|
|
|
echo " Read more at patches/jigasi/001-jigasi-meet-config.patch file"
|
|
|
|
envsubst < patches/jigasi/001-jigasi-meet-config.patch | \
|
|
|
|
patch --no-backup-if-mismatch -d / -p1
|
2024-08-29 04:45:19 +00:00
|
|
|
|
|
|
|
# Jigasi
|
|
|
|
echo "> Patching jigasi's sip-communicator.properties configuration."
|
2024-08-30 00:51:27 +00:00
|
|
|
echo " Read more at patches/jigasi/002-jigasi-sip-properties.patch file"
|
2024-08-29 04:45:19 +00:00
|
|
|
cp "$JIG_SIP_PROP" ${JIG_SIP_PROP}-dpkg-file
|
2024-08-30 00:51:27 +00:00
|
|
|
envsubst < patches/jigasi/002-jigasi-sip-properties.patch | \
|
|
|
|
patch --no-backup-if-mismatch -d / -p1
|
2024-08-29 04:45:19 +00:00
|
|
|
|
|
|
|
# Create transcribe user on hidden domain.
|
|
|
|
prosodyctl register transcriber recorder."$DOMAIN" "$JIG_TRANSC_PASWD"
|
|
|
|
|
|
|
|
# Restart services.
|
|
|
|
systemctl restart prosody \
|
|
|
|
jicofo \
|
|
|
|
jigasi \
|
|
|
|
jibri* \
|
|
|
|
jitsi-videobridge2
|
|
|
|
|
|
|
|
echo ""
|
|
|
|
echo "Full transcript files are available at:"
|
|
|
|
echo "--> /var/lib/jigasi/transcripts/"
|
|
|
|
echo ""
|
|
|
|
echo "Happy transcripting!"
|
|
|
|
echo ""
|