Source: src/IntegrationApi.js

let instance = null;
let token = null;
/**
 * Component to send or receive data
 */
export class IntegrationAPI {
    constructor(params) {
        if (!instance) {
            instance = this;
            this.Parameters = params;
            this.WSParameters = {
                server: "",
                port: "",
                sendKeepAlive: true,
                secureConnection: false
            }
        }
        return instance;
    }

    /**
     * @description Mark the call.
     * @link addMark
     * @tutorial CallControl
     */
    addMark() {
        this.Parameters.callBarService.addMark()
    }

    /**
     * @description Make an assisted call to an ACD.
     * @param {string} id ACD ID
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedDialACD
     * @tutorial AssistedTransfer
     */
    assistedDialACD(id) {
        this.Parameters.assistedTransferService.assistedDialACD(id);
    }

    /**
     * @description Make an assisted call to an agent.
     * @param {string} ext Agent extension
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedDialAgent
     * @tutorial AssistedTransfer
     */
    assistedDialAgent(extAgent) {
        this.Parameters.assistedTransferService.assistedDialAgent(extAgent);
    }

    /**
     * @description Make an assisted call to an external number.
     * @param {string} phone Phone number to call
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedDialNumber
     * @tutorial AssistedTransfer
     */
    assistedDialNumber(phone) {
        this.Parameters.assistedTransferService.assistedDialNumber(phone);
    }

    /**
     * @description Hang up the main call.
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedXFerDropFirstCall
     * @tutorial AssistedTransfer
     */
    assistedXFerDropFirstCall() {
        this.Parameters.assistedTransferService.assistedXFerDropFirstCall();
    }

    /**
     * @description Hang up the second call.
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedXFerDropSecondCall
     * @tutorial AssistedTransfer
     */
    assistedXFerDropSecondCall() {
        this.Parameters.assistedTransferService.assistedXFerDropSecondCall();
    }

    /**
     * @description Hang up the second call.
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedXFerHangUP
     * @tutorial AssistedTransfer
     */
    assistedXFerHangUP() {
        this.Parameters.assistedTransferService.assistedXFerHangUP();
    }

    /**
     * @description Leave the conference and transfer the call to the main and second call.
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} status change}
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedXFerLeaveConference
     * @tutorial AssistedTransfer
     */
    assistedXFerLeaveConference() {
        this.Parameters.assistedTransferService.assistedXFerLeaveConference();
    }

    /**
     * @description Starts a conference between the main call, the second one and the agent.
     *  {@link assistedXFerUseMainCall}
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedXFerMakeConference
     * @tutorial AssistedTransfer
     */
    assistedXFerMakeConference() {
        this.Parameters.assistedTransferService.assistedXFerMakeConference();
    }

    /**
     * @description Transfer main call to the second call.
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} status change
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedXFerTransferCalls
     * @tutorial AssistedTransfer
     */
    assistedXFerTransferCalls() {
        this.Parameters.assistedTransferService.assistedXFerTransferCalls();
    }

    /**
     * @description Select the main call, the second call remains on hold.
     * @fires CORE_APIEvents#{@link event:onMainCall |onMainCall } change to main call
     * fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedXFerUseMainCall
     * @tutorial AssistedTransfer
     */
    assistedXFerUseMainCall() {
        this.Parameters.assistedTransferService.assistedXFerUseMainCall();
    }

    /**
     * @description Select the second call and the main call remains on hold.
     * @fires CORE_APIEvents#{@link event:onSecondCall |onSecondCall } change to the second call
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link assistedXFerUseSecondCall
     * @tutorial AssistedTransfer
     */
    assistedXFerUseSecondCall() {
        this.Parameters.assistedTransferService.assistedXFerUseSecondCall();
    }

