miércoles, 6 de mayo de 2020

Instalación sistema de grabación para Jitsi – JIBRI


En este caso he realizado la instalación sobre una nueva VM con KVM debido a las limitaciones de LXC con el modulo snd-aloop. A esta nueva VM le he instalado una Ubuntu Server 18.04.


Configuración hostname:

    Revisión/configuración hostname
Comprobar que el fichero /etc/hosts tenga definida las ips correctamente:
192.168.X.X jibri.midominio.net jibri
Comprobar que el fichero /etc/hostname este definido correctamente:
jibri
También es válido:
jibri.midominio.net


Configuración java:

Jibri no funciona con muchas de las versiones y opciones de java disponibles, aseguraros de seguir las siguientes instrucciones para no tener problemas:
apt install wget gnupg software-properties-common -y
wget -qO - https://adoptopenjdk.jfrog.io/adoptopenjdk/api/gpg/key/public |apt-key add -
add-apt-repository --yes https://adoptopenjdk.jfrog.io/adoptopenjdk/deb/
apt update && apt install adoptopenjdk-8-hotspot -y
Editamos el siguiente fichero y añadimos la siguiente variable:
nano ~/.bash_profile
export JAVA_HOME=/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64/bin/java
source ~/.bash_profile


Instalación de prerrequisitos:

Instalación de los siguientes paquetes extra:

apt update && install unzip ffmpeg curl alsa-utils icewm xdotool xserver-xorg-input-void xserver-xorg-video-dummy -y


Modulo ALSA:

echo "snd-aloop" >> /etc/modules
modprobe snd-aloop
Comprobar que el modulo se ha cargado:
lsmod | grep snd_aloop


Google Chrome stable & Chromedriver:

curl -sS -o - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add
echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list
apt update && apt install google-chrome-stable -y


mkdir -p /etc/opt/chrome/policies/managed
echo '{ "CommandLineFlagSecurityWarningsEnabled": false }' >>/etc/opt/chrome/policies/managed/managed_policies.json


CHROME_DRIVER_VERSION=`curl -sS chromedriver.storage.googleapis.com/LATEST_RELEASE`
wget -N http://chromedriver.storage.googleapis.com/$CHROME_DRIVER_VERSION/chromedriver_linux64.zip -P ~/
unzip ~/chromedriver_linux64.zip -d ~/
rm ~/chromedriver_linux64.zip
mv -f ~/chromedriver /usr/local/bin/chromedriver
chown root:root /usr/local/bin/chromedriver
chmod 0755 /usr/local/bin/chromedriver


Instalación y configuración del servidor Jibri:

wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -
sh -c "echo 'deb https://download.jitsi.org stable/' > /etc/apt/sources.list.d/jitsi-stable.list"
apt update && apt install jibri -y
usermod -aG adm,audio,video,plugdev jibri


Editamos/creamos el siguiente fichero de configuración:


nano /etc/jitsi/jibri/config.json
root@jibri:~# cat /etc/jitsi/jibri/config.json
{
// NOTE: this is a *SAMPLE* config file, it will need to be configured with
// values from your environment
// Where recording files should be temporarily stored
"recording_directory":"/srv/recordings",
// The path to the script which will be run on completed recordings
"finalize_recording_script_path": "/path/to/finalize_recording.sh",
"xmpp_environments": [
{
// A friendly name for this environment which can be used
// for logging, stats, etc.
"name": "prod environment",
// The hosts of the XMPP servers to connect to as part of
// this environment
"xmpp_server_hosts": [
"videoconf.midominio.net"
],
// The xmpp domain we'll connect to on the XMPP server
"xmpp_domain": "videoconf.midominio.net",
// Jibri will login to the xmpp server as a privileged user
"control_login": {
// The domain to use for logging in
"domain": "auth.videoconf.midominio.net",
// The credentials for logging in
"username": "Jibri",
"password": "JibriPassword"
},
// Using the control_login information above, Jibri will join
// a control muc as a means of announcing its availability
// to provide services for a given environment
"control_muc": {
"domain": "internal.auth.videoconf.midominio.net",
"room_name": "JibriBrewery",
"nickname": "jibri-nickname"
},
// All participants in a call join a muc so they can exchange
// information. Jibri can be instructed to join a special muc
// with credentials to give it special abilities (e.g. not being
// displayed to other users like a normal participant)
"call_login": {
"domain": "recorder.videoconf.midominio.net",
"username": "recorder",
"password": "RecorderPassword"
},
// When jibri gets a request to start a service for a room, the room
// jid will look like:
// roomName@optional.prefixes.subdomain.xmpp_domain
// We'll build the url for the call by transforming that into:
// https://xmpp_domain/subdomain/roomName
// So if there are any prefixes in the jid (like jitsi meet, which
// has its participants join a muc at conference.xmpp_domain) then
// list that prefix here so it can be stripped out to generate
// the call url correctly
"room_jid_domain_string_to_strip_from_start": "conference.",
// The amount of time, in minutes, a service is allowed to continue.
// Once a service has been running for this long, it will be
// stopped (cleanly). A value of 0 means an indefinite amount
// of time is allowed
"usage_timeout": "0"
}
]
}


