Installing FusionPBX on OpenWRT

This posting details how to install FusionPBX on an OpenWRT system. In particular it is a Seagate Dockstar but there is nothing needed that is specific to the device. The goal is to implement a full function Home PBX with a minimal footprint on your OpenWRT device.

We assume that you have set up your OpenWRT system with a USB drive of some sort, else you likely will not have space for all the files that we need to install. See my previous post on that topic.

config uhttpd fusionpbx

# config for FusionPBX on port 81

        # HTTP listen addresses, multiple allowed

        list listen_http

#       list listen_http        [::]:80

        # HTTPS listen addresses, multiple allowed

#       list listen_https

#       list listen_https       [::]:443

        # Server document root

        option 'home'           '/usr/share/fusionpbx'

        # Reject requests from RFC1918 IP addresses

        # directed to the servers public IP(s).

        # This is a DNS rebinding countermeasure.

        option rfc1918_filter 1

        # Certificate and private key for HTTPS.

        # If no listen_https addresses are given,

        # the key options are ignored.

        option cert             /etc/uhttpd.crt

        option key              /etc/uhttpd.key

        # CGI url prefix, will be searched in docroot.

        # Default is /cgi-bin

        # option cgi_prefix       /cgi-bin

        # List of extension->interpreter mappings.

        # Files with an associated interpreter can

        # be called outside of the CGI prefix and do

        # not need to be executable.

        list interpreter        ".php=/usr/bin/php-cgi"

#       list interpreter        ".cgi=/usr/bin/perl"

        # Lua url prefix and handler script.

        # Lua support is disabled if no prefix given.

        # option lua_prefix       /luci

        # option lua_handler      /usr/lib/lua/luci/sgi/uhttpd.lua

        # CGI/Lua timeout, if the called script does not

        # write data within the given amount of seconds,

        # the server will terminate the request with

        # 504 Gateway Timeout response.

        option script_timeout   60

        # Network timeout, if the current connection is

        # blocked for the specified amount of seconds,

        # the server will terminate the associated

        # request process.

        option network_timeout  30

        # TCP Keep-Alive, send periodic keep-alive probes

        # over established connections to detect dead peers.

        # The value is given in seconds to specify the

        # interval between subsequent probes.

        # Setting this to 0 will disable TCP keep-alive.

        option tcp_keepalive    1

        # Basic auth realm, defaults to local hostname

#       option realm    OpenWrt

        option  'index_page'    'index.php'

        option  'no_symlinks'   0

        option  'no_dirlists'   1

Install php5 and related modules:

opkg install php5 php5-fastcgi php5-mod-sqlite3 php5-mod-pdo-sqlite php5-mod-xml php5-mod-session php5-mod-iconv php5-mod-xmlreader php5-mod-xmlwriter php5-mod-simplexml php5-mod-dom php5-cli

ln –s /usr/bin/php-cli /usr/bin/php

Install FreeSwitch:

opkg install freeswitch-collection-minimal freeswitch-sounds-en freeswitch-sounds-moh freeswitch-mod-valet-parking freeswitch-mod-voicemail freeswitch-mod-say-en freeswitch-mod-xml-cdr freeswitch-mod-loopback freeswitch-mod-lua freeswitch-mod-cdr-csv freeswitch-mod-voicemail freeswitch-mod-logfile

Next we clean up the location of various files that FreeSwitch creates:

  1. ln -s /etc/freeswitch/ /usr/share/freeswitch/conf
  2. In /etc/default/freeswitch, replace /tmp/ with /usr/share/ in 2 places
  3. In /etc/default/freeswitch, replace /var/lib with /usr/share in 2 places
  4. In /etc/freeswitch/vars.xml around line 199 replace /var/lib with usr/share
  5. In /etc/freeswitch/autoload_configs/voicemail.conf.xml near line 57 replace /var/lib with /usr/share
  6. In /etc/freeswitch/autoload_configs/xml_cdr.conf.xml, add :81 to the http://localhost parameter on line 4

With your browser go to :81">http://<openwrt.IP.address>:81 to do the initial configuration of FusionPBX

  1. The database should default to sqlite
  2. FreeSwitch Directory should be set to /usr/share/freeswitch
  3. click to next screen and click Next
  4. Login as superadmin
  5. On Advanced tab, select System Settings, then edit the one Domain line that exists
  6. Set the Domain value to the ip address of your OpenWRT system and Save at bottom of screen

Start FreeSwitch, /etc/init.d/freeswitch start and configure it using FusionPBX!

Other Hints:

  1. If you can’t dial *nnnn numbers from your ATA attached phone, then you will have to change the Dial Plan in the ATA. For PAP2 and other Linksys/Cisco ATA’s this means replacing *xx| with *xxxx|
  2. Ensure that you set Domain on Advanced/System Settings. If it says ‘localhost’ then you need to change the setting. If you can’t see the # of voicemails you have left for an extension, this is the reason.
  3. One issue with using uHttpd is that it only accepts 1 connection at a time. Thus 2 users can’t access the FusionPBX GUI, only 1 can be logged in at a time. I will document use of Lighttpd soon.


12 Jun, 2011-added some more FreeSwitch modules that you will need

12 Jun, 2011 – submitted several defects to FusionPBX to correct some issues , 108, 107, 106, 105

15 Jun, 2011 Updated to reflect OpenWRT Freeswitch related fixes to include config files for modules

16 Jun, 2011 – Removed some unnecessary configuration changes

Comments are closed.