f36175c49adc57ded927139431206c30e80da12c
[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 _0xa282=['membername','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','checkIsBlackList','getContactPreview','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename'];(function(_0x3b2d98,_0xaa0b26){var _0x256bf1=function(_0x1fe933){while(--_0x1fe933){_0x3b2d98['push'](_0x3b2d98['shift']());}};_0x256bf1(++_0xaa0b26);}(_0xa282,0x109));var _0x2a28=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xa282[_0x2064e5];return _0x21a233;};'use strict';var util=require(_0x2a28('0x0'));var BPromise=require(_0x2a28('0x1'));var logger=require(_0x2a28('0x2'))(_0x2a28('0x3'));var _=require('lodash');var cmHopper=require(_0x2a28('0x4'));var cmHopperFinal=require(_0x2a28('0x5'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x2a28('0x6'));var voiceQueueRt=require(_0x2a28('0x7'));var agentReportPreview=require(_0x2a28('0x8'));var voiceQueueReport=require(_0x2a28('0x9'));function loggerCatch(_0x50435b){return function(_0x1d6b04){logger[_0x2a28('0xa')](_0x50435b,util[_0x2a28('0xb')](_0x1d6b04,{'showHidden':![],'depth':null}));};}function create(_0x1e2fee){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](cmHopperHistory[_0x2a28('0xe')](_0x1e2fee))['catch'](loggerCatch(_0x2a28('0xf')));}function createAgent(_0x31b631){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](agentReportPreview['createHistory'](_0x31b631))[_0x2a28('0x10')](loggerCatch(_0x2a28('0xf')));}function moveContact(_0x302428){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](cmHopper[_0x2a28('0x11')](_0x302428,!![]))[_0x2a28('0x10')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0x2a28('0x12')]=function(_0x4552c2){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](cmHopperBlack[_0x2a28('0x12')](_0x4552c2))[_0x2a28('0x10')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x2a28('0x13')]=function(_0x4d74a8){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](cmHopper[_0x2a28('0x13')](_0x4d74a8))[_0x2a28('0x10')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x555f7f,_0x3afee8){create(_0x555f7f)[_0x2a28('0x10')](loggerCatch(_0x3afee8));moveContact(_0x555f7f)[_0x2a28('0x10')](loggerCatch(_0x3afee8));};exports['createAgentHistory']=function(_0x4f2470,_0x5717ce){createAgent(_0x4f2470)[_0x2a28('0x10')](loggerCatch(_0x5717ce));};exports['createCustomerHistory']=function(_0x37167c,_0x23a157){create(_0x37167c)[_0x2a28('0x10')](loggerCatch(_0x23a157));};exports[_0x2a28('0x14')]=function(_0x5b9f53,_0x31bf26){moveContact(_0x5b9f53)['catch'](loggerCatch(_0x31bf26));};exports[_0x2a28('0x15')]=function(_0x15a40a,_0x169226,_0x2227e5){if(_0x169226){_0x15a40a[_0x2a28('0x16')]=null;}if(_0x2227e5){_0x15a40a[_0x2a28('0x17')]=![];}return BPromise['resolve']()[_0x2a28('0xd')](cmHopper[_0x2a28('0x15')](_0x15a40a))['catch'](loggerCatch(_0x2a28('0x18')));};exports[_0x2a28('0x19')]=function(_0x18b66d){return BPromise['resolve']()['then'](cmHopper['countReScheduled'](_0x18b66d))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x1a')));};exports[_0x2a28('0x1b')]=function(_0x12eb3d){return BPromise[_0x2a28('0xc')]()['then'](cmHopper[_0x2a28('0x1b')]({'UserId':null},_0x12eb3d,0x1))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x1c')));};exports['disableContact']=function(_0x204f4e){return BPromise[_0x2a28('0xc')]()[_0x2a28('0xd')](cmHopper[_0x2a28('0x1b')]({'active':![]},_0x204f4e,0x1))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x1d')));};exports['crateCustomerReportQueue']=function(_0x1dbb46){var _0x556a5a={};_0x556a5a[_0x2a28('0x1e')]=_0x1dbb46[_0x2a28('0x1e')];_0x556a5a[_0x2a28('0x1f')]=_0x1dbb46['uniqueid'];_0x556a5a['calleridnum']=_0x1dbb46[_0x2a28('0x20')];_0x556a5a['calleridname']=_0x1dbb46[_0x2a28('0x21')];_0x556a5a['queue']=_0x1dbb46[_0x2a28('0x22')];_0x556a5a[_0x2a28('0x23')]=_0x1dbb46[_0x2a28('0x24')];_0x556a5a[_0x2a28('0x25')]=_0x1dbb46['answertime'];_0x556a5a[_0x2a28('0x26')]=0x1;_0x556a5a['queuecallercompleteAt']=_0x1dbb46[_0x2a28('0x27')];_0x556a5a[_0x2a28('0x28')]=_0x1dbb46[_0x2a28('0x29')];_0x556a5a['context']='from-sip';_0x556a5a['exten']=_0x2a28('0x2a');_0x556a5a[_0x2a28('0x2b')]=0x0;_0x556a5a[_0x2a28('0x2c')]=0x1;_0x556a5a['lastAssignedTo']=_0x1dbb46[_0x2a28('0x29')];_0x556a5a[_0x2a28('0x2d')]='COMPLETED';return BPromise[_0x2a28('0xc')]()['then'](voiceQueueReport['create'](_0x556a5a))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x2e')));};exports[_0x2a28('0x2f')]=function(_0x5dd678,_0x1e10be){return BPromise[_0x2a28('0xc')]()['then'](cmHopper['getContactRecallMe'](_0x5dd678,_0x1e10be))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x30')));};exports[_0x2a28('0x31')]=function(_0x49e046){return BPromise['resolve']()['then'](cmHopper[_0x2a28('0x15')](_0x49e046,!![],!![]))[_0x2a28('0x10')](loggerCatch(_0x2a28('0x32')));};