mkdir /srv/recordings
chown jibri:jitsi /srv/recordings
service jibri restart
systemctl enable jibri


Configuración del servidor Jitsi Meet:

Añadimos la configuración para conectar con el grabador al final del siguiente fichero:
nano /etc/prosody/conf.d/videoconf.midominio.net.cfg.lua
-- internal muc component, meant to enable pools of jibri and jigasi clients
Component "internal.auth.videoconf.midominio.net" "muc"
modules_enabled = {
"ping";
}
storage = "memory"
muc_room_cache_size = 1000


VirtualHost "recorder.videoconf.midominio.net"
modules_enabled = {
"ping";
}
authentication = "internal_plain"


Reiniciamos el servicio y creamos los siguientes usuarios:
/etc/init.d/prosody reload
prosodyctl register jibri auth.videoconf.midominio.net JibriPassword
prosodyctl register recorder recorder.videoconf.midominio.net RecorderPassword
OJO: Utilizar vuestros propios passwords en cada instalación.


Configuración para Jicofo, añadir al final del siguiente fichero de configuración:
nano /etc/jitsi/jicofo/sip-communicator.properties
org.jitsi.jicofo.jibri.BREWERY=JibriBrewery@internal.auth.videoconf.midominio.net
org.jitsi.jicofo.jibri.PENDING_TIMEOUT=90
/etc/init.d/jicofo reload


Por último buscamos los siguientes parámetros de configuración en el fichero:
nano /etc/jitsi/meet/videoconf.midominio.net-config.js
fileRecordingsEnabled: true, // If you want to enable file recording
liveStreamingEnabled: true, // If you want to enable live streaming
hiddenDomain: 'recorder.videoconf.midominio.net',


Comprobar que en el parámetro TOOLBAR_BUTTONS del fichero de configuración /usr/share/jitsi-meet/interface_config.js contiene los valores recording y livestreaming.
Por último comprobar que el servidor Jitsi permite el acceso a su puerto 5222/tcp al servidor Jibri.


Comprobar funcionamiento:

Ya solo nos queda probar nuestras grabaciones.
Para ello pulsamos sobre “Iniciar la grabación”:
 

La grabación se detiene de forma similar.
Tras ello podemos encontrar nuestras grabaciones en el directorio /srv/recordings del servidor Jibri.

Referencias:




4 comentarios:

  1. lo hice todo tal y como esta en este tutorial, pero cuando le doy inciar grabación, hace por empezar, pero a los varios segundos me sale el cartel de que no se puede iniciar la grabación, si sabes algo al respecto ayudame por favor.

    ResponderEliminar
  2. en los logs veo esto:
    2020-08-20 16:44:58.516 SEVERE: [70] org.jitsi.jibri.selenium.JibriSelenium.run() An error occurred while joining the call: org.openqa.selenium.WebDriverException: : Failed to read the 'localStorage' property from 'Window': Access is denied for this document

    ResponderEliminar
    Respuestas
    1. No me he encontrado con este problema.
      Buscando en los foros he encontrado múltiples motivos para el mismo error.
      Parece que también ocurre utilizándolo con docker.

      Algunas cuestiones/ideas:
      - ¿Estás utilizando dos servidores o el mismo para todos los servicios?.
      - Muestra el contenido de /etc/hosts de los servidores implicados.
      - Revisa que no queda ninguna entrada relevante con meet.jitsi en vez de apuntar a tu dominio.
      - ¿En otros logs tienes más info?.

      Eliminar
    2. Ya solucione el problema, era problema con em certificado autofirmado, se soluciona diciendole a googlr chrome q acepte los certificados autofirmados.

      Eliminar