    /**
     * @description Save disposition and reschedule call-in.
     * @fires CORE_APIEvents#{@link event:onDisposeApplied|onDisposeApplied} on sucess
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @param {uint} id ACD ID
     * @param {int} dispositionId  Disposition ID
     * @param {int} callId Call ID
     * @param {string} dateCallback Callback date yyyy/MM/dd HH:mm
     * @param {string} phone Phone number to callback
     * @param {string} callKey ID provided by the client
     * @param {string} data1 Value is saved in the field: data1
     * @param {string} data2 Value is saved in the field: data2
     * @param {string} data3 Value is saved in the field: data3
     * @param {string} data4 Value is saved in the field: data4
     * @param {string} data5 Value is saved in the field: data5
     * @param {boolean} existNum Determine which number will be dialed (true:The one assigned in the phone parameter, false:The number already exists in the system).
     * @param {int} subId Sub disposition ID (If it does not exist, assign the value of zero).
     * @example CallBackAcd(1, 1, 1200, "2023-02-01 09:00", "0011223344", "5845", "data1", "data2", "data3", "data4", "data5", false , 1); // Telephone number do not exists in the system.
     * @example CallBackAcd(1, 1, 1200, "2023-02-01 09:00", "", "5845", "data1", "data2", "data3", "data4", "data5", true , 1); // Telephone number exists in the system.
     * @link reprogramAcdCall
     * @see getPhoneNumbers
     * @tutorial InboundDispositions
     */
    CallBackAcd(id, dispositionId, callId, dateCallback, phone, callKey, data1, data2, data3, data4, data5, existNum, subDis) {
        this.Parameters.reprogamCallService.CallBackAcd(id, dispositionId, callId, dateCallback, phone, callKey, data1, data2, data3, data4, data5, existNum, subDis);
    }

    /**
     * @description Change agent password.
     * @fires CORE_APIEvents#{@link event:onPasswordUpdated|onPasswordUpdated} on sucess
     * @fires CORE_APIEvents#{@link event:errorOnPasswordChange|errorOnPasswordChange} on error
     * @fires CORE_APIEvents#{@link event:onErrorPasswordUpdate |onErrorPasswordUpdate} on error
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @param {string} currentPassword Current password
     * @param {string} newPassword New password
     * @example ChangePassword("passwordCurrent", "NewPassword");
     * @link ChangePassword
     * @tutorial DataAgent
     */
    ChangePassword(currentPassword, newPassword) {
        this.Parameters.loginService.ChangePassword(currentPassword, newPassword);
    }

    /**
     * @description Close session.
     * @fires CORE_APIEvents#{@link event:onLogOut|onLogOut} on sucess
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @example closeSession();
     * @tutorial DataAgent
     * @link CloseSession
     */
    closeSession() {
        this.Parameters.loginService.closeSession();
    }

    /**
     * @description For the websocket connection we have to have access to the token <br/>
     * http://serverNuxibaIPorDomain/AgentKolob/IntegrationToken.html
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} returns  SocketClosed o Error
     * @tutorial index
     */
    connectToServer() {
        let newToken = localStorage.getItem('NuxibaTokenAgent');
        if (!newToken) {
                instance.Parameters.SingletonWebSocket.setToken(newToken);
                instance.connectToServerAfterToken();
                console.log('[TokenFromCRM] Token setted: ',newToken);
        } else {
            instance.Parameters.SingletonWebSocket.setToken(newToken);
            instance.connectToServerAfterToken();
            console.log('[TokenFromCRM] Updating Connection: ', newToken);
        }
    }

    /**
     * @description Internal method to make the connection after getting the token from the page: AgentKolob/IntegrationToken.html
     */
    connectToServerAfterToken() {
        this.Parameters.SingletonWebSocket.setwsServer(this.WSParameters.server);
        let port = 1337;
        if (!this.WSParameters.port) {
            port = this.WSParameters.secureConnection ? 1338 : 1337;
        } else {
            port = this.WSParameters.port
        }
        this.Parameters.SingletonWebSocket.setPort(port);
        this.Parameters.SingletonWebSocket.setKeepAlive(this.WSParameters.sendKeepAlive);
        setTimeout(() => { this.Parameters.SingletonWebSocket.connect(this.WSParameters.secureConnection); }, 25);
    }

