How to Install FOP2 on MiRTA PBX

Installing FOP2 on MiRTA PBX ( http://www.mirtapbx.com )

Since version 2.30, FOP2 includes support for the multi tenant MiRTA PBX. As this system uses the Asterisk realtime backend in all aspects, there are some specific steps to integrate FOP2 with it. Also the multi tenancy aspect of the PBX might require some code tweaks on certain FOP2 components (like call history/cdr).

Here is a brief guide on installing FOP2 on this platform:

  • Download and Install FOP2 normally. MiRTA uses the Centos 64 bits platform. So you should run these commands:
  • cd /usr/src
    wget http://www.fop2.com/download/centos64 -O fop2.tgz
    tar zxvf fop2.tgz
    cd fop2
    make
        
  • Change ownership of files to ‘apache’ user:
  • chgrp apache /usr/local/fop2
    chown apache.apache /var/www/html/fop2
    chown apache.apache /var/www/html/fop2/* -R
    chgrp apache /usr/local/fop2/fop2settings.db
    
  • Add a new manager user into Asterisk by editing the file /etc/asterisk/manager.conf and adding at the end:
  • [fop2]
    secret = fop333
    deny = 0.0.0.0/0.0.0.0
    permit = 127.0.0.1/255.255.255.0
    read = all
    write = all
    writetimeout = 1000
    eventfilter=!Event: RTCP*
    eventfilter=!Event: VarSet
    eventfilter=!Event: Cdr
    eventfilter=!Event: DTMF
    eventfilter=!Event: AGIExec
    eventfilter=!Event: ExtensionStatus
    eventfilter=!Event: ChannelUpdate
    eventfilter=!Event: ChallengeSent
    eventfilter=!Event: SuccessfulAuth
    
  • Edit the fop2 configuration file located in /usr/local/fop2/fop2.cfg
    • set manager_user and manager_secret with the same user/secret you created on the previous step:
    • manager_user=fop2
      manager_secret=fop333
      
    • set odbc voicemail:
    • voicemail_path=dbi:ODBC:asterisk1!voicemail_messages
      
    • change agent login method:
    • use_agent_login=1
  • Edit the FOP2 Manager configuration file located in /var/www/html/fop2/admin/config.php
  • $DBHOST="localhost";
    $DBUSER="root";
    $DBPASS="passw0rd";
    $DBNAME=“asterisk";
    $ENGINE="mirtapbx";
    
  • In the same FOP2 Manager configuration file, change the admin user and password. We strongly suggest to use a different user/password combo than the one provided by default.
  • $ADMINUSER = "fop2admin";
    $ADMINPWD = "fop2admin";
    
  • Initialize de FOP2 Database by running this command:
  • php -f /var/www/html/fop2/admin/update_conf.php 1
    
  • Restart the Asterisk Manager with this command:
  • asterisk -rx "manager reload"
    
  • Log into the FOP2 Manager by pointing your browser to http://your.server/fop2/admin using the user/password you configured before. Once logged in, go to the Plugins tab and install the MiRTA plugin.
  • Once the plugin is installed, copy the ODBC compatibility helper into your MiRTA installation:
  • cp /var/www/html/fop2/admin/plugins/mirtapbx/fop2-odbc-mirta.conf /etc/asterisk/func_odbc.d/
    
  • From the FOP2 Manager, select a particular tenant, then go to the Users tab and select the "Recreate Users" options from the Action menu for that tenant.

If you are installing FOP2 on a standalone/separate server, you will need to setup unixODBC in order for the voicemail to work. Only do this if you install on a separate server, as MiRTA already installs and configures ODBC for you:

yum install unixODBC
yum install mysql-connector-odbc

Then you will have to set the /etc/odbc.ini file something like this, but using correct mysql data. You will have to create a special user in the MySQL server and grant full permissions to the asterisk database and select permissions to asteriskcdrdb:

[asterisk1]
Driver = MySQL
SERVER = 192.168.1.1
PORT = 3306
USER = fop2
Password = asdfasdf
Database = asterisk

[asteriskcdrdb1]
Driver = MySQL
SERVER = 192.168.1.1
PORT = 3306
USER = fop2
Password = asdfasdf
Database = asteriskcdrdb

On recent php versions, there is a bug with odbc functions, so we created a special file that bypasses php odbc driver and uses the mysql driver instead. You will have to replace that file in order to download/listen to voicemails, with these commands:

cd /var/www/html/fop2
rm downloadOdbc.php
wget http://download.fop2.com/downloadOdbc.mysql.php.txt
mv downloadOdbc.mysql.php.txt downloadOdbc.php

There is another file that needs modification in MiRTA (for call history to work):

cd /var/www/html/fop2
wget http://download.fop2.com/calldetailsrecordsmirta.php.txt
rm calldetailrecords.php
mv calldetailsrecordsmirta.php.txt calldetailrecords.php

 

If you installed the Call History plugin, you must also do a manual change in some files to support MiRTA db structure for CDR records:

cd /var/www/html/fop2/admin/plugins/callhistory
cp callhistorybsgridmirta.php callhistorybsgrid.php

The above will only work if you have the call history plugin installed... otherwise it is not needed.

This is the basics to get you started.


Did you find this article useful?