From 4c2f84aea04d642428af5ee44df288d95f8d6245 Mon Sep 17 00:00:00 2001 From: Aaron van Meerten Date: Tue, 20 Aug 2024 14:17:42 -0400 Subject: [PATCH] feat(jigasi): new JIGASI_MODE variable for sip vs transcriber behavior --- jigasi.yml | 1 + .../defaults/sip-communicator.properties | 30 +++++++-- jigasi/rootfs/etc/cont-init.d/10-config | 13 +++- transcriber.yml | 67 +++++++++++++++++++ 4 files changed, 104 insertions(+), 7 deletions(-) create mode 100644 transcriber.yml diff --git a/jigasi.yml b/jigasi.yml index 2c83398..0084b6a 100644 --- a/jigasi.yml +++ b/jigasi.yml @@ -37,6 +37,7 @@ services: - JIGASI_JVB_TIMEOUT - JIGASI_LOCAL_REGION - JIGASI_LOG_FILE + - JIGASI_MODE="sip" - JIGASI_SIP_URI - JIGASI_SIP_PASSWORD - JIGASI_SIP_SERVER diff --git a/jigasi/rootfs/defaults/sip-communicator.properties b/jigasi/rootfs/defaults/sip-communicator.properties index 850d1af..da52380 100644 --- a/jigasi/rootfs/defaults/sip-communicator.properties +++ b/jigasi/rootfs/defaults/sip-communicator.properties @@ -1,8 +1,10 @@ -{{ $ENABLE_TRANSCRIPTIONS := .Env.ENABLE_TRANSCRIPTIONS | default "0" | toBool -}} {{ $JIGASI_BREWERY_MUC := .Env.JIGASI_BREWERY_MUC | default "jigasibrewery" -}} {{ $JIGASI_XMPP_USER := .Env.JIGASI_XMPP_USER | default "jigasi" -}} {{ $JIGASI_JVB_TIMEOUT := .Env.JIGASI_JVB_TIMEOUT | default "30000" -}} +{{ $JIGASI_MODE := .Env.JIGASI_MODE | default "sip" -}} {{ $JIGASI_LOCAL_REGION := .Env.JIGASI_LOCAL_REGION | default "" -}} +{{ $JIGASI_TRANSCRIBER_USER := .Env.JIGASI_TRANSCRIBER_USER | default "transcriber" -}} +{{ $JIGASI_TRANSCRIBER_FILTER_SILENCE = .Env.JIGASI_TRANSCRIBER_FILTER_SILENCE | default "0" | toBool -}} {{ $BOSH_URL_PATTERN := .Env.BOSH_URL_PATTERN | default "" -}} {{ $USE_TRANSLATOR_IN_CONFERENCE := .Env.USE_TRANSLATOR_IN_CONFERENCE | default "0" | toBool -}} {{ $XMPP_AUTH_DOMAIN := .Env.XMPP_AUTH_DOMAIN | default "auth.meet.jitsi" -}} @@ -11,10 +13,10 @@ {{ $XMPP_INTERNAL_MUC_DOMAIN := .Env.XMPP_INTERNAL_MUC_DOMAIN | default "internal-muc.meet.jitsi" -}} {{ $XMPP_DOMAIN := .Env.XMPP_DOMAIN | default "meet.jitsi" -}} {{ $XMPP_PORT := .Env.XMPP_PORT | default "5222" -}} +{{ $XMPP_RECORDER_DOMAIN := .Env.XMPP_RECORDER_DOMAIN | default "recorder.meet.jitsi" -}} {{ $XMPP_SERVER := .Env.XMPP_SERVER | default "xmpp.meet.jitsi" -}} {{ $XMPP_SERVERS := splitList "," $XMPP_SERVER -}} {{ $SHUTDOWN_REST_ENABLED := .Env.SHUTDOWN_REST_ENABLED | default "false" | toBool -}} -{{ $DISABLE_SIP := .Env.JIGASI_DISABLE_SIP | default "false" | toBool -}} {{/* assign env from context, preserve during range when . is re-assigned */}} {{ $TRUSTED_DOMAIN_LIST := .Env.JIGASI_TRUSTED_DOMAINS | default "" -}} {{ $TRUSTED_DOMAINS := splitList "," $TRUSTED_DOMAIN_LIST -}} @@ -31,7 +33,7 @@ net.java.sip.communicator.packetlogging.PACKET_LOGGING_ENABLED=false # Control REST Shutdown org.jitsi.jigasi.ENABLE_REST_SHUTDOWN={{ $SHUTDOWN_REST_ENABLED }} -{{ if not $ENABLE_TRANSCRIPTIONS -}} +{{ if eq $JIGASI_MODE "sip" -}} # SIP account net.java.sip.communicator.impl.protocol.sip.acc1=acc1 {{ if .Env.JIGASI_SIP_SERVER }} @@ -134,7 +136,7 @@ net.java.sip.communicator.impl.protocol.jabber.acc{{ $index }}.BREWERY={{ $JIGAS net.java.sip.communicator.impl.protocol.jabber.acc{{ $index }}.DOMAIN_BASE={{ $XMPP_DOMAIN }} {{ end -}} org.jitsi.jigasi.BREWERY_ENABLED=true -org.jitsi.jigasi.ENABLE_SIP={{ not $DISABLE_SIP }} +org.jitsi.jigasi.ENABLE_SIP={{ eq $JIGASI_MODE "sip" }} org.jitsi.jigasi.HEALTH_CHECK_SIP_URI={{ .Env.JIGASI_HEALTH_CHECK_SIP_URI | default "" }} org.jitsi.jigasi.HEALTH_CHECK_INTERVAL={{ .Env.JIGASI_HEALTH_CHECK_INTERVAL | default "300000" }} @@ -148,6 +150,12 @@ org.jitsi.jigasi.xmpp.acc.AUTO_DISCOVER_STUN=false org.jitsi.jigasi.xmpp.acc.IM_DISABLED=true org.jitsi.jigasi.xmpp.acc.SERVER_STORED_INFO_DISABLED=true org.jitsi.jigasi.xmpp.acc.IS_FILE_TRANSFER_DISABLED=true +{{ if eq $JIGASI_MODE "transcriber" -}} +org.jitsi.jigasi.xmpp.acc.USER_ID={{ $JIGASI_TRANSCRIBER_USER }}@{{ $XMPP_RECORDER_DOMAIN }} +org.jitsi.jigasi.xmpp.acc.PASS={{ .Env.JIGASI_TRANSCRIBER_PASSWORD }} +org.jitsi.jigasi.xmpp.acc.ANONYMOUS_AUTH=false +org.jitsi.jigasi.xmpp.acc.ALLOW_NON_SECURE=true +{{ else }} {{ if .Env.ENABLE_AUTH | default "0" | toBool }} {{ if .Env.ENABLE_GUESTS | default "0" | toBool }} org.jitsi.jigasi.xmpp.acc.USER_ID={{ $JIGASI_XMPP_USER }}@{{ $XMPP_GUEST_DOMAIN }} @@ -159,13 +167,13 @@ org.jitsi.jigasi.xmpp.acc.ANONYMOUS_AUTH=false org.jitsi.jigasi.xmpp.acc.PASS={{ .Env.JIGASI_XMPP_PASSWORD }} org.jitsi.jigasi.xmpp.acc.ALLOW_NON_SECURE=true {{ end }} - +{{ end }} # Activate this property if you are using self-signed certificates or other # type of non-trusted certicates. In this mode your service trust in the # remote certificates always. net.java.sip.communicator.service.gui.ALWAYS_TRUST_MODE_ENABLED=true -{{ if $ENABLE_TRANSCRIPTIONS -}} +{{ if eq $JIGASI_MODE "transcriber" -}} # Transcription config org.jitsi.jigasi.ENABLE_TRANSCRIPTION=true org.jitsi.jigasi.transcription.ENABLE_TRANSLATION=true @@ -179,6 +187,16 @@ org.jitsi.jigasi.transcription.SAVE_TXT=true org.jitsi.jigasi.transcription.SEND_TXT={{ .Env.JIGASI_TRANSCRIBER_SEND_TXT | default "false"}} org.jitsi.jigasi.transcription.RECORD_AUDIO={{ .Env.JIGASI_TRANSCRIBER_RECORD_AUDIO | default "false"}} org.jitsi.jigasi.transcription.RECORD_AUDIO_FORMAT=wav +{{ if .Env.JIGASI_TRANSCRIBER_CUSTOM_SERVICE -}} +org.jitsi.jigasi.transcription.customService={{ .Env.JIGASI_TRANSCRIBER_CUSTOM_SERVICE }} +{{ end -}} +{{ if $JIGASI_TRANSCRIBER_FILTER_SILENCE -}} +org.jitsi.jigasi.transcription.FILTER_SILENCE = true +{{ end -}} +{{ if .Env.JIGASI_TRANSCRIBER_REMOTE_CONFIG_URL -}} +org.jitsi.jigasi.transcription.remoteTranscriptionConfigUrl={{ .Env.JIGASI_TRANSCRIBER_REMOTE_CONFIG_URL }} +{{ end -}} + {{ end -}} {{ if .Env.JIGASI_SIP_DEFAULT_ROOM }} diff --git a/jigasi/rootfs/etc/cont-init.d/10-config b/jigasi/rootfs/etc/cont-init.d/10-config index c158cb7..4479c07 100644 --- a/jigasi/rootfs/etc/cont-init.d/10-config +++ b/jigasi/rootfs/etc/cont-init.d/10-config @@ -13,6 +13,17 @@ if [[ "$JIGASI_XMPP_PASSWORD" == "$OLD_JIGASI_XMPP_PASSWORD" ]]; then exit 1 fi +[ -z "$JIGASI_MODE" ] && JIGASI_MODE="sip" +if [[ "$(echo $JIGASI_MODE | tr '[:upper:]' '[:lower:]')" == "transcriber" ]]; then + OLD_JIGASI_TRANSCRIBER_PASSWORD=passw0rd + if [[ "$JIGASI_TRANSCRIBER_PASSWORD" == "$OLD_JIGASI_TRANSCRIBER_PASSWORD" ]]; then + echo 'FATAL ERROR: Jigasi transcriber password must be changed, check the README' + exit 1 + fi + # set random jigasi nickname for the instance if is not set + [ -z "${JIGASI_INSTANCE_ID}" ] && export JIGASI_INSTANCE_ID="transcriber-$(date +%N)" +fi + # set random jigasi nickname for the instance if is not set [ -z "${JIGASI_INSTANCE_ID}" ] && export JIGASI_INSTANCE_ID="jigasi-$(date +%N)" @@ -56,7 +67,7 @@ mkdir -pm777 /tmp/transcripts chown jigasi:jitsi /tmp/transcripts # Create Google Cloud Credentials -if [[ $ENABLE_TRANSCRIPTIONS -eq 1 || $ENABLE_TRANSCRIPTIONS == "true" ]]; then +if [[ "$(echo $JIGASI_MODE | tr '[:upper:]' '[:lower:]')" == "transcriber" ]]; then if [[ -z $GC_PROJECT_ID || -z $GC_PRIVATE_KEY_ID || -z $GC_PRIVATE_KEY || -z $GC_CLIENT_EMAIL || -z $GC_CLIENT_ID || -z $GC_CLIENT_CERT_URL ]]; then echo 'Transcriptions: One or more environment variables are undefined' exit 1 diff --git a/transcriber.yml b/transcriber.yml new file mode 100644 index 0000000..2dc4ad9 --- /dev/null +++ b/transcriber.yml @@ -0,0 +1,67 @@ +version: '3.5' + +services: + # SIP gateway (audio) + transcriber: + image: jitsi/jigasi:${JITSI_IMAGE_VERSION:-unstable} + restart: ${RESTART_POLICY:-unless-stopped} + volumes: + - ${CONFIG}/transcriber:/config:Z + - ${CONFIG}/transcripts:/tmp/transcripts:Z + environment: + - AUTOSCALER_SIDECAR_KEY_FILE + - AUTOSCALER_SIDECAR_KEY_ID + - AUTOSCALER_SIDECAR_GROUP_NAME + - AUTOSCALER_SIDECAR_HOST_ID + - AUTOSCALER_SIDECAR_INSTANCE_ID + - AUTOSCALER_SIDECAR_PORT + - AUTOSCALER_SIDECAR_REGION + - AUTOSCALER_SIDECAR_SHUTDOWN_POLLING_INTERVAL + - AUTOSCALER_SIDECAR_STATS_POLLING_INTERVAL + - AUTOSCALER_URL + - BOSH_URL_PATTERN + - ENABLE_AUTH + - ENABLE_GUESTS + - XMPP_AUTH_DOMAIN + - XMPP_GUEST_DOMAIN + - XMPP_MUC_DOMAIN + - XMPP_INTERNAL_MUC_DOMAIN + - XMPP_SERVER + - XMPP_PORT + - XMPP_RECORDER_DOMAIN + - XMPP_DOMAIN + - PUBLIC_URL + - JIGASI_CONFIGURATION + - JIGASI_DISABLE_SIP + - JIGASI_JVB_TIMEOUT + - JIGASI_LOCAL_REGION + - JIGASI_LOG_FILE + - JIGASI_MODE="transcriber" + - JIGASI_XMPP_USER + - JIGASI_XMPP_PASSWORD + - JIGASI_BREWERY_MUC + - JIGASI_ENABLE_SDES_SRTP + - JIGASI_TRANSCRIBER_ADVERTISE_URL + - JIGASI_TRANSCRIBER_CUSTOM_SERVICE + - JIGASI_TRANSCRIBER_FILTER_SILENCE + - JIGASI_TRANSCRIBER_PASSWORD + - JIGASI_TRANSCRIBER_RECORD_AUDIO + - JIGASI_TRANSCRIBER_REMOTE_CONFIG_URL + - JIGASI_TRANSCRIBER_SEND_TXT + - JIGASI_TRANSCRIBER_USER + - GC_PROJECT_ID + - GC_PRIVATE_KEY_ID + - GC_PRIVATE_KEY + - GC_CLIENT_EMAIL + - GC_CLIENT_ID + - GC_CLIENT_CERT_URL + - SHUTDOWN_REST_ENABLED + - SENTRY_DSN="${JIGASI_SENTRY_DSN:-0}" + - SENTRY_ENVIRONMENT + - SENTRY_RELEASE + - TZ + - USE_TRANSLATOR_IN_CONFERENCE + depends_on: + - prosody + networks: + meet.jitsi: