2016-05-26 12:55:14 +02:00
#!/bin/sh
2017-03-09 18:40:20 +01:00
2019-02-28 19:45:13 +01:00
#move to script directory so all relative paths work
cd " $( dirname " $0 " ) "
#includes
2019-02-28 19:46:30 +01:00
. ../config.sh
2020-05-19 06:32:18 +02:00
. ../environment.sh
2019-02-28 19:45:13 +01:00
2019-02-21 18:04:23 +01:00
#upgrade packages
2019-02-21 18:17:03 +01:00
apt update && apt upgrade -y
2019-02-21 18:04:23 +01:00
# install dependencies
2022-01-10 23:51:59 +01:00
apt install -y autoconf automake devscripts g++ git-core libncurses5-dev libtool make libjpeg-dev
2019-06-04 03:09:03 +02:00
apt install -y pkg-config flac libgdbm-dev libdb-dev gettext sudo equivs mlocate git dpkg-dev libpq-dev
apt install -y liblua5.2-dev libtiff5-dev libperl-dev libcurl4-openssl-dev libsqlite3-dev libpcre3-dev
apt install -y devscripts libspeexdsp-dev libspeex-dev libldns-dev libedit-dev libopus-dev libmemcached-dev
2020-05-19 06:32:18 +02:00
apt install -y libshout3-dev libmpg123-dev libmp3lame-dev yasm nasm libsndfile1-dev libuv1-dev libvpx-dev
2024-02-09 21:32:45 +01:00
apt install -y libavformat-dev libswscale-dev libvlc-dev python3-distutils sox libsox-fmt-all
2020-05-19 06:32:18 +02:00
#install dependencies that depend on the operating system version
if [ ." $os_codename " = ."stretch" ] ; then
2022-01-10 23:51:59 +01:00
apt install -y libvpx4 swig3.0
2020-05-19 06:32:18 +02:00
fi
if [ ." $os_codename " = ."buster" ] ; then
2022-01-10 23:51:59 +01:00
apt install -y libvpx5 swig3.0
2020-05-19 06:32:18 +02:00
fi
2021-11-01 18:27:28 +01:00
if [ ." $os_codename " = ."bullseye" ] ; then
2022-04-14 23:56:30 +02:00
apt install -y libvpx6 swig4.0
2021-11-01 18:27:28 +01:00
fi
2019-02-21 18:04:23 +01:00
# additional dependencies
2022-01-10 23:51:59 +01:00
apt install -y sqlite3 unzip
2016-05-26 12:55:14 +02:00
2016-07-05 19:00:20 +02:00
#we are about to move out of the executing directory so we need to preserve it to return after we are done
CWD = $( pwd )
2022-01-10 23:51:59 +01:00
2022-03-24 05:38:03 +01:00
#install the following dependencies if the switch version is greater than 1.10.0
if [ $( echo " $switch_version " | tr -d '.' ) -gt 1100 ] ; then
# libks build-requirements
apt install -y cmake uuid-dev
# libks
cd /usr/src
git clone https://github.com/signalwire/libks.git libks
cd libks
cmake .
2023-10-04 00:15:13 +02:00
make -j $( getconf _NPROCESSORS_ONLN)
2022-03-24 05:38:03 +01:00
make install
# libks C includes
export C_INCLUDE_PATH = /usr/include/libks
# sofia-sip
cd /usr/src
#git clone https://github.com/freeswitch/sofia-sip.git sofia-sip
wget https://github.com/freeswitch/sofia-sip/archive/refs/tags/v$sofia_version .zip
unzip v$sofia_version .zip
2023-12-06 18:53:47 +01:00
cd sofia-sip-$sofia_version
2022-03-24 05:38:03 +01:00
sh autogen.sh
2024-01-15 18:11:30 +01:00
./configure --enable-debug
2023-10-04 00:15:13 +02:00
make -j $( getconf _NPROCESSORS_ONLN)
2022-03-24 05:38:03 +01:00
make install
# spandsp
cd /usr/src
git clone https://github.com/freeswitch/spandsp.git spandsp
cd spandsp
2023-10-01 06:12:21 +02:00
git reset --hard 0d2e6ac65e0e8f53d652665a743015a88bf048d4
2023-09-21 17:53:54 +02:00
#/usr/bin/sed -i 's/AC_PREREQ(\[2\.71\])/AC_PREREQ([2.69])/g' /usr/src/spandsp/configure.ac
2022-03-24 05:38:03 +01:00
sh autogen.sh
2024-01-15 18:11:30 +01:00
./configure --enable-debug
2023-10-04 00:15:13 +02:00
make -j $( getconf _NPROCESSORS_ONLN)
2022-03-24 05:38:03 +01:00
make install
ldconfig
2022-01-10 23:51:59 +01:00
fi
2016-07-05 18:59:30 +02:00
cd /usr/src
2022-03-17 22:50:56 +01:00
2022-09-10 17:56:37 +02:00
#check for master
if [ $switch_branch = "master" ] ; then
#master branch
echo "Using version master"
rm -r /usr/src/freeswitch
git clone https://github.com/signalwire/freeswitch.git
2022-03-24 05:38:03 +01:00
cd /usr/src/freeswitch
2022-09-10 17:56:37 +02:00
./bootstrap.sh -j
2022-03-24 05:38:03 +01:00
fi
2016-05-26 12:55:14 +02:00
2022-09-10 17:56:37 +02:00
#check for stable release
if [ $switch_branch = "stable" ] ; then
echo " Using version $switch_version "
#1.8 and older
if [ $( echo " $switch_version " | tr -d '.' ) -lt 1100 ] ; then
wget http://files.freeswitch.org/freeswitch-releases/freeswitch-$switch_version .zip
unzip freeswitch-$switch_version .zip
2023-12-06 19:09:26 +01:00
cd /usr/src/freeswitch-$switch_version
2022-09-10 17:56:37 +02:00
fi
#1.10.0 and newer
if [ $( echo " $switch_version " | tr -d '.' ) -gt 1100 ] ; then
2024-11-24 00:34:47 +01:00
git clone -b $switch_version --single-branch https://github.com/fusionpbx/freeswitch freeswitch-$switch_version
2024-12-12 00:46:23 +01:00
git checkout $switch_version
2024-11-24 00:34:47 +01:00
#wget http://files.freeswitch.org/freeswitch-releases/freeswitch-$switch_version.-release.zip
#unzip freeswitch-$switch_version.-release.zip
#mv freeswitch-$switch_version.-release freeswitch-$switch_version
2023-12-06 19:09:26 +01:00
cd /usr/src/freeswitch-$switch_version
2024-11-24 00:46:31 +01:00
# bootstrap is needed if using git
./bootstrap.sh -j
2024-06-22 19:07:15 +02:00
2024-06-22 21:28:23 +02:00
#apply rtp timestamp patch - Fix RTP audio issues use the following for additional information. https://github.com/briteback/freeswitch/commit/9f8968ccabb8a4e0353016d4ea0ff99561b005f1
2024-11-24 00:34:47 +01:00
#patch -u /usr/src/freeswitch-$switch_version/src/switch_rtp.c -i /usr/src/fusionpbx-install.sh/debian/resources/switch/source/switch_rtp.diff
2024-06-22 21:28:23 +02:00
#apply pull request 2300 to Fix session deadlock that results in stale or stuck calls. https://github.com/signalwire/freeswitch/pull/2300
2024-11-24 00:34:47 +01:00
#patch -d /usr/src/freeswitch-$switch_version/src -i /usr/src/fusionpbx-install.sh/debian/resources/switch/source/pull_2300.diff
2024-06-22 21:28:23 +02:00
2024-06-22 19:07:15 +02:00
#apply mod_pgsql patch
#patch -u /usr/src/freeswitch-$switch_version/src/mod/databases/mod_pgsql/mod_pgsql.c -i /usr/src/fusionpbx-install.sh/debian/resources/switch/source/mod_pgsql.patch
2022-09-10 17:56:37 +02:00
fi
fi
2022-03-18 18:20:55 +01:00
2019-02-21 18:04:23 +01:00
# enable required modules
2022-01-10 23:51:59 +01:00
#sed -i /usr/src/freeswitch/modules.conf -e s:'#applications/mod_avmd:applications/mod_avmd:'
2023-12-06 19:09:26 +01:00
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#applications/mod_av:formats/mod_av:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#applications/mod_callcenter:applications/mod_callcenter:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#applications/mod_cidlookup:applications/mod_cidlookup:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#applications/mod_memcache:applications/mod_memcache:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#applications/mod_nibblebill:applications/mod_nibblebill:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#applications/mod_curl:applications/mod_curl:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#applications/mod_translate:applications/mod_translate:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#formats/mod_shout:formats/mod_shout:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#formats/mod_pgsql:formats/mod_pgsql:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#say/mod_say_es:say/mod_say_es:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'#say/mod_say_fr:say/mod_say_fr:'
2019-02-21 18:04:23 +01:00
2019-06-04 04:33:05 +02:00
#disable module or install dependency libks to compile signalwire
2023-12-06 19:09:26 +01:00
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'applications/mod_signalwire:#applications/mod_signalwire:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'endpoints/mod_skinny:#endpoints/mod_skinny:'
sed -i /usr/src/freeswitch-$switch_version /modules.conf -e s:'endpoints/mod_verto:#endpoints/mod_verto:'
2019-06-04 04:33:05 +02:00
2019-02-21 18:04:23 +01:00
# prepare the build
#./configure --prefix=/usr/local/freeswitch --enable-core-pgsql-support --disable-fhs
2024-01-15 18:11:30 +01:00
./configure -C --enable-portable-binary --disable-dependency-tracking --enable-debug \
2019-02-21 18:04:23 +01:00
--prefix= /usr --localstatedir= /var --sysconfdir= /etc \
--with-openssl --enable-core-pgsql-support
# compile and install
2023-10-04 00:15:13 +02:00
make -j $( getconf _NPROCESSORS_ONLN)
2016-05-26 12:55:14 +02:00
make install
2016-09-04 20:32:10 +02:00
2016-07-05 19:00:20 +02:00
#return to the executing directory
cd $CWD