    /**
     * @description Close the connection between the websocket and the server
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} returns status SocketClosed or Error
     * @tutorial index
     */
    disconnectToServer() {
        this.Parameters.SingletonWebSocket.close();
    }

    /**
     * @description Save disposition (call-in) without callback.
     * @fires CORE_APIEvents#{@link event:onDisposeApplied|onDisposeApplied} on sucess
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @fires CORE_APIEvents#{@link event:onReprogramCall|onReprogramCall} Disposition has callback
     * @param {int} dispositionId Disposition ID
     * @param {int} callID Call ID
     * @param {int} subDispositionId Sub disposition ID (If it does not exist, assign the value of zero ).
     * @link disposeACDCall
     * @example disposeACDCall(1, 45, 45); // With subdisposition ID.
     * @example disposeACDCall(2, 45, 0); // Without sub disposition ID.
     * @see reprogramAcdCall
     * @tutorial InboundDispositions
     */
    disposeACDCall(dispositionId, callID, subId) {
        this.Parameters.dispositionCallService.disposeACDCall(dispositionId, callID, subId);
    }

    /**
     * @description Save disposition (call-out) without callback.
     * @todo The method fails
     * @fires CORE_APIEvents#{@link event:onDisposeApplied|onDisposeApplied} on sucess
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @fires CORE_APIEvents#{@link event:onReprogramCall|onReprogramCall} Disposition has callback
     * @param {int} dispositionId Disposition ID
     * @param {int} camId Campaign ID
     * @param {int} callID Call ID
     * @param {int} subId Sub disposition ID (If it does not exist, assign the value of zero )
     * @link disposeCampaingCall
     * @see reprogramCampaignCall
     * @example disposeCampaingCall(1, 1, 123, 0); // Without sub disposition ID.
     * @example disposeCampaingCall(1, 1, 123, 1); // With sub disposition ID.
     * @tutorial OutboundDispositions
     */
    disposeCampaingCall(dispositionId, camId, callID, subId) {
        this.Parameters.dispositionCallService.disposeCampaingCall(dispositionId, camId, callID, subId);
    }

    /**
     * @description Save disposition (chat)
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @param {uint} chatId Chat ID
     * @param {uint} dispId Disposition ID
     * @param {uint} subDispId Sub disposition ID (If it does not exist, assign the value of zero )
     * @link disposeClientChat
     * @see getACDDispositions
     * @example disposeClientChat(1, 1, 0); // Without sub disposition
     * @example disposeClientChat(2, 2, 45); // With sub disposition
     * @tutorial ChatClient
     */
    disposeClientChat(chatId, dispId, subDispId) {
    }

    /**
     * @description Send dialing tones.
     * @param {string} digit Send digits from 0 to 9, * and #
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @fires CORE_APIEvents#{@link event:errorOnDTMFJS|errorOnDTMFJS} send error
     * @example DTMFDigit("2");
     * @link DTMFDigit
     * @tutorial CallControl
     */
    DTMFDigit(digit) {
        this.Parameters.callBarService.DTMFDigit(digit);
    }

    /**
     * @description Exit assisted mode.
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link exitAssistedMode
     * @tutorial exitAssistedMode
     */
    exitAssistedMode() {
        this.Parameters.assistedModeService.exitAssistedMode();
    }

    /**
     * @description End conversation
     * @param {uint} chatId Chat ID
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @fires CORE_APIEvents#{@link event:onClientChatWrapUpStarted|onClientChatWrapUpStarted} starts wrap up
     * @link finishClientChatConversation
     * @example finishClientChatConversation(1);
     * @tutorial ChatClient
     */
    finishClientChatConversation(chatId) {
    }

    /**
     * @description Get inbound calls dispositions list.
     * @fires CORE_APIEvents#{@link event:onDispositions|onDispositions} returns the list
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @param {int} id ACD ID
     * @link getACDDispositions
     * @example getACDDispositions(1);
     * @tutorial InboundDispositions
     */
    getACDDispositions(id) {
        this.Parameters.dispositionCallService.getACDDispositions(id);
    }

    /**
     * @description Retrieves the agent ID.
     * @fires CORE_APIEvents#{@link event:agentId|agentId} event to retrieve the agent ID
     * @link GetAgentID
     */
    GetAgentID() {
        this.Parameters.agentDataService.GetAgentID();
    }

    /**
     * @description Get the calls record of the day.
     * @fires CORE_APIEvents#{@link event:onCallHistory|onCallHistory} returns call record list
     * @fires CORE_APIEvents#{@link event:errorOnCallHistory|errorOnCallHistory} on error
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link getCallHistory
     */
    getCallHistory() {
        this.Parameters.callLog.getCallHistory();
    }

    /**
     * @description Get the dispositions and sub dispositions list.
     * @fires CORE_APIEvents#{@link event:onDispositions|onDispositions} returns the disposotions and sub dispositions list
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @param {int} id Campaign ID
     * @link getCampaignDispositions
     * @example getCampaignDispositions(1);
     * @tutorial OutboundDispositions
     */
    getCampaignDispositions(id) {
        this.Parameters.dispositionCallService.getCampaignDispositions(id);
    }

    /**
     * @description Get the dispositions, sub dispositions and phone numbers list to make a callback.
     * @fires CORE_APIEvents#{@link event:onDispositionsAndNumbers|onDispositionsAndNumbers} returns the list
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @param {uint} id Campaign ID
     * @param {uint} callOutID Callout ID
     * @link getCampaignDispositionsAndNumbers
     * @example getCampaignDispositionsAndNumbers(1,1520);
     * @tutorial OutboundDispositions
     */
    getCampaignDispositionsAndNumbers(id, callOutID) {
        this.Parameters.reprogamCallService.getCampaignDispositionsAndNumbers(id, callOutID);
    }

    /**
     * @description Get the asigned manual dialing campaigns list.
     * @fires CORE_APIEvents#{@link event:onCampaigns|onCampaigns} returns the campaigns list
     * @fires CORE_APIEvents#{@link event:errorOnCampaignsRelated|errorOnCampaignsRelated} on error
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link GetCampaignsRelated
     * @tutorial ManualCall
     */
    getCampaignsRelated() {
        this.Parameters.callService.GetCampaignsRelated();
    }

    /**
     * @description Get chat templates.
     * @fires CORE_APIEvents#{@link event:onChatAnswerTemplates|onChatAnswerTemplates} Templates list
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @param {uint} id ACD ID
     * @link getChatAnswerTemplates
     * @example getChatAnswerTemplates(1);
     * @tutorial ChatClient
     */
    getChatAnswerTemplates(id) {
    }

        /**
     * @description Get chat history.
     * @fires CORE_APIEvents#{@link event:onAdministrators|onAdministrators} returns chat history
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link getChatHistory
     * @tutorial ChatAdminstrator
     */
        getChatHistory(admin) {
            this.Parameters.chatService.getChatHistory(admin);
        }

    /**
     * @description Get the dispositions and sub dispositions list.
     * @fires CORE_APIEvents#{@link event:onDispositions|onDispositions} returns the dispositions and sub dispositions list
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link getDispositions
     * @tutorial OutboundDispositions
     */
    getDispositions() {
        this.Parameters.dispositionCallService.getDispositions();
    }

    /**
     * @description Retrieves the agent extension.
     * @fires CORE_APIEvents#{@link event:extension|extension} Event to retrieve the agent's extension
     * @link GetExtension
     */
    GetExtension() {
        this.Parameters.agentDataService.GetExtension();
    }

