No audio and video after patching Prosody for Token Authentication

Hi guys.

I installed Jitsi on Ubuntu 16.04 without problems following the quickstart. I opened the browser and everything worked well, i could see other people, audio, video, everything perfect!

Now I’m trying to install the token authentication plugin following the instructions here: https://github.com/jitsi/lib-jitsi-meet/blob/master/doc/tokens.md

When I run the command “apt-get install jitsi-meet-tokens” it says that I have to upgrade Prosody. So I read the paragraph “Patching Prosody”, I installed the nightly build xenial_amd64 and edited the configuration file as described.

Before proceeding with the installation of jitsi-meet-tokens, I tried to reload the web page to see if anything was working but audio and video didn’t work anymore. I tried installing other versions of Prosody (i.e. 0.11) but the result is always the same: after the upgrade there is no audio and no video.

What am I doing wrong? Any help would be appreciated.

Thanks!

I solved the problem comparing the old prosody.cfg.lua with the new one.

I set c2s_require_encryption=false and added Include “conf.d/*.cfg.lua” at the end of file (as described at https://github.com/jitsi/lib-jitsi-meet/blob/master/doc/tokens.md)

I also commented the line VirtualHost “localhost” (but I think this is not mandatory)

Then I restarted prosody with the following command:
/etc/init.d/prosody restart

I hope this is useful to others.

Bye

After installing jitsi-meet-tokens and reboot audio and video are gone again! :frowning:

I tried passing a token with the jwt parameter in the url but nothing changes… the conference is running but audio and video are gone, the buttons are disabled.

Can you help me? What am I doing wrong?

Thanks

I solved the problems reinstalling everything on Debian 9 Stretch:

sudo apt update
sudo apt upgrade -y
sudo shutdown -r now

sudo hostnamectl set-hostname HOSTNAME
sudo sed -i ‘s/^127.0.1.1.*$/127.0.1.1 DOMAIN HOSTNAME/g’ /etc/hosts

sudo apt install -y lua5.1 lua-expat lua-filesystem lua-socket ssl-cert
wget https://packages.prosody.im/debian/pool/main/p/prosody-trunk/prosody-trunk_1nightly747-1~stretch_amd64.deb
sudo dpkg -i prosody-trunk_1nightly747-1~stretch_amd64.deb
chmod +r /etc/prosody/certs/localhost.key

sudo apt install -y nginx
sudo systemctl start nginx.service
sudo systemctl enable nginx.service

sudo apt install -y apt-transport-https
wget -qO - https://download.jitsi.org/jitsi-key.gpg.key | sudo apt-key add -
sudo sh -c “echo ‘deb https://download.jitsi.org stable/’ > /etc/apt/sources.list.d/jitsi-stable.list”
sudo apt update -y
sudo apt install -y jitsi-meet
sudo /usr/share/jitsi-meet/scripts/install-letsencrypt-cert.sh

sudo apt install -y libssl1.0-dev git luarocks lua-bitop
sudo luarocks install luacrypto
sudo luarocks install luajwtjitsi
sudo luarocks install luasec
apt-get install jitsi-meet-tokens

sudo apt install -y ufw
sudo ufw allow OpenSSH
sudo ufw allow http
sudo ufw allow https
sudo ufw allow in 10000:20000/udp
sudo ufw enable

And this is a sample PHP code to generate the token:

// Create token header as a JSON string
$header = json_encode([“kid”=>“jitsi/APP_ID”, ‘typ’ => ‘JWT’, ‘alg’ => ‘HS256’]);
// Create token payload as a JSON string
$payload = json_encode([
“context” => [
“user” => [
“id” => “1”,
“name” => “USERNAME”,
“avatar” => “IMAGE_URL”,
“email” => “EMAIL”
],
“group” => “GROUP”
],
“aud” => “jitsi”,
“iss” => “APP_ID”,
“sub” => “DOMAIN”,
“room” => “*”,
“exp” => 1616078683
]);
// Encode Header to Base64Url String
$base64UrlHeader = str_replace([’+’, ‘/’, ‘=’], [’-’, ‘’, ‘’], base64_encode($header));
// Encode Payload to Base64Url String
$base64UrlPayload = str_replace([’+’, ‘/’, ‘=’], [’-’, '
’, ‘’], base64_encode($payload));
// Create Signature Hash
$signature = hash_hmac(‘sha256’, $base64UrlHeader . “.” . $base64UrlPayload, ‘SECRET’, true);
// Encode Signature to Base64Url String
$base64UrlSignature = str_replace([’+’, ‘/’, ‘=’], [’-’, ‘_’, ‘’], base64_encode($signature));
// Create JWT
$jwt = $base64UrlHeader . “.” . $base64UrlPayload . “.” . $base64UrlSignature;
echo $jwt;

I hope this is useful to others.

Bye

2 Likes

I am not sure if anyone here is able to help me - I have been trying to install Jitsi with tokens for 3 days now with no luck, seems to install and i can pass the profile data in the token but there is no video or audio - I have tried following this method without any luck, the error i can see in the logs is

Mar 29 19:21:46 c2s55e6ad3f9240 error Traceback[c2s]: /usr/lib/prosody/modules/mod_posix.lua:123: bad argument #3 to ‘format’ (string expected, got nil)
stack traceback:
[C]: in function ‘format’
/usr/lib/prosody/modules/mod_posix.lua:123: in function ‘?’
/usr/lib/prosody/util/logger.lua:46: in function </usr/lib/prosody/util/logger.lua:44>
(tail call): ?
(tail call): ?
…jitsi-meet/prosody-plugins/mod_muc_domain_mapper.lua:90: in function ‘?’
/usr/lib/prosody/util/filters.lua:24: in function ‘filter’
/usr/lib/prosody/core/sessionmanager.lua:35: in function ‘send’
/usr/lib/prosody/modules/mod_saslauth.lua:295: in function ‘?’
/usr/lib/prosody/util/events.lua:78: in function </usr/lib/prosody/util/events.lua:74>
(tail call): ?
/usr/lib/prosody/core/stanza_router.lua:149: in function ‘core_process_stanza’
/usr/lib/prosody/modules/mod_c2s.lua:254: in function ‘func’
/usr/lib/prosody/util/async.lua:90: in function </usr/lib/prosody/util/async.lua:88>

I need to have JWT installed and working - If anyone can please help me that would be great. I thanks you in advance for your help.

1 Like

did you fix your issue?

No, not yet.

I think I’ve fixed it. Take a look here.

1 Like

I fixed the same issue by following @lucapan 's process then followed @sparviere 's version change.

Thanks guys!

1 Like

There is another issue with Debian 9. When you reboot the system, it will reset your hosts config. To avoid that, you have to edit /etc/cloud/cloud.cfg and set the following parameters:

preserve_hostname: true
manage_etc_hosts: false

I hope this is useful to others.

Bye