freeswitch: build ourselves with patches included

This commit is contained in:
chandi 2023-03-21 12:45:14 +01:00
parent ad484aa870
commit 2a0cd91e72
7 changed files with 112 additions and 64 deletions

View File

@ -106,7 +106,10 @@ services:
build:
context: mod/freeswitch
args:
BBB_BUILD_TAG: {{ .Env.BBB_BUILD_TAG }}
TAG_FS_BUILD_FILES: {{ .Env.TAG_FS_BUILD_FILES }}
TAG_FS_CONFIG: {{ .Env.TAG_FS_CONFIG }}
TAG_FREESWITCH: {{ .Env.TAG_FREESWITCH }}
image: alangecker/bbb-docker-freeswitch:{{ .Env.TAG_FS_CONFIG }}
restart: unless-stopped
cap_add:

View File

@ -1,66 +1,88 @@
FROM debian:bullseye-slim
ARG BBB_BUILD_TAG
FROM gitlab.senfcall.de:5050/senfcall-public/docker-bbb-build:$BBB_BUILD_TAG AS builder
# install dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
subversion curl wget ca-certificates gnupg gnupg2 lsb-release unzip
ARG TAG_FREESWITCH
RUN mkdir -p /build/freeswitch && \
cd /build/freeswitch && \
git init && \
git remote add origin https://github.com/signalwire/freeswitch.git && \
git fetch --depth 1 origin $TAG_FREESWITCH && \
git checkout FETCH_HEAD
COPY --from=alangecker/bbb-docker-base-java /usr/local/bin/dockerize /usr/local/bin/dockerize
# install freeswitch
RUN wget -q -O /usr/share/keyrings/freeswitch-archive-keyring.gpg https://freeswitch-mirror.chandi.it/repo/deb/debian-release/signalwire-freeswitch-repo.gpg && \
echo 'deb [signed-by=/usr/share/keyrings/freeswitch-archive-keyring.gpg] http://freeswitch-mirror.chandi.it/repo/deb/debian-release/ bullseye main' > /etc/apt/sources.list.d/freeswitch.list && \
# install most recent git version for proper sparse-checkout support
# https://stackoverflow.com/questions/72223738/failed-to-initialize-sparse-checkout
RUN echo 'deb https://ppa.launchpadcontent.net/git-core/ppa/ubuntu focal main' > /etc/apt/sources.list.d/git-core-ppa.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A1715D88E1DF1F24 && \
apt-get update && \
apt-get install -y \
freeswitch \
freeswitch-mod-commands \
freeswitch-mod-conference \
freeswitch-mod-console \
freeswitch-mod-dialplan-xml \
freeswitch-mod-dptools \
freeswitch-mod-event-socket \
freeswitch-mod-native-file \
freeswitch-mod-opusfile \
freeswitch-mod-opus \
freeswitch-mod-sndfile \
freeswitch-mod-spandsp \
freeswitch-mod-sofia \
freeswitch-sounds-en-us-callie \
iptables
apt-get install -y git
# replace mute & unmute sounds
RUN wget -q https://gitlab.senfcall.de/senfcall-public/mute-and-unmute-sounds/-/archive/master/mute-and-unmute-sounds-master.zip && \
# get build files for bbb-freeswitch (build/packages-template/bbb-freeswitch-core/)
ARG TAG_FS_BUILD_FILES
RUN git clone -b $TAG_FS_BUILD_FILES --depth 1 --filter=blob:none --sparse https://github.com/bigbluebutton/bigbluebutton.git /bbb && \
cd /bbb && \
git sparse-checkout set build/packages-template/bbb-freeswitch-core/ && \
cp build/packages-template/bbb-freeswitch-core/* /build/ && \
rm -rf /bbb
# mock files expected by build.sh
RUN mkdir -p /build/bbb-voice-conference/config/freeswitch/conf/ && \
touch \
/build/opts-build.sh \
/build/freeswitch.service.build \
/build/bbb-voice-conference/config/freeswitch/conf/a \
&& \
echo "" > /usr/local/bin/fpm
RUN cd /build && ./build.sh
# add english sounds
RUN mkdir -p /build/staging/opt/freeswitch/share/freeswitch && \
wget http://bigbluebutton.org/downloads/sounds.tar.gz -O sounds.tar.gz && \
tar xvfz sounds.tar.gz -C /build/staging/opt/freeswitch/share/freeswitch && \
wget https://gitlab.senfcall.de/senfcall-public/mute-and-unmute-sounds/-/archive/master/mute-and-unmute-sounds-master.zip && \
unzip mute-and-unmute-sounds-master.zip && \
cd mute-and-unmute-sounds-master/sounds/ && \
find . -name "*.wav" -exec /bin/bash -c "echo {};sox -v 0.3 {} /tmp/tmp.wav; mv /tmp/tmp.wav /usr/share/freeswitch/sounds/en/us/callie/conference/{}" \; && \
cd ../.. && \
rm -r mute-and-unmute-sounds-master mute-and-unmute-sounds-master.zip
# -- get official bbb freeswitch config
# we use svn for retrieving the files since the repo is quite large,
# git sparse-checkout is not yet available with buster and there
# is no other sane way of downloading a single directory via git
cd mute-and-unmute-sounds-master/sounds && \
find . -name "*.wav" -exec /bin/bash -c "sox -v 0.3 {} /tmp/tmp.wav; cp /tmp/tmp.wav /build/staging/opt/freeswitch/share/freeswitch/sounds/en/us/callie/conference/{}" \;
# add bigblugbutton config
ARG TAG_FS_CONFIG
RUN svn checkout https://github.com/bigbluebutton/bigbluebutton/tags/$TAG_FS_CONFIG/bbb-voice-conference/config/freeswitch/conf /etc/freeswitch \
&& rm -rf /etc/freeswitch/.svn
RUN git clone -b $TAG_FS_CONFIG --depth 1 --filter=blob:none --sparse https://github.com/bigbluebutton/bigbluebutton.git /bbb && \
cd /bbb && \
git sparse-checkout set bbb-voice-conference/config/freeswitch/conf/ && \
cp -r /bbb/bbb-voice-conference/config/freeswitch/conf/* /build/staging/opt/freeswitch/etc/freeswitch/
# the current available freeswitch-mod-opusfile is broken,
# it can't write any .opus files. The fix provided in
# https://github.com/signalwire/freeswitch/pull/719/files
# is not sufficient as the module still comes without opus
# write support, so we rather switch to the binary built
# by bigbluebutton and add its dependencies
RUN wget -O /usr/lib/freeswitch/mod/mod_opusfile.so https://github.com/bbb-pkg/bbb-freeswitch-core/raw/43f3a47af1fcf5ea559e16bb28b900c925a7f2c3/opt/freeswitch/lib/freeswitch/mod/mod_opusfile.so \
&& wget -O /tmp/libopusenc0_0.2.1-1bbb1_amd64.deb https://launchpad.net/~bigbluebutton/+archive/ubuntu/support/+files/libopusenc0_0.2.1-1bbb1_amd64.deb \
# ===============================================
# we are using ubuntu here, because libjpeg8 is required, but not available in debian
FROM ubuntu:20.04
RUN apt-get update && \
apt-get install -y \
xmlstarlet wget iptables curl \
libfreetype6 libcurl4 libspeex1 libspeexdsp1 libopus0 libsndfile1 libopusfile0 liblua5.2-0 libjbig0 libldns2 libedit2 libtiff5 libpng16-16 \
&& \
# install libopusenc0
wget -O /tmp/libopusenc0_0.2.1-1bbb1_amd64.deb https://launchpad.net/~bigbluebutton/+archive/ubuntu/support/+files/libopusenc0_0.2.1-1bbb1_amd64.deb \
&& dpkg -i /tmp/libopusenc0_0.2.1-1bbb1_amd64.deb \
&& rm /tmp/libopusenc0_0.2.1-1bbb1_amd64.deb
# add modifications
COPY ./conf /etc/freeswitch/
# add dockerize
COPY --from=alangecker/bbb-docker-base-java /usr/local/bin/dockerize /usr/local/bin/dockerize
# copy over built freeswitch & config
COPY --from=builder /build/staging/opt /opt
COPY --from=builder /build/staging/etc /etc
RUN ldconfig && \
ln -s /opt/freeswitch/conf /etc/freeswitch && \
groupadd freeswitch && \
useradd --home-dir /opt/freeswitch --shell /usr/sbin/nologin -g freeswitch freeswitch
COPY ./entrypoint.sh /entrypoint.sh
COPY ./conf /etc/freeswitch/
ENTRYPOINT /entrypoint.sh

View File

@ -54,7 +54,7 @@
for presence.
-->
<!-- Name of the db to use for this profile -->
<!--<param name="dbname" value="share_presence"/>-->
<param name="dbname" value="sqlite://memory://file:external-ipv6?mode=memory&amp;cache=shared"/>
<!--<param name="presence-hosts" value="$${domain}"/>-->
<!--<param name="force-register-domain" value="$${domain}"/>-->
<!--all inbound reg will stored in the db using this domain -->

View File

@ -52,7 +52,7 @@
for presence.
-->
<!-- Name of the db to use for this profile -->
<!--<param name="dbname" value="share_presence"/>-->
<param name="dbname" value="sqlite://memory://file:external?mode=memory&amp;cache=shared"/>
<!--<param name="presence-hosts" value="$${domain}"/>-->
<!--<param name="force-register-domain" value="$${domain}"/>-->
<!--all inbound reg will stored in the db using this domain -->

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash -e
# remove all SIP (port 5060) iptable rules
iptables -S INPUT | grep "\-\-dport 5060 " | cut -d " " -f 2- | xargs -rL1 iptables -D
@ -15,13 +15,19 @@ for IP in "${ADDR[@]}"; do
iptables -I INPUT -p udp --dport 5060 -s $IP -j ACCEPT
done
mkdir -p /var/freeswitch/meetings
chown -R freeswitch:daemon /var/freeswitch/meetings
chmod 777 /var/freeswitch/meetings
chown -R freeswitch:daemon /opt/freeswitch/var
chown -R freeswitch:daemon /opt/freeswitch/etc
chmod -R g-rwx,o-rwx /opt/freeswitch/etc
# install freeswitch sounds if missing
SOUNDS_DIR=/usr/share/freeswitch/sounds
if [ "$SOUNDS_LANGUAGE" == "de-de-daedalus3" ]; then
SOUNDS_DIR=/opt/freeswitch/share/freeswitch/sounds
if [ "$SOUNDS_LANGUAGE" == "en-us-callie" ]; then
# default, is already installed
echo ""
elif [ "$SOUNDS_LANGUAGE" == "de-de-daedalus3" ]; then
if [ ! -d "$SOUNDS_DIR/de/de/daedalus3" ]; then
echo "sounds package for de-de-daedalus3 not installed yet"
wget -O /tmp/freeswitch-german-soundfiles.zip https://github.com/Daedalus3/freeswitch-german-soundfiles/archive/master.zip
@ -36,10 +42,24 @@ if [ "$SOUNDS_LANGUAGE" == "de-de-daedalus3" ]; then
fi
else
SOUNDS_PACKAGE=$(echo "freeswitch-sounds-${SOUNDS_LANGUAGE}" | tr '[:upper:]' '[:lower:]')
if ! dpkg -s $SOUNDS_PACKAGE >/dev/null 2>&1; then
if [ ! -f $SOUNDS_DIR/$SOUNDS_LANGUAGE.installed ]; then
echo "sounds package for $SOUNDS_LANGUAGE not installed yet"
apt-get install $SOUNDS_PACKAGE
# get filename of latest release for this sound package
FILENAME=$(curl -s https://files.freeswitch.org/releases/sounds/ | grep -i $SOUNDS_LANGUAGE 2> /dev/null | awk -F'\"' '{print $8}' | grep -E '\-48000-.*\.gz$' | sort -V | tail -n 1)
if [ "$FILENAME" = "" ]; then
echo "Error: could not find sounds for language '$SOUNDS_LANGUAGE'"
echo "make sure to specify a value for SOUNDS_LANGUAGE which exists on https://files.freeswitch.org/releases/sounds/"
exit 1
fi
for bitrate in 8000 16000 32000 48000; do
URL=https://files.freeswitch.org/releases/sounds/$(echo $FILENAME | sed "s/48000/$bitrate/")
wget -O /tmp/sounds.tar.gz $URL
tar xvfz /tmp/sounds.tar.gz -C $SOUNDS_DIR
done
touch $SOUNDS_DIR/$SOUNDS_LANGUAGE.installed
fi
fi
@ -49,4 +69,4 @@ export SOUNDS_PATH=$SOUNDS_DIR/$(echo "$SOUNDS_LANGUAGE" | sed 's|-|/|g')
dockerize \
-template /etc/freeswitch/vars.xml.tmpl:/etc/freeswitch/vars.xml \
-template /etc/freeswitch/autoload_configs/conference.conf.xml.tmpl:/etc/freeswitch/autoload_configs/conference.conf.xml \
/usr/bin/freeswitch -u freeswitch -g daemon -nonat -nf
/opt/freeswitch/bin/freeswitch -u freeswitch -g daemon -nonat -nf

View File

@ -45,12 +45,14 @@ docker run \
-e TAG_BBB_WEB=${TAG_BBB_WEB} \
-e TAG_HTML5=${TAG_HTML5} \
-e TAG_FS_CONFIG=${TAG_FS_CONFIG} \
-e TAG_FS_BUILD_FILES=${TAG_FS_BUILD_FILES} \
-e TAG_LEARNING_DASHBOARD=${TAG_LEARNING_DASHBOARD} \
-e TAG_RECORDINGS=${TAG_RECORDINGS} \
-e TAG_WEBRTC_SFU=${TAG_WEBRTC_SFU} \
-e TAG_WEBHOOKS=${TAG_WEBHOOKS} \
-e TAG_PLAYBACK=${TAG_PLAYBACK} \
-e TAG_PADS=${TAG_PADS} \
-e TAG_FREESWITCH=${TAG_FREESWITCH} \
-e DEV_MODE=${DEV_MODE:-false} \
-e EXTERNAL_IPv6=${EXTERNAL_IPv6:-} \
-e ENABLE_RECORDING=${ENABLE_RECORDING:-false} \

View File

@ -4,7 +4,7 @@
# https://gitlab.senfcall.de/senfcall-public/docker-bbb-build
BBB_BUILD_TAG=v2022-12-08-meteor-290
BBB_BUILD_TAG=v2022-12-29-grails-524
# https://github.com/bigbluebutton/bigbluebutton
TAG_COMMON_MESSAGE=v2.5.10
@ -14,9 +14,10 @@ TAG_BBB_WEB=v2.5.11
TAG_HTML5=v2.5.10
TAG_RECORDINGS=v2.5.10
TAG_LEARNING_DASHBOARD=v2.5.10
TAG_FS_CONFIG=v2.5.7
TAG_FS_CONFIG=v2.6.0
TAG_FS_BUILD_FILES=v2.6.0
TAG_FREESWITCH=v1.10.9
# individual git submodules
# use `./scripts/checkout-submodules` to ensure, that the submodules