    /**
     * @description Get the IVR list.
     * @fires CORE_APIEvents#{@link event:onIVRList|onIVRList}  returns the IVR list
     * @link getIVRList
     * @tutorial IVR
     */
    getIVRList() {
        this.Parameters.ongoingCallIvrService.getIVRList();
    }

    /**
     * @description Retrieve last call data.
     * @example
     * {
     * CalKey:"new2",
     * CallId: 275,
     * CallOutId: 376,
     * CallType: 2,
     * DNIS: "",
     * DataContact: ["Data1","Data2","Data3","Data4","Data5"],
     * DataKeyValue: "0:0",
     * Description: "Sales",
     * EngineId: 1,
     * HoldTime: "",
     * Id: 3,
     * IsACDTransfer: false,
     * IsQueueCall: false,
     * Phone: "2012",
     * Port: 2,
     * WaitingTime: 0,
     * WrapUpTime: 600,
     * allowACDCallBack: true,
     * holdTime: true,
     * secondPhone: 0
     * }
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link getLastCallData
     * @tutorial CallInformation
     */
    GetLastCallData() {
        return this.Parameters.SingletonSharedData.getLastDataCall();
    }

    /**
     * @description Get the phone numbers list to make callback.
     * @param {Number} callOutID Register ID
     * @fires CORE_APIEvents#{@link event:onPhoneNumbers|onPhoneNumbers} returns the phone numbers list
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link getPhoneNumbers
     * @example getPhoneNumbers(1520);
     * @tutorial OutboundDispositions
     */
    getPhoneNumbers(callOutID) {
        this.Parameters.reprogamCallService.getPhoneNumbers(callOutID);
    }

    /**
     * @description Get the online admins list.
     * @fires CORE_APIEvents#{@link event:onAdministrators|onAdministrators} returns the online admins list
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link getSupervisorsToChat
     * @tutorial ChatAdminstrator
     */
    getSupervisorsToChat() {
        this.Parameters.chatService.getSupervisorsToChat();
    }

    /**
     * @description  Get the transfer options.
     * @fires CORE_APIEvents#{@link event:onTransferOptions|onTransferOptions}  returns the transfer options list
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link getTransfersOptions
     * @tutorial BlindTransfer
     */
    getTransfersOptions() {
        this.Parameters.callService.getTransfersOptions();
    }

    /**
     * @description Get the unavailable status used in the day.
     * @fires CORE_APIEvents#{@link event:onUnavailableHistory|onUnavailableHistory} returns the unavailable status usted list
     * @fires CORE_APIEvents#{@link event:errorOnUnavailableStatusHistory|errorOnUnavailableStatusHistory} on error
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link getUnavailableHistory
     */
    getUnavailableHistory() {
        this.Parameters.notAvailableService.getUnavailableHistory();
    }

    /**
     * @description Get the unavailable status asigned list.
     * @fires CORE_APIEvents#{@link event:onUnavailableTypes|onUnavailableTypes} returns the unavailable staus asigned list
     * @fires CORE_APIEvents#{@link event:errorOnUnavailableStatus|errorOnUnavailableStatus} on error
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @example getUnavailables();
     * @link getUnavailables
     * @tutorial Unavailable
     */
    getUnavailables() {
        this.Parameters.notAvailableService.getUnavailables();
    }

    /**
    * @description Retrieves the username.
    * @link GetUserName
    */
    GetUserName() {
        this.Parameters.agentDataService.GetUserName();
    }

    /**
     * @description Hang up call and leave a message.
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link HangUpCall
     * @tutorial CallControl
     */
    hangUpAndLeaveMessage() {
        this.Parameters.callService.hangUpAndLeaveMessage();
    }

