44cc9dc23e2cf106b55ad02c18d07a48cac9d35b
[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 _0xfb65=['voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','moment','getContacts','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','Request','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId','VoiceQueueId','destroyContact','DestroyCmHopper','getContactDialer','priority','scheduledat','ASC','GetContactDialer','GetContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','ContactId','CampaignId','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue','Queue','unlockContact','getContactRecallMe','DESC'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0xfb65,0x82));var _0x5fb6=function(_0x54a69d,_0x2e4c47){_0x54a69d=_0x54a69d-0x0;var _0x2b69f0=_0xfb65[_0x54a69d];return _0x2b69f0;};'use strict';var client=require('../client');var moment=require(_0x5fb6('0x0'));exports[_0x5fb6('0x1')]=function(_0x5cc692,_0x860687){return function(){return client['Request'](_0x5fb6('0x2'),{'options':{'where':{'VoiceQueueId':_0x5cc692},'include':[{'model':_0x5fb6('0x3'),'as':_0x5fb6('0x4')}],'limit':_0x860687,'raw':![]},'log':_0x5fb6('0x5')});};};exports[_0x5fb6('0x6')]=function(_0x1fefe3,_0x4dec8f,_0x50782b){return function(){return client[_0x5fb6('0x7')](_0x5fb6('0x8'),{'body':_0x1fefe3,'options':{'where':{'VoiceQueueId':_0x4dec8f,'scheduledat':{'$lte':moment()[_0x5fb6('0x9')](_0x5fb6('0xa'))}},'limit':_0x50782b},'log':'UpdateCmHopper'});};};exports[_0x5fb6('0xb')]=function(_0x29dd40){return client[_0x5fb6('0x7')](_0x5fb6('0x8'),{'body':_0x29dd40,'options':{'where':{'ContactId':_0x29dd40['ContactId'],'ListId':_0x29dd40[_0x5fb6('0xc')],'VoiceQueueId':_0x29dd40[_0x5fb6('0xd')],'CampaignId':_0x29dd40['CampaignId']}},'log':_0x5fb6('0xb')});};exports[_0x5fb6('0xe')]=function(_0x160070,_0x41405c,_0x34a705){return function(){return client['Request'](_0x5fb6('0xf'),{'options':{'where':{'VoiceQueueId':_0x160070,'ListId':_0x41405c,'ContactId':_0x34a705}},'log':_0x5fb6('0xf')});};};exports[_0x5fb6('0x10')]=function(_0x41d503,_0x6b58a2,_0x1bab1f,_0x1a391f){return client[_0x5fb6('0x7')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x41d503,'active':![],'scheduledat':{'$lte':moment()['format'](_0x5fb6('0xa'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x6b58a2}}]},'order':[[_0x5fb6('0x11'),'DESC'],[_0x5fb6('0x12'),_0x1a391f],['id',_0x5fb6('0x13')]],'raw':!![],'limit':_0x1bab1f},'log':_0x5fb6('0x14')});};exports['getContactDialerIvr']=function(_0x48f94d,_0x3ebbec,_0x27bd8b){return client[_0x5fb6('0x7')](_0x5fb6('0x14'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x48f94d,'active':![],'scheduledat':{'$lte':moment()[_0x5fb6('0x9')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0x5fb6('0x3'),'as':'Contact'}],'order':[[_0x5fb6('0x11'),'DESC'],[_0x5fb6('0x12'),_0x27bd8b],['id',_0x5fb6('0x13')]],'raw':!![],'limit':_0x3ebbec},'log':_0x5fb6('0x15')});};exports[_0x5fb6('0x16')]=function(_0x5885f1,_0x418f58){_0x5885f1[_0x5fb6('0x17')]=_0x5885f1['queue'];return client['Request'](_0x5fb6('0x18'),{'body':_0x5885f1,'options':{'where':{'ContactId':_0x5885f1[_0x5fb6('0x19')],'ListId':_0x5885f1['ListId'],'VoiceQueueId':_0x5885f1[_0x5fb6('0xd')],'CampaignId':_0x5885f1[_0x5fb6('0x1a')],'active':_0x418f58?undefined:!![]}},'log':_0x5fb6('0x18')});};exports[_0x5fb6('0x1b')]=function(_0x582f60){return client[_0x5fb6('0x7')](_0x5fb6('0x1c'),{'options':{'where':{'VoiceQueueId':_0x582f60['id']?_0x582f60['id']||null:null}},'log':_0x5fb6('0x1b')});};exports[_0x5fb6('0x1d')]=function(_0x1b6953){return function(){return client[_0x5fb6('0x7')]('GetCmHopperPreview',{'options':{'where':{'id':_0x1b6953},'include':[{'model':'CmContact','as':_0x5fb6('0x4')},{'model':_0x5fb6('0x1e'),'as':_0x5fb6('0x1f'),'attributes':['id',_0x5fb6('0x20')]},{'model':_0x5fb6('0x21'),'as':_0x5fb6('0x22'),'attributes':['id',_0x5fb6('0x20')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x5fb6('0x23')]=function(_0x3f9b86,_0xac9a34,_0x5a1f0d){return client[_0x5fb6('0x7')](_0x5fb6('0x8'),{'body':_0x3f9b86,'options':{'where':{'id':_0xac9a34},'limit':_0x5a1f0d},'log':'UpdateCmHopper'});};exports[_0x5fb6('0x24')]=function(_0x408fd9,_0x52afd7){return function(){return client[_0x5fb6('0x7')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x408fd9,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x5fb6('0x9')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x52afd7}},'order':[['priority',_0x5fb6('0x25')],[_0x5fb6('0x12'),_0x5fb6('0x25')],['id',_0x5fb6('0x13')]],'include':[{'model':_0x5fb6('0x3'),'as':_0x5fb6('0x4')},{'model':'User','as':_0x5fb6('0x1f'),'attributes':['id',_0x5fb6('0x20'),_0x5fb6('0x26')]}],'group':_0x5fb6('0x27'),'raw':!![]},'log':_0x5fb6('0x14')});};};exports[_0x5fb6('0x28')]=function(_0x238a37,_0xf78e09){return client[_0x5fb6('0x7')](_0x5fb6('0x29'),{'body':_0x238a37,'options':_0xf78e09||{},'log':_0x5fb6('0x29')});};exports['handlePreviewRecallNotifications']=function(_0xde8b2c,_0x1aa02b,_0x5acfe6){return function(){return client[_0x5fb6('0x7')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0xde8b2c,'interval':_0x1aa02b,'availableAgentsIds':_0x5acfe6}},'log':'handlePreviewRecallNotifications'});};};