Built motion from commit d5e4af8c.|2.6.23
[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 _0x0512=['createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/voiceQueueReport','error','inspect','createHistory','catch','then','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20'];(function(_0x3a2e49,_0x21ebea){var _0x257140=function(_0x5a2362){while(--_0x5a2362){_0x3a2e49['push'](_0x3a2e49['shift']());}};_0x257140(++_0x21ebea);}(_0x0512,0x1d8));var _0x2051=function(_0x559391,_0x4a2699){_0x559391=_0x559391-0x0;var _0x48cf02=_0x0512[_0x559391];return _0x48cf02;};'use strict';var util=require(_0x2051('0x0'));var BPromise=require(_0x2051('0x1'));var logger=require('../../../config/logger')(_0x2051('0x2'));var cmHopper=require(_0x2051('0x3'));var cmHopperHistory=require(_0x2051('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x2051('0x5'));function loggerCatch(_0x5b5610){return function(_0x21196d){logger[_0x2051('0x6')](_0x5b5610,util[_0x2051('0x7')](_0x21196d,{'showHidden':![],'depth':null}));};}function create(_0x4f8743){return cmHopperHistory[_0x2051('0x8')](_0x4f8743)[_0x2051('0x9')](loggerCatch('[createHistory]\x20'));}function createAgent(_0x497da1){return BPromise['resolve']()[_0x2051('0xa')](agentReportPreview[_0x2051('0x8')](_0x497da1))[_0x2051('0x9')](loggerCatch(_0x2051('0xb')));}function moveContact(_0x50a6c3){return cmHopper['moveContactManagedDialer'](_0x50a6c3,!![])[_0x2051('0x9')](loggerCatch(_0x2051('0xc')));}exports[_0x2051('0xd')]=function(_0x36d88f){return cmHopperBlack[_0x2051('0xd')](_0x36d88f)['catch'](loggerCatch(_0x2051('0xe')));};exports[_0x2051('0xf')]=function(_0x249a7f){return BPromise[_0x2051('0x10')]()['then'](cmHopper[_0x2051('0xf')](_0x249a7f))['catch'](loggerCatch(_0x2051('0x11')));};exports[_0x2051('0x8')]=function(_0x3dd236,_0x276fcb){create(_0x3dd236)[_0x2051('0x9')](loggerCatch(_0x276fcb));moveContact(_0x3dd236)['catch'](loggerCatch(_0x276fcb));};exports[_0x2051('0x12')]=function(_0x4bba4c,_0x1272d7){createAgent(_0x4bba4c)[_0x2051('0x9')](loggerCatch(_0x1272d7));};exports['createCustomerHistory']=function(_0x467266,_0x16f8b6){create(_0x467266)[_0x2051('0x9')](loggerCatch(_0x16f8b6));};exports[_0x2051('0x13')]=function(_0x24dc12,_0x5059fd){moveContact(_0x24dc12)[_0x2051('0x9')](loggerCatch(_0x5059fd));};exports[_0x2051('0x14')]=function(_0x51d42d,_0x3b6ffc,_0x496c41){if(_0x3b6ffc){_0x51d42d[_0x2051('0x15')]=null;}if(_0x496c41){_0x51d42d[_0x2051('0x16')]=![];}return cmHopper[_0x2051('0x14')](_0x51d42d)[_0x2051('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x2051('0x17')]=function(_0x284bc7){return cmHopper['countReScheduled'](_0x284bc7)[_0x2051('0x9')](loggerCatch(_0x2051('0x18')));};exports[_0x2051('0x19')]=function(_0x5c33b6){return cmHopper[_0x2051('0x19')]({'UserId':null},_0x5c33b6,0x1)['catch'](loggerCatch('[unlockContact]\x20'));};exports[_0x2051('0x1a')]=function(_0x1786b8){return cmHopper['unlockContact']({'active':![]},_0x1786b8,0x1)[_0x2051('0x9')](loggerCatch(_0x2051('0x1b')));};exports['crateCustomerReportQueue']=function(_0x2d1814){var _0x2069c8={};_0x2069c8['type']=_0x2d1814[_0x2051('0x1c')];_0x2069c8[_0x2051('0x1d')]=_0x2d1814[_0x2051('0x1d')];_0x2069c8[_0x2051('0x1e')]=_0x2d1814['calleridnum'];_0x2069c8['calleridname']=_0x2d1814[_0x2051('0x1f')];_0x2069c8['queue']=_0x2d1814[_0x2051('0x20')];_0x2069c8['queuecallerjoinAt']=_0x2d1814[_0x2051('0x21')];_0x2069c8[_0x2051('0x22')]=_0x2d1814[_0x2051('0x21')];_0x2069c8[_0x2051('0x23')]=0x1;_0x2069c8[_0x2051('0x24')]=_0x2d1814['endtime'];_0x2069c8[_0x2051('0x25')]=_0x2d1814[_0x2051('0x26')];_0x2069c8['context']=_0x2051('0x27');_0x2069c8['exten']=_0x2051('0x28');_0x2069c8[_0x2051('0x29')]=0x0;_0x2069c8['assigned']=0x1;_0x2069c8[_0x2051('0x2a')]=_0x2d1814[_0x2051('0x26')];_0x2069c8[_0x2051('0x2b')]=_0x2051('0x2c');return BPromise['resolve']()[_0x2051('0xa')](voiceQueueReport[_0x2051('0x2d')](_0x2069c8))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x2051('0x2e')]=function(_0x43bfac,_0x573e1b){return BPromise[_0x2051('0x10')]()[_0x2051('0xa')](cmHopper[_0x2051('0x2e')](_0x43bfac,_0x573e1b))[_0x2051('0x9')](loggerCatch(_0x2051('0x2f')));};exports[_0x2051('0x30')]=function(_0x5cafac){return cmHopper[_0x2051('0x14')](_0x5cafac,!![],!![])[_0x2051('0x9')](loggerCatch('[rescheduleContactInQueue]\x20'));};