-
-
Save mariogasparoni/dc4490fcc85a527ac45f3d42e35a962c to your computer and use it in GitHub Desktop.
| #!/bin/bash | |
| ## Script for building/installing FreeSWITCH from source. | |
| ## URL: https://gist.github.com/mariogasparoni/dc4490fcc85a527ac45f3d42e35a962c | |
| ## Freely distributed under the MIT license | |
| ## | |
| ## | |
| set -xe | |
| FREESWITCH_SOURCE=https://github.com/signalwire/freeswitch.git | |
| FREESWITCH_RELEASE=master #or set this to any other version, for example: v1.10.5 | |
| PREFIX=/usr/share/freeswitch | |
| # If you want to remove some modules from build, specify/uncomment it here | |
| REMOVED_MODULES=( | |
| # mod_signalwire | |
| # mog_pgsql | |
| ) | |
| #Clean old prefix and build | |
| sudo rm -rf $PREFIX | |
| rm -rf ~/build-$FREESWITCH_RELEASE | |
| #install dependencies | |
| sudo apt-get update && sudo apt-get install -y git-core build-essential python python2-dev python3-dev autoconf automake cmake libtool libncurses5 libncurses5-dev make libjpeg-dev pkg-config zlib1g-dev sqlite3 libsqlite3-dev libpcre3-dev libspeexdsp-dev libedit-dev libldns-dev liblua5.1-0-dev libcurl4-gnutls-dev libapr1-dev yasm libsndfile-dev libopus-dev libtiff-dev libavformat-dev libswscale-dev libavresample-dev libpq-dev | |
| #clone source and prepares it | |
| mkdir -p ~/build-$FREESWITCH_RELEASE | |
| cd ~/build-$FREESWITCH_RELEASE | |
| PVERSION=( ${FREESWITCH_RELEASE//./ } ) | |
| MIN_VERSION=${PVERSION[1]} | |
| PATCH_VERSION=${PVERSION[2]} | |
| if [[ $FREESWITCH_RELEASE = "master" ]] || [[ $MIN_VERSION -ge 10 && $PATCH_VERSION -ge 3 ]] | |
| then | |
| echo "VERSION => 1.10.3 - need to build libsk2, signalwire-c , spandsp and sofia-sip separatedly" | |
| #build and install libks2 - needed for mod_verto and signalwire | |
| git clone https://github.com/signalwire/libks.git | |
| cd libks | |
| cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX | |
| make | |
| sudo make install | |
| cd .. | |
| #build and install signalwire-c - needed for mod_signalwire | |
| git clone https://github.com/signalwire/signalwire-c | |
| cd signalwire-c | |
| env PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX:PATH=$PREFIX | |
| make | |
| sudo make install | |
| cd .. | |
| #build and install libspandev | |
| git clone https://github.com/freeswitch/spandsp.git | |
| cd spandsp | |
| git checkout 67d2455efe02e7ff0d897f3fd5636fed4d54549e # workaround for @signalwire/freeswitch#2158 (thx to @9to1url) | |
| ./bootstrap.sh | |
| ./configure --prefix=$PREFIX | |
| make | |
| sudo make install | |
| cd .. | |
| #build and install mod_sofia | |
| git clone https://github.com/freeswitch/sofia-sip.git | |
| cd sofia-sip | |
| ./bootstrap.sh | |
| ./configure --prefix=$PREFIX | |
| make | |
| sudo make install | |
| cd .. | |
| fi | |
| #avoid git access's denied error | |
| touch .config && sudo chown $USER:$USER .config | |
| if [ ! -d freeswitch ] | |
| then | |
| git clone $FREESWITCH_SOURCE freeswitch | |
| cd freeswitch | |
| else | |
| cd freeswitch | |
| git fetch origin | |
| fi | |
| git reset --hard $FREESWITCH_RELEASE && git clean -d -x -f | |
| #remove modules from building | |
| for module in "${REMOVED_MODULES[@]}" | |
| do | |
| sed -i "s/applications\/mod_signalwire/#applications\/mod_signalwire/g" build/modules.conf.in | |
| done | |
| #sed -i "s/databases\/mod_pgsql/#databases\/mod_pgsql/g" build/modules.conf.in | |
| ./bootstrap.sh | |
| #configure , build and install | |
| env PKG_CONFIG_PATH=$PREFIX/lib/pkgconfig ./configure --prefix=$PREFIX --disable-libvpx | |
| env C_INCLUDE_PATH=$PREFIX/include make | |
| sudo make install config-vanilla | |
| #package | |
| cd ~/build-$FREESWITCH_RELEASE | |
| tar zcvf freeswitch-$FREESWITCH_RELEASE.tar.gz $PREFIX |
Hi, I'm kind of new of coding,
Is it available to build mod_h323 or mod_opal here. I added it to modules.conf.in and when make the error happen:
making all mod_h323
make[4]: Entering directory '/root/build-master/freeswitch/src/mod/endpoints/mod_h323'
CXX mod_h323_la-mod_h323.lo
In file included from mod_h323.cpp:40:
mod_h323.h:42:10: fatal error: ptlib.h: No such file or directory
42 | #include <ptlib.h>
| ^~~~~~~~~
As freeswitch document, ptlib is required for mod_h323, so what should I do now, install more or just comment that line/
Thanks in advanced
The loop needs to modified:
#remove modules from building
for module in "${REMOVED_MODULES[@]}"
do
sed -i "s/applications/mod_signalwire/#applications/mod_signalwire/g" build/modules.conf.in
done
#sed -i "s/databases/mod_pgsql/#databases/mod_pgsql/g" build/modules.conf.in
Should be something like this:
for module in "${REMOVED_MODULES[@]}"
do
sed -i "s|^${module}|#${module}|" build/modules.conf.in
done
and
REMOVED_MODULES=(
"applications/mod_signalwire"
"databases/mod_pgsql"
)
@mariogasparoni I figured this out some time ago, but I realized I never posed back to here. So here's what I found:
If your base OS uses OpenSSL3 (Ubuntu 22.04, RHEL9, etc) you need to use FS 1.10.10+
FS 1.10.9 and lower requires that you to use
git clone -bv1.8.3 https://github.com/signalwire/libks.git /usr/local/src/libksinstead ofgit clone https://github.com/signalwire/libks.git /usr/local/src/libksbecause they require libks v1 and the default branch is now v2.libflite1andflite-devare required if you want to build mod_fliteSo, my specific issue was that I was building 1.10.7, but not selecting a v1 branch for libks