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 it won't work as voicemail files will be stored on the Asterisk server hard drive, and not the local drive where FOP2 is installed. The solution is 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 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 (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.
[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: SuccessfulAuthOnce the user is created, reload the Asterisk manager for the new configuration to take effect:
asterisk -rx "manager reload"
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 email@example.com 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.
manager_host=192.168.10.1 manager_user=fop2 manager_secret=fop222Once that is set, you can test if the connection performs correctly with the command:
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";
Apart from basic MySQL credentials, you might want to specify the configuration engine you have in your Asterisk backend. If you use FreePBX, the engine to use is 'freepbx'. If you use MiRTA, then it is 'mirtapbx'. So, on the same config.php file uncomment the $ENGINE line and set it correctly:
$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.phpIf everything goes correctly, then you should be done by now.