Easy FusionPBX

=Supported Distributions=

Lenny

 * Select the Base Install option [on the debian install iso]. All other packages will be added.
 * When you get a warning about it not being Lucid, go ahead and continue.
 * nginx and php5-fpm options do not work (since the script uses ppa's). Select Apache instead.
 * Dahdi isn't included in the official repositories.

Squeeze

 * Webserver: apache/nginx
 * Databases: sqlite/MySQL/postgres9
 * Postgres 8 probably works fine Please confirm
 * thank you cbillen for testing

Get it here: http://www.debian.org/distrib/netinst
 * Select the Base Install option [on the debian install iso]. All other packages will be added.

10.04 LTS Lucid
Get it here: http://www.ubuntu.com/server/get-ubuntu/download When you install ubuntu, you should select the "Manual package selection" option. This way we can keep the install to the bare minimum. Just quit tasksel during the install.
 * Webserver: apache/nginx
 * Databases: sqlite/MySQL/postgres9/postgres8
 * Fully Functional
 * Select Ubuntu 10.04 LTS Long Term Support
 * Choose 32 bit or 64 bit depending on your hardware

12.04 LTS Precise
Get it here: http://www.ubuntu.com/download/server Currently testing. Please try it and let us know if anything is broken.
 * Webserver
 * nginx works
 * apache works
 * Databases
 * sqlite works with apache, nginx untested
 * mysql db create error (with apache), nginx untested.
 * postgres 8: Not available [or recommended]
 * postgres 9: works with apache, nginx untested
 * Switching Webservers
 * Apache->Nginx: works
 * Nginx->Apache: untested

= Get the latest install script =

Project
migrated to fusionpbx googlecode svn (2011-11-10)
 * http://fusionpbx.googlecode.com/svn/trunk/scripts/install/ubuntu/install_fusionpbx.sh

If you use this script, it may error out, unable to git the project. If so, change the following:

FSGIT=git://git.freeswitch.org/freeswitch.git
 * 1) staying with default repository, feel free to change this to github. Some report faster downloads.
 * 1) FSGIT=git://github.com/FreeSWITCH/FreeSWITCH.git

To: FSGIT=http://git.freeswitch.org/freeswitch.git
 * 1) staying with default repository, feel free to change this to github. Some report faster downloads.
 * 1) FSGIT=http://github.com/FreeSWITCH/FreeSWITCH.git

via subversion
to install the script with subversion (preferred) sudo apt-get install subversion sudo svn checkout https://fusionpbx.googlecode.com/svn/trunk/scripts/install/ubuntu/ /usr/src/install_fusionpbx sudo chmod 755 /usr/src/install_fusionpbx/install_fusionpbx.sh sudo ln -s /usr/src/install_fusionpbx/install_fusionpbx.sh /usr/local/bin/

with wget
To download with wget: sudo wget -O /usr/local/bin/install_fusionpbx.sh http://fusionpbx.googlecode.com/svn/trunk/scripts/install/ubuntu/install_fusionpbx.sh /usr/local/bin/install_fusionpbx.sh sudo chmod 755 /usr/local/bin/install_fusionpbx.sh

Run Script
sudo /usr/local/bin/install_fusionpbx.sh Better way to run: sudo /usr/local/bin/install_fusionpbx.sh install-both user |tee /tmp/install_fusion.log

Features

 * FreeSWITCH
 * It installs all necessary dependencies.
 * It grabs the latest FreeSWITCH git and compile it, including dealing with a mod_dingaling issue.
 * It sets permissions properly for FreeSWITCH.
 * Sets up Fail2Ban (for FreeSWITCH)
 * Sets up LogRotate (for FreeSWITCH)
 * Checks for public IP address, optionally starts FreeSWITCH with -nonat for faster startup


 * FusionPBX (optional)
 * It sets permissions properly FusionPBX to edit FreeSWITCH config files. FreeSWITCH is now running as www-data starting with v4.3.3
 * Grabs the latest FusionPBX from SVN and dependencies (php5-cli, php5-sqlite, sqlite)
 * OPTION: Installs and configures: apache2 with mod-php5 OR nginx with php5-fpm.
 * OPTION: Install MySQL for the FusionPBX database (instead of default sqlite).
 * OPTION: PostgreSQL 8 (or 9) beginning with v4.3.3
 * If using odbc for voicemail, FusionPBX requires php5-odbc!

Everything should automatically configured!

=License=

-- "THE WAF LICENSE" (version 1) This is the Wife Acceptance Factor (WAF) License. jamesdotfsatstubbornrosesd0tcom wrote this file. As long as you retain this notice you can do whatever you want with it. If you appreciate the work, please consider purchasing something from my wife's wishlist. That pays bigger dividends to this coder than anything else I can think of ;). It also  keeps her happy while she's being ignored; so I can work on this stuff.    James Rose  latest wishlist: http://www.stubbornroses.com/waf.html  Credit: Based off of the BEER-WARE LICENSE (REVISION 42) by Poul-Henning Kamp -- Under no conditions, should a donation be considered to my loving wife until you've first donated to FusionPBX, and FreeSWITCH (so requests soapee01) =Options=

Command Line Options
This script should be called as: install_fusionpbx option1 option2

option1: install-freeswitch install-fusionpbx install-both upgrade-freeswitch upgrade-fusionpbx fix-https fix-permissions version|--version|-v

option2: user: option waits in certain places for the user to check for errors it is interactive and prompts you about what to install"     auto: tries an automatic install. Get a cup of coffee, this will        take a while. FOR THE BRAVE!

EXAMPLE install_fusionpbx install-both user

