Spreed WebRTC server and web client

Works only on arm routers like RT-AC56U, RT-AC68U, RT-AC87U, RT-AC3200, RT-AC5300...
Spreed WebRTC
implements a WebRTC audio/video call and conferencing server and web client.
Tested on RT-AC68U rev A2, RMerlin firmware v380.60_beta2, hdd usb3, Optware-NG & Entware-NG

1 - Flash Rmerlin firmware from here

2a - Install Optware-NG from here

Install necessary packages

ipkg install nano findutils

or

2b - Install Entware-NG from here

Install necessary packages

opkg install nano findutils

3 - Setup Debian Jessie from here

4 - Enter chrooted debian with:

debian enter

5 - Update Debian

apt update && apt upgrade -y

6 - Install necessary packages

apt install wget git build-essential golang-go nodejs autoconf -y

- Download source code

cd /var/tmp
git clone https://github.com/strukturag/spreed-webrtc.git
cd spreed-webrtc
./autogen.sh
./configure --prefix=/usr

- Compile and install Spreed WebRTC, this will take ~5 minutes, don't interrupt!

time make
make install

- Create server configuration file

mkdir -p /etc/spreed-webrtc-server
cp /var/tmp/spreed-webrtc/server.conf.in /etc/spreed-webrtc-server/server.conf
cd /etc/spreed-webrtc-server

10 - Enable https and tweak some other settings

sed -i 's|listen = 127.0.0.1:8080|;listen = 127.0.0.1:8080|g' "/etc/spreed-webrtc-server/server.conf"
sed -i 's|;listen = 127.0.0.1:8443|listen = 0.0.0.0:8910|g' "/etc/spreed-webrtc-server/server.conf"
sed -i 's|;root =.*|root = /usr/share/spreed-webrtc-server/www|g' "/etc/spreed-webrtc-server/server.conf"
sed -i 's|;certificate = server.crt|certificate = server.crt|g' "/etc/spreed-webrtc-server/server.conf"
sed -i 's|;key = server.key|key = server.crt|g' "/etc/spreed-webrtc-server/server.conf"

11 - Create certificate (change values in red if you want)

openssl req -new -x509 -days 1095 -nodes \
-subj "/C=RO/ST=Timis/L=Timisoara/O=HQT/CN=www.asusrouter.com" \
-keyout server.crt -out server.crt
chmod 400 server.crt

12 - Create startup script

cat >> /etc/init.d/spreedwebrtcserver << 'EOF'
#!/bin/sh
### BEGIN INIT INFO
# Provides: spreed-webrtc-server
# Required-Start: $remote_fs $syslog $networking
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Spreed WebRTC
# Description: WebRTC audio/video call and conferencing server and web client
# More information at https://github.com/strukturag/spreed-webrtc
# Author: TeHashX / contact@hqt.ro
# Version: 1.1
### END INIT INFO
CONF="/etc/spreed-webrtc-server/server.conf"
test -f "/usr/sbin/spreed-webrtc-server" || exit 0
spreed_running=`ps ax | grep "spreed-webrtc-server" | awk '{ print $1 }' | wc -l`
case "$1" in
start)
if [ "$spreed_running" -gt 1 ]; then
echo "Spreed Webrtc Server already running..."
exit 0
fi
echo -n "Starting Spreed Webrtc Server: "
cd /etc/spreed-webrtc-server/
/usr/sbin/spreed-webrtc-server -c=$CONF & >/dev/null 2>&1
echo "done"
sleep 5
exit 0
;;
stop)
if [ "$spreed_running" -eq 1 ]; then
echo "Spreed Webrtc Server is not running (no process found)..."
exit 0
fi
echo -n "Killing Spreed Webrtc Server: "
# Trying to kill the Spreed Webrtc Server
ps ax | grep "spreed-webrtc-server" | awk '{ print $1 }' | xargs kill >/dev/null 2>&1
sleep 1
echo "done"
;;
restart)
sh $0 stop
sh $0 start
;;
status)
if [ "$spreed_running" -gt 1 ]; then
echo "Spreed Webrtc Server running."
else
echo "It seems that Spreed Webrtc Server isn't running (no process found)."
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
EOF

Press ENTER

13 - Give permission

chmod +x /etc/init.d/spreedwebrtcserver

14 - Exit Debian

exit

15 - Add Spreed WebRTC to chrooted services list

echo "" >>/opt/etc/chroot-services.list
echo "spreedwebrtcserver" >>/opt/etc/chroot-services.list
chmod 755 /opt/etc/chroot-services.list

16 - Start Spreed WebRTC from outside debian

debian restart

17 - Go to default router ip address and port :8910, like https://192.168.1.1:8910 or https://www.asusrouter.com:8910

spreed-main

ACCESS FROM WAN

Open Spreed WebRTC port

nano /jffs/scripts/firewall-start

Paste this lines in terminal

 #!/bin/sh

iptables -I INPUT -p tcp --destination-port 8910 -j ACCEPT

Save witCTRL-O / Enter / and exit with CTRL-X

Apply rules

chmod a+rx /jffs/scripts/firewall-start
sh /jffs/scripts/firewall-start

Go to your wan-ip-address:8910

Enjoy...

To be continued with owncloud integration and the rest of setup if requested by user...

This tutorial is dedicated @Ian Bas

REVIEW (CLICK ON THE STARS TO RATE!)
5
Sending
User Review
5 (6 votes)