Author Topic: Wallboard Example script  (Read 41188 times)

barryf

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 4
    • View Profile
Wallboard Example script
« on: December 10, 2007, 11:25:20 »
Hi,

Here is a small script to grab the calls waiting and Agent information for a given queue from the QueueMetrics XML-RPC service and create a simple display for use on a wallboard.
 
Display colours will change from Green to Yellow to Red depending on Calls waiting, Ready Agents. Will also sound an alarm.
 
This has proved useful in a large callcentre where the standard QM RT monitoring screen is too detailed and hard to see from a distance.

Screenshots:
http://www.flantel.com/qm/qmon1.jpg
http://www.flantel.com/qm/qmon2.jpg


Get the code here:
http://www.flantel.com/qm/qmon.php.txt

Feel free to use it, improve it, just share your changes!

-Barry Flanagan


QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Wallboard Example script
« Reply #1 on: December 10, 2007, 12:29:37 »
Super cool  ;D how do you set up the script?

barryf

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 4
    • View Profile
Re: Wallboard Example script
« Reply #2 on: December 10, 2007, 12:50:09 »
Super cool  ;D how do you set up the script?


Basic instructions are in comments in the script.

To use, simply define the queues you want to monitor as $queueid, and set the QM ROBOT user and PASS, as well as the IP address of your QM server.

I allow passing of a GET variable within the URL to select the queue to monitor, which is then evaluated in the switch statement. Just define $queueid to contain the Asterisk queue names (not the QM aliases). So just change the $queuename and $queueid in the switch statement to suit your needs.

If you want to set a default queue for when no GET is included (i.e. /qmon.php?queue=QUEUENAME) then define this in $defaultqueue.

Code: [Select]
// Set which queue you want to default to when none is specified
$defaultqueue = 'verification';

// Allow seting of the queue to monitor, and the refresh time.
isset($_REQUEST['refresh'])?$refresh = $_REQUEST['refresh']:$refresh=120;
isset($_REQUEST['queue'])?$queuereq = $_REQUEST['queue']:$queuereq=$defaultqueue;

// Depending on which queue was requested, set $queueid for passing to queuemetrics.
switch ($queuereq) {
  case 'verification':
    $queueid = "301|310|311|312";
    $queuename='Dublin Verification';
    break ;;
  case 'inbound':
    $queueid = "401|402|403|404|405|406|407|408|409|410|411|412";
    $queuename='Inbound';
    break;;
  case 'outbound':
    $queueid = "Outbound";
    $queuename='Outbound';
    break ;;
}


// Set up the XML-RPC instance.
require_once 'XML/RPC.php';
$qm_server = "127.0.0.1"; // the QueueMetrics server address
$qm_port   = "8080";        // the port QueueMetrics is running on
$qm_webapp = "queuemetrics"; // the webapp name for QueueMetrics


Hope this helps.

-Barry Flanagan

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Wallboard Example script
« Reply #3 on: December 12, 2007, 16:05:38 »
That's great!  ;) :D

moa

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Wallboard Example script
« Reply #4 on: December 21, 2007, 22:03:30 »
 ???

I'm unable to get this script to work.
I receive this error:

Fault Code: 5 Fault Reason: Didn't receive 200 OK from remote server. (HTTP/1.1 302 Moved Temporarily)

My guess is its looking for "/$qm_webapp/xmlrpc.do".  I tried looking through all of the queuemetrics directories but I'm cant find it anywhere.

Any ideas?

barryf

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 4
    • View Profile
Re: Wallboard Example script
« Reply #5 on: December 22, 2007, 12:50:54 »

I'm unable to get this script to work.
I receive this error:

Fault Code: 5 Fault Reason: Didn't receive 200 OK from remote server. (HTTP/1.1 302 Moved Temporarily)

My guess is its looking for "/$qm_webapp/xmlrpc.do".  I tried looking through all of the queuemetrics directories but I'm cant find it anywhere.

Any ideas?

No idea. Are you using a very recent version of QM? The XML-RPC only kicked in in later versions.

-Barry

moa

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Wallboard Example script
« Reply #6 on: December 24, 2007, 18:24:41 »


No idea. Are you using a very recent version of QM? The XML-RPC only kicked in in later versions.

-Barry


Using QM 1.4.2.

One question. Does this script have to be run over Tomcat?  I'm attempting to run it on a different server with Apache2, php and pear installed.



moa

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Wallboard Example script
« Reply #7 on: December 24, 2007, 20:59:47 »
 ;D ;D ;D

I got it.  It took some digging.  Looks like I was missing Xerces.

I found this post:

http://astrecipes.net/index.php?from=226&q=astrecipes/xml-rpc+not+working

Hope this helps answer any other questions.

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Wallboard Example script
« Reply #8 on: January 02, 2008, 12:53:40 »
One question. Does this script have to be run over Tomcat?  I'm attempting to run it on a different server with Apache2, php and pear installed.

