Automatically start recording when meeting is started

I am new to Jitsi / Jibri. I can start the recording from client but I want to do it in server. I couldn’t find any resource about this.

I am wondering if it is possible to start recording automatically when the meeting start. If so how can I achieve this?

2 Likes

Thanks, I will give it a try

I had a chance to try it with the help of README.md but it didn’t start.

First I create a Dockerfile to customize the existing prosody image.

FROM jitsi/prosody:stable-6433

RUN wget -O /prosody-plugins/mod_jibri_autostart.lua https://raw.githubusercontent.com/jitsi-contrib/prosody-plugins/main/jibri_autostart/mod_jibri_autostart.lua

COPY jitsi-meet.cfg.lua /defaults/conf.d/jitsi-meet.cfg.lua

I got the original jitsi-meet.cfg.lua from container and customize it to add jibri_autostart to enabled modules. However I am not sure if I added in the correct place (Maybe that is the problem).
I will try to add inside this Component "{{ .Env.XMPP_MUC_DOMAIN }}" "muc"

EDIT: adding it inside Component "{{ .Env.XMPP_MUC_DOMAIN }}" "muc" solved it.

Here is the comple jitsi-meet.cfg.lua file.

{{ $ENABLE_AUTH := .Env.ENABLE_AUTH | default "0" | toBool }}
{{ $ENABLE_GUEST_DOMAIN := and $ENABLE_AUTH (.Env.ENABLE_GUESTS | default "0" | toBool)}}
{{ $AUTH_TYPE := .Env.AUTH_TYPE | default "internal" }}
{{ $JWT_ASAP_KEYSERVER := .Env.JWT_ASAP_KEYSERVER | default "" }}
{{ $JWT_ALLOW_EMPTY := .Env.JWT_ALLOW_EMPTY | default "0" | toBool }}
{{ $JWT_AUTH_TYPE := .Env.JWT_AUTH_TYPE | default "token" }}
{{ $JWT_TOKEN_AUTH_MODULE := .Env.JWT_TOKEN_AUTH_MODULE | default "token_verification" }}
{{ $ENABLE_LOBBY := .Env.ENABLE_LOBBY | default "true" | toBool }}
{{ $ENABLE_AV_MODERATION := .Env.ENABLE_AV_MODERATION | default "true" | toBool }}
{{ $ENABLE_XMPP_WEBSOCKET := .Env.ENABLE_XMPP_WEBSOCKET | default "1" | toBool }}
{{ $PUBLIC_URL := .Env.PUBLIC_URL | default "https://localhost:8443" -}}
{{ $TURN_PORT := .Env.TURN_PORT | default "443" }}
{{ $TURNS_PORT := .Env.TURNS_PORT | default "443" }}
{{ $XMPP_MUC_DOMAIN_PREFIX := (split "." .Env.XMPP_MUC_DOMAIN)._0 }}
{{ $DISABLE_POLLS := .Env.DISABLE_POLLS | default "false" | toBool -}}

admins = {
    "{{ .Env.JICOFO_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}",
    "{{ .Env.JVB_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}"
}

unlimited_jids = {
    "{{ .Env.JICOFO_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}",
    "{{ .Env.JVB_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}"
}

plugin_paths = { "/prosody-plugins/", "/prosody-plugins-custom" }

muc_mapper_domain_base = "{{ .Env.XMPP_DOMAIN }}";
muc_mapper_domain_prefix = "{{ $XMPP_MUC_DOMAIN_PREFIX }}";

http_default_host = "{{ .Env.XMPP_DOMAIN }}"

{{ if .Env.TURN_CREDENTIALS }}
external_service_secret = "{{.Env.TURN_CREDENTIALS}}";
{{ end }}

{{ if or .Env.TURN_HOST .Env.TURNS_HOST }}
external_services = {
  {{ if .Env.TURN_HOST }}
     { type = "turn", host = "{{ .Env.TURN_HOST }}", port = {{ $TURN_PORT }}, transport = "tcp", secret = true, ttl = 86400, algorithm = "turn" }
  {{ end }}
  {{ if and .Env.TURN_HOST .Env.TURNS_HOST }}
  ,
  {{ end }}
  {{ if .Env.TURNS_HOST }}
     { type = "turns", host = "{{ .Env.TURNS_HOST }}", port = {{ $TURNS_PORT }}, transport = "tcp", secret = true, ttl = 86400, algorithm = "turn" }
  {{ end }}
};
{{ end }}

