Skip to content

Instantly share code, notes, and snippets.

@baltuonis
Last active March 11, 2021 16:41
Show Gist options
  • Save baltuonis/10cae1fa29a2203339d9003c1bc3a2fa to your computer and use it in GitHub Desktop.
Save baltuonis/10cae1fa29a2203339d9003c1bc3a2fa to your computer and use it in GitHub Desktop.
BigBlueButton to Icecast streaming configuration (using mod_shout in FreeSWITCH)

BigBlueButton > FreeSwitch > Icecast configuration

Summary

What needs to be done in order for BBB to be able to stream to Icecast:

  1. Get Freeswitch source
  2. Install dev dependencies
  3. Compile with mod_shout support
  4. Copy compiled modules to FreeSwitch directory
  5. Enable mod_shout module in FreeSwitch
  6. Restart FreeSwitch
  7. Enable conference room streaming to specific SHOUTCAST stream

Documentations

https://docs.bigbluebutton.org/admin/configuration-files.html

https://freeswitch.org/confluence/display/FREESWITCH/Command-Line+Interface+fs_cli

https://freeswitch.org/confluence/display/FREESWITCH/mod_shout

https://freeswitch.org/confluence/display/FREESWITCH/Command-Line+Interface+fs_cli

Some extra help http://www.programmersought.com/article/4919919716/

FREESWITCH > IceCast streaming Commands

Use when you've already compiled and enabled mod_shout module.

cd  /opt/freeswitch/bin/
./fs_cli -l error
./fs_cli -l error -x "conference list"

# Within FS_CLI
# Get running conference list
conference list  

# Check status if recording already
conference 97214 recording status

# Put conference room & shoutcast stream endpoint
conference 75796 record shout://user:[email protected]:8000/stream_endpoint


# TEST Stream output
https://yourradio.com:8443/stream_endpoint

# Stop conference stream
conference CONFERENCE_NUMBER norecord all

FREESWITCH COMPILATION

Installing compile dependencies

# [optional] Install freeswitch dependencies through APT - didn't work for me
apt-get update && apt-get install -yq gnupg2 wget lsb-release
wget -O - https://files.freeswitch.org/repo/ubuntu-1604/freeswitch-1.6/freeswitch_archive_g0.pub | apt-key add -
echo "deb http://files.freeswitch.org/repo/ubuntu-1604/freeswitch-1.6/ xenial main" > /etc/apt/sources.list.d/freeswitch.list
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 1FDDF413C2B201E5
apt-get update && apt-get build-dep freeswitch

# For UBUNTU 16

apt-get install -y libvorbis0a libogg0 libogg-dev libvorbis-dev  build-essential autoconf automake libtool libncurses5 libncurses5-dev gawk  libz-dev pkg-config  autoconf automake devscripts gawk g++ git-core libncurses5-dev libtool make python-dev gawk pkg-config libtiff5-dev libperl-dev libgdbm-dev libdb-dev gettext libssl-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libedit-dev pkg-config uuid-dev zlib1g-dev  libsqlite3-dev libcurl4-openssl-dev libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev libtiff5-dev yasm libopus-dev libsndfile1-dev unzip libldns-dev lame libmp3lame0 yasm libavformat-dev build-essential pkg-config uuid-dev zlib1g-dev libsqlite3-dev libcurl4-openssl-dev libpcre3-dev libspeexdsp-dev libldns-dev libedit-dev libtiff5-dev yasm libopus-dev libsndfile1-dev yasm nasm   liblua5.2-dev zlib1g-dev libspeex1 libopus-dev libsndfile-dev autoconf automake devscripts gawk g++ git-core libjpeg-dev  libncurses5-dev libtool-bin libtool make python-dev gawk pkg-config libtiff5-dev libperl-dev libgdbm-dev libdb-dev gettext libssl-dev libcurl4-openssl-dev libpcre3-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libedit-dev libldns-dev libpq-dev yasm nasm unixodbc-dev unixodbc-bin unixodbc  libswscale-dev libshout3-dev libmpg123-dev libmp3lame-dev 

# Optional (if compilation fails)

apt-get install -y libjpeg62-dev  libjpeg62-turbo-dev

Compile signalwire specific libraries

cd /opt/download

wget https://cmake.org/files/v3.13/cmake-3.13.3.tar.gz
tar -zxvf cmake-3.13.3.tar.gz
cd cmake-3.13.3
./bootstrap
# Use 4-6 cores. Cmake will run out of memory on certain compilations if using ALL cores
make -j6
make install
cd ..

git clone https://github.com/signalwire/libks.git
cd libks
cmake .
make -j
make install
cd ..


git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c
cmake .
make -j
make install

cp /usr/local/lib/pkgconfig/*.pc /usr/lib/pkgconfig/
# cp -f /usr/local/lib/* /usr/lib64/

Compiling FreeSwitch

# Get source
mkdir -p /opt/download/
cd /opt/download/
git clone https://github.com/signalwire/freeswitch.git -bv1.10 freeswitch
cd freeswitch
git config pull.rebase true

# Enable mod_shout in build/modules.conf.in
vim /opt/download/freeswitch/build/modules.conf.in

# Compile everything
./bootstrap.sh -j && ./configure && make -j7

# If compilation fails - check bottom section - maybe you need to compile LIBKS / SIGNALWIRE manually
# Sometimes multicore make fails, becaue it's missing a library that's yet to be built. You can retry to continue compiling...
make -j6
# If you need to compile again because of missing library, you will probably need to run a clean command and reconfigure
make clean && ./configure && make -j7

# .... when you've finished compiling
# Copy all mod_shout libraries to
ls /opt/download/freeswitch/src/mod/formats/mod_shout/.libs/*
cp /opt/download/freeswitch/src/mod/formats/mod_shout/.libs/* /opt/freeswitch/lib/freeswitch/mod/
# If can't find them
find /opt/download/freeswitch -name mod_shout.so
# If compilation was successful but you can't find mod_shout - compile it manually
make mod_shout

# Enable mod_shout in auto modules
# https://freeswitch.org/confluence/display/FREESWITCH/mod_shout
vim /opt/freeswitch/conf/autoload_configs/modules.conf.xml

systemctl restart freeswitch.service

# See FREESWITCH > IceCast stream commands section
@Alienmaster
Copy link

I had problems with Ubuntu 16.04 and the spandsp and sofia-sip dependency.
This worked for me:
https://blog.csdn.net/liliangnike/article/details/108641497

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment