jibri {
  // A unique identifier for this Jibri
  // TODO: eventually this will be required with no default
  id = "{{ inventory_hostname }}"
  // Whether or not Jibri should return to idle state after handling
  // (successfully or unsuccessfully) a request.  A value of 'true'
  // here means that a Jibri will NOT return back to the IDLE state
  // and will need to be restarted in order to be used again.
  single-use-mode = false
  api {
    http {
      external-api-port = 2222
      internal-api-port = 3333
    }
    xmpp {
      // See example_xmpp_envs.conf for an example of what is expected here
      environments = [
          {
            // A user-friendly name for this environment
            name = "prod env"

            // A list of XMPP server hosts to which we'll connect
            xmpp-server-hosts = [
                "{{ jitsi_server_host }}",
            ]

            // The base XMPP domain
            xmpp-domain = "{{ jitsi_server_host }}"

            // The MUC we'll join to announce our presence for
            // recording and streaming services
            control-muc {
                domain = "internal.auth.{{ jitsi_server_host }}"
                room-name = "JibriBrewery"
                nickname = "{{ inventory_hostname }}-nickname"
            }

            // The login information for the control MUC
            control-login {
                domain = "auth.{{ jitsi_server_host }}"
                // Optional port, defaults to 5222.
                // port = 6222
                username = "{{ jibri_user }}"
                password = "{{ jibri_password }}"
            }

            // An (optional) MUC configuration where we'll
            // join to announce SIP gateway services
           # sip-control-muc {
           #     domain = "domain"
           #     room-name = "room-name"
           #     nickname = "nickname"
           # }

            // The login information the selenium web client will use
            call-login {
                domain = "recorder.{{ jitsi_server_host }}"
                username = "{{ jibri_user }}-record"
                password = "{{ jibri_password }}"
            }

            // The value we'll strip from the room JID domain to derive
            // the call URL
            strip-from-room-domain = "conference."

            // How long Jibri sessions will be allowed to last before
            // they are stopped.  A value of 0 allows them to go on
            // indefinitely
            usage-timeout = 1 hour

            // Whether or not we'll automatically trust any cert on
            // this XMPP domain
            trust-all-xmpp-certs = true
        }
      ]
    }
  }
  recording {
    recordings-directory = "/tmp/recordings"
    # TODO: make this an optional param and remove the default
    # finalize-script = "/path/to/finalize"
  }
  streaming {
    // A list of regex patterns for allowed RTMP URLs.  The RTMP URL used
    // when starting a stream must match at least one of the patterns in
    // this list.
    rtmp-allow-list = [
      // By default, all services are allowed
      ".*"
    ]
  }
  ffmpeg {
    resolution = "1280x720"
    // The audio source that will be used to capture audio on Linux
    audio-source = "alsa"
    // The audio device that will be used to capture audio on Linux
    audio-device = "plug:bsnoop"
  }
  chrome {
    // The flags which will be passed to chromium when launching
    flags = [
      {% if jitsi_cookie_enabled | default(false) %}
      "--load-extension=/opt/chrome-extension-cookie",
      {% endif %}
      "--use-fake-ui-for-media-stream",
      "--start-maximized",
      "--kiosk",
      "--enabled",
      "--disable-infobars",
      "--autoplay-policy=no-user-gesture-required"
    ]
  }
  stats {
    enable-stats-d = true
  }
  webhook {
    // A list of subscribers interested in receiving webhook events
    subscribers = []
  }
  jwt-info {
    // The path to a .pem file which will be used to sign JWT tokens used in webhook
    // requests.  If not set, no JWT will be added to webhook requests.
    # signing-key-path = "/path/to/key.pem"

    // The kid to use as part of the JWT
    # kid = "key-id"

    // The issuer of the JWT
    # issuer = "issuer"

    // The audience of the JWT
    # audience = "audience"

    // The TTL of each generated JWT.  Can't be less than 10 minutes.
    # ttl = 1 hour
  }
  call-status-checks {
    // If all clients have their audio and video muted and if Jibri does not
    // detect any data stream (audio or video) comming in, it will stop
    // recording after NO_MEDIA_TIMEOUT expires.
    no-media-timeout = 30 seconds

    // If all clients have their audio and video muted, Jibri consideres this
    // as an empty call and stops the recording after ALL_MUTED_TIMEOUT expires.
    all-muted-timeout = 10 minutes

    // When detecting if a call is empty, Jibri takes into consideration for how
    // long the call has been empty already. If it has been empty for more than
    // DEFAULT_CALL_EMPTY_TIMEOUT, it will consider it empty and stop the recording.
    default-call-empty-timeout = 30 seconds
  }
}