635350cc22c1262b965a3c08131b811dceab6efd
[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 _0xf789=['checkIsBlackList','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer'];(function(_0x12dfaf,_0x390977){var _0x2a1e24=function(_0x23a69b){while(--_0x23a69b){_0x12dfaf['push'](_0x12dfaf['shift']());}};_0x2a1e24(++_0x390977);}(_0xf789,0x95));var _0x9f78=function(_0x5a00e2,_0x500992){_0x5a00e2=_0x5a00e2-0x0;var _0x1990cc=_0xf789[_0x5a00e2];return _0x1990cc;};'use strict';var util=require(_0x9f78('0x0'));var BPromise=require('bluebird');var logger=require(_0x9f78('0x1'))(_0x9f78('0x2'));var _=require(_0x9f78('0x3'));var cmHopper=require(_0x9f78('0x4'));var cmHopperFinal=require(_0x9f78('0x5'));var cmHopperHistory=require(_0x9f78('0x6'));var cmHopperBlack=require(_0x9f78('0x7'));var voiceQueueRt=require(_0x9f78('0x8'));var agentReportPreview=require(_0x9f78('0x9'));var voiceQueueReport=require(_0x9f78('0xa'));function loggerCatch(_0x2e9916){return function(_0x1980b5){logger[_0x9f78('0xb')](_0x2e9916,util[_0x9f78('0xc')](_0x1980b5,{'showHidden':![],'depth':null}));};}function create(_0x182896){return BPromise[_0x9f78('0xd')]()[_0x9f78('0xe')](cmHopperHistory[_0x9f78('0xf')](_0x182896))[_0x9f78('0x10')](loggerCatch(_0x9f78('0x11')));}function createAgent(_0x28d32f){return BPromise[_0x9f78('0xd')]()['then'](agentReportPreview[_0x9f78('0xf')](_0x28d32f))[_0x9f78('0x10')](loggerCatch(_0x9f78('0x11')));}function moveContact(_0x1b9f5b){return BPromise[_0x9f78('0xd')]()['then'](cmHopper[_0x9f78('0x12')](_0x1b9f5b,!![]))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x9f78('0x13')]=function(_0x119b71){return BPromise['resolve']()[_0x9f78('0xe')](cmHopperBlack['checkIsBlackList'](_0x119b71))[_0x9f78('0x10')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x234ad5){return BPromise[_0x9f78('0xd')]()[_0x9f78('0xe')](cmHopper['getContactPreview'](_0x234ad5))['catch'](loggerCatch(_0x9f78('0x14')));};exports['createHistory']=function(_0x224096,_0x5506db){create(_0x224096)['catch'](loggerCatch(_0x5506db));moveContact(_0x224096)[_0x9f78('0x10')](loggerCatch(_0x5506db));};exports[_0x9f78('0x15')]=function(_0x594bd8,_0x1b4a71){createAgent(_0x594bd8)[_0x9f78('0x10')](loggerCatch(_0x1b4a71));};exports['createCustomerHistory']=function(_0x578d02,_0x37f1bf){create(_0x578d02)[_0x9f78('0x10')](loggerCatch(_0x37f1bf));};exports[_0x9f78('0x16')]=function(_0x35efe4,_0x2dc42b){moveContact(_0x35efe4)['catch'](loggerCatch(_0x2dc42b));};exports[_0x9f78('0x17')]=function(_0x54f7b5,_0x18c3c7,_0xb81d95){if(_0x18c3c7){_0x54f7b5[_0x9f78('0x18')]=null;}if(_0xb81d95){_0x54f7b5[_0x9f78('0x19')]=![];}return BPromise[_0x9f78('0xd')]()['then'](cmHopper[_0x9f78('0x17')](_0x54f7b5))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0x9f78('0x1a')]=function(_0x15683b){return BPromise['resolve']()[_0x9f78('0xe')](cmHopper[_0x9f78('0x1a')](_0x15683b))[_0x9f78('0x10')](loggerCatch('[countReScheduled]\x20'));};exports[_0x9f78('0x1b')]=function(_0x11022f){return BPromise[_0x9f78('0xd')]()[_0x9f78('0xe')](cmHopper[_0x9f78('0x1b')]({'UserId':null},_0x11022f,0x1))[_0x9f78('0x10')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x300ff0){return BPromise[_0x9f78('0xd')]()[_0x9f78('0xe')](cmHopper['unlockContact']({'active':![]},_0x300ff0,0x1))['catch'](loggerCatch(_0x9f78('0x1c')));};exports[_0x9f78('0x1d')]=function(_0x4b38c9){var _0x2032dc={};_0x2032dc['type']=_0x4b38c9[_0x9f78('0x1e')];_0x2032dc['uniqueid']=_0x4b38c9[_0x9f78('0x1f')];_0x2032dc[_0x9f78('0x20')]=_0x4b38c9['calleridnum'];_0x2032dc[_0x9f78('0x21')]=_0x4b38c9[_0x9f78('0x21')];_0x2032dc[_0x9f78('0x22')]=_0x4b38c9[_0x9f78('0x22')];_0x2032dc[_0x9f78('0x23')]=_0x4b38c9[_0x9f78('0x24')];_0x2032dc['queuecallerleaveAt']=_0x4b38c9[_0x9f78('0x24')];_0x2032dc[_0x9f78('0x25')]=0x1;_0x2032dc[_0x9f78('0x26')]=_0x4b38c9[_0x9f78('0x27')];_0x2032dc[_0x9f78('0x28')]=_0x4b38c9[_0x9f78('0x29')];_0x2032dc[_0x9f78('0x2a')]=_0x9f78('0x2b');_0x2032dc[_0x9f78('0x2c')]=_0x9f78('0x2d');_0x2032dc[_0x9f78('0x2e')]=0x0;_0x2032dc[_0x9f78('0x2f')]=0x1;_0x2032dc[_0x9f78('0x30')]=_0x4b38c9[_0x9f78('0x29')];_0x2032dc[_0x9f78('0x31')]=_0x9f78('0x32');return BPromise[_0x9f78('0xd')]()['then'](voiceQueueReport[_0x9f78('0x33')](_0x2032dc))[_0x9f78('0x10')](loggerCatch(_0x9f78('0x34')));};exports['getContactRecallMe']=function(_0x239189,_0x3fff37){return BPromise[_0x9f78('0xd')]()[_0x9f78('0xe')](cmHopper[_0x9f78('0x35')](_0x239189,_0x3fff37))[_0x9f78('0x10')](loggerCatch(_0x9f78('0x36')));};exports['rescheduleContactInQueue']=function(_0x3b19f3){return BPromise[_0x9f78('0xd')]()[_0x9f78('0xe')](cmHopper[_0x9f78('0x17')](_0x3b19f3,!![],!![]))['catch'](loggerCatch(_0x9f78('0x37')));};