Asterisk / FreePBX queue and agent wallboard

This is an update the this post (http://sysadminman.net/blog/2012/asterisk-elastix-queue-and-agent-wallboard-3604) which had some code for a basic wallboard. This version is updated a little with better handling of some of the output from Asterisk. It also uses Twitter Bootstrap to make the wall board a little prettier. Here is an example screenshot of the new version –

Asterisk wall board

Prerequisits

Before we get started there are a few things you need

  1. This wall board was written against Asterisk 1.8 – it may work with other version
  2. A part of the code assumes FreePBX is installed on the machine so gets the queue names from ‘/etc/asterisk/queues_additional.conf’. If it isn’t you should adjust this
  3. ‘/etc/asterisk/phpagi.conf’ should be configured correctly for your system. You should ensure it contains lines like this, where the asmanager settings match those in /etc/asterisk/manager.conf –
[phpagi]
tempdir=/tmp

[asmanager]
server=localhost
port=5038
username=admin
secret=password

Installation

First we need to decide where to install the wallbaord. This will depend on your system but if you are running FreePBX then in the ‘admin’ folder is probably a good idea –

mkdir /var/www/html/admin/wallboard
cd /var/www/html/admin/wallboard

Next grab the most recent version of Twitter Bootstrap and install it –

wget http://twitter.github.com/bootstrap/assets/bootstrap.zip
unzip bootstrap.zip

Next get phpagi and install it (this is used to connect to Asterisk and is why we needed to configure the phpagi.conf file list in prerequisites above)

wget http://sysadminman.net/misc/phpagi-2.20.tgz
tar xvfz phpagi-2.20.tgz
ln -s phpagi-2.20 phpagi

and finally download the wallboard files and extract them –

wget http://sysadminman.net/misc/astwb-1.0.tar.gz
tar xvfz astwb-1.0.tar.gz

Finally you need to edit ‘cdr.php’ and set the database connection details so that it can connect to MySQL for the call detail records. You should be able to find the settings in /etc/amportal.conf if you are running FreePBX –

AMPDBUSER=asteriskuser
AMPDBPASS=password

And now if you point your web browser to the URL you install the wall board to – http://AsteriskIP/admin/wallboard.

Please post any questions or comments in teh comments below.

60 thoughts on “Asterisk / FreePBX queue and agent wallboard

  1. matt Post author

    Hi Bilal. If you’re running FreePBX have a look in /etc/amportal.conf and you should see a DB username and password. It’s those you need to enter in cdr.php.

  2. matt Post author

    If you’re just seeing blank numbers then double check the instructions for PHPAGI above. That’s the bit that lets it connect to Asterisk to get the stats.

  3. matt Post author

    If the CDR is working but not the queue details it’s probably a problem with the PHPAGI setup. I’d double check the settings above that relate to that.

  4. Marcos Pires

    Funny. I have same problem as @Bilal but every .php alone seems to work fine. But when I access through index.php I got a blank template.
    Any ideas ?

    Regards.

  5. Dan

    Hi Matt,

    thanks for your fine work. I do have some issues, though. As you probably know, the Elastix distro (which is based on FreePBX) works under https secured protocol. For some reason, the wallboard does not appear. It seems that it is making an http request of some sort, and the server cannot handle this type of request. Have you encounter such behaviour so far?
    Also, some data from the wallboard need to be a little bit modified. Foe example: total calls in the queues need to be on a daily basis, not total.
    If you can give me some hints I appreciate very much,

    Thank you again,

  6. Michael

    Love the layout for this wallboard. I was wondering though, is it possible to have this running on a remote server? I managed to get the call history working by just pointing the mysql query away from localhost and to the phone server, however none of the call queue stuff shows up. I looked in the phpagi/phpagi-asmanager.php file and found the server, port, username, and secret settings and set them to use the remote values, but its still not loading any of the data.

    So basically, any ideas on what else I would need to change to get this working remotely?

  7. Leo Ashcraft

    Seems to work for the most part – but it is throwing all kinds of errors:

    It wont let me post the errors here though

    This is on asterisk 11.7 centos 6.5

  8. Leo Ashcraft

    Seems to work for the most part – but it is throwing all kinds of errors:

    Warning: date- It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected America/Chicago for CST/-6.0/no DST instead in /var/www/html/admin/wallboard/phpagi-2.20/phpagi-asmanager.php on line 742

    Call History (last 5 calls)

    Warning: mysql_fetch_array expects parameter 1 to be resource, boolean given in /var/www/html/admin/wallboard/cdr.php on line 30

    This is on asterisk 11.7 centos 6.5

  9. matt Post author

    Hi Leo

    Are you seeing these warnings on the web page or in the logs? They are only warnings. First one you could fix by setting the timezone in php.ini. Not too sure about the second one.

    Cheers, Matt

  10. matt Post author

    Should be right at the top –

    $db_admin = ‘dbuser’;
    $db_password = ‘dbpassword’;

  11. peter

    in cdr.php, should everything be as it is except the db user and password in cdr.php being changed to the AMPDBUSER AND PASSWORD of the amportal.conf??

  12. Tim

    Not working for me with Asterisk 11.7
    [Sat Mar 01 20:11:10 2014] [error] [client 192.168.1.249] PHP Notice: Undefined variable: result in /var/www/html/wallboard/call_queue.php on line 20, referer: http://xxxxx/wallboard/
    [Sat Mar 01 20:11:10 2014] [error] [client 192.168.1.249] PHP Notice: Undefined variable: peer in /var/www/html/wallboard/call_queue.php on line 21, referer: http://xxxxx/wallboard/

  13. Tim

    Ignore my last post this is working well for me!

    However all the agent status fields show double entries any idea why this is?

  14. Matt Newcombe Post author

    Hi Tim

    Is that just when you have all queues selected, or a specific queue?

    Cheers, Matt

  15. FreePbx User

    Hi Matt, on the “ALL” view I have multiple agents showing under the status… is there anyway to filter those results to that it’s only one?

    Thanks,

    FPU

  16. Matt Newcombe Post author

    Hi there

    Are they showing up multiple times because they are in multiple queues, or is it a bug and they are only on one queue?

    Cheers, Matt

  17. Adriel Lucas

    Bom dia,

    Esse post que você colocou no blog é muito legal, parabéns!!

    Estou utilizando elastix, lá a visualização desse tipo de relatório não é legível para quem é gestor e não é da área de TI.

    Instalei o sistema que vc disponibilizou, no entanto, ele acessa as filas mas não gera nenhum tipo de relatório, fica uma tela branca
    https://dl.dropboxusercontent.com/u/20885700/queues.png

    como faço para resolver esse tipo de problema?

    Att

  18. Matt Newcombe Post author

    You would need to check your Web server logs to see if it is generating any errors.

  19. Jme

    Hi Matt

    I found your wallboard a couple of days ago on this blog, and it looks really promising.
    Unfortunately I have the same problem as some of the other guys here in the comments: all I can see is the dropdown containing the queues.
    It looks like only index.php is accessible:

    [error] [client X.X.X.X] client denied by server configuration: /var/www/html/admin/wallboard/call_queue.php, referer: http:///admin/wallboard/

    This same entry appears for all .php files except index.php. This is quite strange because the other .php files have the same permissions as index.php…
    I’m running FreePBX Distro 5.211.65-12.

    Any idea?

    Thanks!

  20. Jme

    Update: problem solved! Solution:
    /var/www/html/admin/.htaccess limits access to only index.php and config.php on FreePBX (don’t know in which version this started:

    You can change this to allow access to all .php files:

    Only do this if your FreePBX GUI isn’t accessible from the public internet.

  21. Matt Newcombe Post author

    Thanks for taking the time to post the solution, much appreciated. Matt.

  22. Andrew Dunn

    Hi, When i view the wallboard I can see the last 5 calls but nothing is generated to show anything in the queue. It shows my queue but its all ‘0’ under the headings.

  23. Matt Newcombe Post author

    Hi Andrew

    I’d check to see if you can see the results in Asterisk by running the commands the script is trying to. Try

    asterisk -rv
    queue show

    If that works OK I would double check the phpagi setup as that’s what the script is using to connect to Asterisk and run the commands.

    Cheers, Matt

  24. Adrian Joseph

    Hi Matt,

    Thanks for sharing such an excellent piece work! Highly appreciated! This is jsut what was required.
    Just one question, I am looking to change the calls waiting in queue, to show the CLID instead of their number 1. 2. 3. etc…. is there a possibilty you could share something over that?

    Also how can I change the theme of the entire dashboard. Any other CSS you have in mind that we could use.

    Thanks a lot once again.
    A.J

  25. Adrian Joseph

    Hi Everyone…

    I resolved it yesterday after some research and trial and errors. Simply used the channel to call the ID from core show channel command.

    Thought I’d share it here so that if anyone like me needs it can help himself. 🙂

    Cannot post the code as it keeps sayin access denied. Tried the HTML tags too. :/

    Cheers!
    A.J

  26. Matt Newcombe Post author

    Hi AJ

    Thanks for the info. Do you fancy dropping me your email address via the contact form and I’ll get in touch?

    Cheers Matt

  27. Michael

    Hi,

    Firstly, thank you for sharing this.

    I have gotten the screen to display, however everything is left aligned. Also the text headings below the “total calls queueing” seems to be unformated. i.e. it does not look as good as your picture.

    We are using FreePBX Distro 2.11.0.38 with Asterisk V11.13.0

    I am also getting this in the error logs

    [error] [client y.y.y.y] Fri, 24 Oct 2014 12:50:24 +0200 – No event handler for event ‘fullybooted’, referer: http://x.x.x.x/admin/wallboard/

    Kind Regards
    Michael

  28. Lee Williams

    Hi Matt,

    Your wallboard looks interesting, but I cannot pull down the astwb tarball. I have already pulled bootstrap directly from twitter and phpagi from SourceForge. It there any chance you could email it to us?

    Thanks

    Lee

  29. Leonard

    Hi Guys,

    cant get this to work. Only shows queues at the top and the rest doesnt load?

  30. MDL

    Hi Guys,

    I found this wallboard a couple of days ago on this blog.
    Unfortunately I have the same problem as some of the guys here in the comments: all I can see is the dropdown containing the queues.
    Everything is blank.I try do some tricks of everbody above but it does not work with me.

    Tks

  31. Sanaullah Kiyani

    Awesome post MAT – your post helped me Alot ,, cant describe the time saving in WORDS 🙂

    Also Jme31 Thanks for solution Worked for ME too :0

  32. jose hector galimberti

    HI Matt, i want to help improve the wallboard to show more usefull information

  33. Neven

    Hi Matt,

    I have error showing on bottom of wallboard

    Access denied for user ‘admin’@’localhost’ (using password: YES)
    I’m new to this, is there anyway to find is my database name as cdr.php shows
    $db = ‘asteriskcdrdb’;
    $tablename = ‘cdr’;

    thx,

    Neven

  34. Mark

    Hi Matt
    Great work, this is just what I’m looking for. I have it running and it shows the call history, all beat it all history regardless of the queue selected but the rest is blank. Any idea what I need to do to fix this?

    I also had the same problem as Neven above which was down to DB username and password but they can be found as you describe near the bottom of the file.

  35. Mark

    Hi Matt, A bit of self service but I managed to get all the info to display by adding all the text you suggested to the end of phpagi.conf and changed the password to match the one found in manager.conf. Is there a way to restrict call history to the queue selected rather than all?

    Another nice thing would be to select more than one queue but not all.

    Mark

Comments are closed.