    /**
     * @description Hang up call.
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link HangUpCall
     * @tutorial CallControl
     */
    hangUpCall() {
        this.Parameters.callService.HangUpCall();
    }

    /**
     * @description Cancel the manual dialing before the client answer the phone.
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} status change
     * @fires CORE_APIEvents#{@link event:onDialResult|onDialResult} dialing results
     * @link HangUpManualDial
     * @tutorial ManualCall
     */
    hangUpManualDial() {
        this.Parameters.callService.HangUpManualDial();
    }

    /**
     * @description Put or quit hold during the call.
     * @todo event is not implemented
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @fires CORE_APIEvents#{@link event:onHold|onHold}  event is not implemented
     * @link HoldCall
     * @tutorial CallControl
     */
    HoldCall() {
        this.Parameters.callBarService.HoldCall()
    }

    /**
     * @description Starts an IVR block, the agent remains waiting until the IVR stops playing.
     * @param {int} id IVR block
     * @fires CORE_APIEvents#{@link event:onIdleStart|onIdleStart} starts the IVR block on the client side
     * @link idleStart
     * @tutorial IVR
     */
    idleStart(id) {
        this.Parameters.ongoingCallIvrService.idleStart(id);
    }

    /**
     * @description Login.
     * @param {string} username Username
     * @param {string} password Password
     * @fires CORE_APIEvents#{@link event:onLogin|onLogin} on sucess
     * @fires CORE_APIEvents#{@link event:remoteLoginError|remoteLoginError} on error
     * @example login("testAgent","testPassword");
     * @tutorial DataAgent
     * @link login
     */
    login(username, password) {
        this.Parameters.loginService.login(username, password);
    }

    /**
     * @description Do manual dialing.
     * @fires CORE_APIEvents#{@link event:wrongNumber|wrongNumber} Phone does not meet the dialing rules
     * @fires CORE_APIEvents#{@link event:onDialingNumber|onDialingNumber} on sucess
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} status change
     * @fires CORE_APIEvents#{@link event:numberOnDoNotCallList|numberOnDoNotCallList} Phone number is in a black list
     * @fires CORE_APIEvents#{@link event:timeZoneNumber|timeZoneNumber} Phone number can't be dialed in this schedule
     * @fires CORE_APIEvents#{@link event:onDialResult|onDialResult} dialing results
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @param {String} phone Phone number to dial
     * @param {int} id  Campaign ID
     * @param {String} clientName [clientName= ] client's name
     * @param {String} callKey [callKey= null] Id asigned by the client
     * @example makeManualCall('11078510',1,'Jesus','4582 3423 4865')  //All the parameters
     * @example makeManualCall('11078510',10)  //Only required parameters
     * @see getUnavailables
     * @tutorial ManualCall
     */
    makeManualCall(phone, id, clientName, callKey) {
        this.Parameters.callService.makeManualCall(phone, id, clientName, callKey);
    }

    /**
     * @description Cancel a manual call that was rescheduled.
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @example cancelManualCallReprogramed()
     * @tutorial ManualCall
     */
    cancelManualCallReprogramed() {
        this.Parameters.callService.cancelManualCallReprogramed();
    }

    /**
     * @description Start or stop the recording.
     * @link addMark
     * @tutorial CallControl
     */
    recordingStopStart() {
        this.Parameters.callBarService.recordingStopStart();
    }

