Built motion from commit 4a17b4ed.|2.6.17
[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 _0x8db0=['queuecallerleaveAt','answertime','queuecallercomplete','queuecallercompleteAt','endtime','membername','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','catch','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queue','queuecallerjoinAt'];(function(_0x16a263,_0x169420){var _0x5a2193=function(_0x8e664a){while(--_0x8e664a){_0x16a263['push'](_0x16a263['shift']());}};_0x5a2193(++_0x169420);}(_0x8db0,0x112));var _0x08db=function(_0x5ac0f0,_0xee4d98){_0x5ac0f0=_0x5ac0f0-0x0;var _0x4aceec=_0x8db0[_0x5ac0f0];return _0x4aceec;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x08db('0x0'))(_0x08db('0x1'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0x08db('0x2'));var cmHopperBlack=require(_0x08db('0x3'));var agentReportPreview=require(_0x08db('0x4'));var voiceQueueReport=require(_0x08db('0x5'));function loggerCatch(_0x9aa09b){return function(_0x547270){logger[_0x08db('0x6')](_0x9aa09b,util[_0x08db('0x7')](_0x547270,{'showHidden':![],'depth':null}));};}function create(_0x3f1fae){return cmHopperHistory[_0x08db('0x8')](_0x3f1fae)['catch'](loggerCatch(_0x08db('0x9')));}function createAgent(_0x29b723){return BPromise[_0x08db('0xa')]()['then'](agentReportPreview[_0x08db('0x8')](_0x29b723))['catch'](loggerCatch(_0x08db('0x9')));}function moveContact(_0x40b228){return cmHopper['moveContactManagedDialer'](_0x40b228,!![])[_0x08db('0xb')](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x230faf){return cmHopperBlack['checkIsBlackList'](_0x230faf)[_0x08db('0xb')](loggerCatch(_0x08db('0xc')));};exports[_0x08db('0xd')]=function(_0x28e81e){return BPromise[_0x08db('0xa')]()[_0x08db('0xe')](cmHopper[_0x08db('0xd')](_0x28e81e))[_0x08db('0xb')](loggerCatch(_0x08db('0xf')));};exports[_0x08db('0x8')]=function(_0x297612,_0x4ba0ed){create(_0x297612)[_0x08db('0xb')](loggerCatch(_0x4ba0ed));moveContact(_0x297612)['catch'](loggerCatch(_0x4ba0ed));};exports[_0x08db('0x10')]=function(_0x569b87,_0x3246ce){createAgent(_0x569b87)[_0x08db('0xb')](loggerCatch(_0x3246ce));};exports[_0x08db('0x11')]=function(_0x28c211,_0x272d81){create(_0x28c211)[_0x08db('0xb')](loggerCatch(_0x272d81));};exports[_0x08db('0x12')]=function(_0x581ce2,_0x34492e){moveContact(_0x581ce2)[_0x08db('0xb')](loggerCatch(_0x34492e));};exports['rescheduleContact']=function(_0x1fe854,_0x39db96,_0x45ccdc){if(_0x39db96){_0x1fe854['UserId']=null;}if(_0x45ccdc){_0x1fe854['active']=![];}return cmHopper[_0x08db('0x13')](_0x1fe854)[_0x08db('0xb')](loggerCatch(_0x08db('0x14')));};exports[_0x08db('0x15')]=function(_0x3e9c39){return cmHopper[_0x08db('0x15')](_0x3e9c39)[_0x08db('0xb')](loggerCatch(_0x08db('0x16')));};exports[_0x08db('0x17')]=function(_0x5d620d){return cmHopper[_0x08db('0x17')]({'UserId':null},_0x5d620d,0x1)['catch'](loggerCatch(_0x08db('0x18')));};exports['disableContact']=function(_0x20c8b1){return cmHopper[_0x08db('0x17')]({'active':![]},_0x20c8b1,0x1)[_0x08db('0xb')](loggerCatch(_0x08db('0x19')));};exports[_0x08db('0x1a')]=function(_0x2e3348){var _0x4b8287={};_0x4b8287[_0x08db('0x1b')]=_0x2e3348[_0x08db('0x1b')];_0x4b8287[_0x08db('0x1c')]=_0x2e3348[_0x08db('0x1c')];_0x4b8287[_0x08db('0x1d')]=_0x2e3348[_0x08db('0x1d')];_0x4b8287['calleridname']=_0x2e3348['calleridname'];_0x4b8287[_0x08db('0x1e')]=_0x2e3348[_0x08db('0x1e')];_0x4b8287[_0x08db('0x1f')]=_0x2e3348['answertime'];_0x4b8287[_0x08db('0x20')]=_0x2e3348[_0x08db('0x21')];_0x4b8287[_0x08db('0x22')]=0x1;_0x4b8287[_0x08db('0x23')]=_0x2e3348[_0x08db('0x24')];_0x4b8287['connectedlinename']=_0x2e3348[_0x08db('0x25')];_0x4b8287[_0x08db('0x26')]=_0x08db('0x27');_0x4b8287[_0x08db('0x28')]=_0x08db('0x29');_0x4b8287[_0x08db('0x2a')]=0x0;_0x4b8287[_0x08db('0x2b')]=0x1;_0x4b8287[_0x08db('0x2c')]=_0x2e3348[_0x08db('0x25')];_0x4b8287[_0x08db('0x2d')]='COMPLETED';return BPromise[_0x08db('0xa')]()[_0x08db('0xe')](voiceQueueReport[_0x08db('0x2e')](_0x4b8287))[_0x08db('0xb')](loggerCatch(_0x08db('0x2f')));};exports[_0x08db('0x30')]=function(_0x21707e,_0xa7bf6a){return BPromise[_0x08db('0xa')]()[_0x08db('0xe')](cmHopper[_0x08db('0x30')](_0x21707e,_0xa7bf6a))[_0x08db('0xb')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x08db('0x31')]=function(_0x260aa2){return cmHopper['rescheduleContact'](_0x260aa2,!![],!![])[_0x08db('0xb')](loggerCatch(_0x08db('0x32')));};