ee88db5d592e349d29149df60bc04155187a6b45
[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 _0x0e85=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','context','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','preview','lodash','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','active'];(function(_0xba5f89,_0x3116c0){var _0x3b6958=function(_0x21e526){while(--_0x21e526){_0xba5f89['push'](_0xba5f89['shift']());}};_0x3b6958(++_0x3116c0);}(_0x0e85,0x7c));var _0x50e8=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x0e85[_0x56916d];return _0x2b7f1f;};'use strict';var util=require(_0x50e8('0x0'));var BPromise=require(_0x50e8('0x1'));var logger=require('../../../config/logger')(_0x50e8('0x2'));var _=require(_0x50e8('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x50e8('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0x50e8('0x5'));var voiceQueueReport=require(_0x50e8('0x6'));function loggerCatch(_0xe3151e){return function(_0xfde42){logger['error'](_0xe3151e,util[_0x50e8('0x7')](_0xfde42,{'showHidden':![],'depth':null}));};}function create(_0x108edc){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](cmHopperHistory[_0x50e8('0xa')](_0x108edc))[_0x50e8('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x11717c){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](agentReportPreview[_0x50e8('0xa')](_0x11717c))[_0x50e8('0xb')](loggerCatch(_0x50e8('0xc')));}function moveContact(_0x45dc6f){return BPromise[_0x50e8('0x8')]()['then'](cmHopper['moveContactManagedDialer'](_0x45dc6f,!![]))[_0x50e8('0xb')](loggerCatch(_0x50e8('0xd')));}exports['checkIsBlackList']=function(_0x49e02f){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](cmHopperBlack[_0x50e8('0xe')](_0x49e02f))[_0x50e8('0xb')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x50e8('0xf')]=function(_0x3149d4){return BPromise[_0x50e8('0x8')]()['then'](cmHopper['getContactPreview'](_0x3149d4))[_0x50e8('0xb')](loggerCatch(_0x50e8('0x10')));};exports[_0x50e8('0xa')]=function(_0x291fb7,_0x211731){create(_0x291fb7)[_0x50e8('0xb')](loggerCatch(_0x211731));moveContact(_0x291fb7)['catch'](loggerCatch(_0x211731));};exports['createAgentHistory']=function(_0x441f25,_0xc97063){createAgent(_0x441f25)[_0x50e8('0xb')](loggerCatch(_0xc97063));};exports[_0x50e8('0x11')]=function(_0x5dae4e,_0x90c54c){create(_0x5dae4e)[_0x50e8('0xb')](loggerCatch(_0x90c54c));};exports['createCustomerFinal']=function(_0x415596,_0x55997c){moveContact(_0x415596)[_0x50e8('0xb')](loggerCatch(_0x55997c));};exports[_0x50e8('0x12')]=function(_0xd263d,_0x20f835,_0x46af8e){if(_0x20f835){_0xd263d['UserId']=null;}if(_0x46af8e){_0xd263d[_0x50e8('0x13')]=![];}return BPromise[_0x50e8('0x8')]()['then'](cmHopper[_0x50e8('0x12')](_0xd263d))[_0x50e8('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x50e8('0x14')]=function(_0xe7e56c){return BPromise['resolve']()['then'](cmHopper['countReScheduled'](_0xe7e56c))[_0x50e8('0xb')](loggerCatch(_0x50e8('0x15')));};exports[_0x50e8('0x16')]=function(_0x371a1f){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](cmHopper['unlockContact']({'UserId':null},_0x371a1f,0x1))[_0x50e8('0xb')](loggerCatch(_0x50e8('0x17')));};exports['disableContact']=function(_0x177201){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](cmHopper[_0x50e8('0x16')]({'active':![]},_0x177201,0x1))['catch'](loggerCatch(_0x50e8('0x18')));};exports['crateCustomerReportQueue']=function(_0x30fedf){var _0x39c0c6={};_0x39c0c6[_0x50e8('0x19')]=_0x30fedf['type'];_0x39c0c6[_0x50e8('0x1a')]=_0x30fedf[_0x50e8('0x1a')];_0x39c0c6[_0x50e8('0x1b')]=_0x30fedf[_0x50e8('0x1b')];_0x39c0c6[_0x50e8('0x1c')]=_0x30fedf[_0x50e8('0x1c')];_0x39c0c6[_0x50e8('0x1d')]=_0x30fedf['queue'];_0x39c0c6[_0x50e8('0x1e')]=_0x30fedf[_0x50e8('0x1f')];_0x39c0c6['queuecallerleaveAt']=_0x30fedf['answertime'];_0x39c0c6[_0x50e8('0x20')]=0x1;_0x39c0c6[_0x50e8('0x21')]=_0x30fedf[_0x50e8('0x22')];_0x39c0c6['connectedlinename']=_0x30fedf['membername'];_0x39c0c6[_0x50e8('0x23')]=_0x50e8('0x24');_0x39c0c6['exten']=_0x50e8('0x25');_0x39c0c6[_0x50e8('0x26')]=0x0;_0x39c0c6[_0x50e8('0x27')]=0x1;_0x39c0c6[_0x50e8('0x28')]=_0x30fedf['membername'];_0x39c0c6[_0x50e8('0x29')]='COMPLETED';return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](voiceQueueReport[_0x50e8('0x2a')](_0x39c0c6))['catch'](loggerCatch(_0x50e8('0x2b')));};exports[_0x50e8('0x2c')]=function(_0x548f3c,_0x245b45){return BPromise[_0x50e8('0x8')]()[_0x50e8('0x9')](cmHopper[_0x50e8('0x2c')](_0x548f3c,_0x245b45))['catch'](loggerCatch(_0x50e8('0x2d')));};exports[_0x50e8('0x2e')]=function(_0x24d3ea){return BPromise[_0x50e8('0x8')]()['then'](cmHopper[_0x50e8('0x12')](_0x24d3ea,!![],!![]))[_0x50e8('0xb')](loggerCatch(_0x50e8('0x2f')));};