FOP2 Full WallBoard Queue Block Active Calls Wrong

[h]FOP2 Full WallBoard Queue Block Active Calls Wrong[/h]

So I have to say I love FOP2 and support is great when you can get it. I think they are overloaded. Nicholas helped on a lot of things but then got distracted before my Active Calls was accurate. However, I have found FOP2 so versatile it was pretty easy to make a work-around. I'm using FreePBX 13 with Asterisk 13. Here's what I did to get accurate Active Calls per queue. Note that I delete the Queue Block lines for Active Calls, and put the data in a Mini Web Browser control available in plugins.

First, go to https://[myAsteriskBox]/fop2/admin and login, then click Plugins and scroll to Full Wallboard. (You have to buy this) then click Settings.

Scroll down to Queue Boc Template and delete the following lines:
<tr>
    <td class='qboxtd'>
      <div class="img-rounded">
          <span class='number'>{@filter type="mmss"}{@formula value="{TALKTIME}/({COMPLETED}+{ABANDONED})"/}{/filter}</span><br/>
          <span class='lxabel translate'>Avg Talk Time</span>
      </div>
    </td>
       <td class='qboxtd'>
           <span class='number'>{@filter type="mmss"}{@formula value="{WAITTIME}/({COMPLETED}+{ABANDONED})"/}{/filter}</span><br/>
         <span class='lxabel translate'>Avg Wait Time</span>
    </td>
  </tr>  
Note that leaves a blank box it the widget. You can adjust other rows to compensate.

Now you need to write a php agi and save it. Here,s the code:'
require_once(Inludedb.pho);
$Today = date("Y-m-d");
//$Today = '2017-10-06';
$qtime = $Today . ' 08:30:00';
$qend = $Today . ' 19:00:00';

$mysqli = new mysqli($dbip, $dbuser, $dbpass, $dbdb);
$sql="select count(*) from cdr where dst='2032639754' and calldate > '$qtime' and calldate < '$qend';";
$result = $mysqli->query($sql);
$row = $result->fetch_array();
$result->close();
$tfr=$row[0];
$mysqli->close();
$queue_list=shell_exec("asterisk -rx 'queue show' | fgrep strategy | cut -c1-3");
//$queue_list=shell_exec("asterisk -rx 'queue show' | sed -n '/strategy/{s/^\(.\{3\}\).*/\1/g;p}' 2>&1");
$qarray=explode("\n",$queue_list);
asort($qarray);
$active_calls=array();
$qname=array();
$total_calls=0;
$mysqli = new mysqli($dbip, $dbuser, $dbpass, 'asterisk');
foreach($qarray as $queue) {
	if ($queue <> 'def' && $queue <> "" && $queue <> 105) {
		$query = "select descr from queues_config where extension=$queue;";
		$result = $mysqli->query($query);
		$row = $result->fetch_array(MYSQLI_ASSOC);
		$qname[$queue]=$row["descr"];
		$result->close();
		$active_calls[$queue]=trim(shell_exec("asterisk -rx 'queue show $queue' | fgrep 'In use' | wc -l"));
		$total_calls+=$active_calls[$queue];
	}
}
?>
<body><center><table><tr><td style="font-family: Arial; font-size: 10pt;">Transfers Today</td></tr><tr><td style="font-family: Arial; text-align: center;font-size: 40pt;"><b><?php echo $tfr; ?></b></td></tr></table>
<table><tr><td colspan=2 style="font-family: Arial; font-size: 15pt;"><b>ACTIVE CALLS</b></td></tr>
<td style="font-family: Arial; font-size: 15pt;"><b>Queue</b></td><td style="font-family: Arial; font-size: 15pt;"><b>Calls</b></td></tr>
<?php
foreach ($active_calls as $q => $ct) {
	$qnm=$qname[$q];
	echo "<tr><td style='font-family: Arial; font-size: 12pt;'>$qnm</td><td style='font-family: Arial; font-size: 12pt;'>$ct</td></tr>";
}
?>
<td style="font-family: Arial; font-size: 15pt;"><b>Total</b></td><td style="font-family: Arial; font-size: 15pt;"><b><?php echo $total_calls; ?></b></td></tr>

</table></body><html>

Now that also puts in a block called transferred calls that my client wants. You can eliminate that if you just want queue active4 calls.
YOU CSS jockies will see many improvements possible... Fell free to comment.

Then, in the mini web browser settings, add the URL for the PHP page above (don't forget the MySQL database) and it should appear on any page you give mini web browser permission in groups or users.

Comments

  • I am so sorry - cut an pate error. (2 glasses of wine). Delete these lines from Queue Boc Template :
    <tr>
        <td class='qboxtd'>
          <div class="img-rounded">
              <span class='number'>{AGENTSSTAFFED}</span><br/>
              <span class='lxabel translate'>Agents Staffed</span>
          </div>
        </td>
           <td class='qboxtd'>
             <span class='number'>{ACTIVECALLS}</span><br>
             <span class='lxabel translate'>Active Calls</span>
        </td>
      </tr>
    

    I deleted another <TD> I didn't need and added Agents Staffed back in.
Sign In or Register to comment.