    /**
     * @description Disposition a call with callback.
     * @fires CORE_APIEvents#{@link event:onDisposeApplied|onDisposeApplied} on sucess
     * @param {uint} camId Campaign ID
     * @param {uint} dispositionId Disposition ID
     * @param {uint} callID Call ID
     * @param {String} dateCallback Call back date yyyy/MM/dd HH:mm
     * @param {String} phone Phone number to callback
     * @param {Boolean} existNum Determine which number will be dialed (true:The one assigned in the phone parameter, false:The number already exists in the system).
     * @param {int} subDispositionId Sub disposition ID (If it does not exist, assign the value of zero ).
     * @link reprogramCampaignCall
     * @example reprogramCampaignCall(1, 1, 123, "2019/04/23 13:35", "11078510", false, 0);
     * @example reprogramCampaignCall(1, 1, 123, "2019/04/23 13:35", "", true,0);
     * @tutorial OutboundDispositions
     */
    reprogramCampaignCall(idCampaign, idDisposition, callID, dateCallback, phone, existNum, subId) {
        this.Parameters.reprogamCallService.reprogramCampaignCall(idCampaign, idDisposition, callID, dateCallback, phone, existNum, subId);
    }

    /**
     * @description Save Disposition without callback.
     * @fires CORE_APIEvents#{@link event:onDisposeApplied|onDisposeApplied} on sucess
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @fires CORE_APIEvents#{@link event:onReprogramCall|onReprogramCall} Disposition has callback
     * @link saveDisposition
     * @tutorial exitAssistedMode
     */
    saveDisposition(callID, dispositionId, subId) {
        this.Parameters.dispositionCallService.saveDisposition(callID, dispositionId, subId);
    }

    /**
     * @description Send message to the admin.
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @param {string} administrator Admin's name
     * @param {string} message Message
     * @link sendChatMessage
     * @see getSupervisorsToChat
     * @example sendChatMessage("root","Hola como te va es un mensaje de prueba");
     * @tutorial ChatAdminstrator
     */
    sendChatMessage(administrator, message) {
        this.Parameters.chatService.sendClientChatMessage();
    }

    /**
     * @description Send message to the client.
     * @param {uint} adminId Admin ID
     * @param {String} message Message
     * @see {@link event:onClientChatConnected|onClientChatConnected} chat info
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link sendClientChatMessage
     * @example sendClientChatMessage(1,"Hola buenod dias en que puedo ayudarlo");
     * @tutorial ChatClient
     */
    sendClientChatMessage(adminId, message) {
        this.Parameters.chatService.sendClientChatMessage(adminId, message);
    }

    /**
     * @description Mute the microphone.
     * @todo event is not implemented
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @fires CORE_APIEvents#{@link event:onMute|onMute} status microphone muted
     * @link setMute
     * @tutorial CallControl
     */
    setMute() {
        this.Parameters.callBarService.setMute();
    }

    /**
     * @description Asign an unavailable status.
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} on sucess
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @fires CORE_APIEvents#{@link event:errorOnUnavailableStatus|errorOnUnavailableStatus} on error is not implemented
     * @param {int} unavailableId Unavailable status ID
     * @see getUnavailables
     * @example setOnUnavailableStatus(1); //Unavailable status ID
     * @example setOnUnavailableStatus(0); //When the unavailable status does not exist on the list, execute the event: errorOnUnavailableStatus
     * @link setOnUnavailableStatus
     */
    setOnUnavailableStatus(unavailableID) {
        this.Parameters.notAvailableService.setUnavailable(unavailableID);
    }

    /**
     * @description Change to available.
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} status change
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @link SetReady
     * @tutorial Unavailable
     */
    SetReady() {
        this.Parameters.loginService.SetReady();
    }

    /**
     * @description Change to available status with password.
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} status change
     * @fires CORE_APIEvents#{@link event:errorOnAvailableStatus|errorOnAvailableStatus} on error
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @param {string} agentPwd Agent password
     * @param {string} supervisorPwd Supervisor password
     * @link setReadyWithPassword
     * @example setReadyWithPassword("agentPass","adminPass");
     * @tutorial Unavailable
     */
    setReadyWithPassword(agentPwd,supervisorPwd) {
        this.Parameters.loginService.setReadyWithPassword(agentPwd,supervisorPwd);
    }

