Built motion from commit 953226e6.|2.6.32
[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 _0x677e=['uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','createHistory','catch','resolve','then','[createHistory]\x20','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','UserId','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x677e,0x13d));var _0xe677=function(_0x4704dc,_0x575a5f){_0x4704dc=_0x4704dc-0x0;var _0x254d81=_0x677e[_0x4704dc];return _0x254d81;};'use strict';var util=require('util');var BPromise=require(_0xe677('0x0'));var logger=require(_0xe677('0x1'))(_0xe677('0x2'));var cmHopper=require(_0xe677('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0xe677('0x4'));var voiceQueueReport=require(_0xe677('0x5'));function loggerCatch(_0x49b165){return function(_0x3e6ffa){logger[_0xe677('0x6')](_0x49b165,util['inspect'](_0x3e6ffa,{'showHidden':![],'depth':null}));};}function create(_0x4cc73d){return cmHopperHistory[_0xe677('0x7')](_0x4cc73d)[_0xe677('0x8')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x2d6f3f){return BPromise[_0xe677('0x9')]()[_0xe677('0xa')](agentReportPreview[_0xe677('0x7')](_0x2d6f3f))[_0xe677('0x8')](loggerCatch(_0xe677('0xb')));}function moveContact(_0xb13a7f){return cmHopper[_0xe677('0xc')](_0xb13a7f,!![])[_0xe677('0x8')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xe677('0xd')]=function(_0x402283){return cmHopperBlack[_0xe677('0xd')](_0x402283)[_0xe677('0x8')](loggerCatch(_0xe677('0xe')));};exports[_0xe677('0xf')]=function(_0x201bdb){return BPromise[_0xe677('0x9')]()['then'](cmHopper['getContactPreview'](_0x201bdb))[_0xe677('0x8')](loggerCatch(_0xe677('0x10')));};exports[_0xe677('0x7')]=function(_0x4c2d6f,_0x4fc6f9){create(_0x4c2d6f)['catch'](loggerCatch(_0x4fc6f9));moveContact(_0x4c2d6f)['catch'](loggerCatch(_0x4fc6f9));};exports[_0xe677('0x11')]=function(_0x102584,_0x2a592c){createAgent(_0x102584)[_0xe677('0x8')](loggerCatch(_0x2a592c));};exports['createCustomerHistory']=function(_0x425153,_0x49b8d9){create(_0x425153)[_0xe677('0x8')](loggerCatch(_0x49b8d9));};exports['createCustomerFinal']=function(_0x525351,_0x42062e){moveContact(_0x525351)[_0xe677('0x8')](loggerCatch(_0x42062e));};exports['rescheduleContact']=function(_0x5ab843,_0x1138c2,_0x123448){if(_0x1138c2){_0x5ab843[_0xe677('0x12')]=null;}if(_0x123448){_0x5ab843['active']=![];}return cmHopper[_0xe677('0x13')](_0x5ab843)[_0xe677('0x8')](loggerCatch(_0xe677('0x14')));};exports[_0xe677('0x15')]=function(_0x49dc68){return cmHopper[_0xe677('0x15')](_0x49dc68)['catch'](loggerCatch('[countReScheduled]\x20'));};exports[_0xe677('0x16')]=function(_0x8af390){return cmHopper['unlockContact']({'UserId':null},_0x8af390,0x1)['catch'](loggerCatch(_0xe677('0x17')));};exports['disableContact']=function(_0x361f48){return cmHopper[_0xe677('0x16')]({'active':![]},_0x361f48,0x1)['catch'](loggerCatch('[activeContact]\x20'));};exports[_0xe677('0x18')]=function(_0x45836f){var _0x2a629b={};_0x2a629b['type']=_0x45836f[_0xe677('0x19')];_0x2a629b['uniqueid']=_0x45836f[_0xe677('0x1a')];_0x2a629b['calleridnum']=_0x45836f[_0xe677('0x1b')];_0x2a629b['calleridname']=_0x45836f[_0xe677('0x1c')];_0x2a629b[_0xe677('0x1d')]=_0x45836f[_0xe677('0x1d')];_0x2a629b['queuecallerjoinAt']=_0x45836f[_0xe677('0x1e')];_0x2a629b[_0xe677('0x1f')]=_0x45836f[_0xe677('0x1e')];_0x2a629b[_0xe677('0x20')]=0x1;_0x2a629b[_0xe677('0x21')]=_0x45836f[_0xe677('0x22')];_0x2a629b[_0xe677('0x23')]=_0x45836f[_0xe677('0x24')];_0x2a629b[_0xe677('0x25')]=_0xe677('0x26');_0x2a629b[_0xe677('0x27')]='xcally-motion-preview';_0x2a629b[_0xe677('0x28')]=0x0;_0x2a629b['assigned']=0x1;_0x2a629b[_0xe677('0x29')]=_0x45836f[_0xe677('0x24')];_0x2a629b[_0xe677('0x2a')]=_0xe677('0x2b');return BPromise['resolve']()[_0xe677('0xa')](voiceQueueReport[_0xe677('0x2c')](_0x2a629b))[_0xe677('0x8')](loggerCatch(_0xe677('0x2d')));};exports[_0xe677('0x2e')]=function(_0x3a5c3d,_0xd1a77c){return BPromise[_0xe677('0x9')]()[_0xe677('0xa')](cmHopper[_0xe677('0x2e')](_0x3a5c3d,_0xd1a77c))[_0xe677('0x8')](loggerCatch(_0xe677('0x2f')));};exports[_0xe677('0x30')]=function(_0x4fff5c){return cmHopper[_0xe677('0x13')](_0x4fff5c,!![],!![])[_0xe677('0x8')](loggerCatch('[rescheduleContactInQueue]\x20'));};