Built motion from commit (unavailable).|2.4.3
[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 _0xf428=['[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','active','countReScheduled','unlockContact','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','exten','xcally-motion-preview','holdtime','lastAssignedTo','COMPLETED','create','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList'];(function(_0x4b4798,_0x1becd4){var _0x2be3a2=function(_0x23dfa9){while(--_0x23dfa9){_0x4b4798['push'](_0x4b4798['shift']());}};_0x2be3a2(++_0x1becd4);}(_0xf428,0xb7));var _0x8f42=function(_0x2c5205,_0x273e21){_0x2c5205=_0x2c5205-0x0;var _0x2c3c67=_0xf428[_0x2c5205];return _0x2c3c67;};'use strict';var util=require(_0x8f42('0x0'));var BPromise=require(_0x8f42('0x1'));var logger=require(_0x8f42('0x2'))(_0x8f42('0x3'));var _=require('lodash');var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x8f42('0x4'));var cmHopperBlack=require(_0x8f42('0x5'));var voiceQueueRt=require(_0x8f42('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x8f42('0x7'));function loggerCatch(_0x3a3ea0){return function(_0x2a8ea9){logger['error'](_0x3a3ea0,util[_0x8f42('0x8')](_0x2a8ea9,{'showHidden':![],'depth':null}));};}function create(_0x54e7e4){return BPromise[_0x8f42('0x9')]()[_0x8f42('0xa')](cmHopperHistory[_0x8f42('0xb')](_0x54e7e4))[_0x8f42('0xc')](loggerCatch(_0x8f42('0xd')));}function createAgent(_0x239203){return BPromise[_0x8f42('0x9')]()[_0x8f42('0xa')](agentReportPreview[_0x8f42('0xb')](_0x239203))['catch'](loggerCatch(_0x8f42('0xd')));}function moveContact(_0x1b4b4b){return BPromise[_0x8f42('0x9')]()[_0x8f42('0xa')](cmHopper[_0x8f42('0xe')](_0x1b4b4b,!![]))['catch'](loggerCatch(_0x8f42('0xf')));}exports[_0x8f42('0x10')]=function(_0x560ed5){return BPromise['resolve']()[_0x8f42('0xa')](cmHopperBlack[_0x8f42('0x10')](_0x560ed5))['catch'](loggerCatch(_0x8f42('0x11')));};exports[_0x8f42('0x12')]=function(_0x5d7e8b){return BPromise[_0x8f42('0x9')]()['then'](cmHopper[_0x8f42('0x12')](_0x5d7e8b))[_0x8f42('0xc')](loggerCatch(_0x8f42('0x13')));};exports[_0x8f42('0xb')]=function(_0x385113,_0x4b1ecf){create(_0x385113)[_0x8f42('0xc')](loggerCatch(_0x4b1ecf));moveContact(_0x385113)[_0x8f42('0xc')](loggerCatch(_0x4b1ecf));};exports[_0x8f42('0x14')]=function(_0x17e15f,_0x42d80f){createAgent(_0x17e15f)['catch'](loggerCatch(_0x42d80f));};exports['createCustomerHistory']=function(_0x3b656a,_0x27e900){create(_0x3b656a)[_0x8f42('0xc')](loggerCatch(_0x27e900));};exports[_0x8f42('0x15')]=function(_0xd1e07b,_0x20498f){moveContact(_0xd1e07b)[_0x8f42('0xc')](loggerCatch(_0x20498f));};exports[_0x8f42('0x16')]=function(_0x11d7d8,_0x25968b,_0xa2c3ef){if(_0x25968b){_0x11d7d8['UserId']=null;}if(_0xa2c3ef){_0x11d7d8[_0x8f42('0x17')]=![];}return BPromise[_0x8f42('0x9')]()[_0x8f42('0xa')](cmHopper[_0x8f42('0x16')](_0x11d7d8))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x8f42('0x18')]=function(_0x1c9294){return BPromise[_0x8f42('0x9')]()['then'](cmHopper['countReScheduled'](_0x1c9294))[_0x8f42('0xc')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x30bb0b){return BPromise[_0x8f42('0x9')]()[_0x8f42('0xa')](cmHopper[_0x8f42('0x19')]({'UserId':null},_0x30bb0b,0x1))[_0x8f42('0xc')](loggerCatch('[unlockContact]\x20'));};exports[_0x8f42('0x1a')]=function(_0x3b4fc2){return BPromise[_0x8f42('0x9')]()[_0x8f42('0xa')](cmHopper[_0x8f42('0x19')]({'active':![]},_0x3b4fc2,0x1))[_0x8f42('0xc')](loggerCatch(_0x8f42('0x1b')));};exports[_0x8f42('0x1c')]=function(_0x173f9e){var _0x317924={};_0x317924['type']=_0x173f9e[_0x8f42('0x1d')];_0x317924[_0x8f42('0x1e')]=_0x173f9e[_0x8f42('0x1e')];_0x317924[_0x8f42('0x1f')]=_0x173f9e[_0x8f42('0x1f')];_0x317924[_0x8f42('0x20')]=_0x173f9e['calleridname'];_0x317924[_0x8f42('0x21')]=_0x173f9e[_0x8f42('0x21')];_0x317924['queuecallerjoinAt']=_0x173f9e[_0x8f42('0x22')];_0x317924[_0x8f42('0x23')]=_0x173f9e[_0x8f42('0x22')];_0x317924[_0x8f42('0x24')]=0x1;_0x317924[_0x8f42('0x25')]=_0x173f9e[_0x8f42('0x26')];_0x317924['connectedlinename']=_0x173f9e[_0x8f42('0x27')];_0x317924[_0x8f42('0x28')]='from-sip';_0x317924[_0x8f42('0x29')]=_0x8f42('0x2a');_0x317924[_0x8f42('0x2b')]=0x0;_0x317924['assigned']=0x1;_0x317924[_0x8f42('0x2c')]=_0x173f9e[_0x8f42('0x27')];_0x317924['queuecallerexitreason']=_0x8f42('0x2d');return BPromise[_0x8f42('0x9')]()['then'](voiceQueueReport[_0x8f42('0x2e')](_0x317924))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x44396c,_0x392417){return BPromise['resolve']()[_0x8f42('0xa')](cmHopper['getContactRecallMe'](_0x44396c,_0x392417))[_0x8f42('0xc')](loggerCatch(_0x8f42('0x2f')));};exports[_0x8f42('0x30')]=function(_0x1ef042){return BPromise['resolve']()['then'](cmHopper[_0x8f42('0x16')](_0x1ef042,!![],!![]))[_0x8f42('0xc')](loggerCatch(_0x8f42('0x31')));};