Thanks - I saw this but wasn’t sure if it would work on Nethserver (are the modules installed with our version of ejabberd?) and I wasn’t sure if anyone had a guide for it already, since changing config files in Nethserver is another layer of complexity.
I got this working, but it hasn’t been turned into a sleek script (yet?). Sharing my steps here so anyone else can copy them and possibly improve on them.
Server side install of ejabberd 20.04
wget https://www.process-one.net/downloads/downloads-action.php?file=/20.04/ejabberd-20.04-0.x86_64.rpm -O ejabberd-20.04-0.x86_64.rpm
rpm -i ejabberd-20.04-0.x86_64.rpm
# copy or move database folder from 20.03 folder to 20.04 folder
# update /usr/lib/systemd/system/ejabberd.service references to 20.03 to 20.04
# update /etc/ejabberd/ejabberd.yml <- details below, this should be done correctly using the official e-smith configuration language
systemctl daemon-reload
systemctl restart ejabberd
Add these listeners to ejabberd.yml:
-
port: 3478
transport: udp
module: ejabberd_stun
use_turn: true
turn_min_port: 49152
turn_max_port: 65535
## The server's public IPv4 address:
turn_ip: "YOUR IP HERE"
-
port: 5349
transport: tcp
module: ejabberd_stun
use_turn: true
tls: true
turn_min_port: 49152
turn_max_port: 65535
ip: "YOUR IP HERE"
turn_ip: "YOUR IP HERE"
and the module default configuration under modules:
mod_stun_disco: {}
And last but not least, make sure you add a service with the appropriate firewall ports opened:
At this point, your server will be running ejabberd 20.04 and configured to support voice and video calling.
P.S.: Here’s a script stolen form Holger and hacked together, not confirmed to work yet but should help to automate updating your IP.
#!/bin/sh
set -e
set -u
ejabberd_yml='/etc/ejabberd/ejabberd.yml'
ip_url='https://ifconfig.me/ip'
old_ip=$(sed -n 's/^[[:blank:]]\{1,\}turn_ip:[[:blank:]]*"\?\([[:digit:].]*\)"\?.*$/\1/p' "$ejabberd_yml")
new_ip=$(curl "$ip_url")
if [ $old_ip == $new_ip ]; then
echo "IP Unchanged: $new_ip"
else
echo "IPs Match: Old: $old_ip New: $new_ip"
fi
if [ -z "$old_ip" ]
then
echo >&2 "FATAL: Found no 'turn_ip' in $ejabberd_yml"
exit 1
fi
if [ -z "$new_ip" ]
then
echo >&2 "FATAL: Cannot retrieve my IP address from $ip_url"
exit 1
fi
if [ "$old_ip" != "$new_ip" ]
then
sed -i "s/$old_ip/$new_ip/" "$ejabberd_yml"
systemctl restart ejabberd
fi
When upgrading ejabberd, I left the old directory in place to avoid causing issues, but it seems that’s what caused it, because in the pre-upgrade event S50nethserver-ejabberd-backup there’s this command:
Having the old directory there caused problems, so I renamed the old one and the backups started working again. I haven’t noticed any issues in ejabberd, since it should all be using the latest version.
WHile testing and trying to implement Voice calling Functions on ejabbered, this is what i discovered.
Adding this module, breaks ejabbered, with the error.
In /var/log/ejabberd/error.log was following error:
2022-04-03 19:44:18.255 [critical] <0.106.0>@ejabberd_app:start:71 Failed to start ejabberd application: Invalid value of option modules: unknown ejabberd module: mod_stun_disco. Did you mean mod_disco?
there seems to be an error with that module as desribed here