{{ if and $ENABLE_AUTH (eq $AUTH_TYPE "jwt") .Env.JWT_ACCEPTED_ISSUERS }}
asap_accepted_issuers = { "{{ join "\",\"" (splitList "," .Env.JWT_ACCEPTED_ISSUERS) }}" }
{{ end }}

{{ if and $ENABLE_AUTH (eq $AUTH_TYPE "jwt") .Env.JWT_ACCEPTED_AUDIENCES }}
asap_accepted_audiences = { "{{ join "\",\"" (splitList "," .Env.JWT_ACCEPTED_AUDIENCES) }}" }
{{ end }}

consider_bosh_secure = true;

-- Deprecated in 0.12
-- https://github.com/bjc/prosody/commit/26542811eafd9c708a130272d7b7de77b92712de
{{ $XMPP_CROSS_DOMAINS := $PUBLIC_URL }}
{{ $XMPP_CROSS_DOMAIN := .Env.XMPP_CROSS_DOMAIN | default "" }}
{{ if eq $XMPP_CROSS_DOMAIN "true"}}
cross_domain_websocket = true
cross_domain_bosh = true
{{ else }}
{{ if not (eq $XMPP_CROSS_DOMAIN "false") }}
  {{ $XMPP_CROSS_DOMAINS = list $PUBLIC_URL (print "https://" .Env.XMPP_DOMAIN) .Env.XMPP_CROSS_DOMAIN | join "," }}
{{ end }}
cross_domain_websocket = { "{{ join "\",\"" (splitList "," $XMPP_CROSS_DOMAINS) }}" }
cross_domain_bosh = { "{{ join "\",\"" (splitList "," $XMPP_CROSS_DOMAINS) }}" }
{{ end }}

VirtualHost "{{ .Env.XMPP_DOMAIN }}"
{{ if $ENABLE_AUTH }}
  {{ if eq $AUTH_TYPE "jwt" }}
    authentication = "{{ $JWT_AUTH_TYPE }}"
    app_id = "{{ .Env.JWT_APP_ID }}"
    app_secret = "{{ .Env.JWT_APP_SECRET }}"
    allow_empty_token = {{ $JWT_ALLOW_EMPTY }}
    {{ if $JWT_ASAP_KEYSERVER }}
    asap_key_server = "{{ .Env.JWT_ASAP_KEYSERVER }}"
    {{ end }}

    {{ else if eq $AUTH_TYPE "ldap" }}
    authentication = "cyrus"
    cyrus_application_name = "xmpp"
    allow_unencrypted_plain_auth = true
  {{ else if eq $AUTH_TYPE "internal" }}
    authentication = "internal_hashed"
  {{ end }}
{{ else }}
    authentication = "jitsi-anonymous"
{{ end }}
    ssl = {
        key = "/config/certs/{{ .Env.XMPP_DOMAIN }}.key";
        certificate = "/config/certs/{{ .Env.XMPP_DOMAIN }}.crt";
    }
    modules_enabled = {
        "bosh";
        {{ if $ENABLE_XMPP_WEBSOCKET }}
        "websocket";
        "smacks"; -- XEP-0198: Stream Management
        {{ end }}
        "pubsub";
        "ping";
        "speakerstats";
        "conference_duration";
        {{ if or .Env.TURN_HOST .Env.TURNS_HOST }}
        "external_services";
        {{ end }}
        {{ if $ENABLE_LOBBY }}
        "muc_lobby_rooms";
        {{ end }}
        {{ if $ENABLE_AV_MODERATION }}
        "av_moderation";
        {{ end }}
        {{ if .Env.XMPP_MODULES }}
        "{{ join "\";\n\"" (splitList "," .Env.XMPP_MODULES) }}";
        {{ end }}
        {{ if and $ENABLE_AUTH (eq $AUTH_TYPE "ldap") }}
        "auth_cyrus";
        {{end}}
    }

    {{ if $ENABLE_LOBBY }}
    main_muc = "{{ .Env.XMPP_MUC_DOMAIN }}"
    lobby_muc = "lobby.{{ .Env.XMPP_DOMAIN }}"
    {{ if .Env.XMPP_RECORDER_DOMAIN }}
    muc_lobby_whitelist = { "{{ .Env.XMPP_RECORDER_DOMAIN }}" }
    {{ end }}
    {{ end }}

    speakerstats_component = "speakerstats.{{ .Env.XMPP_DOMAIN }}"
    conference_duration_component = "conferenceduration.{{ .Env.XMPP_DOMAIN }}"

    {{ if $ENABLE_AV_MODERATION }}
    av_moderation_component = "avmoderation.{{ .Env.XMPP_DOMAIN }}"
    {{ end }}

    c2s_require_encryption = false

