Support #667
Updated by Daniel Curtis about 9 years ago
This is a guide for setting up FreeSWITCH with Nginx, PostgreSQL, and FusionPBX on FreeBSD 9. h2. Prepare the Environment * Make sure the system is up to date: <pre> pkg update && pkg upgrade && portsnap fetch extract </pre> * Install a few dependencies: <pre> pkg install portmaster screen sox cmake autoconf automake lua51 curl git gmake jpeg ldns libedit binutils freetype2 libtool openssl pcre pkgconf flex speex sqlite3 wget subversion postgresql94-client sofia-sip x264 libvpx opus ffmpeg pkg2ng </pre> h2. Install FreeSWITCH * Make a source directory: <pre> mkdir /usr/local/src </pre> *NOTE*: I could not build FreeSWITCH from ports, so this guide will compile from GitHub. * Clone the latest version of freeswitch: <pre> cd /usr/local/src git clone -b v1.6 https://freeswitch.org/stash/scm/fs/freeswitch.git </pre> * Disable mod_fsv: <pre> cd freeswitch sed -i '' -e 's/applications\/mod_fsv/#applications\/mod_fsv/' modules.conf </pre> * Build and install freeswitch: <pre> ./bootstrap.sh -j ./configure --enable-core-pgsql-support gmake gmake install cd-sounds-install cd-moh-install </pre> * Create the rc script: <pre> vi /usr/local/etc/rc.d/freeswitch </pre> #* And add the following <pre> #!/bin/sh # # PROVIDE: freeswitch # REQUIRE: LOGIN cleanvar # KEYWORD: shutdown # # Add the following lines to /etc/rc.conf to enable freeswitch: # freeswitch_enable: Set it to "YES" to enable freeswitch. # Default is "NO". # freeswitch_flags: Flags passed to freeswitch-script on startup. # Default is "". # . /etc/rc.subr name="freeswitch" rcvar=${name}_enable load_rc_config $name : ${freeswitch_enable="NO"} : ${freeswitch_pidfile="/usr/local/freeswitch/run/freeswitch.pid"} start_cmd=${name}_start stop_cmd=${name}_stop pidfile=${freeswitch_pidfile} freeswitch_start() { /usr/local/freeswitch/bin/freeswitch ${freeswitch_flags} echo -n "Starting FreeSWITCH: " } freeswitch_stop() { /usr/local/freeswitch/bin/freeswitch -stop } run_rc_command "$1" </pre> * Make the script executable: <pre> chmod +x /usr/local/etc/rc.d/freeswitch </pre> * Start and enable Enable freeswitch to start at boot: <pre> echo 'freeswitch_enable="YES"' >> /etc/rc.conf echo 'freeswitch_flags="-nc"' >> /etc/rc.conf service freeswitch start </pre> #* *NOTE*: If your Freeswitch server has a IP address and not behind a NAT router, add the @-nonat@ parameter to the freeswitch_flags. This will disable NAT traversal feature of FreeSWITCH. h2. Install FusionPBX * Install fusionpbx: <pre> portmaster www/fusionpbx </pre> #* *NOTE*: Make sure to enable *[X]PDOPGSQL* while configuring fuzionpbx. h2. Resources * http://wiki.fusionpbx.com/index.php?title=FreeBSD_Install * https://freeswitch.org/confluence/display/FREESWITCH/FreeBSD * https://code.google.com/p/libyuv/wiki/GettingStarted