    /**
     * @description Transfer the call to an ACD.
     * @param {int} id ACD ID
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} status change
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @see getTransfersOptions
     * @link transferCallToACD
     * @example transferCallToACD(1);
     * @tutorial BlindTransfer
     */
    transferCallToACD(id) {
        this.Parameters.callService.transferCallToACD(id);
    }

    /**
     * @description Transfer the call to an agent.
     * @param {int} extensionAgent Agent extension
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus}  status change
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @see getTransfersOptions
     * @link transferCallToAgent
     * @example transferCallToAgent(1);
     * @tutorial BlindTransfer
     */
    transferCallToAgent(extensionAgent) {
        this.Parameters.callService.transferCallToAgent(extensionAgent);
    }

    /**
     * @description Transfer the call to an external phone number.
     * @param {string} phone External phone number
     * @fires CORE_APIEvents#{@link event:onAgentStatus|onAgentStatus} status change
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @see getTransfersOptions
     * @link transferCallToPhoneNumber
     * @example transferCallToPhoneNumber("9988774455");
     * @tutorial BlindTransfer
     */
    transferCallToPhoneNumber(phone) {
        this.Parameters.callService.transferCallToPhoneNumber(phone);
    }

    /**
     * @description Update client's contact info.
     * @todo event is not implemented
     * @fires CORE_APIEvents#{@link event:onDataCallUpdated|onDataCallUpdated} on sucess
     * @fires CORE_APIEvents#{@link event:onError|onError} invalid status
     * @fires CORE_APIEvents#{@link event:errorOnUpdateDataCall|errorOnUpdateDataCall} on error
     * @param {uint} callOutID Identificador de la llamada
     * @param {String} data1 Value is saved in the field: data1
     * @param {String} data2 Value is saved in the field: data2
     * @param {String} data3 Value is saved in the field: data3
     * @param {String} data4 Value is saved in the field: data4
     * @param {String} data5 Value is saved in the field: data5
     * @link UpdateDataCall
     * @example updateCallData(1520,"data1","data2","data3","data4","data5");
     * @tutorial CallInformation
     */
    updateCallData(callOutID, data1, data2, data3, data4, data5) {
        this.Parameters.callService.UpdateDataCall(callOutID, data1, data2, data3, data4, data5);
    }

    /**
     * @description Validate telephony.
     * @tutorial DataAgent
     * @link validateTelephony
     */
    validateTelephony() {
        this.Parameters.loginService.validateTelephony();
    }

    /**
    * @description Speakers and microphone volume control.
    * @param {Number} deviceType Select the audio (0:speakers,1:microphone)
    * @param {Number} xVol Turn the volume (value from  0 to 100)
    * @link controlVolume
    * @example volumeControl(0,70);
    * @example volumeControl(1,70);
    * @tutorial CallControl
    */
    volumeControl(deviceType, xVol) {
        this.Parameters.callBarService.controlVolume(deviceType, xVol);
    }

    /**
    * @description Get Auxiliar Readys list.
    * @param None, not required
    * @example getAuxiliarReadys();
    */
    getAuxiliarReadys(){
        this.Parameters.auxiliarReadysService.getAuxiliarReadys();
    }

    /**
    * @description Get Auxiliar Ready current status.
    * @param None, not required
    * @example getAuxiliarReadyStatus();
    */
    getAuxiliarReadyStatus(){
        this.Parameters.auxiliarReadysService.getAuxiliarReadyStatus();
    }

    /**
    * @description Set Auxiliar Ready.
    * @param {object} JSON.parse value from list Auxiliar Readys
    * @param {string} Value from supervisor password
    * @example let auxiliarReadyObj = JSON.parse(document.getElementById("selectAuxiliarReadys").value);
    * @example setAuxiliarReady(auxiliarReadyObj, "password1");
    */
    setAuxiliarReady(supervisorPwd, auxiliarReadyObj){
        this.Parameters.auxiliarReadysService.setAuxiliarReady(supervisorPwd,auxiliarReadyObj);
    }
}