Built motion from commit 9e1399f3.|2.5.37
[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 _0xc068=['COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','../../../config/logger','preview','lodash','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/voiceQueueReport','error','resolve','then','createHistory','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','queuecallerjoinAt','answertime','queuecallercompleteAt','endtime','membername','from-sip','holdtime','assigned','lastAssignedTo'];(function(_0x2af55b,_0x297c12){var _0x4ea7cb=function(_0x176c70){while(--_0x176c70){_0x2af55b['push'](_0x2af55b['shift']());}};_0x4ea7cb(++_0x297c12);}(_0xc068,0xc9));var _0x8c06=function(_0x52d8d4,_0xe7f4dc){_0x52d8d4=_0x52d8d4-0x0;var _0x275382=_0xc068[_0x52d8d4];return _0x275382;};'use strict';var util=require(_0x8c06('0x0'));var BPromise=require('bluebird');var logger=require(_0x8c06('0x1'))(_0x8c06('0x2'));var _=require(_0x8c06('0x3'));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0x8c06('0x4'));var cmHopperBlack=require(_0x8c06('0x5'));var voiceQueueRt=require(_0x8c06('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x8c06('0x7'));function loggerCatch(_0xe34d73){return function(_0x2e9ac5){logger[_0x8c06('0x8')](_0xe34d73,util['inspect'](_0x2e9ac5,{'showHidden':![],'depth':null}));};}function create(_0x1b0e75){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopperHistory[_0x8c06('0xb')](_0x1b0e75))[_0x8c06('0xc')](loggerCatch(_0x8c06('0xd')));}function createAgent(_0x4b78e5){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](agentReportPreview[_0x8c06('0xb')](_0x4b78e5))[_0x8c06('0xc')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x18a692){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopper[_0x8c06('0xe')](_0x18a692,!![]))[_0x8c06('0xc')](loggerCatch(_0x8c06('0xf')));}exports[_0x8c06('0x10')]=function(_0x663ee9){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopperBlack[_0x8c06('0x10')](_0x663ee9))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x8c06('0x11')]=function(_0x5f043){return BPromise['resolve']()[_0x8c06('0xa')](cmHopper[_0x8c06('0x11')](_0x5f043))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x12')));};exports['createHistory']=function(_0x2cf500,_0x40b7cf){create(_0x2cf500)[_0x8c06('0xc')](loggerCatch(_0x40b7cf));moveContact(_0x2cf500)[_0x8c06('0xc')](loggerCatch(_0x40b7cf));};exports[_0x8c06('0x13')]=function(_0x3f72ba,_0x43e308){createAgent(_0x3f72ba)['catch'](loggerCatch(_0x43e308));};exports[_0x8c06('0x14')]=function(_0x3fcbe6,_0x3c23d7){create(_0x3fcbe6)[_0x8c06('0xc')](loggerCatch(_0x3c23d7));};exports[_0x8c06('0x15')]=function(_0x2de95a,_0x28f9cb){moveContact(_0x2de95a)[_0x8c06('0xc')](loggerCatch(_0x28f9cb));};exports[_0x8c06('0x16')]=function(_0x124527,_0xac0ce5,_0x21646f){if(_0xac0ce5){_0x124527[_0x8c06('0x17')]=null;}if(_0x21646f){_0x124527[_0x8c06('0x18')]=![];}return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopper[_0x8c06('0x16')](_0x124527))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x19')));};exports[_0x8c06('0x1a')]=function(_0x8f74e2){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopper[_0x8c06('0x1a')](_0x8f74e2))[_0x8c06('0xc')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x3211f2){return BPromise['resolve']()[_0x8c06('0xa')](cmHopper[_0x8c06('0x1b')]({'UserId':null},_0x3211f2,0x1))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x1c')));};exports[_0x8c06('0x1d')]=function(_0x4edc7b){return BPromise[_0x8c06('0x9')]()['then'](cmHopper[_0x8c06('0x1b')]({'active':![]},_0x4edc7b,0x1))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x1e')));};exports[_0x8c06('0x1f')]=function(_0x3ac4f4){var _0x3fa6e6={};_0x3fa6e6[_0x8c06('0x20')]=_0x3ac4f4[_0x8c06('0x20')];_0x3fa6e6[_0x8c06('0x21')]=_0x3ac4f4[_0x8c06('0x21')];_0x3fa6e6[_0x8c06('0x22')]=_0x3ac4f4[_0x8c06('0x22')];_0x3fa6e6['calleridname']=_0x3ac4f4['calleridname'];_0x3fa6e6['queue']=_0x3ac4f4['queue'];_0x3fa6e6[_0x8c06('0x23')]=_0x3ac4f4[_0x8c06('0x24')];_0x3fa6e6['queuecallerleaveAt']=_0x3ac4f4[_0x8c06('0x24')];_0x3fa6e6['queuecallercomplete']=0x1;_0x3fa6e6[_0x8c06('0x25')]=_0x3ac4f4[_0x8c06('0x26')];_0x3fa6e6['connectedlinename']=_0x3ac4f4[_0x8c06('0x27')];_0x3fa6e6['context']=_0x8c06('0x28');_0x3fa6e6['exten']='xcally-motion-preview';_0x3fa6e6[_0x8c06('0x29')]=0x0;_0x3fa6e6[_0x8c06('0x2a')]=0x1;_0x3fa6e6[_0x8c06('0x2b')]=_0x3ac4f4['membername'];_0x3fa6e6['queuecallerexitreason']=_0x8c06('0x2c');return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](voiceQueueReport['create'](_0x3fa6e6))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x2d')));};exports[_0x8c06('0x2e')]=function(_0x3e8d0a,_0x5d3e06){return BPromise['resolve']()[_0x8c06('0xa')](cmHopper[_0x8c06('0x2e')](_0x3e8d0a,_0x5d3e06))[_0x8c06('0xc')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0x8c06('0x2f')]=function(_0x347a75){return BPromise[_0x8c06('0x9')]()[_0x8c06('0xa')](cmHopper[_0x8c06('0x16')](_0x347a75,!![],!![]))[_0x8c06('0xc')](loggerCatch(_0x8c06('0x30')));};