Freeswitch Gentoo Installation

PBX Installation
Sergio Basurto J.
Autor
January 14, 2022
Creado
March 27, 2023
Última modificación

This manual will show how to install freeswitch PBX on gentoo, this steps includes some procedures that the reader must know prior the reading of this instructions.

First Steps

Cloning Repos

The very first steps to do are:

  1. Clone freeswitch main repository
  2. Clone freeswitch contrib repository (This step is optional, and must be used only if we need it)

The link must be the last one refered on official freeswitch page

To clone main repository do:

cd /usr/src/
git clone https://github.com/signalwire/freeswitch.git # development
git clone -b v1.10 https://github.com/signalwire/freeswitch.git # current stable

Once the main repo is cloned, now is time to clone contrib.

cd /usr/src/freeswitch
git clone https://github.com/freeswitch/freeswitch-contrib

Note
Also we must to be sure to get the official repo here

Emerging Dependencies

Now is time to emerge dependencies:

emerge -av sqlite speex media-libs/speexdsp ldns dev-libs/libedit opus libsndfile libshout media-libs/tiff yasm dev-libs/libvformat dev-libs/apr dev-libs/apr-util

Note
If you want to compile mod_av you must install ffmpeg.

Note
Optionaly you could install unix odbc for accessing database, I prefer postgresql in the core

echo "dev-db/unixODBC -minimal" >> /etc/portage/package.use/unixODBC
emerge -av unixODBC

After this we are almost ready to start installation of Freeswitch, just a couple of steps more.

Compiling Dependencies

LIBKS Installation

We must download libks from officia git site and clone into our /usr/src/ directory, after download is done we must compile it as follows:

cd /usr/src/
git clone https://github.com/signalwire/libks.git
cd libks/
cmake .
make
make install

Asure that pkgconfig file is okay.

ln -s /usr/lib/pkgconfig/libks.pc /usr/lib64/pkgconfig/libks.pc

SPANDSP Installation

We must download spandsp from freeswitch otherwise the version wont be 3.0 and clone into our /usr/src/ directory, after download is done we must compile it as follows:

cd /usr/src/
git clone https://github.com/freeswitch/spandsp
cd spandsp/
./bootstrap.sh
./configure
make && make install
ln -s /usr/local/lib/pkgconfig/spandsp.pc /usr/lib/pkgconfig/spandsp.pc
ln -s /usr/local/lib/pkgconfig/spandsp.pc /usr/lib64/pkgconfig/spandsp.pc

SOFIA-SIP Installation

We must download sofa-sip from official git site and clone into our /usr/src/ directory, after download is done we must compile it as follows:

cd /usr/src/
git clone https://github.com/freeswitch/sofia-sip.git
cd sofia-sip/
./bootstrap.sh
./configure
make && make install
ln -s /usr/local/lib/pkgconfig/sofia-sip-ua.pc /usr/lib64/pkgconfig/sofia-sip-ua.pc

SIGNALWIRE-C Installation

We must download signalwire-c from official git site and clone into our /usr/src/ directory, after download is done we must compile it as follows:

cd /usr/src/
git clone https://github.com/signalwire/signalwire-c.git
cd signalwire-c/
cmake .
make
make install
ln -s /usr/local/lib/pkgconfig/signalwire_client.pc /usr/lib64/pkgconfig/signalwire_client.pc

Flite Installation

We must download flite from official site to our /usr/src/ directory, after download is done we must compile it as follows:

cd /usr/src/
wget -c www.festvox.org/flite/packed/flite-2.0/flite-2.0.0-release.tar.bz2
tar -jxvf flite-2.0.0-release.tar.bz2
cd flite-2.0.0-release
./configure --with-pic --enable-shared
make && make install

Lua Installation

Also download Lua from official website to our /usr/src/ directory, before compile lua add -fPIC and -shared to file /usr/src/lua-5.2.4/src/Makefile in respective lines:

Tip
In Makefile on directory lua-5.4.3/src edit to achive following lines.
CFLAGS= -O2 -Wall -DLUA_COMPAT_ALL -fPIC $(SYSCFLAGS) $(MYCFLAGS)
LDFLAGS= -shared $(SYSLDFLAGS) $(MYLDFLAGS)

cd /usr/src/
wget -c https://www.lua.org/ftp/lua-5.4.3.tar.gz
tar -zxvf lua-5.4.3.tar.gz
cd lua-5.4.3
make linux  && make install

Luasql Installation

cd /usr/src/
git clone https://github.com/keplerproject/luasql.git
cd luasql/
make postgres && make install
cd /usr/local/lib/lua/5.4
ln -s /usr/local/lib/lua/5.2/luasql ./

Compiling Freeswitch

To compile freeswitch there is a lot of good documentation out there, I will detail some important steps to consider in Gentoo.

The first step is run bootstrap.

cd /usr/src/freeswitch
./bootstrap.sh

Once bootstrap is done, we must edit the file modules.conf to enable the modules we want to include in our installation. In my case some modules I enabled were:

  1. mod_curl
  2. mod_flite
  3. mod_xml_curl

Next we must run configure script with the options we want to enable, compile and install it.

Warning
If you are using gcc 11 you must do the following step before configure :

export CPPFLAGS="-Wno-array-parameter -Wno-error=deprecated-declarations -Wno-error=array-bounds"
cd /usr/src/freeswitch
./configure --enable-core-pgsql-support
make && make install
make cd-sounds-install && make cd-moh-install && make uhd-sounds-install && make uhd-moh-install && make hd-sounds-install && make hd-moh-install && make sounds-install && make moh-install

Danger
Before we start service we must change default passwords in two places, vars.xml and event_socket.conf.xml

In vars.xml change 1234 for a very strong password:

<X-PRE-PROCESS cmd="set" data="default_password=1234"/>

In event_socket.conf.xml do the same:

<param name="password" value="Cluecon"/>

And I think that is all.