Built motion from commit (unavailable).|2.5.4
[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 _0x7fbe=['[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','[countReScheduled]\x20','unlockContact'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2bcb4d,_0x1b1d96){_0x2bcb4d=_0x2bcb4d-0x0;var _0x423940=_0x7fbe[_0x2bcb4d];return _0x423940;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var _=require(_0xe7fb('0x2'));var cmHopper=require(_0xe7fb('0x3'));var cmHopperFinal=require(_0xe7fb('0x4'));var cmHopperHistory=require(_0xe7fb('0x5'));var cmHopperBlack=require(_0xe7fb('0x6'));var voiceQueueRt=require(_0xe7fb('0x7'));var agentReportPreview=require(_0xe7fb('0x8'));var voiceQueueReport=require(_0xe7fb('0x9'));function loggerCatch(_0x290172){return function(_0x12d1b0){logger[_0xe7fb('0xa')](_0x290172,util[_0xe7fb('0xb')](_0x12d1b0,{'showHidden':![],'depth':null}));};}function create(_0x5ad75b){return BPromise[_0xe7fb('0xc')]()[_0xe7fb('0xd')](cmHopperHistory[_0xe7fb('0xe')](_0x5ad75b))[_0xe7fb('0xf')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x558857){return BPromise[_0xe7fb('0xc')]()[_0xe7fb('0xd')](agentReportPreview[_0xe7fb('0xe')](_0x558857))[_0xe7fb('0xf')](loggerCatch(_0xe7fb('0x10')));}function moveContact(_0x42435c){return BPromise[_0xe7fb('0xc')]()[_0xe7fb('0xd')](cmHopper[_0xe7fb('0x11')](_0x42435c,!![]))[_0xe7fb('0xf')](loggerCatch(_0xe7fb('0x12')));}exports[_0xe7fb('0x13')]=function(_0xdf9760){return BPromise[_0xe7fb('0xc')]()[_0xe7fb('0xd')](cmHopperBlack['checkIsBlackList'](_0xdf9760))[_0xe7fb('0xf')](loggerCatch(_0xe7fb('0x14')));};exports['getContactPreview']=function(_0x30015a){return BPromise[_0xe7fb('0xc')]()['then'](cmHopper[_0xe7fb('0x15')](_0x30015a))['catch'](loggerCatch(_0xe7fb('0x16')));};exports[_0xe7fb('0xe')]=function(_0x12603d,_0x17e8a8){create(_0x12603d)['catch'](loggerCatch(_0x17e8a8));moveContact(_0x12603d)[_0xe7fb('0xf')](loggerCatch(_0x17e8a8));};exports['createAgentHistory']=function(_0x293a47,_0x546463){createAgent(_0x293a47)[_0xe7fb('0xf')](loggerCatch(_0x546463));};exports[_0xe7fb('0x17')]=function(_0x3f96a7,_0x182269){create(_0x3f96a7)['catch'](loggerCatch(_0x182269));};exports[_0xe7fb('0x18')]=function(_0x5d1c87,_0x11cae0){moveContact(_0x5d1c87)['catch'](loggerCatch(_0x11cae0));};exports[_0xe7fb('0x19')]=function(_0x4ea664,_0xa5af01,_0x135624){if(_0xa5af01){_0x4ea664['UserId']=null;}if(_0x135624){_0x4ea664[_0xe7fb('0x1a')]=![];}return BPromise[_0xe7fb('0xc')]()[_0xe7fb('0xd')](cmHopper['rescheduleContact'](_0x4ea664))[_0xe7fb('0xf')](loggerCatch(_0xe7fb('0x1b')));};exports['countReScheduled']=function(_0x5bea27){return BPromise['resolve']()[_0xe7fb('0xd')](cmHopper['countReScheduled'](_0x5bea27))['catch'](loggerCatch(_0xe7fb('0x1c')));};exports[_0xe7fb('0x1d')]=function(_0x2996ae){return BPromise['resolve']()[_0xe7fb('0xd')](cmHopper[_0xe7fb('0x1d')]({'UserId':null},_0x2996ae,0x1))[_0xe7fb('0xf')](loggerCatch(_0xe7fb('0x1e')));};exports[_0xe7fb('0x1f')]=function(_0x16237a){return BPromise[_0xe7fb('0xc')]()['then'](cmHopper['unlockContact']({'active':![]},_0x16237a,0x1))[_0xe7fb('0xf')](loggerCatch(_0xe7fb('0x20')));};exports[_0xe7fb('0x21')]=function(_0x4fd290){var _0xb1f2f4={};_0xb1f2f4[_0xe7fb('0x22')]=_0x4fd290[_0xe7fb('0x22')];_0xb1f2f4[_0xe7fb('0x23')]=_0x4fd290[_0xe7fb('0x23')];_0xb1f2f4[_0xe7fb('0x24')]=_0x4fd290[_0xe7fb('0x24')];_0xb1f2f4[_0xe7fb('0x25')]=_0x4fd290['calleridname'];_0xb1f2f4[_0xe7fb('0x26')]=_0x4fd290[_0xe7fb('0x26')];_0xb1f2f4[_0xe7fb('0x27')]=_0x4fd290['answertime'];_0xb1f2f4['queuecallerleaveAt']=_0x4fd290[_0xe7fb('0x28')];_0xb1f2f4['queuecallercomplete']=0x1;_0xb1f2f4[_0xe7fb('0x29')]=_0x4fd290[_0xe7fb('0x2a')];_0xb1f2f4[_0xe7fb('0x2b')]=_0x4fd290[_0xe7fb('0x2c')];_0xb1f2f4['context']=_0xe7fb('0x2d');_0xb1f2f4[_0xe7fb('0x2e')]=_0xe7fb('0x2f');_0xb1f2f4[_0xe7fb('0x30')]=0x0;_0xb1f2f4[_0xe7fb('0x31')]=0x1;_0xb1f2f4['lastAssignedTo']=_0x4fd290[_0xe7fb('0x2c')];_0xb1f2f4[_0xe7fb('0x32')]=_0xe7fb('0x33');return BPromise[_0xe7fb('0xc')]()[_0xe7fb('0xd')](voiceQueueReport[_0xe7fb('0x34')](_0xb1f2f4))[_0xe7fb('0xf')](loggerCatch(_0xe7fb('0x35')));};exports[_0xe7fb('0x36')]=function(_0x59f9df,_0x44d8cf){return BPromise[_0xe7fb('0xc')]()[_0xe7fb('0xd')](cmHopper['getContactRecallMe'](_0x59f9df,_0x44d8cf))[_0xe7fb('0xf')](loggerCatch(_0xe7fb('0x37')));};exports[_0xe7fb('0x38')]=function(_0x1530b1){return BPromise[_0xe7fb('0xc')]()[_0xe7fb('0xd')](cmHopper[_0xe7fb('0x19')](_0x1530b1,!![],!![]))[_0xe7fb('0xf')](loggerCatch(_0xe7fb('0x39')));};