No there are no requirements for the script, as it's a plain PHP script that just interfaces to QM. (BTW, if you plan to fetch large datasets, make sure you don't get smothered by PHP's run-time and memory limits)

moa

  • Newbie
  • *
  • Posts: 27
  • Karma: 1
    • View Profile
Re: Wallboard Example script
« Reply #9 on: January 27, 2008, 10:16:32 »
This wallboard is awesome.  I've changed the colors around and it makes our call center look very professional.  I highly recommend it!

One thought on adding to it.  How hard would it be to grab the current days SLA percentage for All Queues selected and display it in one of the upper corners?
« Last Edit: January 28, 2008, 01:05:52 by moa »

byronsmith

  • Newbie
  • *
  • Posts: 6
  • Karma: 1
    • View Profile
Re: Wallboard Example script
« Reply #10 on: February 14, 2008, 14:33:21 »
Hello,

Not sure if anyone was interested, I made a few slight adjustments and a few colour/design changes.

http://my.computr.co.uk/downloads/qmon.txt (to change queuename use qmon.php?queue=queueone|queuetwo|queuethree etc)
http://my.computr.co.uk/downloads/style.css.txt

http://my.computr.co.uk/downloads/image1.jpg
http://my.computr.co.uk/downloads/image2.jpg
http://my.computr.co.uk/downloads/image3.jpg

I also found I had the same error that moa had with Xerces, basically followed the instructions and viola, it all worked. I have Queuemetrics 1.4.2

Another problem I found was:

$params_rt = array(
           new XML_RPC_Value($queuename),
           new XML_RPC_Value("USER"),
           new XML_RPC_Value("PASSWORD"),
           new XML_RPC_Value(""),
           new XML_RPC_Value(""),
           $req_blocks_rt
       );

Where $queuename was $queueid but after changing it to $queuename it worked for me... no idea why.

Anyway,

Enjoy.
Byron

« Last Edit: February 14, 2008, 15:05:32 by byronsmith »

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: Wallboard Example script
« Reply #11 on: February 15, 2008, 10:45:14 »
Looks really cool!  :D
the value you pass in the XML-RPC call is the queue_id in Asterisk (that is the 'raw' queue name) or a set of queue names, pipe separated (eg q1|q2|q3)
Thanks!

barryf

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 4
    • View Profile
Re: Wallboard Example script
« Reply #12 on: February 15, 2008, 10:54:27 »

Another problem I found was:

$params_rt = array(
           new XML_RPC_Value($queuename),
           new XML_RPC_Value("USER"),
           new XML_RPC_Value("PASSWORD"),
           new XML_RPC_Value(""),
           new XML_RPC_Value(""),
           $req_blocks_rt
       );

Where $queuename was $queueid but after changing it to $queuename it worked for me... no idea why.


That's because you took out the switch statement:

// Set which queue you want to default to when none is specified
$defaultqueue = 'verification';

// Allow seting of the queue to monitor, and the refresh time.
isset($_REQUEST['refresh'])?$refresh = $_REQUEST['refresh']:$refresh=120;
isset($_REQUEST['queue'])?$queuereq = $_REQUEST['queue']:$queuereq=$defaultqueue;

// Depending on which queue was requested, set $queueid for passing to queuemetrics.
switch ($queuereq) {
  case 'verification':
    $queueid = "301|310|311|312";
    $queuename='Dublin Verification';
    break ;;
  case 'inbound':
    $queueid = "401|402|403|404|405|406|407|408|409|410|411|412";
    $queuename='Inbound';
    break;;
  case 'outbound':
    $queueid = "Outbound";
    $queuename='Outbound';
    break ;;
}


I use this so that I can pass a queue GET parameter such as "inbound" which then sets
$queueid= "401|402|403|404|405|406|407|408|409|410|411|412";

which contains the real Asterisk queue names separated by pipes, and also sets $queuename for display at the top.

-Barry Flanagan

byronsmith

  • Newbie
  • *
  • Posts: 6
  • Karma: 1
    • View Profile
Re: Wallboard Example script
« Reply #13 on: February 17, 2008, 23:32:10 »
Hi Barry,

For sure, I realised what your switch/case was for but I didn't need it in my case. Apologies if it looked like what I did made it seem as if the code broke, this was not the case, in fact the truth is when I used the queue id's in the query string it didn't work, using the queue names it did work in my case, hence the reason for bringing up the $queueid and $queuename etc.

Anyways, the many thing is it works and all that is thanks to your efforts, many thanks.

Regards
Byron

Roque

  • Newbie
  • *
  • Posts: 11
  • Karma: 0
    • View Profile
Re: Wallboard Example script
« Reply #14 on: April 03, 2008, 20:53:58 »
The screen shots look great.  But where does this script go (directory) or is it appended into an existing script?  How does it get called?
Thanks in advance!
-Roque