923df47428a6d4cdaa367a3c4dcb96c259cb9d6c
[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 _0x4dfa=['type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','resolve','then','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue'];(function(_0x5d5b1a,_0xea27e5){var _0x5d35a7=function(_0x3fa8e2){while(--_0x3fa8e2){_0x5d5b1a['push'](_0x5d5b1a['shift']());}};_0x5d35a7(++_0xea27e5);}(_0x4dfa,0xbb));var _0xa4df=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x4dfa[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var BPromise=require(_0xa4df('0x0'));var logger=require(_0xa4df('0x1'))(_0xa4df('0x2'));var cmHopper=require(_0xa4df('0x3'));var cmHopperHistory=require(_0xa4df('0x4'));var cmHopperBlack=require(_0xa4df('0x5'));var agentReportPreview=require(_0xa4df('0x6'));var voiceQueueReport=require(_0xa4df('0x7'));function loggerCatch(_0x302698){return function(_0x3e7cdb){logger[_0xa4df('0x8')](_0x302698,util[_0xa4df('0x9')](_0x3e7cdb,{'showHidden':![],'depth':null}));};}function create(_0x52ba1a){return cmHopperHistory[_0xa4df('0xa')](_0x52ba1a)[_0xa4df('0xb')](loggerCatch(_0xa4df('0xc')));}function createAgent(_0x4e1884){return BPromise[_0xa4df('0xd')]()[_0xa4df('0xe')](agentReportPreview[_0xa4df('0xa')](_0x4e1884))[_0xa4df('0xb')](loggerCatch(_0xa4df('0xc')));}function moveContact(_0x2c6556){return cmHopper['moveContactManagedDialer'](_0x2c6556,!![])[_0xa4df('0xb')](loggerCatch(_0xa4df('0xf')));}exports[_0xa4df('0x10')]=function(_0x1f41d6){return cmHopperBlack['checkIsBlackList'](_0x1f41d6)[_0xa4df('0xb')](loggerCatch(_0xa4df('0x11')));};exports[_0xa4df('0x12')]=function(_0xe54bbb){return BPromise[_0xa4df('0xd')]()[_0xa4df('0xe')](cmHopper['getContactPreview'](_0xe54bbb))['catch'](loggerCatch(_0xa4df('0x13')));};exports['createHistory']=function(_0x4561d8,_0x51aa92){create(_0x4561d8)['catch'](loggerCatch(_0x51aa92));moveContact(_0x4561d8)[_0xa4df('0xb')](loggerCatch(_0x51aa92));};exports[_0xa4df('0x14')]=function(_0x103fb3,_0x372da5){createAgent(_0x103fb3)[_0xa4df('0xb')](loggerCatch(_0x372da5));};exports[_0xa4df('0x15')]=function(_0x6d92e3,_0x12337e){create(_0x6d92e3)[_0xa4df('0xb')](loggerCatch(_0x12337e));};exports[_0xa4df('0x16')]=function(_0x9eb59b,_0x251c29){moveContact(_0x9eb59b)['catch'](loggerCatch(_0x251c29));};exports[_0xa4df('0x17')]=function(_0x2d6dc3,_0x4d88a0,_0x502eac){if(_0x4d88a0){_0x2d6dc3[_0xa4df('0x18')]=null;}if(_0x502eac){_0x2d6dc3[_0xa4df('0x19')]=![];}return cmHopper[_0xa4df('0x17')](_0x2d6dc3)[_0xa4df('0xb')](loggerCatch('[rescheduleContact]\x20'));};exports[_0xa4df('0x1a')]=function(_0x16a0b3){return cmHopper[_0xa4df('0x1a')](_0x16a0b3)[_0xa4df('0xb')](loggerCatch(_0xa4df('0x1b')));};exports[_0xa4df('0x1c')]=function(_0x13788a){return cmHopper[_0xa4df('0x1c')]({'UserId':null},_0x13788a,0x1)[_0xa4df('0xb')](loggerCatch(_0xa4df('0x1d')));};exports[_0xa4df('0x1e')]=function(_0x3e48ae){return cmHopper[_0xa4df('0x1c')]({'active':![]},_0x3e48ae,0x1)[_0xa4df('0xb')](loggerCatch(_0xa4df('0x1f')));};exports[_0xa4df('0x20')]=function(_0x3fd1c9){var _0x4c8358={};_0x4c8358[_0xa4df('0x21')]=_0x3fd1c9[_0xa4df('0x21')];_0x4c8358[_0xa4df('0x22')]=_0x3fd1c9['uniqueid'];_0x4c8358[_0xa4df('0x23')]=_0x3fd1c9[_0xa4df('0x23')];_0x4c8358[_0xa4df('0x24')]=_0x3fd1c9[_0xa4df('0x24')];_0x4c8358[_0xa4df('0x25')]=_0x3fd1c9[_0xa4df('0x25')];_0x4c8358[_0xa4df('0x26')]=_0x3fd1c9[_0xa4df('0x27')];_0x4c8358['queuecallerleaveAt']=_0x3fd1c9[_0xa4df('0x27')];_0x4c8358[_0xa4df('0x28')]=0x1;_0x4c8358[_0xa4df('0x29')]=_0x3fd1c9[_0xa4df('0x2a')];_0x4c8358['connectedlinename']=_0x3fd1c9[_0xa4df('0x2b')];_0x4c8358[_0xa4df('0x2c')]=_0xa4df('0x2d');_0x4c8358['exten']=_0xa4df('0x2e');_0x4c8358[_0xa4df('0x2f')]=0x0;_0x4c8358['assigned']=0x1;_0x4c8358[_0xa4df('0x30')]=_0x3fd1c9[_0xa4df('0x2b')];_0x4c8358[_0xa4df('0x31')]=_0xa4df('0x32');return BPromise[_0xa4df('0xd')]()['then'](voiceQueueReport[_0xa4df('0x33')](_0x4c8358))['catch'](loggerCatch(_0xa4df('0x34')));};exports[_0xa4df('0x35')]=function(_0x5e9af7,_0x202ad1){return BPromise[_0xa4df('0xd')]()[_0xa4df('0xe')](cmHopper[_0xa4df('0x35')](_0x5e9af7,_0x202ad1))[_0xa4df('0xb')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x2ed006){return cmHopper[_0xa4df('0x17')](_0x2ed006,!![],!![])[_0xa4df('0xb')](loggerCatch(_0xa4df('0x36')));};