Built motion from commit (unavailable).|2.4.4
[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 _0x627f=['[countReScheduled]\x20','unlockContact','[unlockContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','../../../config/logger','lodash','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled'];(function(_0x3269a7,_0x2af7c2){var _0x3699e9=function(_0x53fb12){while(--_0x53fb12){_0x3269a7['push'](_0x3269a7['shift']());}};_0x3699e9(++_0x2af7c2);}(_0x627f,0x1b1));var _0xf627=function(_0x1710ee,_0x1ff879){_0x1710ee=_0x1710ee-0x0;var _0x4e825b=_0x627f[_0x1710ee];return _0x4e825b;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0xf627('0x0'))('preview');var _=require(_0xf627('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require(_0xf627('0x2'));var cmHopperHistory=require(_0xf627('0x3'));var cmHopperBlack=require(_0xf627('0x4'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xf627('0x5'));var voiceQueueReport=require(_0xf627('0x6'));function loggerCatch(_0x22eaa5){return function(_0x3c6d43){logger[_0xf627('0x7')](_0x22eaa5,util[_0xf627('0x8')](_0x3c6d43,{'showHidden':![],'depth':null}));};}function create(_0x255db9){return BPromise[_0xf627('0x9')]()[_0xf627('0xa')](cmHopperHistory[_0xf627('0xb')](_0x255db9))['catch'](loggerCatch(_0xf627('0xc')));}function createAgent(_0x2cb51c){return BPromise[_0xf627('0x9')]()['then'](agentReportPreview[_0xf627('0xb')](_0x2cb51c))[_0xf627('0xd')](loggerCatch(_0xf627('0xc')));}function moveContact(_0x449d90){return BPromise[_0xf627('0x9')]()[_0xf627('0xa')](cmHopper[_0xf627('0xe')](_0x449d90,!![]))[_0xf627('0xd')](loggerCatch(_0xf627('0xf')));}exports[_0xf627('0x10')]=function(_0x5ac0e2){return BPromise['resolve']()[_0xf627('0xa')](cmHopperBlack[_0xf627('0x10')](_0x5ac0e2))[_0xf627('0xd')](loggerCatch(_0xf627('0x11')));};exports['getContactPreview']=function(_0x30583c){return BPromise[_0xf627('0x9')]()[_0xf627('0xa')](cmHopper[_0xf627('0x12')](_0x30583c))[_0xf627('0xd')](loggerCatch('[getContactPreview]\x20'));};exports['createHistory']=function(_0x47b78b,_0x46b96e){create(_0x47b78b)['catch'](loggerCatch(_0x46b96e));moveContact(_0x47b78b)['catch'](loggerCatch(_0x46b96e));};exports[_0xf627('0x13')]=function(_0x329f3c,_0x1dbe21){createAgent(_0x329f3c)[_0xf627('0xd')](loggerCatch(_0x1dbe21));};exports[_0xf627('0x14')]=function(_0x3e5b18,_0x7655bf){create(_0x3e5b18)[_0xf627('0xd')](loggerCatch(_0x7655bf));};exports[_0xf627('0x15')]=function(_0x307c9b,_0x60bfc3){moveContact(_0x307c9b)[_0xf627('0xd')](loggerCatch(_0x60bfc3));};exports[_0xf627('0x16')]=function(_0x5e12b9,_0x51a79b,_0x22a504){if(_0x51a79b){_0x5e12b9[_0xf627('0x17')]=null;}if(_0x22a504){_0x5e12b9[_0xf627('0x18')]=![];}return BPromise['resolve']()['then'](cmHopper[_0xf627('0x16')](_0x5e12b9))['catch'](loggerCatch('[rescheduleContact]\x20'));};exports[_0xf627('0x19')]=function(_0x29e946){return BPromise[_0xf627('0x9')]()[_0xf627('0xa')](cmHopper[_0xf627('0x19')](_0x29e946))[_0xf627('0xd')](loggerCatch(_0xf627('0x1a')));};exports[_0xf627('0x1b')]=function(_0x376894){return BPromise[_0xf627('0x9')]()['then'](cmHopper[_0xf627('0x1b')]({'UserId':null},_0x376894,0x1))[_0xf627('0xd')](loggerCatch(_0xf627('0x1c')));};exports['disableContact']=function(_0x3418a8){return BPromise['resolve']()[_0xf627('0xa')](cmHopper[_0xf627('0x1b')]({'active':![]},_0x3418a8,0x1))[_0xf627('0xd')](loggerCatch('[activeContact]\x20'));};exports[_0xf627('0x1d')]=function(_0x2d814c){var _0x259b02={};_0x259b02[_0xf627('0x1e')]=_0x2d814c[_0xf627('0x1e')];_0x259b02['uniqueid']=_0x2d814c[_0xf627('0x1f')];_0x259b02[_0xf627('0x20')]=_0x2d814c[_0xf627('0x20')];_0x259b02[_0xf627('0x21')]=_0x2d814c[_0xf627('0x21')];_0x259b02[_0xf627('0x22')]=_0x2d814c[_0xf627('0x22')];_0x259b02[_0xf627('0x23')]=_0x2d814c[_0xf627('0x24')];_0x259b02[_0xf627('0x25')]=_0x2d814c[_0xf627('0x24')];_0x259b02[_0xf627('0x26')]=0x1;_0x259b02['queuecallercompleteAt']=_0x2d814c['endtime'];_0x259b02['connectedlinename']=_0x2d814c[_0xf627('0x27')];_0x259b02[_0xf627('0x28')]=_0xf627('0x29');_0x259b02[_0xf627('0x2a')]=_0xf627('0x2b');_0x259b02[_0xf627('0x2c')]=0x0;_0x259b02[_0xf627('0x2d')]=0x1;_0x259b02[_0xf627('0x2e')]=_0x2d814c[_0xf627('0x27')];_0x259b02[_0xf627('0x2f')]='COMPLETED';return BPromise['resolve']()[_0xf627('0xa')](voiceQueueReport['create'](_0x259b02))[_0xf627('0xd')](loggerCatch(_0xf627('0x30')));};exports['getContactRecallMe']=function(_0x2dd996,_0x44b4c5){return BPromise['resolve']()[_0xf627('0xa')](cmHopper[_0xf627('0x31')](_0x2dd996,_0x44b4c5))[_0xf627('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x4c858a){return BPromise[_0xf627('0x9')]()['then'](cmHopper[_0xf627('0x16')](_0x4c858a,!![],!![]))[_0xf627('0xd')](loggerCatch(_0xf627('0x32')));};