|
Overview
For many users of Elastix, they are using Queues to handle support calls or calls in general. In most cases they don't require live statistics like a call centre does, in fact many just want a report to provide to management to support their case for more staff or show how advertising is affecting their call rates. These reports might be typically run at the end of the month.
Asternic stats is perfect for this situation. You can have it generate them hourly, daily, weekly, its up to you. The reports are rich in graphs showing calls missed, calls answered, typical time to answer etc, etc.
It does what it says it does, and does it well. For an additional cost, the writers have a realtime version as well if you find it suitable for your needs.
Have a look at http://www.asternic.org/stats/ for more info, includng a demo of the product
INSTALLING THE FILES
using winscp copy asternic-stats-1.0.tgz into /usr/src
perform in the /usr/src directory
tar xvzf asternic-stats-1.0.tgz
it will create a directory call asternic-stats
mkdir /var/www/html/asternic-stats
cd /var/www/html
chown asterisk:asterisk asternic-stats
cd /usr/src/asternic-stats/html
mv * /var/www/html/asternic-stats
At this point you can check that you have done everything right so far by going to the following address using your normal Internet Browser
http://{yourElastixAddress}/asternic-stats
It should pop up with a screen with some major errors, but at least you know you have completed the first part correctly.
NOW TO CREATE THE DATABASE
cd /usr/src/asternic-stats/sql
mysqladmin -p create qstat
This will prompt for the root password for Mysql which is eLaStIx.2oo7
No error will comeback, it will basically create the EMPTY database
mysql -p qstat < ./sql/qstat.sql
This will prompt for the root password for Mysql which is eLaStIx.2oo7
again no error will comeback, but it would have created the table schema
Thats it for creating the database.
ASTERISK & MYSQL DETAILS FOR CONNECTION
use your favourite Linux editor & edit the following file (I use nano, but vi and others are the same)
nano /var/www/html/asternic-stats/config.php
The only line that you need to change is
$dbpass = '';
to
$dbpass = 'eLaStIx.2oo7';
again use your favourite Linux editor & edit the following file
nano /var/www/html/asternic-stats/config_realtime.php
The only line that you need to change is
$manager_secret = "amp109";
to
$manager_secret = "elastix456";
Now you can confirm that you have done everything right by going to http://{yourElastixAddress}/asternic-stats
If everything is correct you will now have nice screen with no errors. You will have no queues in the list as we are not finished yet
THE FINAL SETUP
We are now going to remove the rest of the Asternic-stats to a permanent home and out of the /usr/src directory
cd /usr/src
mv asternic-stats /opt
so you will now find the rest of asternic-stats under the /opt directory.
use your favourite Linux editor & edit the following file (I use nano, but vi and others are the same)
nano /opt/asternic-stats/parselog/config.php
The only line that you need to change is
$dbpass = '';
to
$dbpass = 'eLaStIx.2oo7';
Now at this present time, Asternic-Stats knows nothing of your queues or agents (Dynamic or Static). So the next few lines we are going to run the parser manually, so that it picks up the queues and agents, because like almost everyone, you are wanting to see what it looks like before you have finished. A word of warning....you need to setup some queues and at least one static agent or dynamic agent and make a call to the queue. If you don't want to incorporate your queue into your call flow at this time, just create the queue, and make a manual call to the queue from your phone (e.g. your queue number might be 500, so dial the queue directly from your phone e.g. 500#). This will create some information in the queue log which will be used by the parser to populate the database.
now at the Linux prompt type
cd /opt/asternic-stats/parselog
php -q ./parselog.php convertlocal
NOTE: We use the convertlocal switch at the end as we are using Freepbx, and this converts the long winded SIP name to a simple name like SIP/201. This is mainly for aesthetics, otherwise the long name over the top of other text looks messy.
You will probably panic when you see all these errors come up e.g. PHP Notice: Undefined Offset. These are normal. Looking at the way the product works, it expects a standard number of fields in the Queuelogs, and they are not there (we are not dealing with well structured log files here such as XML). It just errors on these missing fields (data is not lost). It may be different under other PHP versions, but I have not really gone indepth on this. The product does its job
Now the final part is to run the parser periodically. Since most of the time, if you are reporting on Queue operation, it is normally done as a daily or monthly report, so you could add it to your daily cronjob. Some may want it a little more often, so that they can keep a close to realtime view of the queues, so you may want to have it hourly, which is what I generally do. A word of warning however, is that Asternic processes the logs in a manual way (e.g. no amazing smarts), so if you are getting thousands of calls per hour, you are probably not going to want it processing every hour and impacting on your Asterisk systems capability to reliably handle calls.
Asternic do offer a realtime capability with this product at a cost. The last time I requested the cost, I believed it to be quite reasonable for the product, so if you need it, approach them and obtain the latest costs.
Anyhow in the meantime, since this tutorial is not about how to setup cronjobs, I am going to keep it simple. Elastix already has some cronjobs setup for other applications such as Hylafax, and log rotation, so we are going to piggy back on these to keep it simple.
cd /etc/cron.hourly
using your favourite editor and create a new file called qtstats
and add the following lines
#!/bin/sh
# Runs the queue stats program parsing the logs
# If you're short on disk space, you might want to tune this commandline.
/opt/asternic-stats/parselog/parselog.php convertlocal
exit 0
Now save the file, and once saved perform the following command to make the file executable.
chmod 755 qstats
Just to make sure that it works
at the command line type
./qstats
and you should see the parsing occur manually. If this works, then it will run as a cron job each hour.
Thats it. Your system should now be functional.
|