[This is a work in progress article. There can be changes or additions to this article in the near future.]
Freeswitch port on Freebsd is at 1.0.6 while the current version of Freeswitch is on 1.3.x . The devel port for Freeswitch does not compile on FreeBSD 9.1 at the moment. Instructions at Freeswitch site does not work cleanly for the current version of FreeBSD (9.1). It requires tweaking in the script/code to get it working correctly. Also, make sure that you have “source” selected while installing FreeBSD, otherwise DAHDI kernel module with fail to build.
First step is to install all the required dependencies using ports. FreeBSD 9.1 does not have pre-built packages because of the security breach found during the end quarter of 2012.
# portsnap fetch extract
# mkdir -p /usr/ports/packages/All
The reason I have created a packages/All directory is because I like to keep all the packages pre-built with me to save time on subsequent installations. Most of the ports can be left to their default configurations. One port that needs extra settings is Perl. In the config dialog box for perl, make sure to select multithreading and mulitplicity if you need mod_perl module enabled in Freeswitch.
# cd /usr/ports/lang/perl5.14
# make config
# make config-recursive
# make package-recursive clean
Install all the other ports in batch mode. If you are not interested in making packages, you can instead use
make all install clean
instead in the above command as well as all the commands that follow. I also needed access to Postgresql database from Freeswitch/mod_perl, for which certain modules are required to be installed. These are optional if you do not need mod_perl and/or Postgresql connectivity.
# cd /usr/ports/databases/postgresql92-client; make -DBATCH package-recursive clean
cd /usr/ports/databases/unixODBC; make -DBATCH package-recursive clean
# cd /usr/ports/databases/p5-DBI; make -DBATCH package-recursive clean
# cd /usr/ports/databases/p5-DBD-Pg; make -DBATCH package-recursive clean
# cd /usr/ports/net/p5-URI; make -DBATCH package-recursive clean
The dependency list is mentioned on the Freeswitch website:
# cd /usr/ports/devel/autoconf; make -DBATCH package-recursive clean
# cd /usr/ports/lang/gcc34; make -DBATCH package-recursive clean
# cd /usr/ports/devel/automake; make -DBATCH package-recursive clean
# cd /usr/ports/devel/git; make -DBATCH package-recursive clean
# cd /usr/ports/devel/libtool; make -DBATCH package-recursive clean
# cd /usr/ports/devel/ncurses; make -DBATCH package-recursive clean
# cd /usr/ports/ftp/wget; make -DBATCH package-recursive clean
# cd /usr/ports/devel/pkgconf; make -DBATCH package-recursive clean
# cd /usr/ports/graphics/tiff; make -DBATCH package-recursive clean
Install libpri and dahdi-kmod (installs dahdi as dependency). If you are making packages, you need to modify the Makefile for dahdi-kmod26 located in /usr/ports/misc/dahdi-kmod26. Comment out line number 47 which says “NO_PACKAGE= Should be in sync with the kernel to work correctly”
# cd /usr/ports/misc/libpri; make -DBATCH package-recursive clean
# cd /usr/ports/misc/dahdi-dmod26; make -DBATCH package-recursive clean
# echo 'dahdi_enable="YES"' >> /etc/rc.conf
# echo 'dahdi_module="{MODULE_NAME}"' >> /etc/rc.conf
Replace the module name with the appropriate module for your card. For a list of modules, see this page. At the moment, support is only available for Digium cards on FreeBSD. If anybody knows how to configure Sangoma or other cards, I would love to hear about it.
Download Freeswitch from git repository:
# cd /usr/src
# /usr/local/bin/git clone git://git.freeswitch.org/freeswitch.git freeswitch-upstream
# cd freeswitch-upstream
# ./bootstrap.sh
Once the bootstrap process completes, move into spandsp directory.
# cd libs/spandsp
Edit the spandsp configure file and comment out the following code
for ac_header in tgmath.h
do :
ac_fn_c_check_header_mongrel "$LINENO" "tgmath.h" "ac_cv_header_tgmath_h" "$ac_includes_default"
if test "x$ac_cv_header_tgmath_h" = xyes; then :
cat >>confdefs.h < <_ACEOF
#define HAVE_TGMATH_H 1
_ACEOF
INSERT_TGMATH_HEADER="#include "
fi
done
Once you are done with the changes, configure and install spandsp module. Also, freetdm needs to be configured with libpri enabled. Make sure that you use gmake as bsd make would not work for compiling spandsp and freeswtich
# setenv LDFLAGS -L/usr/local/lib
# setenv CPPFLAGS -I/usr/local/include
# ./configure; gmake install; cd ..
# cd freetdm; ./configure --with-libpri --prefix=/usr/local/freeswitch; gmake
# ./configure; gmake install samples sounds-install moh-install hd-sounds-install hd-moh-install
spandsp libs will be installed in /usr/local/libs while freeswitch and freetdm would be installed in /usr/local/freeswitch and /usr/local/freetdm respectively.
References:
(1) Freeswitch installation Guide
(2) FreeBSD Forums