Author Topic: queue_log table fields  (Read 11223 times)

dlm

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
    • Email
queue_log table fields
« on: March 21, 2007, 21:29:48 »
I'm using qloaderd script to copy queue_log records to MySQL. I followed the instructions and everything works fine. One of our customer requested a specific format of the queue stats in order to import this data into another statistic software.

1. I need to re-elaborate the basic log information but could not find enough about the standard fields of the queue_log table in queuemetrics MySQL db. Any suggestions about the field meaning (especially data1..data4 and verb), so I can build my own queries?  ???

2. Secondly, is there any way to extract the Answered Calls (and Unanswered Calls) detail page in a CSV/XML format automatically or from a script/software? I was able to write a program which takes CSV exported data form QM and builds up data into a specific custom format, so I wonder if I can import data automatically instead of manually feed my script.

Thank you for your support.

David

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: queue_log table fields
« Reply #1 on: March 21, 2007, 23:29:56 »
Hello David,
parsing the queue_log table directly via SQL is not a great idea - if it were so easy at it may seem, there would be no need for QueueMetrics itself! :)
If you need to elaborate on or export data from QueueMetrics, the best way to do it is to use the XML-RPC interface - see http://queuemetrics.com/download/QueueMetrics_XmlRpc_v10.pdf - with a scripting language of your choice. You may use that interface just to query QM for the very list of taken and lost calls or agents essions and then work on those as the basic "building blocks" of your own reports.

dlm

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
    • Email
Re: queue_log table fields
« Reply #2 on: March 22, 2007, 10:38:11 »
Yes, I noticed that the queue_log table was not so useful for what I need to do. And yes, that's why QM is there for...  ;)

As for the XML-RPC, what tables codes I need to use to get the following from the interface?

1. Detail of answered calls
2. Detail of unanswered calls

Have you got a quick sample accessing the interface with PHP (I can't use Java or Python  :-[)...?

Thanks. Kind regards.

David

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: queue_log table fields
« Reply #3 on: March 22, 2007, 10:49:56 »
Hello there,
the tables you are looking for can be accessed using the following names:

  • DetailsDO.CallsOK
  • DetailsDO.CallsKO
  • DetailsDO.AgentSessions

I think the names are fairly well self-explanatory :)

We are preparing an XML-RPC tutorial for PHP as well, as it is very widely used. I'll keep you posted. This should be a good starting point anyway: http://www.phpbuilder.com/columns/luis20010329.php3?page=3&print_mode=1


« Last Edit: March 22, 2007, 10:56:39 by QueueMetrics »

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Simple XML-RPC client for QueueMetrics
« Reply #4 on: March 22, 2007, 12:30:16 »
This is a very simple XML-RPC client for QueueMetrics. It is based on the standard XML_RPC library that is a part of Pear, so it should be already installed on most recent versions of PHP.
This client will query QueueMetrics asking for the details of answered and unanswered calls, and will print them out in tabular form. Should be pretty self-explanatory. :)


Code: [Select]

<h1>QueueMetrics XML-RPC client in PHP</h1>
<?
require_once 'XML/RPC.php';

$qm_server = "10.10.3.5";           // the QueueMetrics server address
$qm_port   = "8080";                // the port QueueMetrics is running on
$qm_webapp = "queuemetrics-1.3.3";  // the webapp name for QueueMetrics


// set which response blocks we are looking for
$req_blocks = new XML_RPC_Value(array(
  new XML_RPC_Value("DetailsDO.CallsOK"),
    new XML_RPC_Value("DetailsDO.CallsKO")
    ), "array");

// general invocation parameters - see the documentation
$params = array(
          new XML_RPC_Value("queue-dps"),
new XML_RPC_Value("robot"),
new XML_RPC_Value("robot"),
new XML_RPC_Value(""),
new XML_RPC_Value(""),
new XML_RPC_Value("2007-01-01.10:23:12"),
new XML_RPC_Value("2007-10-10.10:23:10"),
new XML_RPC_Value(""),
$req_blocks
          );
         
$msg = new XML_RPC_Message('QM.stats', $params);
$cli = new XML_RPC_Client("/$qm_webapp/xmlrpc.do", $qm_server, $qm_port);
//$cli->setDebug(1);
$resp = $cli->send($msg);
if (!$resp) {
    echo 'Communication error: ' . $cli->errstr;
    exit;
}
if ($resp->faultCode()) {
    echo 'Fault Code: ' . $resp->faultCode() . "\n";
    echo 'Fault Reason: ' . $resp->faultString() . "\n";
} else {
    $val = $resp->value();
    $blocks = XML_RPC_decode($val);

     // now we print out the details....   
     printBlock( "result", $blocks );
     printBlock( "DetailsDO.CallsOK", $blocks );
     printBlock( "DetailsDO.CallsKO", $blocks );
}

// output a response block as HTML
function printBlock( $blockname, $blocks ) {
echo "<h2>Response block: $blockname </h2>";
echo "<table border=1>";
$block = $blocks[$blockname];
for ( $r = 0; $r < sizeof( $block ); $r++ ) {
echo "<tr>";
for ( $c = 0; $c < sizeof( $block[$r] ); $c++ ) {
echo( "<td>" . $block[$r][$c] . "</td>" );
}
echo "</tr>\n";
}
echo "</table>";
}

?>


Please forgive the indenting - I am having some copy&paste problems.
« Last Edit: March 22, 2007, 12:33:13 by QueueMetrics »

dlm

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
    • Email
Re: queue_log table fields
« Reply #5 on: April 16, 2007, 11:45:26 »
Hello again,

I'm trying to use the PHP script (btw, thank you very much!) and it seems to work... I mean, when I call the page, I get Status OK from the script but no data comes out after the table column names. Running a custom report from the web interface with the same period (start and end date/hour), I get plenty of information about the Answered and Unanswered Calls.

Here is an example of the HTML output:

QueueMetrics XML-RPC client in PHP

Response block: result
Status   OK
Description   
Time elapsed (ms)   78
QM Version   1.3.2

Response block: DetailsDO.CallsOK
Date   Caller   Queue   Wait   Duration   Disconnection   Handled by   Attempts   

Response block: DetailsDO.CallsKO
Date   Caller   Queue   Disconnection   Position   Wait   Attempts


This means that the XML-RPC is working fine, but why doesn't it retrieve the data I need?
I'm sure the solution is "under my nose", but I just can't find it.

Any ideas?

Thanks,
David

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: queue_log table fields
« Reply #6 on: April 16, 2007, 14:34:11 »
Aren't you querying the wrong queue(s)? if you were, everything would be fine, but no data would show up....

dlm

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
    • Email
Re: queue_log table fields
« Reply #7 on: April 16, 2007, 18:44:23 »
 :-[  :-[  :-[

I've been f****g up, er... messing up with the right spelling of the queue name...
Ah, springtime is here again... my brain's not plugged in!

Tnx,

David

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: queue_log table fields
« Reply #8 on: April 17, 2007, 16:11:07 »
Gee, if only all problems were so easy to solve :)

dlm

  • Newbie
  • *
  • Posts: 6
  • Karma: 0
    • View Profile
    • Email
Re: queue_log table fields
« Reply #9 on: April 25, 2007, 09:23:00 »
Thanks again, my routine works like a charm now...  :D

David

QueueMetrics

  • Loway
  • Hero Member
  • *
  • Posts: 2999
  • Karma: 39
    • View Profile
    • QueueMetrics
Re: queue_log table fields
« Reply #10 on: April 26, 2007, 09:11:27 »
That's good :)