Built motion from commit 2b9af5da.|2.6.26
[motion2.git] / server / services / ami / rpc / cmHopper.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 _0x9b97=['unlockContact','getContactRecallMe','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','getContacts','Request','GetCmHopper','CmContact','updateContacts','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','format','priority','DESC','ASC','getContactDialerIvr','scheduledat','moveContactManagedDialer','campaign','MoveContactManagedDialer','ContactId','getContactPreview','GetCmHopperPreview','Contact','User','Agent','name','VoiceQueue','Queue','getCmHopper'];(function(_0x28fb30,_0x257208){var _0x44048b=function(_0x106f81){while(--_0x106f81){_0x28fb30['push'](_0x28fb30['shift']());}};_0x44048b(++_0x257208);}(_0x9b97,0x11e));var _0x79b9=function(_0xe3b8a3,_0x31b9c6){_0xe3b8a3=_0xe3b8a3-0x0;var _0x17e467=_0x9b97[_0xe3b8a3];return _0x17e467;};'use strict';var client=require(_0x79b9('0x0'));var moment=require('moment');exports[_0x79b9('0x1')]=function(_0x3c4fa6,_0x20beff){return function(){return client[_0x79b9('0x2')](_0x79b9('0x3'),{'options':{'where':{'VoiceQueueId':_0x3c4fa6},'include':[{'model':_0x79b9('0x4'),'as':'Contact'}],'limit':_0x20beff,'raw':![]},'log':'getCmHopper'});};};exports[_0x79b9('0x5')]=function(_0x43ca68,_0x71521c,_0x53ad97){return function(){return client[_0x79b9('0x2')](_0x79b9('0x6'),{'body':_0x43ca68,'options':{'where':{'VoiceQueueId':_0x71521c,'scheduledat':{'$lte':moment()['format'](_0x79b9('0x7'))}},'limit':_0x53ad97},'log':_0x79b9('0x6')});};};exports[_0x79b9('0x8')]=function(_0x156e25){return client[_0x79b9('0x2')]('UpdateCmHopper',{'body':_0x156e25,'options':{'where':{'ContactId':_0x156e25['ContactId'],'ListId':_0x156e25[_0x79b9('0x9')],'VoiceQueueId':_0x156e25[_0x79b9('0xa')],'CampaignId':_0x156e25[_0x79b9('0xb')]}},'log':_0x79b9('0x8')});};exports[_0x79b9('0xc')]=function(_0x1cde44,_0x187feb,_0xb71cf4){return function(){return client[_0x79b9('0x2')](_0x79b9('0xd'),{'options':{'where':{'VoiceQueueId':_0x1cde44,'ListId':_0x187feb,'ContactId':_0xb71cf4}},'log':_0x79b9('0xd')});};};exports['getContactDialer']=function(_0x458174,_0x416833,_0x51173c,_0x548f65){return client['Request'](_0x79b9('0xe'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x458174,'active':![],'scheduledat':{'$lte':moment()[_0x79b9('0xf')](_0x79b9('0x7'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x416833}}]},'order':[[_0x79b9('0x10'),_0x79b9('0x11')],['scheduledat',_0x548f65],['id',_0x79b9('0x12')]],'raw':!![],'limit':_0x51173c},'log':_0x79b9('0xe')});};exports[_0x79b9('0x13')]=function(_0x4720ec,_0xf1a6c8,_0x5917ab){return client[_0x79b9('0x2')](_0x79b9('0xe'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x4720ec,'active':![],'scheduledat':{'$lte':moment()['format'](_0x79b9('0x7'))}},'include':[{'model':_0x79b9('0x4'),'as':'Contact'}],'order':[['priority','DESC'],[_0x79b9('0x14'),_0x5917ab],['id',_0x79b9('0x12')]],'raw':!![],'limit':_0xf1a6c8},'log':'GetContactDialerIvr'});};exports[_0x79b9('0x15')]=function(_0x26f60c,_0x2de174){_0x26f60c[_0x79b9('0x16')]=_0x26f60c['queue'];return client[_0x79b9('0x2')](_0x79b9('0x17'),{'body':_0x26f60c,'options':{'where':{'ContactId':_0x26f60c[_0x79b9('0x18')],'ListId':_0x26f60c[_0x79b9('0x9')],'VoiceQueueId':_0x26f60c[_0x79b9('0xa')],'CampaignId':_0x26f60c[_0x79b9('0xb')],'active':_0x2de174?undefined:!![]}},'log':_0x79b9('0x17')});};exports['countReScheduled']=function(_0xdd133f){return client[_0x79b9('0x2')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0xdd133f['id']?_0xdd133f['id']||null:null}},'log':'countReScheduled'});};exports[_0x79b9('0x19')]=function(_0xb77974){return function(){return client[_0x79b9('0x2')](_0x79b9('0x1a'),{'options':{'where':{'id':_0xb77974},'include':[{'model':_0x79b9('0x4'),'as':_0x79b9('0x1b')},{'model':_0x79b9('0x1c'),'as':_0x79b9('0x1d'),'attributes':['id',_0x79b9('0x1e')]},{'model':_0x79b9('0x1f'),'as':_0x79b9('0x20'),'attributes':['id',_0x79b9('0x1e')]}],'raw':!![]},'log':_0x79b9('0x21')});};};exports[_0x79b9('0x22')]=function(_0xb6ce97,_0x46dfa3,_0x32572d){return client[_0x79b9('0x2')](_0x79b9('0x6'),{'body':_0xb6ce97,'options':{'where':{'id':_0x46dfa3},'limit':_0x32572d},'log':_0x79b9('0x6')});};exports[_0x79b9('0x23')]=function(_0x1d307f,_0x531e7f){return function(){return client[_0x79b9('0x2')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1d307f,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x531e7f}},'order':[[_0x79b9('0x10'),_0x79b9('0x11')],[_0x79b9('0x14'),_0x79b9('0x11')],['id','ASC']],'include':[{'model':'CmContact','as':_0x79b9('0x1b')},{'model':'User','as':'Agent','attributes':['id',_0x79b9('0x1e'),'voicePause']}],'group':_0x79b9('0x24'),'raw':!![]},'log':_0x79b9('0xe')});};};exports['resetActiveCalls']=function(_0x53de40,_0x8f0374){return client[_0x79b9('0x2')](_0x79b9('0x25'),{'body':_0x53de40,'options':_0x8f0374||{},'log':_0x79b9('0x25')});};exports[_0x79b9('0x26')]=function(_0x5b2b17,_0x548c06,_0x592105){return function(){return client[_0x79b9('0x2')](_0x79b9('0x27'),{'body':{'where':{'voiceQueueIds':_0x5b2b17,'interval':_0x548c06,'availableAgentsIds':_0x592105}},'log':_0x79b9('0x26')});};};