272d563d23113ebe6729a3db4f70e854b874888e
[motion2.git] / server / services / ami / preview / rpcDb.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x7c25=['queuecallercomplete','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopperHistory','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','then','createHistory','catch','[createHistory]\x20','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','rescheduleContact','active','disableContact','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','calleridname','queue','queuecallerjoinAt','answertime'];(function(_0x42dee5,_0x431698){var _0x400bfa=function(_0x27eaf4){while(--_0x27eaf4){_0x42dee5['push'](_0x42dee5['shift']());}};_0x400bfa(++_0x431698);}(_0x7c25,0x70));var _0x57c2=function(_0x1164ed,_0x564dc7){_0x1164ed=_0x1164ed-0x0;var _0x504a87=_0x7c25[_0x1164ed];return _0x504a87;};'use strict';var util=require(_0x57c2('0x0'));var BPromise=require(_0x57c2('0x1'));var logger=require(_0x57c2('0x2'))(_0x57c2('0x3'));var _=require(_0x57c2('0x4'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x57c2('0x5'));var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x57c2('0x6'));var agentReportPreview=require(_0x57c2('0x7'));var voiceQueueReport=require(_0x57c2('0x8'));function loggerCatch(_0x5793e3){return function(_0x5d77fb){logger[_0x57c2('0x9')](_0x5793e3,util[_0x57c2('0xa')](_0x5d77fb,{'showHidden':![],'depth':null}));};}function create(_0x8a3286){return BPromise['resolve']()[_0x57c2('0xb')](cmHopperHistory[_0x57c2('0xc')](_0x8a3286))[_0x57c2('0xd')](loggerCatch(_0x57c2('0xe')));}function createAgent(_0x3a070a){return BPromise[_0x57c2('0xf')]()[_0x57c2('0xb')](agentReportPreview[_0x57c2('0xc')](_0x3a070a))[_0x57c2('0xd')](loggerCatch(_0x57c2('0xe')));}function moveContact(_0x2976f3){return BPromise['resolve']()['then'](cmHopper['moveContactManagedDialer'](_0x2976f3,!![]))[_0x57c2('0xd')](loggerCatch(_0x57c2('0x10')));}exports[_0x57c2('0x11')]=function(_0x4e2cdf){return BPromise[_0x57c2('0xf')]()[_0x57c2('0xb')](cmHopperBlack[_0x57c2('0x11')](_0x4e2cdf))[_0x57c2('0xd')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x57c2('0x12')]=function(_0x192485){return BPromise['resolve']()[_0x57c2('0xb')](cmHopper[_0x57c2('0x12')](_0x192485))[_0x57c2('0xd')](loggerCatch(_0x57c2('0x13')));};exports['createHistory']=function(_0x112501,_0x3ed778){create(_0x112501)[_0x57c2('0xd')](loggerCatch(_0x3ed778));moveContact(_0x112501)[_0x57c2('0xd')](loggerCatch(_0x3ed778));};exports[_0x57c2('0x14')]=function(_0x329a39,_0x3d424f){createAgent(_0x329a39)[_0x57c2('0xd')](loggerCatch(_0x3d424f));};exports['createCustomerHistory']=function(_0xccdebf,_0x4b3861){create(_0xccdebf)[_0x57c2('0xd')](loggerCatch(_0x4b3861));};exports['createCustomerFinal']=function(_0x163618,_0x2cdf0d){moveContact(_0x163618)[_0x57c2('0xd')](loggerCatch(_0x2cdf0d));};exports[_0x57c2('0x15')]=function(_0x139f51,_0x441684,_0x3070af){if(_0x441684){_0x139f51['UserId']=null;}if(_0x3070af){_0x139f51[_0x57c2('0x16')]=![];}return BPromise[_0x57c2('0xf')]()[_0x57c2('0xb')](cmHopper['rescheduleContact'](_0x139f51))[_0x57c2('0xd')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x1dd0de){return BPromise[_0x57c2('0xf')]()['then'](cmHopper['countReScheduled'](_0x1dd0de))[_0x57c2('0xd')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x4c815){return BPromise[_0x57c2('0xf')]()[_0x57c2('0xb')](cmHopper['unlockContact']({'UserId':null},_0x4c815,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x57c2('0x17')]=function(_0x8fc65f){return BPromise['resolve']()[_0x57c2('0xb')](cmHopper[_0x57c2('0x18')]({'active':![]},_0x8fc65f,0x1))[_0x57c2('0xd')](loggerCatch(_0x57c2('0x19')));};exports[_0x57c2('0x1a')]=function(_0x2cf5fd){var _0x46f5f7={};_0x46f5f7[_0x57c2('0x1b')]=_0x2cf5fd[_0x57c2('0x1b')];_0x46f5f7['uniqueid']=_0x2cf5fd['uniqueid'];_0x46f5f7['calleridnum']=_0x2cf5fd['calleridnum'];_0x46f5f7['calleridname']=_0x2cf5fd[_0x57c2('0x1c')];_0x46f5f7['queue']=_0x2cf5fd[_0x57c2('0x1d')];_0x46f5f7[_0x57c2('0x1e')]=_0x2cf5fd['answertime'];_0x46f5f7['queuecallerleaveAt']=_0x2cf5fd[_0x57c2('0x1f')];_0x46f5f7[_0x57c2('0x20')]=0x1;_0x46f5f7['queuecallercompleteAt']=_0x2cf5fd[_0x57c2('0x21')];_0x46f5f7[_0x57c2('0x22')]=_0x2cf5fd[_0x57c2('0x23')];_0x46f5f7['context']=_0x57c2('0x24');_0x46f5f7['exten']=_0x57c2('0x25');_0x46f5f7['holdtime']=0x0;_0x46f5f7[_0x57c2('0x26')]=0x1;_0x46f5f7[_0x57c2('0x27')]=_0x2cf5fd[_0x57c2('0x23')];_0x46f5f7[_0x57c2('0x28')]=_0x57c2('0x29');return BPromise['resolve']()[_0x57c2('0xb')](voiceQueueReport[_0x57c2('0x2a')](_0x46f5f7))[_0x57c2('0xd')](loggerCatch(_0x57c2('0x2b')));};exports[_0x57c2('0x2c')]=function(_0x484d53,_0x346db6){return BPromise[_0x57c2('0xf')]()[_0x57c2('0xb')](cmHopper[_0x57c2('0x2c')](_0x484d53,_0x346db6))[_0x57c2('0xd')](loggerCatch(_0x57c2('0x2d')));};exports[_0x57c2('0x2e')]=function(_0x1e7ae5){return BPromise['resolve']()[_0x57c2('0xb')](cmHopper[_0x57c2('0x15')](_0x1e7ae5,!![],!![]))['catch'](loggerCatch(_0x57c2('0x2f')));};