How To: FreeSwitch Installation and Configuration on Linux

FreeSwitch is a high-performance VoIP/SIP PBX/Switch software package.

FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat driven products scaling from a soft-phone up to a soft-switch.

Installing FreeSwitch Dependencies

Things like ODBC and a few other packages are necessary.

apt-get install libedit-dev libldns-dev libmp4v2-dev libncurses5-dev libmemcached-dev libpcre3-dev libspeex-dev libspeexdsp-dev libsqlite3-dev libvlc-dev
emerge -pv dev-db/unixODBC media-libs/tiff media-libs/alsa-lib net-misc/curl net-misc/memcached dev-lang/erlang

Upgrade OpenSSL On Ubuntu Lucid

On Ubuntu Lucid (and others) you much manually install an updated OpenSSL

wget http://www.openssl.org/source/openssl-1.0.1f.tar.gz
cd openssl-1.0.1f
./config shared --prefix=/opt/openssl-1.0.1f
make && make install

On Gentoo Check your USE flags against these.

dev-db/unixODBC-2.2.12  USE="-gnome -qt3" 0 kB
media-libs/tiff-3.8.2-r8  USE="jpeg zlib -jbig -nocxx" 0 kB
media-libs/alsa-lib-1.0.20-r1  USE="python -alisp -debug -doc" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" 777 kB
net-misc/curl-7.19.6  USE="ipv6 ldap ssl -ares -gnutls -idn -kerberos -libssh2 -nss -test" 2,293 kB
dev-lang/erlang-12.2.5-r1  USE="ssl -doc -emacs -hipe -java -kpoll -odbc -sctp -smp -tk" 46,358 kB
app-admin/eselect-emacs-1.10  0 kB
net-misc/memcached-1.4.1  USE="-debug -slabs-reassign -test" 271 kB
net-libs/opal-3.10.10 USE="audio -capi -celt -debug -doc dtmf -examples -fax -ffmpeg -h224 -h281 -h323 -iax -ilbc ipv6 -ivr -ixj -java -ldap -lid plugins -sbc -sip -sipim -srtp ssl -static-libs -stats -swig theora video -vpb -vxml -wav -x264 -x264-static -xml"

Installing FreeSwitch from Git

Quite easy, clone the Git repo, bootstrap, adjust modules, ./configure and make.

Start by checking out the trunk and running the bootstrap.

git clone git://git.freeswitch.org/freeswitch.git /usr/src/freeswitch
cd /usr/src/freeswitch

Edit modules.conf for your desired environent, for example

sed -i 's/^.*applications\/mod_avmd.*$/applications\/mod_avmd/' modules.conf
sed -i 's/^.*applications\/mod_cluechoo.*$/applications\/mod_cluechoo/' modules.conf
sed -i 's/^.*applications\/mod_curl.*$/applications\/mod_curl/' modules.conf
sed -i 's/^.*applications\/mod_distributor.*$/applications\/mod_distributor/' modules.conf
sed -i 's/^.*applications\/mod_spy.*$/applications\/mod_spy/' modules.conf
sed -i 's/^.*applications\/mod_memcache.*$/applications\/mod_memcache/' modules.conf
sed -i 's/^.*dialplans\/mod_dialplan_asterisk.*$/#dialplans\/mod_dialplan_asterisk/' modules.conf
sed -i 's/^.*say\/mod_say_ru.*$/#say\/mod_say_ru/' modules.conf

Now ./configure freeswitch, run ./configure --help for more information about the options and adjust as necessary, the following is only an example

root@ar # ./configure \
  --prefix=/opt/freeswitch \
  --without-erlang \
  --without-java \
  --without-python \

Append this if using Ubuntu with older OpenSSL

CFLAGS="-I/opt/openssl-1.0.1f/include" LDFLAGS="-L/opt/openssl-1.0.1f/lib"

Then make and check for errors and other possible issues. Follow with make install when all is well

root@host # make
[ snip ]
Compiling mod_xml_rpc.c...
mkdir .libs
Compiling mod_xml_rpc.c ...
Creating mod_xml_rpc.so...
Making all in build
 +-------- FreeSWITCH Build Complete -----------+
 + FreeSWITCH has been successfully built.      +
 + Install by running:                          +
 +                                              +
 +               make install                   +
root@host # make install

Configure and Start FreeSwitch

FreeSwitch is now installed into /opt/freeswitch, go there create a default extension and SIP profile.

root@host # cd /opt/freeswitch
root@host # nano conf/sip_profiles/external/[provider].xml
root@host # nano conf/dialplan/default.xml

Creating a Test SIP Extension

This creates a default extensions that all inbound calls will route to. Add this in conf/dialplan/default.xml.

    <!-- Initial Entry for Inbound Calls -->
    <extension name="init">
        <action application="log" data="NOTICE dialplan/default.xml@64" />
        <action application="info" />
        <action application="answer" />
        <action application="record_session" data="/tmp/call-record.wav"/>

FreeSWITCH & ESL phpmod

On these system one update needs to happen to the ESL make file so it's going to process correctly. Use of -Werror will cause the build to fail. Patch the libs/esl/Makefile as follows.

--- Makefile	2010-12-10 19:00:21.000000000 +0000
+++ Makefile.e	2010-12-10 21:00:05.000000000 +0000
@@ -3,9 +3,9 @@
 DEBUG=-g -ggdb
-PICKY=-O2 -ffast-math -Wall -Werror -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
+PICKY=-O2 -ffast-math -Wall -Wunused-variable -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-CXXFLAGS=$(BASE_FLAGS) -Wall -Werror -Wno-unused-variable
+CXXFLAGS=$(BASE_FLAGS) -Wall -Wno-unused-variable
 LIBS=-lncurses -lpthread -lesl -lm

That is, remove -Werror from PICKY and CXXFLAGS. Then make phpmod-install will complete.

Debian/Ubunut and apt Based Systems §

~ # apt-get install gawk
~ # update-alternatives --set awk /usr/bin/gawk
~ # apt-get install autoconf build-essential git libtool make
~ # apt-get install libssl-dev libasound2-dev libogg-dev libvorbis-dev
~ # cd /usr/src
. # git clone git://git.freeswitch.org/freeswitch.git /usr/src/freeswitch
. # cd freeswitch
. # ./bootstrap.sh
. # ./configure ...
. # make
. # make install

See Debian Bug 628247 for more information on gawk vs mawk (gawk is better).

See Also

History / Changelog

  • 2014-02-06 - Notes on ptlib, opal

Loading Comments from Disqus...