Built motion from commit 3a7e82ea.|2.6.29
[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 _0x7719=['type','uniqueid','calleridnum','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','resolve','then','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue'];(function(_0x32caa5,_0x13d0db){var _0x1f32ec=function(_0x51fb6a){while(--_0x51fb6a){_0x32caa5['push'](_0x32caa5['shift']());}};_0x1f32ec(++_0x13d0db);}(_0x7719,0x17c));var _0x9771=function(_0xc36bd1,_0x307e75){_0xc36bd1=_0xc36bd1-0x0;var _0x1b9790=_0x7719[_0xc36bd1];return _0x1b9790;};'use strict';var util=require(_0x9771('0x0'));var BPromise=require(_0x9771('0x1'));var logger=require(_0x9771('0x2'))('preview');var cmHopper=require(_0x9771('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x9771('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x9771('0x5'));function loggerCatch(_0x2eedf0){return function(_0x1bdb56){logger[_0x9771('0x6')](_0x2eedf0,util[_0x9771('0x7')](_0x1bdb56,{'showHidden':![],'depth':null}));};}function create(_0x5407af){return cmHopperHistory['createHistory'](_0x5407af)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x36a97f){return BPromise['resolve']()['then'](agentReportPreview[_0x9771('0x8')](_0x36a97f))[_0x9771('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5443fd){return cmHopper[_0x9771('0xa')](_0x5443fd,!![])[_0x9771('0x9')](loggerCatch(_0x9771('0xb')));}exports['checkIsBlackList']=function(_0x758fd9){return cmHopperBlack[_0x9771('0xc')](_0x758fd9)[_0x9771('0x9')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x9771('0xd')]=function(_0x474502){return BPromise[_0x9771('0xe')]()[_0x9771('0xf')](cmHopper[_0x9771('0xd')](_0x474502))[_0x9771('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0x9771('0x8')]=function(_0x3e94df,_0x27dd39){create(_0x3e94df)[_0x9771('0x9')](loggerCatch(_0x27dd39));moveContact(_0x3e94df)[_0x9771('0x9')](loggerCatch(_0x27dd39));};exports[_0x9771('0x10')]=function(_0x46dd91,_0x5d7aa5){createAgent(_0x46dd91)[_0x9771('0x9')](loggerCatch(_0x5d7aa5));};exports[_0x9771('0x11')]=function(_0x5d8c3a,_0x5dd419){create(_0x5d8c3a)[_0x9771('0x9')](loggerCatch(_0x5dd419));};exports['createCustomerFinal']=function(_0x3ac36c,_0x580ee0){moveContact(_0x3ac36c)[_0x9771('0x9')](loggerCatch(_0x580ee0));};exports[_0x9771('0x12')]=function(_0x2824d4,_0x31f8f5,_0x917239){if(_0x31f8f5){_0x2824d4[_0x9771('0x13')]=null;}if(_0x917239){_0x2824d4[_0x9771('0x14')]=![];}return cmHopper[_0x9771('0x12')](_0x2824d4)[_0x9771('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x9771('0x15')]=function(_0x4b8ca2){return cmHopper[_0x9771('0x15')](_0x4b8ca2)[_0x9771('0x9')](loggerCatch(_0x9771('0x16')));};exports[_0x9771('0x17')]=function(_0x40e539){return cmHopper['unlockContact']({'UserId':null},_0x40e539,0x1)['catch'](loggerCatch(_0x9771('0x18')));};exports[_0x9771('0x19')]=function(_0x54eabb){return cmHopper[_0x9771('0x17')]({'active':![]},_0x54eabb,0x1)['catch'](loggerCatch(_0x9771('0x1a')));};exports[_0x9771('0x1b')]=function(_0x417900){var _0x5a9434={};_0x5a9434[_0x9771('0x1c')]=_0x417900[_0x9771('0x1c')];_0x5a9434[_0x9771('0x1d')]=_0x417900['uniqueid'];_0x5a9434[_0x9771('0x1e')]=_0x417900['calleridnum'];_0x5a9434['calleridname']=_0x417900['calleridname'];_0x5a9434[_0x9771('0x1f')]=_0x417900['queue'];_0x5a9434['queuecallerjoinAt']=_0x417900[_0x9771('0x20')];_0x5a9434[_0x9771('0x21')]=_0x417900[_0x9771('0x20')];_0x5a9434[_0x9771('0x22')]=0x1;_0x5a9434[_0x9771('0x23')]=_0x417900[_0x9771('0x24')];_0x5a9434[_0x9771('0x25')]=_0x417900[_0x9771('0x26')];_0x5a9434[_0x9771('0x27')]='from-sip';_0x5a9434[_0x9771('0x28')]='xcally-motion-preview';_0x5a9434[_0x9771('0x29')]=0x0;_0x5a9434[_0x9771('0x2a')]=0x1;_0x5a9434[_0x9771('0x2b')]=_0x417900[_0x9771('0x26')];_0x5a9434[_0x9771('0x2c')]=_0x9771('0x2d');return BPromise['resolve']()[_0x9771('0xf')](voiceQueueReport[_0x9771('0x2e')](_0x5a9434))[_0x9771('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x9771('0x2f')]=function(_0x2c5f66,_0x666e6a){return BPromise[_0x9771('0xe')]()[_0x9771('0xf')](cmHopper[_0x9771('0x2f')](_0x2c5f66,_0x666e6a))[_0x9771('0x9')](loggerCatch(_0x9771('0x30')));};exports[_0x9771('0x31')]=function(_0x361b49){return cmHopper[_0x9771('0x12')](_0x361b49,!![],!![])['catch'](loggerCatch(_0x9771('0x32')));};