{{ if $ENABLE_GUEST_DOMAIN }}
VirtualHost "{{ .Env.XMPP_GUEST_DOMAIN }}"
    authentication = "jitsi-anonymous"

    c2s_require_encryption = false
{{ end }}

VirtualHost "{{ .Env.XMPP_AUTH_DOMAIN }}"
    ssl = {
        key = "/config/certs/{{ .Env.XMPP_AUTH_DOMAIN }}.key";
        certificate = "/config/certs/{{ .Env.XMPP_AUTH_DOMAIN }}.crt";
    }
    modules_enabled = {
        "limits_exception";
    }
    authentication = "internal_hashed"

{{ if .Env.XMPP_RECORDER_DOMAIN }}
VirtualHost "{{ .Env.XMPP_RECORDER_DOMAIN }}"
    modules_enabled = {
      "ping";
    }
    authentication = "internal_hashed"
{{ end }}

Component "{{ .Env.XMPP_INTERNAL_MUC_DOMAIN }}" "muc"
    storage = "memory"
    modules_enabled = {
        "ping";
        {{ if .Env.XMPP_INTERNAL_MUC_MODULES -}}
        "{{ join "\";\n\"" (splitList "," .Env.XMPP_INTERNAL_MUC_MODULES) }}";
        {{ end -}}
    }
    restrict_room_creation = true
    muc_room_locking = false
    muc_room_default_public_jids = true

Component "{{ .Env.XMPP_MUC_DOMAIN }}" "muc"
    storage = "memory"
    modules_enabled = {
        "muc_meeting_id";
        {{ if .Env.XMPP_MUC_MODULES -}}
        "{{ join "\";\n\"" (splitList "," .Env.XMPP_MUC_MODULES) }}";
        {{ end -}}
        {{ if and $ENABLE_AUTH (eq $AUTH_TYPE "jwt") -}}
        "{{ $JWT_TOKEN_AUTH_MODULE }}";
        {{ end -}}
        {{ if not $DISABLE_POLLS -}}
        "polls";
        {{ end -}}
    }
    muc_room_cache_size = 1000
    muc_room_locking = false
    muc_room_default_public_jids = true

Component "meet.mydomain.com" "muc"
    modules_enabled = {
      "jibri_autostart";
    }

Component "focus.{{ .Env.XMPP_DOMAIN }}" "client_proxy"
    target_address = "{{ .Env.JICOFO_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}"

Component "speakerstats.{{ .Env.XMPP_DOMAIN }}" "speakerstats_component"
    muc_component = "{{ .Env.XMPP_MUC_DOMAIN }}"

Component "conferenceduration.{{ .Env.XMPP_DOMAIN }}" "conference_duration_component"
    muc_component = "{{ .Env.XMPP_MUC_DOMAIN }}"

{{ if $ENABLE_AV_MODERATION }}
Component "avmoderation.{{ .Env.XMPP_DOMAIN }}" "av_moderation_component"
    muc_component = "{{ .Env.XMPP_MUC_DOMAIN }}"
{{ end }}

{{ if $ENABLE_LOBBY }}
Component "lobby.{{ .Env.XMPP_DOMAIN }}" "muc"
    storage = "memory"
    restrict_room_creation = true
    muc_room_locking = false
    muc_room_default_public_jids = true
{{ end }}

This is my prosody container logs, I have two errors in the log but I am not sure if this is related.

