Integrate Flash Operator Panel v2 into FreePBX

Flash Operator PanelThis guide will explain how to replace Flash Operator Panel v1, which is included in FreePBX, with Flash Operator Panel v2 on a RedHat Enterprise Linux server running Asterisk+FreePBX.  It is important to note that FOP1 is completely free whereas FOP2 is free only up to 15 buttons.  Every element is considered a button.  So all extensions + trunks + queues + parking lots + etc. must add up to 15 or less.  After that no more buttons will appear until you buy a license.

A key advantage of FOP2 is that it requires an extension and password to view.  With FOP1 there is no built in way to prevent everyone from viewing the PBX status.

Command line text is in courier font.

 

For this procedure we assume you are using:

Redhat Enterprise Linux v5+ (or one of the free generic versions)
FreePBX v2.9+
Flash Operator Panel 2.20+

First install Linux+Asterisk+FreePBX
 

Download FOP2 to your Windows (or Linux?) desktop.  Transfer it over to /usr/src/ on your Linux+Asterisk+FreePBX server using a program such as WinSCP.  While we are at it we may as well download FOP2Admin at the same link as above.  This can remain on your desktop for now.

From a console on your FreePBX server (assuming i386 for the rest of this procedure):

cd /usr/src
tar zxvf fop2-2.20-centos5-i386.tgz
cd fop2
make install

This will copy the files to /usr/local/fop2 and the web pages to /var/www/html/fop2

 

FreePBX Integration

cd /usr/local/fop2
cat extensions_override_freepbx.conf >>/etc/asterisk/extensions_override_freepbx.conf

This appends the contents of the fop2 version to the existing contents in the asterisk version of this file.  In many cases the asterisk version will be empty but we do it this way just in case it's not.

CREATE NEW MANAGER API
Using the default [admin] api seems to cause fop2 to stop responding on occasion so we must create a new one.  First install the Asterisk API module in FreePBX.  Go into Asterisk API menu and create a new API.  Give it a manager name, manager secret,   Select ALL read/write rights.

For Deny use: 0.0.0.0/0.0.0.0
For Permit use: 127.0.0.1/255.255.255.0

Compare /usr/local/fop2/fop2.cfg

[general] 
; AMI definitions
manager_host = 127.0.0.1
manager_port = 5038
manager_user = admin
manager_secret = amp111

With /etc/asterisk/manager_additional.conf
This is the new manager api we created above via the Asterisk API FreePBX module.  In this case we gave it a manager name of fop2 and a manager secret of fop2secret.

 

 

[fop2]

 

 

secret = fop2secret
deny=0.0.0.0/0.0.0.0
permit=127.0.0.1/255.255.255.0
read = system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate
write = system,call,log,verbose,command,agent,user,config,dtmf,reporting,cdr,dialplan,originate
 

If required, change the value of manager_user=fop2 in the first file to match [fop2] in the second file and change manager_secret=fop2secret  to match secret=fop2secret.  Note: You can use whatever names you want for manager_user and manager_secret when creating the new manager API using the Asterisk API FreePBX module.  We are providing names to use as an example. Whatever names you use,  make sure they match in both of the files.

REPLACING FOP1 LINKS WITH FOP2

Add the following line to the end of your /etc/httpd/conf/httpd.conf file:
alias /panel/ "/var/www/html/fop2/"

Copy the FOP2 index.html file to index_amp.php which FreePBX expects to find.
cp /var/www/html/fop2/index.html /var/www/html/fop2/index_amp.php

Change ownership
chown -R asterisk.asterisk /var/www/html/fop2

Now reload apache in order for the changes to take effect.
service httpd restart

CALL EVENTS

Call events send hold/unhold events to FOP2.  From the FreePBX GUI install the Asterisk SIP Settings module   (Tools>Module Admin>).
 
After installing the module go to the Asterisk SIP settings menu (Tools>Asterisk SIP Settings).
At the bottom set Call Events = Yes

Alternatively if you don't want to install the Asterisk SIP settings module you can add callevents=yes to /etc/asterisk/sip_general_custom.conf.

QUEUES

If you plan to ever use the Queue module now would be the time to install it (Tools>Module Admin).
After installing the module go to the Queue menu (Setup>Queues).
At the bottom set Event when Called to Yes.

You will have to choose a queue number and name at the very top as well.  123 for example.

TEST MANAGER CONNECTION

/usr/local/fop2/fop2_server --test

You should see "Connection to manager OK!"  If you did not set queue as above you will get an error regarding that which is ok as long as you don't plan to use queues.

CHANGE FOP1 PORT #

FOP v1 is included with FreePBX.  Before starting FOP2 we need to change the port # of FOP1 to something other than port 4445.  This is because FOP2 also uses 4445 by default.

nano /var/www/html/panel/op_server.cfg
listen_port=4444

(Ctl-x>y>ENTER)

Alternatively you can prevent FOP1 from starting.  This would normally be preferrable however it causes a constant "WARNING" indicator on the FreePBX dashboard.  Therefore it is not the recommended approach.  If however you prefer to do it this way, in FreePBX v2.9 we do this using the new Advanced Settings Menu (Tools>Advanced Settings).
Find the Flash Operator Panel Section and set Start FOP with amportal to FALSE.

amportal restart

Make sure you restart amportal or reboot to ensure FOP1 is running on the new port. 

ENABLE FOP2 on BOOT and START

chkconfig fop2 on
service fop2 start

Now see if you see the FOP2 login come up when you click on Flash Operator Panel (FOP) on the front page of your FreePBX GUI and on the Panel Tab in the Administrator section of your FreePBX GUI.  NOTE: in FOP2 the username is your extension number and the password is your extension voicemail password.

FOP2ADMIN

If you want to customize FOP2 there is an administrators module available for FreePBX.  Download fop2admin module from here

In FreePBX go to Tools>Module Admin and select Upload Module.  You can select the downloaded module on your desktop from there and install.

NOTE:  Once you install this module you will not be able to log into FOP2 until you assign extensions/passwords/permissions using the FOP2ADMIN FOP Users GUI

SERVER STATUS PATCH

On the FreePBX dashboard (FreePBX System Status) there is a server status on the bottom right that will show Op Panel > Warn in yellow if you stopped FOP1.  If you did not stop it then it is showing the status of FOP1 not FOP2.  In order to correct this we need to patch FreePBX.  NOTE1: future updates to FreePBX may reverse this patch which would require this procedure to be repeated. NOTE2: This fix only works with FOP1 configured to start with FreePBX.  This is because FreePBX first checks if FOP1 is configured to start before checking the listen port.

This patch assumes we have FOP2 set to the default listen port 4445.

First create the patch file:
nano /usr/src/fop2patch.diff

Copy/paste the following into the newly created file:

--- class.procinfo.php  2011-01-06 12:54:05.000000000 -0500
+++ class.procinfo.php.new      2011-01-06 12:47:55.000000000 -0500
@@ -24,6 +24,7 @@
     } else {
       $listen_port = 4445;
     }
+     $listen_port = 4445;
 
                return $this->check_port($listen_port);
        }

Save it:
CTL-x>y>ENTER

Change to the module directory:
cd /var/www/html/admin/modules/dashboard

Apply the patch:
patch < /usr/src/fop2patch.diff

Once again, this patch only works if FOP1 is configured to start with FreePBX as explained further up in this document.  If FOP1 is configured to not start, FreePBX automatically assumes FOP1 is not running, will not run our patch to listen to FOP2 on port 4445, and will always show a warning on the dashboard.

Sections: