How to install FOP2 on a standalone (separate) server than Asterisk

Installing FOP2 on a separate server


FOP2 is a networked application. As such it can be installed on the same server where Asterisk resides, or it could be installed on a standalone/separate server. This guide will show you how to do the later, using the following fictional IP addresses for the example:

Asterisk Server: 192.168.10.1
FOP2 Server: 192.168.10.10

When installing on a remote server, there are some complications/gotchas to take into consideration, please read them before embarking into this journey:

Voicemail Explorer: If you use voicemail explorer in a default file based configuration, then the feature won't work because voicemail files will be stored on the Asterisk server hard drive, and not the local drive where FOP2 is installed. The solution would be to mount /var/spool/asterisk/voicemail via NFS or similar, or better yet, use ODBC for voicemail storage in Asterisk and configure it appropriately using unixODBC on the FOP2 server and specifying the correct voicemail_path directive in /usr/local/fop2/fop2.cfg

Recordings: The same as voicemail, if you use the recordings interface, then you won't be able to access recordings (to listen/download) as they will be remote to the FOP2 server itself. Again, this can be fixed if you mount the appropriate directories via NFS or similar.

Requirements

FOP2 requires a Linux server with Apache / PHP and MySQL installed (commonly known as LAMP). We recommend to use a CentOS based operating system. Version 6.x works pretty well.

Centos version 7 also works but you might need to install some packages that might not be installed by default, like net-tools, and openssl compat libraries:
yum install net-tools
yum install openssl098e

Installation

Proceed with the installation as described in the online documentation: just download the correct .tar.gz file, extract it, change to the extraction directory and run "make"

Configuration on the Asterisk Server

Once installed, you will need to perform some configuration on the Asterisk server itself. First of all, you need to create a user in /etc/asterisk/manager_custom.conf (or manager.conf on vanilla asterisk installs) and be sure to permit access from the FOP2 server IP address. As the FOP2 server IP address in this example guide is 192.168.10.10, then a user should look like this:
[fop2]
secret = fop222
deny = 0.0.0.0/0.0.0.0
permit = 127.0.0.1/255.255.255.0
permit = 192.168.10.10/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
Once the user is created, reload the Asterisk manager for the new configuration to take effect:

asterisk -rx "manager reload"

You must also be sure that there are no firewall rules blocking access to port tcp/5038. If you have them, then you must add an exception or an allow rule in order to permit access to tcp/5038 from the IP address of the FOP2 server.

After taking care of the Asterisk Manager part you must work on allowing remote access to MySQL for auto configuration (and the FOP2 Manager) to work. In order to do so, you just need to create a special user and grant access, with a command similar to this (you will need to specify the correct IP address of your FOP2 server, you must also know your MySQL root password):

mysql -u root -p -e "GRANT all ON asterisk.* TO fop2@192.168.10.10 identified by 'fop2remotepassword'"
 
Once that access is granted, you are done configuring on the Asterisk server and now can focus on the FOP2 server configs.


Configuration on the FOP2 Server

Once FOP2 is installed, you need to configure a few bits in order to connect to the remote Asterisk server to gather config and status. First of all, edit the /usr/local/fop2/fop2.cfg file and point the manager_host to the Asterisk IP address, and set the correct manager_user and manager_secret. In this example, the Asterisk server is in 192.168.10.1 so fop2.cfg should look like this:

manager_host=192.168.10.1
manager_user=fop2
manager_secret=fop222
Once that is set, you can test if the connection performs correctly with the command:

/usr/local/fop2/fop2_server --test
 

The above command should return that the connection to manager is OK, if you get an Auth Error, please review all the configurations mentioned already, and be sure you made no mistakes or typos on configuration files.

Now you need to configure the FOP2 Manager to point to the remote database. For doing so, edit the file /var/www/html/fop2/admin/config.php and set it correctly. Please remember that in this example, the asterisk server IP is 192.168.10.1, also we use the DBUSER and DBPASS as assigned on the GRANT command we performed on the Asterisk server MySQL database on the previous steps:

$DBHOST="192.168.10.1";
$DBUSER="fop2";
$DBPASS="fop2remotepassword";
$DBNAME="asterisk";
You will also need to configure the backend engine on that config file, if you use FreePBX, the engine name to use is "freepbx":
$ENGINE="freepbx";
 
Once that is set, you can see if configuration is being populated by login into the FOP2 Manager with your browser ( http://192.168.10.10/fop2/admin ) or by running the following script:

php /var/www/html/fop2/admin/update_conf.php
 
If everything goes correctly, then you should be done by now.



Did you find this article useful?