Built motion from commit 5ae82ce5.|2.6.7
[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 _0x1a69=['queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/voiceQueueRt','../rpc/voiceQueueReport','then','createHistory','catch','resolve','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queuecallerjoinAt','answertime'];(function(_0x1eb186,_0x3e8197){var _0x49079e=function(_0x2ebd6f){while(--_0x2ebd6f){_0x1eb186['push'](_0x1eb186['shift']());}};_0x49079e(++_0x3e8197);}(_0x1a69,0x124));var _0x91a6=function(_0x11cc41,_0x3c30ab){_0x11cc41=_0x11cc41-0x0;var _0x474e9e=_0x1a69[_0x11cc41];return _0x474e9e;};'use strict';var util=require(_0x91a6('0x0'));var BPromise=require(_0x91a6('0x1'));var logger=require(_0x91a6('0x2'))(_0x91a6('0x3'));var _=require(_0x91a6('0x4'));var cmHopper=require(_0x91a6('0x5'));var cmHopperFinal=require(_0x91a6('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x91a6('0x7'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x91a6('0x8'));function loggerCatch(_0x2071fb){return function(_0x1ef62d){logger['error'](_0x2071fb,util['inspect'](_0x1ef62d,{'showHidden':![],'depth':null}));};}function create(_0x52b65f){return BPromise['resolve']()[_0x91a6('0x9')](cmHopperHistory[_0x91a6('0xa')](_0x52b65f))[_0x91a6('0xb')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x1840e9){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](agentReportPreview[_0x91a6('0xa')](_0x1840e9))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2a3acd){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper['moveContactManagedDialer'](_0x2a3acd,!![]))['catch'](loggerCatch(_0x91a6('0xd')));}exports[_0x91a6('0xe')]=function(_0xa458bc){return BPromise[_0x91a6('0xc')]()['then'](cmHopperBlack[_0x91a6('0xe')](_0xa458bc))[_0x91a6('0xb')](loggerCatch(_0x91a6('0xf')));};exports['getContactPreview']=function(_0x17d61c){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper[_0x91a6('0x10')](_0x17d61c))['catch'](loggerCatch(_0x91a6('0x11')));};exports[_0x91a6('0xa')]=function(_0x3acbcf,_0x3fc791){create(_0x3acbcf)[_0x91a6('0xb')](loggerCatch(_0x3fc791));moveContact(_0x3acbcf)[_0x91a6('0xb')](loggerCatch(_0x3fc791));};exports[_0x91a6('0x12')]=function(_0x485680,_0x574ce6){createAgent(_0x485680)[_0x91a6('0xb')](loggerCatch(_0x574ce6));};exports[_0x91a6('0x13')]=function(_0x2c3252,_0x375d90){create(_0x2c3252)[_0x91a6('0xb')](loggerCatch(_0x375d90));};exports[_0x91a6('0x14')]=function(_0x165596,_0x26fa5a){moveContact(_0x165596)[_0x91a6('0xb')](loggerCatch(_0x26fa5a));};exports[_0x91a6('0x15')]=function(_0x2f8305,_0x58d121,_0x48eb91){if(_0x58d121){_0x2f8305[_0x91a6('0x16')]=null;}if(_0x48eb91){_0x2f8305[_0x91a6('0x17')]=![];}return BPromise[_0x91a6('0xc')]()['then'](cmHopper[_0x91a6('0x15')](_0x2f8305))['catch'](loggerCatch(_0x91a6('0x18')));};exports[_0x91a6('0x19')]=function(_0x511abc){return BPromise['resolve']()[_0x91a6('0x9')](cmHopper[_0x91a6('0x19')](_0x511abc))[_0x91a6('0xb')](loggerCatch(_0x91a6('0x1a')));};exports['unlockContact']=function(_0x4ed36f){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper[_0x91a6('0x1b')]({'UserId':null},_0x4ed36f,0x1))['catch'](loggerCatch(_0x91a6('0x1c')));};exports[_0x91a6('0x1d')]=function(_0x4910b2){return BPromise[_0x91a6('0xc')]()['then'](cmHopper[_0x91a6('0x1b')]({'active':![]},_0x4910b2,0x1))['catch'](loggerCatch(_0x91a6('0x1e')));};exports[_0x91a6('0x1f')]=function(_0x13bd4f){var _0x15abc5={};_0x15abc5['type']=_0x13bd4f[_0x91a6('0x20')];_0x15abc5[_0x91a6('0x21')]=_0x13bd4f[_0x91a6('0x21')];_0x15abc5[_0x91a6('0x22')]=_0x13bd4f[_0x91a6('0x22')];_0x15abc5[_0x91a6('0x23')]=_0x13bd4f[_0x91a6('0x23')];_0x15abc5['queue']=_0x13bd4f['queue'];_0x15abc5[_0x91a6('0x24')]=_0x13bd4f[_0x91a6('0x25')];_0x15abc5[_0x91a6('0x26')]=_0x13bd4f[_0x91a6('0x25')];_0x15abc5['queuecallercomplete']=0x1;_0x15abc5[_0x91a6('0x27')]=_0x13bd4f[_0x91a6('0x28')];_0x15abc5[_0x91a6('0x29')]=_0x13bd4f[_0x91a6('0x2a')];_0x15abc5['context']=_0x91a6('0x2b');_0x15abc5[_0x91a6('0x2c')]=_0x91a6('0x2d');_0x15abc5[_0x91a6('0x2e')]=0x0;_0x15abc5[_0x91a6('0x2f')]=0x1;_0x15abc5[_0x91a6('0x30')]=_0x13bd4f[_0x91a6('0x2a')];_0x15abc5['queuecallerexitreason']='COMPLETED';return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](voiceQueueReport[_0x91a6('0x31')](_0x15abc5))['catch'](loggerCatch(_0x91a6('0x32')));};exports['getContactRecallMe']=function(_0x3e1c23,_0x3d391c){return BPromise[_0x91a6('0xc')]()[_0x91a6('0x9')](cmHopper[_0x91a6('0x33')](_0x3e1c23,_0x3d391c))[_0x91a6('0xb')](loggerCatch(_0x91a6('0x34')));};exports[_0x91a6('0x35')]=function(_0x4fcf91){return BPromise[_0x91a6('0xc')]()['then'](cmHopper['rescheduleContact'](_0x4fcf91,!![],!![]))[_0x91a6('0xb')](loggerCatch(_0x91a6('0x36')));};