Support Overview

Tutorials

Client API Usage Examples

Upgrade Information

FAQ

New Release History

You are here:   Visualware >   MyConnection Server >   Support >   Client API Usage Examples >   Get results using the Test ID number

Get results using the Test ID number

The example below shows how to get a set of results using only the Test ID number. (this number is displayed in the test applet after every test).

This example is for the VoIP test only and is designed to showcase this feature of MCS.

For this example use Test ID 3209.

Enter Test ID: Get Results

Examples of where a Test ID is shown

  

Code Required

Copy the code below between the <head> </head> sections of the web page.

The only change that will be needed is the MCS domain name/IP, highligted in red below.

This should be changed to the domain/IP of your MyConnection Server installation.

<script>

/*
Currently available VoIP Metrics:

IP
Date
Upstream_jitter
Downstream_jitter
Upstream_Maximum_jitter
Downstream_Maximum_jitter
Upstream_packet_loss
Downstream_packet_loss
Upstream_packet_order
Downstream_packet_order
Packet_discards
MOS
REGISTER_ms
INVITE_ms
BYE_ms
RTTMin
RTTAvg
RTTMax
RTT_Consistency
Upstream_Loss_distribution
Downstream_Loss_distribution
SIP_ALG
*/

// Specify messages to be used depending on the MOS score

var mosMessage = "";
var mosImage = "";
var mosTextColor = "";
var mosRed = "The quality of this connection must drastically improve to fully support VoIP";
var mosYellow = "The quality of this connection must improve to fully support VoIP";
var mosGreen = "The quality of this IP connection is sufficient to support voice traffic";

function getResults() {

//Get Test ID from the form text field

var recId = 0;
recId = document.getElementById('recordIdField').value;

//JQuery script to import MCS results in JS format
// .done executes code should the 'getScript' command succeed
// .fail executes code should the 'getScript' command fail

$.getScript("http://74.204.190.8/myspeed/db/report?id=" + recId + "&fm=js")
.done(function() {

// Define the coloring depending on the MOS result

if (MOS >= 3.8) {
mosMessage = mosGreen;
mosImage = "green.png";
mosTextColor = "#FFFFFF"
}
else if (MOS >= 3.4) {
mosMessage = mosYellow;
mosImage = "yellow.png";
mosTextColor = "#000000"
}
else {
mosMessage = mosRed;
mosImage = "red.png";
mosTextColor = "#FFFFFF"

}

// Determine good/average/bad results for Jitter and Loss
// Padding is used for the bad-to-good color scale

if (Upstream_jitter <= 5) { upJitPad = 160 }
else if (Upstream_jitter <= 20) { upJitPad = 85 }
else { upJitPad = 0 }

if (Upstream_packet_loss <= 1) { upLossPad = 160 }
else if (Upstream_packet_loss <= 2) { upLossPad = 85 }
else { upLossPad = 0 }

if (Downstream_jitter <= 5) { downJitPad = 160 }
else if (Downstream_jitter <= 20) { downJitPad = 85 }
else { downJitPad = 0 }

if (Downstream_packet_loss <= 1) { downLossPad = 160 }
else if (Downstream_packet_loss <= 2) { downLossPad = 85 }
else { downLossPad = 0 }

// Create the table for displaying results

table = "<p class='sectiontitle20'>";
table += "VoIP Test ID: " + recId + "<br>";

table += "</p>";

table += "<table cellpadding='5' cellspacing='0' width='600'>";
table += "<tr>";
table += "<td style=\"background-image:url('images/" + mosImage + "'); background-repeat:no-repeat; background-position:center; height:80px; color:"+mosTextColor+";\" width='100' align='center' valign='middle' class='sectiontitle18'>" + MOS + "<br>MOS</td>";
table += "<td width='500' align='left' valign='middle'>" + mosMessage + "</td>";
table += "</tr>";
table += "</table>";


table += "<table cellpadding='5' cellspacing='0' width='500'>";

table += "<tr>";
table += "<td width='150' valign='bottom' align='right' style='padding-right:10px;'>Upstream Jitter</td>";
table += "<td style=\"background-image:url('images/resultScaleSmall.png'); background-repeat:no-repeat; background-position:bottom left; height:50px;\"><img src='images/indicator.png' style='padding-left:" + upJitPad + "px;'></td>";
table += "<td width='100' valign='bottom' align='left' style='padding-left:10px;'>" + Upstream_jitter + "ms</td>";
table += "</tr>";
table += "<tr>";
table += "<td valign='bottom' align='right' style='padding-right:10px;'>Upstream Loss</td>";
table += "<td style=\"background-image:url('images/resultScaleSmall.png'); background-repeat:no-repeat; background-position:bottom left; height:50px;\"><img src='images/indicator.png' style='padding-left:" + upLossPad + "px;'></td>";
table += "<td valign='bottom' align='left' style='padding-left:10px;'>" + Upstream_packet_loss + "%</td>";
table += "</tr>";
table += "<tr>";
table += "<td valign='bottom' align='right' style='padding-right:10px;'>Downstream Jitter</td>";
table += "<td style=\"background-image:url('images/resultScaleSmall.png'); background-repeat:no-repeat; background-position:bottom left; height:50px;\"><img src='images/indicator.png' style='padding-left:" + downJitPad + "px;'></td>";
table += "<td valign='bottom' align='left' style='padding-left:10px;'>" + Downstream_jitter + "ms</td>";
table += "</tr>";
table += "<tr>";
table += "<td valign='bottom' align='right' style='padding-right:10px;'>Downstream Loss</td>";
table += "<td style=\"background-image:url('images/resultScaleSmall.png'); background-repeat:no-repeat; background-position:bottom left; height:50px;\"><img src='images/indicator.png' style='padding-left:" + downLossPad + "px;'></td>";
table += "<td valign='bottom' align='left' style='padding-left:10px;'>" + Downstream_packet_loss + "%</td>";
table += "</tr>";

table += "</table>";

//Set table to occupy a div

document.getElementById('results').innerHTML = table;
})

.fail(function() {
console.log("fail");
});


}

</script>


Copy and paste the entire code where you want the Test ID Text Box to appear.

The <div> is where the table of results will appear once a valid Test ID has been entered. This can be placed elsewhere if required.

Enter Test ID: <input type="text" style="width:100px;" id="recordIdField">
<a href="javascript:getResults()">Get Results</a>

<br>
<div id="results"></div>


 

MyConnection Server

Home
Online Testing Portal
Download
Purchase
Resources
Support

Visualware Products

VisualRoute
eMailTrackerPro
Visual IP Trace

   

© Visualware Inc. 2017 - All Rights Reserved