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.

emerge -pv dev-db/unixODBC media-libs/tiff media-libs/alsa-lib net-misc/curl net-misc/memcached dev-lang/erlang

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] media-sound/alsa-headers-1.0.20  2,833 kB
[ebuild  NS   ] sys-devel/autoconf-2.13 [2.63-r1] 434 kB
[ebuild  N    ] dev-libs/libevent-1.4.12  488 kB
[ebuild  N    ] media-libs/audiofile-0.2.6-r4  371 kB
[ebuild  N    ] app-admin/eselect-ctags-1.10  8 kB
[ebuild   R   ] dev-db/unixODBC-2.2.12  USE="-gnome -qt3" 0 kB
[ebuild   R   ] media-libs/tiff-3.8.2-r8  USE="jpeg zlib -jbig -nocxx" 0 kB
[ebuild  N    ] 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
[ebuild   R   ] net-misc/curl-7.19.6  USE="ipv6 ldap ssl -ares -gnutls -idn -kerberos -libssh2 -nss -test" 2,293 kB
[ebuild  N    ] dev-lang/erlang-12.2.5-r1  USE="ssl -doc -emacs -hipe -java -kpoll -odbc -sctp -smp -tk" 46,358 kB
[ebuild  N    ] app-admin/eselect-emacs-1.10  0 kB
[ebuild  N    ] net-misc/memcached-1.4.1  USE="-debug -slabs-reassign -test" 271 kB
[ebuild  N    ] app-editors/xemacs-21.4.22-r1  USE="berkdb gdbm gpm ldap -X -Xaw3d -athena -canna -dnd -eolconv -esd -freewnn -gif -jpeg -motif -mule -nas -neXt -png -pop -postgres -tiff -xface -xim" 8,201 kB
[ebuild  N    ] app-xemacs/xemacs-base-2.10-r1  526 kB
[ebuild  N    ] app-xemacs/emerge-1.11  60 kB

Total: 15 packages (11 new, 1 in new slot, 3 reinstalls), Size of downloads: 62,616 kB

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
./bootstrap.sh

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

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">
    <condition>
        <action application="log" data="NOTICE dialplan/default.xml@64" />
        <action application="info" />
        <action application="answer" />
        <action application="record_session" data="/tmp/call-record.wav"/>
    </condition>
    </extension>

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 @@
 LIBEDIT_DIR=../../libs/libedit
 DEBUG=-g -ggdb
 BASE_FLAGS=$(INCS) -DHAVE_EDITLINE $(DEBUG) -I$(LIBEDIT_DIR)/src/ -fPIC
-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
 CFLAGS=$(BASE_FLAGS) $(PICKY)
-CXXFLAGS=$(BASE_FLAGS) -Wall -Werror -Wno-unused-variable
+CXXFLAGS=$(BASE_FLAGS) -Wall -Wno-unused-variable
 MYLIB=libesl.a
 LIBS=-lncurses -lpthread -lesl -lm
 LDFLAGS=-L.

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