Feedback

  • Contents
 

User Queue Watcher Script

This JavaScript demonstrates how to use the advanced scripting API to set up a queue watcher for the logged in user, and watch for object added and state change events.

// Queue Watcher for user queue
scripter.myQueue.objectChangedHandler = CallObjectChanged;
scripter.myQueue.objectRemovedHandler = CallObjectRemoved;
scripter.myQueue.callObjectAddedHandler = CallObjectAdded;
// global call object var mg_callObj = scripter.createCallObject();
// function called when call object is added to UserQueue function CallObjectAdded(p_CallObject) {     mg_callObj = p_CallObject; }
function ObjectAdded(p_Type, p_ObjId) {     if (p_Type == 2)     // only interested in call objects     {         mg_callObj.id = p_ObjId;     } }
function CallObjectChanged(p_Type, p_ObjId) {     // will fire whenever object changes state     if (p_Type == 2) //only interested in call objects     {         mg_callObj.id = p_ObjId;     } }
function CallObjectRemoved(p_Type, p_ObjId) {     // will fire when object has been destroyed, which is usually two minutes after disconnect.     if (p_Type == 2)     //only interested in call objects     {         mg_callObj.id = p_ObjId;     } }