Script Variables
These are included to make the auto mode more flexible. Open the script and set them however you wish.


 * for apache set to a, for nginx/php-fpm set to n -> for an auto install, user mode will prompt
 * APACHENGINX=n


 * for mysql set m. for sqlite set s. for postgresql set p
 * SQLITEMYSQL=s


 * for postgresql v 9.0 (from ppa) set to 9, otherwise stick with 8
 * must set SQLITEMYSQL to p
 * POSTGRES9=8


 * to start FreeSWITCH with -nonat option set SETNONAT to y
 * SETNONAT=n


 * rm -Rf /opt? A default install doesn't have /opt so no worries
 * if you do, set to no, and it will link /usr/local/freeswitch to /opt/freeswitch
 * RMOPT=y


 * below is a list of modules we want to add to provide functionality for FusionPBX don't worry about the applications/mod_ format. This script will find that in modules.conf
 * PAY ATTENTION TO THE SPACES POST AND PRE PARENTHESIS
 * modules_add=( mod_dingaling mod_portaudio mod_callcenter mod_lcr mod_cidlookup mod_directory mod_flite mod_pocketsphinx mod_xml_rpc mod_xml_cdr mod_xml_curl mod_say_es )

=Notes=

=Errata=

Nginx
4/16/2012

Latest PPA versions of nginx have changed the default configuration, so that when you upgrade it won't work. An example would be post installation of the current iso.

Open this file: vim /etc/nginx/fastcgi_params comment out (with #): fastcgi_param HTTPS $https; restart nginx /etc/init.d/nginx restart

Bison
install bison first (new FS dependency) Fixed

Apache Config
Bug reported about setting the Document root path in the apache configuration. Variable substitution wasn't working. In /etc/apache2/sites-enabled/fusionpbx change the root directory to /var/www/fusionpbx and it should be fine. Fixed

Logrotate
The logrotate script doesn't necessarily work as advertised. The cause is due to the way FS handles the sighup. When received, FS will automatically mv /usr/local/freeswitch/log/freeswitch.log to /usr/local/freeswitch/log/freeswitch.log.`date "+%whatever" In some rare instances, logrotate can cause FS to crash when it tries to write/mv to a file that has already been handled by logrotate. Solution is here Changed

Call Detail Records (CDRs)
If your CDRs do not work and you see something like: 18:46:11.070791 [ERR] mod_xml_cdr.c:384 Unable to post to web server, writing to file The issue here is in /usr/local/freeswitch/conf/autoload_configs/xml_cdr.conf.xml

You'll see:  Change it to:  This is due to the nginx https redirect for the public IP. There's an exception in the config file for localhost.

This issue also affects outbound CID when using an Asterisk gateway.
 * install.php needs to tweak for this...

Permissions
Permissions aren't perfect (sorry), there's a script bug. Fixed Setting group ID sticky for FreeSWITCH /usr/bin/find: `freeswitch': No such file or directory The script has had: /usr/bin/find freeswitch -type d -exec /bin/chmod u=rwx,g=srx,o= {} \; This needs to be is: /usr/bin/find /usr/local/freeswitch -type d -exec /bin/chmod u=rwx,g=srx,o= {} \;
 * run 'install_fusionpbx fix-permissions'

NGinx Log Files
Nginx logs for FusionPBX are stored in a non-standard location. See: Fixed /var/log/fusionpbx_gui.access_log /var/log/fusionpbx_gui.error_log

= Bugs and Getting Help = soapee01 on #fusionpbx (freenode) wrote this script. For help, go there. Bugs and feature requests can be handled on the sourceforge project page:

PortAudio
Have fun with your sound card. Make sure the modules are loaded lsmod |grep snd lspci It's already compiled (script and iso), but alsa is not present. apt-get install alsa alsa-utils alsa-tools You'll need to add your users to the audio group. adduser www-data audio Run alsamixer and unmute the channgels (with M) and crank the volume all the way up. alsamixer Reboot is now required (/etc/init.d/alsa might work, didn't for me) Check that the soundcard is there. cat /proc/asound/cards Try playing a file from the CLI aplay /usr/local/freeswitch/sounds/music/8000/suite-espanola-op-47-leyenda.wav It should be working. reference with nice alsamixer pics

Enable the module in FusionPBX
 * System->Modules->PortAudio
 * Enable it
 * Start it

Example Port Audio Commands

Tested with VMWare Player 2011/02/27

=Certificates= Information on importing the self signed certificates can be found here Self-Signed CA

= Wishlist = # Disable viewing .htaccess & .htpassword & .db       location ~ .htaccess { deny all; }       location ~ .htpassword { deny all; } TFTP_USERNAME="www-data" TFTP_DIRECTORY="/var/lib/tftpboot" TFTP_ADDRESS="0.0.0.0:69" TFTP_OPTIONS="--secure"
 * Option to download FreeSWITCH compiled source as tar.gz for iso
 * Option --fix-permissions
 * Needs to check FreeSWITCH init script
 * upgrade-fusionpbx needs to fix permissions, since a FS upgrade kills them.
 * Logrotate for nginx
 * Fail2ban for FusionPBX failed login attempts
 * Need information on attempts/rate/etc
 * Change Fail2ban on FreeSWITCH with attempts/rate/etc in config file (not default settings)
 * Change or have option to download GIT from GitHub repository (It's faster)
 * git://github.com/FreeSWITCH/FreeSWITCH.git
 * Make nginx /apache https by default
 * iso needs to regenerate certificates post install, ideally with 10 year expirations.
 * fix nginx config to not block html files... Don't block ~ .ht
 * Install TFTPD, change permissions to www-data.
 * /var/lib/tftpboot is root dir.
 * /etc/default/tftpd-hpa is config file
 * Install NTPD
 * Package in repository is just 'ntp'