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

  • Hi guys, like Андрей I also stucked on Golang version problem.. it says its needed 1.4 and its currently 1.3.3.

  • mashudi72 -i.like the bedrock

    after installation, everything ok. When I start the application : /etc/init.d/spreedwebrtcserver start

    TLS configuration error: open server.crt: no such file or directory

    • Did you created certificate from step 11?

      • mashudi72 -i.like the bedrock

        yes, we already follow the step 11. I am using Debian Jessie OS.

      • Inside Debian, post here output from
        ls -l /etc/spreed-webrtc-server

      • mashudi72 -i.like the bedrock

        root@localhost:/etc/spreed-webrtc-server# ls -l /etc/spreed-webrtc-server
        total 12
        -rw-r--r-- 1 root root 11070 Nov 21 14:41 server.conf
        root@localhost:/etc/spreed-webrtc-server#

      • As as said first, you didn't created certificate from point 11, copy/paste all this lines after entering debian and press ENTER
        cd /etc/spreed-webrtc-server
        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

      • mashudi72 -i.like the bedrock

        yes, it work.
        thanks you for your help.

        this is the screen log,
        root@localhost:/etc/spreed-webrtc-server# /etc/init.d/spreedwebrtcserver start
        Starting Spreed Webrtc Server: done
        server 2016/11/24 07:41:34.473582 Warning: sessionSecret value is not a hex enco ded encoding/hex: odd length hex string
        server 2016/11/24 07:41:34.480783 Warning: encryptionSecret value is not a hex e ncoded encoding/hex: invalid byte: U+0074 't'
        server 2016/11/24 07:41:34.480879 Enabled modules: [screensharing youtube presen tation contacts]
        server 2016/11/24 07:41:34.503084 Max open files are 65536
        server 2016/11/24 07:41:34.506920 Native TLS configuration intialized
        server 2016/11/24 07:41:34 Starting HTTPS server on 0.0.0.0:8910

        is it ok?

      • Yes, it's ok

      • mashudi72 -i.like the bedrock

        root@localhost:/usr/local# /etc/init.d/spreedwebrtcserver start
        Starting Spreed Webrtc Server: done
        server 2016/11/22 09:59:47.210447 Warning: sessionSecret value is not a hex encoded encoding/hex: odd length hex string
        server 2016/11/22 09:59:47.210709 Warning: encryptionSecret value is not a hex encoded encoding/hex: invalid byte: U+0074 't'
        server 2016/11/22 09:59:47.210819 Enabled modules: [presentation contacts screensharing youtube]
        server 2016/11/22 09:59:47.212352 Max open files are 65536
        server 2016/11/22 09:59:47 TLS configuration error: open server.crt: no such file or directory
        root@localhost:/usr/local#

  • mashudi72 -i.like the bedrock

    after installation, everything ok. When I start the application : /etc/init.d/spreedwebrtcserver start

    TLS configuration error: open server.crt: no such file or directory

  • Андрей И.

    new problem in process http://i.imgur.com/fh6DV47.png

  • Андрей И.

    Can i use this manual for installation on clean debian 8.5?
    When I enter "git clone https://github.com/strukturag/spreed-webrtc.git" get the messages "enter username. What can I enter?

    • Terminal should not ask for password when clone a repository :) I will try later to redo all steps

      • Андрей И.

        yes, it is :( Ask for username on step 7. I try to install on clean debian 8.5 (not router, simple virtual server)
        http://i.imgur.com/4B3Rpv2.png

      • Андрей И.

        i make a mistake :) enter strukturTag instead strukturag

  • Joe Fox

    I have to say that i tested it in LAN only (no need stun server in that case) and it's not working well. Video works but no sound, no file sharing etc.. I have to say that it's a bit useless to install that app on asuswrt except for chat.. :( If you have time and motivation you can try to make a tutorial for jitsi. It is known to be the easiest to install audio/video/chat solution.

    I am myself not an expert so it is as you wish. I can test anything if you need help.

    https://jitsi.org/Projects/JitMeet

  • Joe Fox

    can't download file shared and video doesn't work. It says "Peer connection failed. Check your settings."

    port 8910 is the only one to open ?

  • Joe Fox

    Did the install twice, same problem. How can i troubleshoot ? Thanks

    • TeHashX

      Trying to debug now...

      • TeHashX

        Ok found the mistake, somehow the startup script missed a new line ;(
        Modify /etc/init.d/spreedwebrtcserver from
        ### END INIT INFOCONF="/etc/spreed-webrtc-server/server.conf"
        to
        ### END INIT INFO
        CONF="/etc/spreed-webrtc-server/server.conf"

      • Joe Fox

        Great ! Works now. All i need is to try with another mate when i will have the time. Thanks again ! :)

  • Joe Fox

    At compile do you have those errors ?
    ithub.com/gorilla/mux now at ba336c9cfb43552c90de6cb2ceedd3271c747558
    update github.com/strukturag/sloth failed; trying to fetch newer version
    github.com/longsleep/pkac now at 68bf8859f58dd84332ee41c07eba357fb3818ba3
    update github.com/satori/go.uuid failed; trying to fetch newer version
    github.com/strukturag/sloth now at 74a8bcf67368de59baafe5d3e17aee9875564cfc
    update github.com/strukturag/goacceptlanguageparser failed; trying to fetch newer version
    github.com/satori/go.uuid now at afe1e2ddf0f05b7c29d388a3f8e76cb15c2231ca
    update github.com/strukturag/httputils failed; trying to fetch newer version
    github.com/strukturag/goacceptlanguageparser now at 68066e68c2940059aadc6e19661610cf428b6647
    update github.com/strukturag/phoenix failed; trying to fetch newer version
    github.com/strukturag/httputils now at afbf05c71ac03ee7989c96d033a9571ba4ded468
    update github.com/gorilla/context failed; trying to fetch newer version
    ...

    • TeHashX

      Yes, don't worry about that errors

  • Joe Fox

    All worked well for the install but unable to connect to 192.168.1.1:8910 even in https (yes my router is on 192.168.1.1 :) ). How can i check ?

    edit : root@ROUTEUR:/# spreed-webrtc-server start
    server 2016/07/21 19:11:48 open ./server.conf: no such file or directory

    Got 2 files in /opt/debian/etc/spreed-webrtc-server (server.crt and server.conf)

    • TeHashX

      You probably skip some step, should connect only through https, if not, no camera and mic permission will popup, only tried with chrome web browser. Try installing from scratch

  • Joe Fox

    Wahoo didn't know about that app.. Will test it. Do you know if some external connexion is required ? (want to test it in LAN only) of do we have to login to spreed.ME to access the server ? Thanks.

    • TeHashX

      I'm not 100% sure external connexion is required, please try and leave feedback.

SUBSCRIBE

To be notified by email when a new tutorial is posted :)