Tutorial: 13. Inbound calls dispositions

13. Inbound calls dispositions

Disposition the call

getACDDispositions

To get the Outbound dispositions list, it returns the event: onDispositions

nuxibaIntegration.getACDDispositions(1);

Event onDispositions

Returns the dispositions and subdispositions list.
LoadDisposition is a generic function to fill the 'selects' of dispositions and subdispositions

/**
 * @description Dispositions and subdispositions list
 * @event onDispositions
 * @param {json} callDisposition {
 * dispositions:[{id:int,finishPreview:int,keepOnDial:int,name:string,
 *  subDispositions:[{id:int,finishPreview:int,keepOnDial:int,name:string}]
 *  }]
 * }
 * @@example 
 * {
 * dispositions:[
 *  {
 *      id:1, finishPreview:0, keepOnDial:0, name:"Gestion efectiva", subDispositions: null},
 *  {
 *      id:2, finishPreview:1, keepOnDial:0, name:"Numero Equivocado", 
 *      subDispositions: [ {id:2, finishPreview:1, keepOnDial:0, name:"Numero Equivocado"}]
 *  }
 * ]
 * }
 * @tutorial OutboundDispositions 
 */
function onDispositions(disposition) {
    console.log("onDispositions ", disposition);
    printToConsole("onDispositions");

    document.getElementById("selectDisposition").innerHTML = "";
    let dispositionList = document.getElementById("selectDisposition");


    let option = document.createElement("option");
    option.text = "Select Disposition";
    option.value = 0;
    if (disposition.dispositions.length === 0) {
        dispositionList.add(option);
    } else {

        for (i = 0; i < disposition.dispositions.length; i++) {
            if (disposition.dispositions[i]) {
                let option = document.createElement("option");
                option.text = disposition.dispositions[i].name;
                option.value = disposition.dispositions[i].id;
                dispositionList.add(option);
            }
        }

    }
    dispositionList.addEventListener('change', function (event) {
        var dispositionId = event.target.value;
        var sub;
        for (i = 0; i < disposition.dispositions.length; i++) {
            if (disposition.dispositions[i] && disposition.dispositions[i].id == dispositionId) {
                sub = disposition.dispositions[i].subDispositions;
                break;
            }
        }
        let subDispositionList = document.getElementById("selectSubDisposition");
        subDispositionList.innerHTML = "";

        let option = document.createElement("option");
        option.text = "without SubDisposition";
        option.value = 0;

        if (!sub) {
            subDispositionList.add(option);
            console.log("selectSubDisposition", sub);
        }
        else {
            for (var key in sub) {
                if (sub.hasOwnProperty(key)) {
                    let option = document.createElement("option");
                    option.text = sub[key].name;
                    option.value = sub[key].id;
                    subDispositionList.add(option);
                }
            }
        }

    });
}

disposeACDCall

Disposition a call without callback which returns an on success event onDisposeApplied

nuxibaIntegration.disposeACDCall(1, 45, 45); // con sub-cualificación
nuxibaIntegration.disposeACDCall(2, 45); //Sin sub-cualificación

Evento onDisposeApplied

On sucess calls the next event

/**
 * @description Cuando se realiza la aplicacion de calificar una llamada
 * @see disposeCampaingCall
 * @see reprogramCampaignCall
 * @see disposeCampaingCall
 * @see disposeCampaingCall
 * @event onDisposeApplied
 * @tutorial OutboundDispositions
 */
function onDisposeApplied() {
    console.log("onDisposeApplied");    
}