speakerstats.meet.jitsi:speakerstats_component  info    No muc component found, will listen for it: muc.meet.jitsi
speakerstats.meet.jitsi:tls                     info    Certificates loaded
avmoderation.meet.jitsi:av_moderation_component  info   Starting av_moderation for muc.meet.jitsi
avmoderation.meet.jitsi:av_moderation_component  info   No muc component found, will listen for it: muc.meet.jitsi
avmoderation.meet.jitsi:tls                      info   Certificates loaded
recorder.meet.jitsi:tls                          info   Certificates loaded
portmanager                                      info   Activated service 'c2s' on [*]:5222, [::]:5222
portmanager                                      info   Activated service 'legacy_ssl' on no ports
focus.meet.jitsi:tls                             info   Certificates loaded
meet.mydomain.com:tls                            error  Error creating context for c2s: No certificate present in SSL/TLS configuration for meet.mydomain.com
meet.mydomain.com:tls                            error  Error creating contexts for s2sin: No certificate present in SSL/TLS configuration for meet.mydomain.com
meet.mydomain.com:tls                            info   Certificates loaded
meet.mydomain.com:jibri_autostart                info   loaded
general                                          info   Starting conference duration timer for muc.meet.jitsi
conferenceduration.meet.jitsi:conference_duration_component  info       No muc component found, will listen for it: muc.meet.jitsi
conferenceduration.meet.jitsi:tls                            info       Certificates loaded
meet.jitsi:muc_lobby_rooms                                   info       Lobby component loaded lobby.meet.jitsi
meet.jitsi:tls                                               info       Certificates loaded
portmanager                                                  info       Activated service 'http' on [*]:5280, [::]:5280
portmanager                                                  info       Activated service 'https' on no ports
auth.meet.jitsi:tls                                          info       Certificates loaded
speakerstats.meet.jitsi:speakerstats_component               info       Hook to muc events on muc.meet.jitsi
avmoderation.meet.jitsi:av_moderation_component              info       Hook to muc events on muc.meet.jitsi
muc.meet.jitsi:tls                                           info       Certificates loaded
conferenceduration.meet.jitsi:conference_duration_component  info       Hook to muc events on muc.meet.jitsi
c2s55ce8a0ffac0                                              info       Client connected
c2s55ce8a0ffac0                                              info       Stream encrypted (TLSv1.3 with TLS_AES_256_GCM_SHA384)
c2s55ce8a088590                                              info       Client connected
c2s55ce8a0ffac0                                              info       Authenticated as focus@auth.meet.jitsi
auth.meet.jitsi:limits_exception                             info       Setting stanza size limits for focus@auth.meet.jitsi to 10485760
c2s55ce8a1c5af0                                              info       Client connected
c2s55ce8a088590                                              info       Stream encrypted (TLSv1.3 with TLS_AES_256_GCM_SHA384)
c2s55ce8a1c5af0                                              info       Stream encrypted (TLSv1.3 with TLS_AES_256_GCM_SHA384)
c2s55ce8a1c5af0                                              info       Authenticated as jibri@auth.meet.jitsi
c2s55ce8a1d6910                                              info       Client connected
c2s55ce8a088590                                              info       Authenticated as jvb@auth.meet.jitsi
auth.meet.jitsi:limits_exception                             info       Setting stanza size limits for jvb@auth.meet.jitsi to 10485760
c2s55ce8a1d6910                                              info       Authenticated as si3__kf7uenpymcw@meet.jitsi
c2s55ce8a1d6910                                              info       Client disconnected: connection closed
c2s55ce8a29c2c0                                              info       Client connected
c2s55ce8a29c2c0                                              info       Authenticated as obq7w6ioyv5qfsir@meet.jitsi
c2s55ce8a29c2c0                                              info       Client disconnected: connection closed
speakerstats.meet.jitsi:speakerstats_component               warn       A module has been configured that triggers external events.
speakerstats.meet.jitsi:speakerstats_component               warn       Implement this lib to trigger external events.
c2s55ce8a30a3a0                                              info       Client connected
c2s55ce8a30a3a0                                              info       Authenticated as 0yqtzukqverfwlwq@meet.jitsi

The module seems OK