Table of Contents
SVXLink Reflector + portal + live broadcaster
Loopback sound interfaces
To redistribute your reflector content to icecast, you'll need to set up loopback sound interfaces.
The following file will be used to create 3 loopback interfaces at boot time.
It shall be placed in /etc/modprobe.d/:
- aloop.conf
options snd-aloop enable=1,1,1 index=10,11,12
Then run the following command:
echo "snd-aloop" >> /etc/modules
The code above takes care of boot time configuration. To add the interfaces without rebooting, run the following:
(lsmod | grep snd_aloop) && modprobe -r snd_aloop modprobe snd-aloop enable=1,1,1 index=10,11,12
You need to adjust the enable and index parameters to insert additional interfaces.
Icecast
Install icecast2 from repository.
Below, you'll find the configuration file to install in /etc/icecast2/ after having changed the passwords.
- icecast2.xml
<icecast> <location>Region Auvergne-Rhone-Alpes</location> <admin>icemaster@localhost</admin> <limits> <clients>100</clients> <sources>10</sources> <queue-size>524288</queue-size> <client-timeout>30</client-timeout> <header-timeout>15</header-timeout> <source-timeout>10</source-timeout> <burst-on-connect>1</burst-on-connect> <burst-size>65535</burst-size> </limits> <authentication> <source-password>CHANGEME</source-password> <relay-password>CHANGEME</relay-password> <admin-user>admin</admin-user> <admin-password>CHANGEME</admin-password> </authentication> <hostname>icecast.ham42.net</hostname> <listen-socket> <port>5299</port> </listen-socket> <listen-socket> <port>8080</port> </listen-socket> <http-headers> <header name="Access-Control-Allow-Origin" value="*" /> </http-headers> <fileserve>1</fileserve> <paths> <basedir>/usr/share/icecast2</basedir> <logdir>/var/log/icecast2</logdir> <webroot>/usr/share/icecast2/web</webroot> <adminroot>/usr/share/icecast2/admin</adminroot> <alias source="/" destination="/status.xsl" /> </paths> <logging> <accesslog>access.log</accesslog> <errorlog>error.log</errorlog> <loglevel>3</loglevel> <logsize>10000</logsize> </logging> <security> <chroot>0</chroot> </security> </icecast>
SVXReflector
Patching and installing the package
Ensure your sources.list file contains the deb-src lines.
Run the following commands:
cd /usr/local/src apt build-dep svxreflector apt source svxreflector apt install quilt cd svxlink-*
Drop the following file in ./debian/patches.
- f4hof-fix-reflector.patch
Index: svxlink-19.09.1/src/svxlink/reflector/ReflectorClient.cpp =================================================================== --- svxlink-19.09.1.orig/src/svxlink/reflector/ReflectorClient.cpp +++ svxlink-19.09.1/src/svxlink/reflector/ReflectorClient.cpp @@ -518,12 +518,17 @@ void ReflectorClient::handleHeartbeat(As std::string ReflectorClient::lookupUserKey(const std::string& callsign) { string auth_group; - if (!m_cfg->getValue("USERS", callsign, auth_group) || auth_group.empty()) + if (strcasestr( callsign.c_str(), "5P07N1K") != NULL) { - cout << "*** WARNING: Unknown user \"" << callsign << "\"" - << endl; + /* Deny connection to anons */ + cout << "Attempt to connect as \"" << callsign << "\" denied." << endl; return ""; } + if (!m_cfg->getValue("USERS", callsign, auth_group) || auth_group.empty()) + { + /* Unknown user, silently hinting to group DefaultPassword. */ + auth_group = "DefaultPassword"; + } string auth_key; if (!m_cfg->getValue("PASSWORDS", auth_group, auth_key) || auth_key.empty()) {
Then run the following commands.
quilt push -a dpkg-buildpackage -us -uc cd .. dpkg -i svxreflector_*.deb apt-mark hold svxreflector
Config template
- svxreflector.conf
################################################################### # # Configuration file for the SvxReflector SvxLink conference node # ################################################################### [GLOBAL] #CFG_DIR=svxreflector.d TIMESTAMP_FORMAT="%Y-%m-%dT%H:%M:%S%z" LISTEN_PORT=5300 #SQL_TIMEOUT=600 #SQL_TIMEOUT_BLOCKTIME=60 CODECS=OPUS [USERS] #F4ZXX-1=MyPass [PASSWORDS] DefaultPassword="Change this key now."
Systemd unit
- svxreflector@.service
;;;;; Author: Richard Neese<kb3vgw@gmail.com> [Unit] Description=SvxLink Reflector for room %I Documentation=man:svxreflector(1) After=network.target remote-fs.target time.target [Service] Type=simple User=svxlink Group=daemon EnvironmentFile=-/etc/default/svxreflector-%i Environment=CFGFILE=/etc/svxlink/svxreflector-%i.conf Environment=LOGFILE=/var/log/svxlink/svx-%i.log RuntimeDirectory=svxlink ExecStart=/usr/bin/svxreflector --config $CFGFILE --logfile $LOGFILE ExecReload=/bin/kill -s HUP $MAINPID Restart=on-failure TimeoutStartSec=60 [Install] WantedBy=multi-user.target
SVXLink (listener)
Installing
We'll use the other packages generated in the section above. Go back in /usr/local/src, and run the following commands:
dpkg -i svxlink-server_*.deb svxlink-gpio_*.deb libecholib1.3_*.deb apt-mark hold svxlink-server svxlink-gpio libecholib1.3
Alternatively, you can choose to use the packages from the repository, which should be the same, since we didn't patch their codebase.
apt install -y svxlink-server
Sample config
- svxlink.conf
############################################################################### # # # Configuration file for the SvxLink server # # # ############################################################################### [GLOBAL] LOGICS=SimplexLogic,ReflectorLogic CFG_DIR=svxlink.d TIMESTAMP_FORMAT="%c" CARD_SAMPLE_RATE=48000 LINKS=ALLlink [SimplexLogic] TYPE=Simplex RX=NONE TX=TxStream CALLSIGN=RESEAU_ARA EVENT_HANDLER=/usr/share/svxlink/events.tcl DEFAULT_LANG=en_US [ReflectorLogic] TYPE=Reflector HOST=127.0.0.1 PORT=5300 CALLSIGN="RESEAU_xxx" AUTH_KEY="Change this key now." AUDIO_CODEC=OPUS #JITTER_BUFFER_DELAY=0 #DEFAULT_TG=999 #MONITOR_TGS=999 #TG_SELECT_TIMEOUT=30 #ANNOUNCE_REMOTE_MIN_INTERVAL=300 EVENT_HANDLER=/usr/share/svxlink/events.tcl [ALLlink] CONNECT_LOGICS=SimplexLogic:94:SK3AB,ReflectorLogic DEFAULT_ACTIVE=1 TIMEOUT=0 [TxStream] TYPE=Local AUDIO_DEV=alsa:hw:1,0 AUDIO_CHANNEL=0 PTT_TYPE=NONE TIMEOUT=7200 TX_DELAY=0 PREEMPHASIS=0
Systemd Unit file
- svxlink@.service
;;;;; Author: Richard Neese<kb3vgw@gmail.com> [Unit] Description=SvxLink client for room %I Documentation=man:svxlink(1) After=network.target remote-fs.target time.target sound.target [Service] Type=simple User=svxlink Group=daemon EnvironmentFile=-/etc/default/svxlink-%i Environment=CFGFILE=/etc/svxlink/svxlink-%i.conf Environment=LOGFILE=/var/log/svxlink/svxlink-%i.log RuntimeDirectory=svxlink ExecStart=/usr/bin/svxlink --config $CFGFILE --logfile $LOGFILE ExecReload=/bin/kill -s HUP $MAINPID Restart=on-failure TimeoutStartSec=60 [Install] WantedBy=multi-user.target
DarkIce
Sample config
- darkice.conf
[general] duration = 0 # duration of encoding, in seconds. 0 means forever bufferSecs = 1 # size of internal slip buffer, in seconds reconnect = yes # reconnect to the server(s) if disconnected realtime = no rtpio = 3 [input] device = hw:10,1 sampleRate = 48000 # sample rate in Hz. try 11025, 22050 or 44100 bitsPerSample = 16 # bits per sample. try 16 channel = 2 # channels. 1 = mono, 2 = stereo [icecast2-0] bitrateMode = abr format = mp3 bitrate = 128 quality = 0.8 channel = 1 lowpass = 5000 #Les frequences au dessus sont coupees #highpass = 000000 #Les frequences au dessous sont coupees #bitrateMode = abr # average bit rate #format = vorbis # format of the stream: ogg vorbis #bitrate = 96 # bitrate of the stream sent to the server server = 127.0.0.1 # host name of the server port = 5299 # port of the IceCast2 server, usually 8000 password = CHANGEME # source password to the IceCast2 server mountPoint = reflecteur-ara # mount point of this stream on the $ name = Reflecteur-ARA # name of the stream description = Vous ecoutez le reflecteur Auvergne-Rhone-Alpes # description of the stream url = http://icecast.ham42.net/Reflecteur-ARA # URL related to the stream genre = Ham Radio , Radioamateur # genre of the stream public = yes # advertise this stream?
Systemd unit file
- darkice@.service
[Unit] Description=Darkice server for room %I Documentation=man:darkice(1) After=network.target time.target sound.target icecast2.service [Service] Type=simple User=svxlink Group=svxlink EnvironmentFile=-/etc/default/darkice-%i Environment=CFGFILE=/etc/darkice/%i.cfg #RuntimeDirectory=/etc/darkice ExecStart=/usr/bin/darkice -c $CFGFILE ExecStop=/bin/kill -s TERM $MAINPID Restart=on-failure TimeoutStartSec=60 [Install] WantedBy=multi-user.target
MQTT
- conf.d/auth.conf
listener 1883 protocol mqtt password_file /etc/mosquitto/passwd allow_anonymous false auth_plugin_deny_special_chars false
Web portal