Feedback

  • Contents
 

Blended Campaign JavaScript


Initialize object added handler

window.onload = Init;
function Init() {
    // queue.objectAddedHandler specifies a procedure to // be called when an object is added to a queue
    // syntax: Queue.objectAddedHandler(TypeId,ObjectId)
    scripter.myQueue.objectAddedHandler = ObjectAdded;
}

Handle incoming call

// Object added handler function: object type and object
// id are passed implicitly
function ObjectAdded(ObjType, ObjId) {
    // ObjType == 2 are call objects
    if (ObjType == 2) {
        // Assign id of the added object to this object
        // This assignment will persist for the duration
        // of the script interaction.
        scripter.callObject.id = ObjId;
        var objCall = scripter.createCallObject();
        objCall.id = ObjId;
        // EIC_Workgroup - legacy naming.  Attributes often start with EIC_
        var workgroup = objCall.getAttribute("EIC_Workgroup");
        // Workgroup queue name is case sensitive.
        // If object is assigned to VOYAGE workgroup
        if (workgroup == "Workgroup Queue:VOYAGE") {
            // Reset the object added handler
            scripter.myQueue.ObjectAddedHandler = null;
            // Launch inbound call script
            location.href = "inboundopen.htm";
        } else {
            // If interaction is not a VOYAGE call
            // release the call object
            scripter.callObject.id = -1;
        }
    }
}