QueueMetrics > Scripting QueueMetrics
QM.qaformgrading
(1/1)
eduararley:
Hello everyone.
I'm trying to fill a QA form using XML-RPC API. I'm using PHP, so I'm using a sightly modified version of sample_client.php shipped with the product.
This is what I have:
So, I use the following code:
--- Code: ---<?php
require_once 'XML/RPC.php';
// Variables
$qm_server = "localhost"; // the QueueMetrics server address
$qm_port = "8080"; // the port QueueMetrics is running on
$qm_webapp = "queuemetrics"; // the webapp name for QueueMetrics
// Function: 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>";
}
// ---------------------------------------
// PART 1: QM STATS
// Blocks: Set which response blocks we are looking for
$req_blocks_analysis = new XML_RPC_Value(array(
new XML_RPC_Value("DetailsDO.CallsOK")
), "array");
// Parameters: General invocation parameters - see the documentation
$params = array(
new XML_RPC_Value("801"),
new XML_RPC_Value("robot"),
new XML_RPC_Value("robot"),
new XML_RPC_Value(""),
new XML_RPC_Value(""),
new XML_RPC_Value("2014-09-30.00:00:00"),
new XML_RPC_Value("2014-09-30.23:59:59"),
new XML_RPC_Value(""),
$req_blocks_analysis
);
$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 );
}
// ---------------------------------------
// PART 2: QM QA FORM GRADING
// Blocks: Set which response blocks we are looking for
$req_blocks_qaitems = new XML_RPC_Value(array(
new XML_RPC_Value(array(
new XML_RPC_Value("ENE"),
new XML_RPC_Value("75")
))
), "struct");
$req_blocks_notes = new XML_RPC_Value(array(
new XML_RPC_Value("")
), "array");
$req_blocks_analysis = new XML_RPC_Value(array(
new XML_RPC_Value("DetailsDO.CallsOK")
), "array");
// Parameters: General invocation parameters - see the documentation
$params = array(
new XML_RPC_Value("801"),
new XML_RPC_Value("robot"),
new XML_RPC_Value("robot"),
new XML_RPC_Value("2014-09-30.00:00:00"),
new XML_RPC_Value("86400"),
new XML_RPC_Value("Encuesta"),
new XML_RPC_Value("1412105718.6"),
new XML_RPC_Value("grader"),
$req_blocks_qaitems,
$req_blocks_notes,
$req_blocks_analysis
);
$msg = new XML_RPC_Message('QM.qaformgrading', $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 );
}
?>
--- End code ---
And this is my result:
--- Quote ---Response block: result
Status OK
Description
Time elapsed (ms) 26
QM Version 14.03.3
Response block: DetailsDO.CallsOK
Date Caller Queue IVR Wait Duration Pos. Disconnection Handled by Attempts Code Stints Srv
09/30 - 15:35:18 102 PRUEBA-QA 0:00 0:05 0:42 1 Agent agent/john doe 1
09/30 - 15:43:25 102 PRUEBA-QA 0:00 0:04 0:35 1 Agent agent/john doe 1
Response block: result
Status OK
Description
Time elapsed (ms) 30
QM Version 14.03.3
Response block: DetailsDO.CallsOK
Date Caller Queue IVR Wait Duration Pos. Disconnection Handled by Attempts Code Stints Srv
09/30 - 15:35:18 102 PRUEBA-QA 0:00 0:05 0:42 1 Agent agent/john doe 1
09/30 - 15:43:25 102 PRUEBA-QA 0:00 0:04 0:35 1 Agent agent/john doe 1
--- End quote ---
I suspect there is something wrong with my struct, as everything else seems to work, and I'm getting no errors. However, the QA form is not filled :(
Thanks!
mirkox:
Hello eduararley,
I'm not sure about your question; I mean, you are comparing the result of DetailsDO.CallsOK, before and after you filled in the QA module; it's normal you don't see changes since DetailsDO.CallsOK it's only the calls list and doesn't contains information regarding QA. Try looking manually in QueueMetrics if the form is filled in from your script, just to test.
Let me know if I misunderstood your request :)
Kind Regards
Mirko
eduararley:
Hello Mirko, thanks for your reply.
Yes, I've looked manually in QueueMetrics (I've clicked on the magnifier icon to check call details, and then on QA tab), but I don't see the QA form filled. I've reloaded the report, and also logged out/in from QueueMetrics, but still don't see anything. However, if I fill manually the QA form, the data is saved OK.
About the DetailsDO.CallsOK analysis, it's just something I call to make sure that the date and time data is OK, so the right call is retrieved. I don't use that info for anything else. What I just want is to fill que QA form, nothing else.
Thanks!
Navigation
[0] Message Index
Go to full version