837323b5afc9f95653dcc7e6342f3d9eb1ff3890
[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 _0x5a2a=['User','Agent','name','Queue','unlockContact','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','CmContact','Contact','updateContacts','Request','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','ContactId','ListId','VoiceQueueId','rescheduleContact','destroyContact','DestroyCmHopper','DESC','scheduledat','GetContactDialer','getContactDialerIvr','priority','ASC','GetContactDialerIvr','campaign','queue','MoveContactManagedDialer','CampaignId','countReScheduled','GetCmHopperPreview'];(function(_0x16076a,_0x3cc440){var _0x45f4e6=function(_0xfd0e42){while(--_0xfd0e42){_0x16076a['push'](_0x16076a['shift']());}};_0x45f4e6(++_0x3cc440);}(_0x5a2a,0x1c3));var _0xa5a2=function(_0x529f2b,_0x49ca89){_0x529f2b=_0x529f2b-0x0;var _0x26967f=_0x5a2a[_0x529f2b];return _0x26967f;};'use strict';var client=require(_0xa5a2('0x0'));var moment=require(_0xa5a2('0x1'));exports[_0xa5a2('0x2')]=function(_0x1c932a,_0x5d3456){return function(){return client['Request']('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x1c932a},'include':[{'model':_0xa5a2('0x3'),'as':_0xa5a2('0x4')}],'limit':_0x5d3456,'raw':![]},'log':'getCmHopper'});};};exports[_0xa5a2('0x5')]=function(_0x14aac8,_0x2e97d3,_0x55728b){return function(){return client[_0xa5a2('0x6')]('UpdateCmHopper',{'body':_0x14aac8,'options':{'where':{'VoiceQueueId':_0x2e97d3,'scheduledat':{'$lte':moment()[_0xa5a2('0x7')](_0xa5a2('0x8'))}},'limit':_0x55728b},'log':_0xa5a2('0x9')});};};exports['rescheduleContact']=function(_0x5c254b){return client[_0xa5a2('0x6')](_0xa5a2('0x9'),{'body':_0x5c254b,'options':{'where':{'ContactId':_0x5c254b[_0xa5a2('0xa')],'ListId':_0x5c254b[_0xa5a2('0xb')],'VoiceQueueId':_0x5c254b[_0xa5a2('0xc')],'CampaignId':_0x5c254b['CampaignId']}},'log':_0xa5a2('0xd')});};exports[_0xa5a2('0xe')]=function(_0x28f227,_0x288f31,_0x323527){return function(){return client[_0xa5a2('0x6')](_0xa5a2('0xf'),{'options':{'where':{'VoiceQueueId':_0x28f227,'ListId':_0x288f31,'ContactId':_0x323527}},'log':'DestroyCmHopper'});};};exports['getContactDialer']=function(_0x121b17,_0x3e058b,_0x5704b7,_0x29174b){return client[_0xa5a2('0x6')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x121b17,'active':![],'scheduledat':{'$lte':moment()[_0xa5a2('0x7')](_0xa5a2('0x8'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x3e058b}}]},'order':[['priority',_0xa5a2('0x10')],[_0xa5a2('0x11'),_0x29174b],['id','ASC']],'raw':!![],'limit':_0x5704b7},'log':_0xa5a2('0x12')});};exports[_0xa5a2('0x13')]=function(_0x599599,_0x15e36b,_0x996384){return client[_0xa5a2('0x6')](_0xa5a2('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x599599,'active':![],'scheduledat':{'$lte':moment()[_0xa5a2('0x7')](_0xa5a2('0x8'))}},'include':[{'model':'CmContact','as':_0xa5a2('0x4')}],'order':[[_0xa5a2('0x14'),_0xa5a2('0x10')],[_0xa5a2('0x11'),_0x996384],['id',_0xa5a2('0x15')]],'raw':!![],'limit':_0x15e36b},'log':_0xa5a2('0x16')});};exports['moveContactManagedDialer']=function(_0x299208,_0x2fa65d){_0x299208[_0xa5a2('0x17')]=_0x299208[_0xa5a2('0x18')];return client[_0xa5a2('0x6')](_0xa5a2('0x19'),{'body':_0x299208,'options':{'where':{'ContactId':_0x299208[_0xa5a2('0xa')],'ListId':_0x299208[_0xa5a2('0xb')],'VoiceQueueId':_0x299208[_0xa5a2('0xc')],'CampaignId':_0x299208[_0xa5a2('0x1a')],'active':_0x2fa65d?undefined:!![]}},'log':_0xa5a2('0x19')});};exports[_0xa5a2('0x1b')]=function(_0x9a6e53){return client[_0xa5a2('0x6')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x9a6e53['id']?_0x9a6e53['id']||null:null}},'log':'countReScheduled'});};exports['getContactPreview']=function(_0x33954c){return function(){return client[_0xa5a2('0x6')](_0xa5a2('0x1c'),{'options':{'where':{'id':_0x33954c},'include':[{'model':_0xa5a2('0x3'),'as':_0xa5a2('0x4')},{'model':_0xa5a2('0x1d'),'as':_0xa5a2('0x1e'),'attributes':['id',_0xa5a2('0x1f')]},{'model':'VoiceQueue','as':_0xa5a2('0x20'),'attributes':['id',_0xa5a2('0x1f')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xa5a2('0x21')]=function(_0x402c58,_0x493912,_0xe02093){return client[_0xa5a2('0x6')](_0xa5a2('0x9'),{'body':_0x402c58,'options':{'where':{'id':_0x493912},'limit':_0xe02093},'log':_0xa5a2('0x9')});};exports['getContactRecallMe']=function(_0x41eae4,_0x25b806){return function(){return client[_0xa5a2('0x6')](_0xa5a2('0x22'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x41eae4,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xa5a2('0x7')](_0xa5a2('0x8'))},'UserId':{'$in':_0x25b806}},'order':[[_0xa5a2('0x14'),_0xa5a2('0x10')],[_0xa5a2('0x11'),_0xa5a2('0x10')],['id',_0xa5a2('0x15')]],'include':[{'model':_0xa5a2('0x3'),'as':_0xa5a2('0x4')},{'model':'User','as':_0xa5a2('0x1e'),'attributes':['id','name',_0xa5a2('0x23')]}],'group':_0xa5a2('0x24'),'raw':!![]},'log':_0xa5a2('0x12')});};};exports[_0xa5a2('0x25')]=function(_0x5ed1ee,_0x551e1a){return client[_0xa5a2('0x6')]('ResetActiveCalls',{'body':_0x5ed1ee,'options':_0x551e1a||{},'log':'ResetActiveCalls'});};exports[_0xa5a2('0x26')]=function(_0x41e3b1,_0x58a49b,_0x533175){return function(){return client[_0xa5a2('0x6')](_0xa5a2('0x27'),{'body':{'where':{'voiceQueueIds':_0x41e3b1,'interval':_0x58a49b,'availableAgentsIds':_0x533175}},'log':'handlePreviewRecallNotifications'});};};