Built motion from commit 85f716e9.|2.6.8
[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 _0x04a6=['connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','UserId','active','rescheduleContact','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerleaveAt','answertime','queuecallercompleteAt','endtime'];(function(_0x6f739f,_0xa1c3e3){var _0xac7259=function(_0x3f7d0e){while(--_0x3f7d0e){_0x6f739f['push'](_0x6f739f['shift']());}};_0xac7259(++_0xa1c3e3);}(_0x04a6,0x180));var _0x604a=function(_0x1ca1b2,_0x44866e){_0x1ca1b2=_0x1ca1b2-0x0;var _0x7c7967=_0x04a6[_0x1ca1b2];return _0x7c7967;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x604a('0x0'))(_0x604a('0x1'));var _=require(_0x604a('0x2'));var cmHopper=require(_0x604a('0x3'));var cmHopperFinal=require(_0x604a('0x4'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require('../rpc/cmHopperBlack');var voiceQueueRt=require(_0x604a('0x5'));var agentReportPreview=require(_0x604a('0x6'));var voiceQueueReport=require(_0x604a('0x7'));function loggerCatch(_0x3d0a06){return function(_0x1e765d){logger[_0x604a('0x8')](_0x3d0a06,util[_0x604a('0x9')](_0x1e765d,{'showHidden':![],'depth':null}));};}function create(_0x5a867d){return BPromise[_0x604a('0xa')]()[_0x604a('0xb')](cmHopperHistory[_0x604a('0xc')](_0x5a867d))['catch'](loggerCatch(_0x604a('0xd')));}function createAgent(_0x3756bb){return BPromise['resolve']()['then'](agentReportPreview[_0x604a('0xc')](_0x3756bb))[_0x604a('0xe')](loggerCatch(_0x604a('0xd')));}function moveContact(_0x5c539c){return BPromise[_0x604a('0xa')]()[_0x604a('0xb')](cmHopper['moveContactManagedDialer'](_0x5c539c,!![]))[_0x604a('0xe')](loggerCatch(_0x604a('0xf')));}exports[_0x604a('0x10')]=function(_0x39761){return BPromise[_0x604a('0xa')]()['then'](cmHopperBlack[_0x604a('0x10')](_0x39761))[_0x604a('0xe')](loggerCatch(_0x604a('0x11')));};exports['getContactPreview']=function(_0x3332c6){return BPromise[_0x604a('0xa')]()[_0x604a('0xb')](cmHopper[_0x604a('0x12')](_0x3332c6))[_0x604a('0xe')](loggerCatch(_0x604a('0x13')));};exports[_0x604a('0xc')]=function(_0x5c84f9,_0x22551f){create(_0x5c84f9)['catch'](loggerCatch(_0x22551f));moveContact(_0x5c84f9)[_0x604a('0xe')](loggerCatch(_0x22551f));};exports[_0x604a('0x14')]=function(_0x5e763f,_0x5e2083){createAgent(_0x5e763f)[_0x604a('0xe')](loggerCatch(_0x5e2083));};exports[_0x604a('0x15')]=function(_0x2927a1,_0x448168){create(_0x2927a1)[_0x604a('0xe')](loggerCatch(_0x448168));};exports['createCustomerFinal']=function(_0xa70ed1,_0x4b8fbd){moveContact(_0xa70ed1)[_0x604a('0xe')](loggerCatch(_0x4b8fbd));};exports['rescheduleContact']=function(_0x111429,_0x1554e3,_0x16888b){if(_0x1554e3){_0x111429[_0x604a('0x16')]=null;}if(_0x16888b){_0x111429[_0x604a('0x17')]=![];}return BPromise[_0x604a('0xa')]()[_0x604a('0xb')](cmHopper[_0x604a('0x18')](_0x111429))[_0x604a('0xe')](loggerCatch(_0x604a('0x19')));};exports['countReScheduled']=function(_0x1bde70){return BPromise[_0x604a('0xa')]()[_0x604a('0xb')](cmHopper[_0x604a('0x1a')](_0x1bde70))[_0x604a('0xe')](loggerCatch('[countReScheduled]\x20'));};exports[_0x604a('0x1b')]=function(_0x20a318){return BPromise[_0x604a('0xa')]()[_0x604a('0xb')](cmHopper[_0x604a('0x1b')]({'UserId':null},_0x20a318,0x1))[_0x604a('0xe')](loggerCatch(_0x604a('0x1c')));};exports[_0x604a('0x1d')]=function(_0x53e198){return BPromise[_0x604a('0xa')]()[_0x604a('0xb')](cmHopper[_0x604a('0x1b')]({'active':![]},_0x53e198,0x1))[_0x604a('0xe')](loggerCatch(_0x604a('0x1e')));};exports['crateCustomerReportQueue']=function(_0x4a1e5f){var _0x4d2c5c={};_0x4d2c5c[_0x604a('0x1f')]=_0x4a1e5f[_0x604a('0x1f')];_0x4d2c5c[_0x604a('0x20')]=_0x4a1e5f[_0x604a('0x20')];_0x4d2c5c['calleridnum']=_0x4a1e5f[_0x604a('0x21')];_0x4d2c5c[_0x604a('0x22')]=_0x4a1e5f[_0x604a('0x22')];_0x4d2c5c[_0x604a('0x23')]=_0x4a1e5f[_0x604a('0x23')];_0x4d2c5c['queuecallerjoinAt']=_0x4a1e5f['answertime'];_0x4d2c5c[_0x604a('0x24')]=_0x4a1e5f[_0x604a('0x25')];_0x4d2c5c['queuecallercomplete']=0x1;_0x4d2c5c[_0x604a('0x26')]=_0x4a1e5f[_0x604a('0x27')];_0x4d2c5c[_0x604a('0x28')]=_0x4a1e5f[_0x604a('0x29')];_0x4d2c5c[_0x604a('0x2a')]='from-sip';_0x4d2c5c[_0x604a('0x2b')]=_0x604a('0x2c');_0x4d2c5c[_0x604a('0x2d')]=0x0;_0x4d2c5c['assigned']=0x1;_0x4d2c5c[_0x604a('0x2e')]=_0x4a1e5f[_0x604a('0x29')];_0x4d2c5c[_0x604a('0x2f')]=_0x604a('0x30');return BPromise['resolve']()[_0x604a('0xb')](voiceQueueReport[_0x604a('0x31')](_0x4d2c5c))[_0x604a('0xe')](loggerCatch(_0x604a('0x32')));};exports[_0x604a('0x33')]=function(_0x1135de,_0x325e73){return BPromise['resolve']()[_0x604a('0xb')](cmHopper[_0x604a('0x33')](_0x1135de,_0x325e73))['catch'](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x1d4d83){return BPromise[_0x604a('0xa')]()[_0x604a('0xb')](cmHopper[_0x604a('0x18')](_0x1d4d83,!![],!![]))[_0x604a('0xe')](loggerCatch(_0x604a('0x34')));};