How to install/use Asternic Call Center Stats with a Yeastar MyPBX Box

How to install/use Asternic Call Center Stats with a Yeastar MyPBX Box

If you have a Yeastar MyPBX embeded machine for your telephony solution, you can still use Asternic Call Center Stats to have good reporting on your queue activity. The only catch is that you must install Asternic on a separate Linux server as the little box does not have a robust and large enough permanent storage for the data.

So, first of all, you must have a Linux box ready with Apache, PHP and MySQL installed. You can use a virtual machine with at least 512Mb of RAM for that purpose. That should be enough for small/medium size contact centers. If you have a large contact center and have thousands of calls per day, then you need at least 2Gb or RAM.

In this guide we will asume that the Linux box has the IP address and the Yeastar box has the IP address

Installing Asternic on the Linux Server

Follow the same procedures as on a regular installation. Basically download, extract and run "make".

cd /usr/src
tar zxvf asternic-stats-pro-2.1.1.tgz
cd asternic-stats-pro-2.1.1

Be sure to change owner of html directory to the same user your web server is running as. That user might change depending on your linux distribution of choice, for example it could be the user 'www-data'

chown www-data.www-data /var/www/html/stats/ -R

As this is a standalone Linux box with no Asterisk installation in it, you will have to create the asterisk log directory by hand like this:

mkdir /var/log/asterisk

That's it. You completed the Asternic server side of things. Now you will have to work on the MyPBX box setup:

Preparing/Configuring Yeastar MyPBX

You will have to perform some configuration on the Yeastar box, some directly via command line, login into it via SSH, and some via the web interface:

Enabling queue_log

Log via ssh to the Yeastar Box and enable queue_log by creating a new file:

cd /persistent/custom-cfg
vi logger_custom.conf

Write this content on the logger_custom.conf file. be sure to get into insert mode first by typing i


After typing that, exit VI insert mode by typing ESC
Then save the file and exit the vi text editor by typing   : w q ENTER

Now in the browser GUI click on Apply Changes

Create ssh key

We will use a neat trick to replicate the queue_log from the Yeastar box into our Linux server. For that we will use passwordless ssh. So again, inside the Yeastar box run this commands to create an ssh key:

mkdir /persistent/.ssh
chmod 0700 /persistent/.ssh
dropbearkey -t rsa -f /persistent/.ssh/id_rsa
chmod 0600 /persistent/.ssh/id_rsa

Now we must retrieve the public identity just created, use this command to print it out on screen:

dropbearkey -y -f /persistent/.ssh/id_rsa | grep "^ssh-rsa"

You will have to copy the output and then paste it inside the file /root/.ssh/authorized_keys on your Linux server. So be sure to open that file in the Linux box and paste the contents produced by the above command into it.

Once that's done, you can test if the connection works by running this command inside the Yeastar box (change with the IP address of the Linux box):

ssh -y -i /persistent/.ssh/id_rsa root@

That should connect you to the Linux box with no password prompts. If that is ok be sure to close that session by typing "exit" to return to the Yeastar CLI.

Start the Log replication on Yeastar

We will use the extensibility options the Yeastar box provides via custom scripts. First we create a script to startup a new command when the box boots up, named /persistent/

vi /persistent/

Now set VI to insert mode by typing i and write this content:

chmod +x /persistent/asterniclog
/persistent/asterniclog &

After typing that, exit VI insert mode by typing ESC
Save the file and exit VI by typing : w q ENTER

Now we will create a script to actually feed log updates on the remote server by creating a script /persistent/asterniclog

vi /persistent/asterniclog

Set VI into insert mode by typing i and type this into the file:

sleep 60
tail -f /var/log/yslog/queue_log | ssh -y -i /persistent/.ssh/id_rsa root@ "cat >>/var/log/asterisk/queue_log" &

After typing that, exit VI insert mode by typing ESC
Save the file and exit VI by typing : w q ENTER

Manager configuration

In order for Asternic realtime view to work, you will have to log into the Yeastar Web GUI and allow remote connections to AMI by adding the IP address of your linux box as a "permit" line.


Finally you will have to reboot the Yeastar Box for all the changes to take effect.

Also, do not forget to edit /var/www/html/stats/config.php and set the correct manager user, secret and host .

Did you find this article useful?