Built motion from commit (unavailable).|2.5.6
[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 _0xc978=['checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercompleteAt','endtime','connectedlinename','context','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20'];(function(_0x5e3ac2,_0x225614){var _0x29a007=function(_0x14545e){while(--_0x14545e){_0x5e3ac2['push'](_0x5e3ac2['shift']());}};_0x29a007(++_0x225614);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var util=require(_0x8c97('0x0'));var BPromise=require(_0x8c97('0x1'));var logger=require(_0x8c97('0x2'))(_0x8c97('0x3'));var _=require(_0x8c97('0x4'));var cmHopper=require(_0x8c97('0x5'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x8c97('0x6'));var cmHopperBlack=require(_0x8c97('0x7'));var voiceQueueRt=require(_0x8c97('0x8'));var agentReportPreview=require(_0x8c97('0x9'));var voiceQueueReport=require(_0x8c97('0xa'));function loggerCatch(_0x2a9434){return function(_0xabd146){logger['error'](_0x2a9434,util[_0x8c97('0xb')](_0xabd146,{'showHidden':![],'depth':null}));};}function create(_0x1b5864){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopperHistory[_0x8c97('0xe')](_0x1b5864))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x10')));}function createAgent(_0x4f2d78){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](agentReportPreview[_0x8c97('0xe')](_0x4f2d78))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x10')));}function moveContact(_0x949a83){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopper[_0x8c97('0x11')](_0x949a83,!![]))['catch'](loggerCatch(_0x8c97('0x12')));}exports[_0x8c97('0x13')]=function(_0x4ffa19){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopperBlack['checkIsBlackList'](_0x4ffa19))[_0x8c97('0xf')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x57902c){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopper[_0x8c97('0x14')](_0x57902c))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x15')));};exports[_0x8c97('0xe')]=function(_0x1ea67f,_0xe3be1){create(_0x1ea67f)[_0x8c97('0xf')](loggerCatch(_0xe3be1));moveContact(_0x1ea67f)['catch'](loggerCatch(_0xe3be1));};exports[_0x8c97('0x16')]=function(_0x3f7ac7,_0x18cffa){createAgent(_0x3f7ac7)[_0x8c97('0xf')](loggerCatch(_0x18cffa));};exports[_0x8c97('0x17')]=function(_0x1445db,_0xb502e7){create(_0x1445db)[_0x8c97('0xf')](loggerCatch(_0xb502e7));};exports[_0x8c97('0x18')]=function(_0x18e6fc,_0x3bb0fa){moveContact(_0x18e6fc)[_0x8c97('0xf')](loggerCatch(_0x3bb0fa));};exports[_0x8c97('0x19')]=function(_0x16e3c4,_0x3ea5a3,_0x2b83a8){if(_0x3ea5a3){_0x16e3c4['UserId']=null;}if(_0x2b83a8){_0x16e3c4[_0x8c97('0x1a')]=![];}return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopper['rescheduleContact'](_0x16e3c4))['catch'](loggerCatch(_0x8c97('0x1b')));};exports['countReScheduled']=function(_0x41d276){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopper[_0x8c97('0x1c')](_0x41d276))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x1d')));};exports[_0x8c97('0x1e')]=function(_0x5132c5){return BPromise['resolve']()[_0x8c97('0xd')](cmHopper[_0x8c97('0x1e')]({'UserId':null},_0x5132c5,0x1))[_0x8c97('0xf')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x25ef83){return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](cmHopper[_0x8c97('0x1e')]({'active':![]},_0x25ef83,0x1))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x1f')));};exports['crateCustomerReportQueue']=function(_0x443dfd){var _0x509520={};_0x509520[_0x8c97('0x20')]=_0x443dfd['type'];_0x509520[_0x8c97('0x21')]=_0x443dfd[_0x8c97('0x21')];_0x509520['calleridnum']=_0x443dfd[_0x8c97('0x22')];_0x509520['calleridname']=_0x443dfd[_0x8c97('0x23')];_0x509520[_0x8c97('0x24')]=_0x443dfd[_0x8c97('0x24')];_0x509520[_0x8c97('0x25')]=_0x443dfd[_0x8c97('0x26')];_0x509520[_0x8c97('0x27')]=_0x443dfd['answertime'];_0x509520['queuecallercomplete']=0x1;_0x509520[_0x8c97('0x28')]=_0x443dfd[_0x8c97('0x29')];_0x509520[_0x8c97('0x2a')]=_0x443dfd['membername'];_0x509520[_0x8c97('0x2b')]='from-sip';_0x509520['exten']=_0x8c97('0x2c');_0x509520[_0x8c97('0x2d')]=0x0;_0x509520[_0x8c97('0x2e')]=0x1;_0x509520[_0x8c97('0x2f')]=_0x443dfd[_0x8c97('0x30')];_0x509520[_0x8c97('0x31')]='COMPLETED';return BPromise[_0x8c97('0xc')]()[_0x8c97('0xd')](voiceQueueReport[_0x8c97('0x32')](_0x509520))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x33')));};exports[_0x8c97('0x34')]=function(_0x157c7b,_0x20c33c){return BPromise['resolve']()[_0x8c97('0xd')](cmHopper[_0x8c97('0x34')](_0x157c7b,_0x20c33c))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x35')));};exports[_0x8c97('0x36')]=function(_0x1166f1){return BPromise['resolve']()[_0x8c97('0xd')](cmHopper[_0x8c97('0x19')](_0x1166f1,!![],!![]))[_0x8c97('0xf')](loggerCatch(_0x8c97('0x37')));};