Built motion from commit (unavailable).|2.5.9
[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 _0x4b84=['xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','inspect','resolve','catch','[createHistory]\x20','then','createHistory','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','crateCustomerReportQueue','type','uniqueid','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x4b84,0x1cc));var _0x44b8=function(_0x336376,_0xe4b28d){_0x336376=_0x336376-0x0;var _0x1d2a8e=_0x4b84[_0x336376];return _0x1d2a8e;};'use strict';var util=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0x44b8('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x44b8('0x3'));var cmHopperBlack=require(_0x44b8('0x4'));var voiceQueueRt=require(_0x44b8('0x5'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x55f25d){return function(_0x996a8b){logger['error'](_0x55f25d,util[_0x44b8('0x6')](_0x996a8b,{'showHidden':![],'depth':null}));};}function create(_0x5947f7){return BPromise[_0x44b8('0x7')]()['then'](cmHopperHistory['createHistory'](_0x5947f7))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x9')));}function createAgent(_0x30ebc3){return BPromise['resolve']()[_0x44b8('0xa')](agentReportPreview[_0x44b8('0xb')](_0x30ebc3))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x9')));}function moveContact(_0x24dd10){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper['moveContactManagedDialer'](_0x24dd10,!![]))[_0x44b8('0x8')](loggerCatch(_0x44b8('0xc')));}exports['checkIsBlackList']=function(_0x194230){return BPromise['resolve']()[_0x44b8('0xa')](cmHopperBlack[_0x44b8('0xd')](_0x194230))['catch'](loggerCatch(_0x44b8('0xe')));};exports['getContactPreview']=function(_0x54fa95){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper[_0x44b8('0xf')](_0x54fa95))[_0x44b8('0x8')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x5d6349,_0x3fe9fb){create(_0x5d6349)['catch'](loggerCatch(_0x3fe9fb));moveContact(_0x5d6349)[_0x44b8('0x8')](loggerCatch(_0x3fe9fb));};exports[_0x44b8('0x10')]=function(_0x55e258,_0x36743e){createAgent(_0x55e258)[_0x44b8('0x8')](loggerCatch(_0x36743e));};exports['createCustomerHistory']=function(_0x89bc30,_0x3f4688){create(_0x89bc30)['catch'](loggerCatch(_0x3f4688));};exports[_0x44b8('0x11')]=function(_0x8b4301,_0xebfe79){moveContact(_0x8b4301)[_0x44b8('0x8')](loggerCatch(_0xebfe79));};exports[_0x44b8('0x12')]=function(_0x369c09,_0x452f2f,_0x9b0536){if(_0x452f2f){_0x369c09[_0x44b8('0x13')]=null;}if(_0x9b0536){_0x369c09[_0x44b8('0x14')]=![];}return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper['rescheduleContact'](_0x369c09))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x15')));};exports[_0x44b8('0x16')]=function(_0x1418db){return BPromise[_0x44b8('0x7')]()['then'](cmHopper[_0x44b8('0x16')](_0x1418db))['catch'](loggerCatch(_0x44b8('0x17')));};exports[_0x44b8('0x18')]=function(_0x25a0c1){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper['unlockContact']({'UserId':null},_0x25a0c1,0x1))[_0x44b8('0x8')](loggerCatch('[unlockContact]\x20'));};exports[_0x44b8('0x19')]=function(_0x350482){return BPromise['resolve']()[_0x44b8('0xa')](cmHopper[_0x44b8('0x18')]({'active':![]},_0x350482,0x1))[_0x44b8('0x8')](loggerCatch('[activeContact]\x20'));};exports[_0x44b8('0x1a')]=function(_0x242342){var _0x53d9c7={};_0x53d9c7[_0x44b8('0x1b')]=_0x242342['type'];_0x53d9c7[_0x44b8('0x1c')]=_0x242342['uniqueid'];_0x53d9c7['calleridnum']=_0x242342['calleridnum'];_0x53d9c7[_0x44b8('0x1d')]=_0x242342[_0x44b8('0x1d')];_0x53d9c7[_0x44b8('0x1e')]=_0x242342[_0x44b8('0x1e')];_0x53d9c7[_0x44b8('0x1f')]=_0x242342[_0x44b8('0x20')];_0x53d9c7[_0x44b8('0x21')]=_0x242342[_0x44b8('0x20')];_0x53d9c7[_0x44b8('0x22')]=0x1;_0x53d9c7[_0x44b8('0x23')]=_0x242342[_0x44b8('0x24')];_0x53d9c7[_0x44b8('0x25')]=_0x242342[_0x44b8('0x26')];_0x53d9c7['context']=_0x44b8('0x27');_0x53d9c7['exten']=_0x44b8('0x28');_0x53d9c7[_0x44b8('0x29')]=0x0;_0x53d9c7[_0x44b8('0x2a')]=0x1;_0x53d9c7[_0x44b8('0x2b')]=_0x242342[_0x44b8('0x26')];_0x53d9c7['queuecallerexitreason']=_0x44b8('0x2c');return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](voiceQueueReport[_0x44b8('0x2d')](_0x53d9c7))[_0x44b8('0x8')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x44b8('0x2e')]=function(_0x400edc,_0x1a30fc){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper[_0x44b8('0x2e')](_0x400edc,_0x1a30fc))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x2f')));};exports[_0x44b8('0x30')]=function(_0x181761){return BPromise[_0x44b8('0x7')]()[_0x44b8('0xa')](cmHopper[_0x44b8('0x12')](_0x181761,!![],!![]))[_0x44b8('0x8')](loggerCatch(_0x44b8('0x31')));};