/**
BEFORE RUNNING: Change the User/Password/Server values
There is a handler toolstep that can give you this value, but outside the handler we have to calculat it ourselves.
From the Handler Documentation:
Wait time is calculated using the average wait time for the queue and subtracting the amount of time that the call
has been on the queue. Average wait time is calculated by adding the total wait time for all calls answered in a given period
(the previous 30 minutes) and dividing that total by the number of calls answered in that period.
((Previous Period Total Wait Time) / (Previous Period Total Calls)) - (Current Call Wait Time)
In ICWS, there is a stat for average wait time:
Average Wait Time
StatID: inin.workgroup:AverageWaitTime
Type: statisticDurationValue
Parameters:
ININ.People.WorkgroupStats:Workgroup
ININ.Queue:Interval
Through a series of ICWS calls, we will connect to the server, find the workgroup for the call, get the workgroup statistics, then do the calculations for wait time and output the estimated wait time in an alert.
**/
var APPNAME = "EstimatedWaitTime";
var sessionId = null;
var csrfToken = null;
var userId = "kevin.glinski";
var password = "1234";
var server = "http://morbo.dev2000.com:8018/icws/";
function getWaitTime() {
sessionId = null;
csrfToken = null;
var interactionId = document.getElementById('callIdInput').value;
loginData = {
"__type": "urn:inin.com:connection:icAuthConnectionRequestSettings",
"applicationName": APPNAME,
"userID": userId,
"password": password
};
//Connect to the server
sendRequest("POST", "connection", loginData, function (data) {
sessionId = data.sessionId;
csrfToken = data.csrfToken;
//Get the Queue name and when the interaction entered the queue
//Eic_WorkgroupQueueTimestamp,Eic_WorkgroupName
sendRequest("GET", "/interactions/" + interactionId +...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Fiddle Pages
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Get Fiddle Pages with PRO
Your fiddles accessible under a custom domain and a vanity path - the simplest hosting for your personal project.