643abb085c6c483ee71ec72c7175ca87a54bf99f
[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 _0x0eb0=['countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','resolve','createHistory','catch','then','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20'];(function(_0x5337fa,_0x435f92){var _0x43e388=function(_0x3e26e3){while(--_0x3e26e3){_0x5337fa['push'](_0x5337fa['shift']());}};_0x43e388(++_0x435f92);}(_0x0eb0,0x15b));var _0x00eb=function(_0x54625c,_0x44ff64){_0x54625c=_0x54625c-0x0;var _0x564e76=_0x0eb0[_0x54625c];return _0x564e76;};'use strict';var util=require(_0x00eb('0x0'));var BPromise=require(_0x00eb('0x1'));var logger=require(_0x00eb('0x2'))(_0x00eb('0x3'));var _=require(_0x00eb('0x4'));var cmHopper=require(_0x00eb('0x5'));var cmHopperFinal=require(_0x00eb('0x6'));var cmHopperHistory=require(_0x00eb('0x7'));var cmHopperBlack=require(_0x00eb('0x8'));var voiceQueueRt=require(_0x00eb('0x9'));var agentReportPreview=require(_0x00eb('0xa'));var voiceQueueReport=require(_0x00eb('0xb'));function loggerCatch(_0x3ce267){return function(_0x57a476){logger[_0x00eb('0xc')](_0x3ce267,util['inspect'](_0x57a476,{'showHidden':![],'depth':null}));};}function create(_0x40d4ee){return BPromise[_0x00eb('0xd')]()['then'](cmHopperHistory[_0x00eb('0xe')](_0x40d4ee))[_0x00eb('0xf')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x56c381){return BPromise['resolve']()[_0x00eb('0x10')](agentReportPreview[_0x00eb('0xe')](_0x56c381))['catch'](loggerCatch(_0x00eb('0x11')));}function moveContact(_0x54b20e){return BPromise['resolve']()[_0x00eb('0x10')](cmHopper[_0x00eb('0x12')](_0x54b20e,!![]))[_0x00eb('0xf')](loggerCatch(_0x00eb('0x13')));}exports[_0x00eb('0x14')]=function(_0x2dbee7){return BPromise[_0x00eb('0xd')]()[_0x00eb('0x10')](cmHopperBlack['checkIsBlackList'](_0x2dbee7))[_0x00eb('0xf')](loggerCatch(_0x00eb('0x15')));};exports[_0x00eb('0x16')]=function(_0xfe4068){return BPromise[_0x00eb('0xd')]()[_0x00eb('0x10')](cmHopper[_0x00eb('0x16')](_0xfe4068))['catch'](loggerCatch(_0x00eb('0x17')));};exports[_0x00eb('0xe')]=function(_0x4af2e6,_0x1612ef){create(_0x4af2e6)[_0x00eb('0xf')](loggerCatch(_0x1612ef));moveContact(_0x4af2e6)['catch'](loggerCatch(_0x1612ef));};exports[_0x00eb('0x18')]=function(_0x576d0b,_0x27d43f){createAgent(_0x576d0b)[_0x00eb('0xf')](loggerCatch(_0x27d43f));};exports[_0x00eb('0x19')]=function(_0x52c294,_0xc9c8c2){create(_0x52c294)[_0x00eb('0xf')](loggerCatch(_0xc9c8c2));};exports[_0x00eb('0x1a')]=function(_0x12b1bb,_0x3020c7){moveContact(_0x12b1bb)[_0x00eb('0xf')](loggerCatch(_0x3020c7));};exports[_0x00eb('0x1b')]=function(_0x35e917,_0x2488e9,_0x229739){if(_0x2488e9){_0x35e917[_0x00eb('0x1c')]=null;}if(_0x229739){_0x35e917[_0x00eb('0x1d')]=![];}return BPromise[_0x00eb('0xd')]()[_0x00eb('0x10')](cmHopper[_0x00eb('0x1b')](_0x35e917))['catch'](loggerCatch(_0x00eb('0x1e')));};exports['countReScheduled']=function(_0x3137b4){return BPromise[_0x00eb('0xd')]()['then'](cmHopper[_0x00eb('0x1f')](_0x3137b4))[_0x00eb('0xf')](loggerCatch(_0x00eb('0x20')));};exports['unlockContact']=function(_0x5c4712){return BPromise[_0x00eb('0xd')]()['then'](cmHopper[_0x00eb('0x21')]({'UserId':null},_0x5c4712,0x1))[_0x00eb('0xf')](loggerCatch(_0x00eb('0x22')));};exports[_0x00eb('0x23')]=function(_0x23cfea){return BPromise[_0x00eb('0xd')]()[_0x00eb('0x10')](cmHopper[_0x00eb('0x21')]({'active':![]},_0x23cfea,0x1))[_0x00eb('0xf')](loggerCatch('[activeContact]\x20'));};exports[_0x00eb('0x24')]=function(_0x434882){var _0x513075={};_0x513075['type']=_0x434882[_0x00eb('0x25')];_0x513075['uniqueid']=_0x434882['uniqueid'];_0x513075[_0x00eb('0x26')]=_0x434882[_0x00eb('0x26')];_0x513075[_0x00eb('0x27')]=_0x434882[_0x00eb('0x27')];_0x513075[_0x00eb('0x28')]=_0x434882[_0x00eb('0x28')];_0x513075[_0x00eb('0x29')]=_0x434882[_0x00eb('0x2a')];_0x513075[_0x00eb('0x2b')]=_0x434882[_0x00eb('0x2a')];_0x513075[_0x00eb('0x2c')]=0x1;_0x513075[_0x00eb('0x2d')]=_0x434882[_0x00eb('0x2e')];_0x513075[_0x00eb('0x2f')]=_0x434882[_0x00eb('0x30')];_0x513075['context']=_0x00eb('0x31');_0x513075[_0x00eb('0x32')]=_0x00eb('0x33');_0x513075[_0x00eb('0x34')]=0x0;_0x513075[_0x00eb('0x35')]=0x1;_0x513075[_0x00eb('0x36')]=_0x434882[_0x00eb('0x30')];_0x513075[_0x00eb('0x37')]=_0x00eb('0x38');return BPromise['resolve']()[_0x00eb('0x10')](voiceQueueReport[_0x00eb('0x39')](_0x513075))['catch'](loggerCatch(_0x00eb('0x3a')));};exports['getContactRecallMe']=function(_0x437126,_0x34c9c8){return BPromise[_0x00eb('0xd')]()[_0x00eb('0x10')](cmHopper[_0x00eb('0x3b')](_0x437126,_0x34c9c8))[_0x00eb('0xf')](loggerCatch(_0x00eb('0x3c')));};exports[_0x00eb('0x3d')]=function(_0x36ff1e){return BPromise[_0x00eb('0xd')]()[_0x00eb('0x10')](cmHopper[_0x00eb('0x1b')](_0x36ff1e,!![],!![]))[_0x00eb('0xf')](loggerCatch(_0x00eb('0x3e')));};