Dashboard (wallboard)

Does anybody know a more recent project like this: sysadminman.net

I have installed this on a server, the top part seems to work, but the bottom part shows incorrect data.

I’m guessing a lot has changed in 5 years, so this project is probably out of date. This is some code:

<?php
$qcalls = 0;
$queue = "";
if(isset($_POST['queue'])){ $queue = $_POST['queue']; }

  require_once('./phpagi/phpagi-asmanager.php');

  $asm = new AGI_AsteriskManager();
  if($asm->connect())
  {
    $result = $asm->Command("queue show $queue");
  }
  $asm->disconnect();

// ECHO AGENTS ON A CALL

   echo "Agents on a call<br /><br />";

    if(!strpos($result['data'], ':'))
      echo $peer['data'];
    else
    {
      $data = array();
      echo "<table class='table table-condensed table-striped'>";
      echo "<tr class='heading-medium';><td>Agent ID</td><td>Calls today</td></tr>";
      foreach(explode("\n", $result['data']) as $line)
      {
         if (preg_match("/Busy/", $line) || preg_match("/On Hold/", $line) || preg_match("/In use/", $line)) {
          $pieces2 = preg_split('/ +/', $line);
          echo "<tr>";
          echo "<td class='medium';>".$pieces2[2]." ".$pieces2[1]." </td> ";
          echo "<td class='medium';>$pieces2[8] </td> ";
          echo "</tr>";
         }
      }
      echo "</table>";
    }

echo "</td></tr></table>";
?>

Anyone familiar with this project or know some project that does somewhat similar?

https://www.getisymphony.com/

https://www.fop2.com/docs/wallboard_guide.php

https://wiki.freepbx.org/display/FPG/XactView

You could build something yourself for free. A webpage that displays asterisk CLI commands could be as simple as it gets.

Building it myself sounds like an option, but is there good/complete documentation on all commands? I could also reverse engineer the script I have.

updating the code you’ve got to the new queue report from Asterisk shouldn’t be that big a deal, and if you do it out on GitHub and post a new notes “here and there” that you’re working on it, you might get some help.

Can you give me some pointers on the “new queue report”? I’m only just starting with the CLI and using it for very basic tasks. I have created a simple script that runs “queue show” like the code I posted and which output some data, but have no clue as to what to so next. To be honest I have not looked into the result in depth.

This presents the structure “$result” with a data stream that you need to parse. The data being presented back to the program has probably changed, so the information you need to present needs to change. The ‘else’ leg of the program should be parsing this data out, and it looks like the data that’s being queried is a space delimited set of options (“Busy xxxx”, for example) which are then turned into an array (in $pieces) that are being displayed on the screen. The “pieces” have changed, so the data isn’t being presented correctly any more.

It’s pretty straightforward regex decoding.

If I was starting the project, I’d add a line that said something like "echo “<!-- $pieces[0] - $pieces[1] - …” to the code right at the top of the table rows (before the “<tr>” and then look at the page source and see what the pieces (0 through 9 ?) are so that you know which ones are which, then change the indexes on the display so the pieces are right.

I’d ALSO add a check at the top for the Asterisk Version so that the code would continue to work with the older expression of the “queue show …” command, but that’s just me.

<?php
include '/etc/freepbx.conf';

if($astman->connected()) {
    $result=$astman->Command('queue show');
    $lines=array_filter(explode(PHP_EOL, $result['data']), 'trim');
    echo '<pre>'; print_r($lines); echo '</pre>';
}else echo 'no asterisk manager connection';
?>

This script produces an array like this:

Array
(
    [0] => Privilege: Command
    [1] => 778 has 0 calls (max unlimited) in 'ringall' strategy (4s holdtime, 162s talktime), W:0, C:2, A:2, SL:100.0% within 60s
    [2] =>    Members: 
    [3] =>       Local/[email protected] (ringinuse enabled) (dynamic) (Not in use) has taken no calls yet
    [4] =>       Local/[email protected] (ringinuse enabled) (dynamic) (Not in use) has taken no calls yet
    [5] =>       Local/[email protected] (ringinuse enabled) (dynamic) (Not in use) has taken 5 calls (last was 18277 secs ago)
    [6] =>    No Callers
    [8] => 63 has 0 calls (max unlimited) in 'ringall' strategy (11s holdtime, 169s talktime), W:0, C:18, A:6, SL:100.0% within 60s
    [9] =>    Members: 
    [10] =>       Local/[email protected] (ringinuse enabled) (dynamic) (Not in use) has taken no calls yet
    [11] =>       Local/[email protected] (ringinuse enabled) (dynamic) (Not in use) has taken no calls yet
    [12] =>       Local/[email protected] (ringinuse enabled) (dynamic) (Not in use) has taken no calls yet
    [13] =>       Local/[email protected] (ringinuse enabled) (dynamic) (Not in use) has taken 3 calls (last was 106 secs ago)

etc.

How can I now extract:

  • Calls waiting
  • Agents on a call
  • Agents available
  • Agents available

Rerun it with “queue show 778” and display the output (the program displays information based on a per-queue basis, so if you want to figure out the pieces, you need to work one queue at a time.

Array
(
    [0] => Privilege: Command
    [1] => 778 has 0 calls (max unlimited) in 'ringall' strategy (4s holdtime, 162s talktime), W:0, C:2, A:2, SL:100.0% within 60s
    [2] =>    Members: 
    [3] =>       Local/[email protected] (ringinuse enabled) (dynamic) (Not in use) has taken no calls yet
    [4] =>       Local/[email protected] (ringinuse enabled) (dynamic) (Not in use) has taken no calls yet
    [5] =>       Local/[email protected] (ringinuse enabled) (dynamic) (Not in use) has taken 5 calls (last was 18956 secs ago)
    [6] =>    No Callers
)

Based on looking at these queue reports once about a million years ago, here’s what I think is happening:

The ‘0’ is your “calls in the queue”.

The “Not in use” items are a +1 for “agent idle” and a “not +1” for “agents in call”.

There’s a document out on the Wiki somewhere that tells you what each of the pieces of the report means. It seems to me that “W:0” means “no calls waiting”, “C:2” is the number of calls on the queue, “A:2” is the number of calls answered, and “SL” is the percentage of calls answered within the Service Limit of “60 seconds”.

Double check that, and if that’s the case, you can parse the metrics out from the line using normal regex information. I’m pretty sure the information you’re looking for is all here. It is just going to take you a few minutes to figure out the pieces and parse them out of the report.

1 Like

Great! I will look into this and try to rewrite the script I have.

I reversed engineered wallboard and came up with the following function:

function do_line($line) {
	preg_match_all(
		'/(.*)\/(.*)@(.*) \((.*)\) \((.*)\) \((.*)\) has taken (.*) calls (.*)/s',
		$line,
		$posts,
		PREG_SET_ORDER
	);
	
	echo "<td class='medium';>".$posts[0][2]."</td>";
	echo "<td class='medium';>".($posts[0][7]=='no' ? 0 : $posts[0][7])."</td>";
}

Hopefully it helps someone using this project.

2 Likes

Hey,
i am very interested in having only a dashboard, that is showing my queue.
Can you please give me a hint how to install this “script”?

Thnks a lot Florian

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.