How can we help you?

Installing Asternic Call Center Stats PRO on a separate server
Posted by: Nicolás Gudiño Posted on: Jul-27th, 2015 19:27

Installing CCStats PRO on a separate server


Asternic Call Center Stats PRO is a networked application. As such it can be installed on the same server where Asterisk resides, or it can be installed on a standalone/separate server also. This guide will use as an example the following IP addresses:

Asterisk Server: 192.168.10.1
CCStats Server: 192.168.10.10

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

Recordings: If you want to make recordings available via Asternic Web reports, you won't be able to do so via standard tools/scripts, as the recordings will be stored on a different server than Asternic CCStats web server. This can be fixed if you mount the appropriate directories via NFS or similar, or if you modify the post recording script to move the recording files to the Asternic Server. These steps are *not* covered in this guide.

Requirements

Asternic CCStats PRO requires a Linux server with Apache / PHP and MySQL installed (commonly known as LAMP). It also requires the Ioncube PHP loaders. We recommend to use a CentOS based operating system. Version 6.x works pretty well. Version 7 also works but you might need to install some packages that might not be installed by default, like net-tools ( yum install net-tools )

Installation


On your standalone server:

Download the software to your standalone server, extract it but do not run "make", as we will install some parts of the package, run instead the following:



make mysql
make webfiles
make ioncube

That will install the web application and database into your new server. Finally restart the web server:



service httpd restart



On your Asterisk server:


Now, you need to install the log processing agent onto the Asterisk server itself, so, download the software again, extract it and run:



make parselog
make initscripts


Configuration on the standalone CCStats PRO Server


Once the software is installed, you need to grant permissions for a remote user to access your MySQL database. To do so, and assuming that your Asterisk box IP address is 192.168.10.1, run the following command, for which you must know your MySQL root password:



mysql -u root -p -e "grant ALL PRIVILEGES on qstats.* to qstatsUser@192.168.10.1 identified by 'qstatsPassw0rd'"

You will also need to point to your remote Asterisk server for the realtime view to work, so go ahead and edit the file /var/www/html/stats/config.php and set the manager host (note that we are also specifying a special user/pass for the asterisk manager):



$MANAGER_HOST   = "192.168.10.1";
$MANAGER_USER   = "asternic";
$MANAGER_SECRET = "asternic222";

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 CCStats PRO server IP address. As the CCStats PRO server IP address in this example guide is 192.168.10.10, then a user should look like this:
[asternic]
secret = asternic222
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 also need to modify the asterniclog daemon options to point to the remote CCStats PRO server, so go ahead and edit the file /etc/sysconfig/asterniclog with your favourite text editor so it looks like this:



OPTIONS="-u qstatsUser -p qstatsPassw0rd -d qstats -h 192.168.10.10 -l /var/log/asterisk/queue_log -c --daemon"

Once that is done, restart the service:



service asterniclog restart


If you want to populate the recordings table, you also need to configure correct MySQL credentials in /usr/local/parselog/update_mix_mixmonitor.pl. However, take into account that accessing the recordings won't work directly as they will be stored on a different server, in such cases you have to consider on sharing the recordings directory via NFS or similar means. In any case, the script should included the correct mysql credentials:

$config{'dbhost'} = '192.168.10.10';
$config{'dbname'} = 'qstats';
$config{'dbuser'} = 'qstatsUser'; 
$config{'dbpass'} = 'qstatsPassw0rd';

You also need to modify the asterniclog daemon options to point to the remote CCStats PRO server, so go ahead and edit the file /etc/sysconfig/asterniclog with your favourite text editor so it looks like this:



OPTIONS="-u qstatsUser -p qstatsPassw0rd -d qstats -h 192.168.10.10 -l /var/log/asterisk/queue_log -c --daemon"


Wrapping UP

Now you have the asterniclog service running on your Asterisk server. It runs on the background and feeds any new data that is written into the queue_log file in the MySQL database that resides on your standalone CCStats PRO server.



On your CCStats PRO server you have the web application and database. So, to access the reports just point your browser to it:



http://192.168.10.10/stats



You should be able to run reports and see the realtime view correctly.



Leave a comment