Built motion from commit 377f727e.|2.6.28
[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 _0x8781=['CampaignId','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','User','Agent','name','Queue','unlockContact','getContactRecallMe','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','destroyContact','DestroyCmHopper','getContactDialer','priority','ASC','GetContactDialer','getContactDialerIvr','CmContact','DESC','scheduledat','GetContactDialerIvr','moveContactManagedDialer','campaign'];(function(_0xbf5e16,_0x146ce3){var _0x5975a5=function(_0x2387a7){while(--_0x2387a7){_0xbf5e16['push'](_0xbf5e16['shift']());}};_0x5975a5(++_0x146ce3);}(_0x8781,0x1c8));var _0x1878=function(_0x49e3bd,_0x7cd97f){_0x49e3bd=_0x49e3bd-0x0;var _0x5a74e8=_0x8781[_0x49e3bd];return _0x5a74e8;};'use strict';var client=require(_0x1878('0x0'));var moment=require(_0x1878('0x1'));exports[_0x1878('0x2')]=function(_0x1884a3,_0x152ab9){return function(){return client[_0x1878('0x3')](_0x1878('0x4'),{'options':{'where':{'VoiceQueueId':_0x1884a3},'include':[{'model':'CmContact','as':_0x1878('0x5')}],'limit':_0x152ab9,'raw':![]},'log':_0x1878('0x6')});};};exports[_0x1878('0x7')]=function(_0x43ad96,_0x43d827,_0x1c52e8){return function(){return client['Request'](_0x1878('0x8'),{'body':_0x43ad96,'options':{'where':{'VoiceQueueId':_0x43d827,'scheduledat':{'$lte':moment()[_0x1878('0x9')](_0x1878('0xa'))}},'limit':_0x1c52e8},'log':_0x1878('0x8')});};};exports[_0x1878('0xb')]=function(_0x2e6c2f){return client[_0x1878('0x3')](_0x1878('0x8'),{'body':_0x2e6c2f,'options':{'where':{'ContactId':_0x2e6c2f[_0x1878('0xc')],'ListId':_0x2e6c2f[_0x1878('0xd')],'VoiceQueueId':_0x2e6c2f[_0x1878('0xe')],'CampaignId':_0x2e6c2f['CampaignId']}},'log':_0x1878('0xb')});};exports[_0x1878('0xf')]=function(_0x3cf2ac,_0x36b9e0,_0x5266e2){return function(){return client['Request'](_0x1878('0x10'),{'options':{'where':{'VoiceQueueId':_0x3cf2ac,'ListId':_0x36b9e0,'ContactId':_0x5266e2}},'log':_0x1878('0x10')});};};exports[_0x1878('0x11')]=function(_0x394d1d,_0x565fb4,_0x5804de,_0x19ffaa){return client[_0x1878('0x3')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x394d1d,'active':![],'scheduledat':{'$lte':moment()[_0x1878('0x9')](_0x1878('0xa'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x565fb4}}]},'order':[[_0x1878('0x12'),'DESC'],['scheduledat',_0x19ffaa],['id',_0x1878('0x13')]],'raw':!![],'limit':_0x5804de},'log':_0x1878('0x14')});};exports[_0x1878('0x15')]=function(_0x43b85e,_0x121025,_0x430e64){return client[_0x1878('0x3')](_0x1878('0x14'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x43b85e,'active':![],'scheduledat':{'$lte':moment()[_0x1878('0x9')](_0x1878('0xa'))}},'include':[{'model':_0x1878('0x16'),'as':'Contact'}],'order':[['priority',_0x1878('0x17')],[_0x1878('0x18'),_0x430e64],['id','ASC']],'raw':!![],'limit':_0x121025},'log':_0x1878('0x19')});};exports[_0x1878('0x1a')]=function(_0x1fae20,_0x387f5){_0x1fae20[_0x1878('0x1b')]=_0x1fae20['queue'];return client[_0x1878('0x3')]('MoveContactManagedDialer',{'body':_0x1fae20,'options':{'where':{'ContactId':_0x1fae20[_0x1878('0xc')],'ListId':_0x1fae20[_0x1878('0xd')],'VoiceQueueId':_0x1fae20[_0x1878('0xe')],'CampaignId':_0x1fae20[_0x1878('0x1c')],'active':_0x387f5?undefined:!![]}},'log':_0x1878('0x1d')});};exports['countReScheduled']=function(_0x461905){return client[_0x1878('0x3')](_0x1878('0x1e'),{'options':{'where':{'VoiceQueueId':_0x461905['id']?_0x461905['id']||null:null}},'log':_0x1878('0x1f')});};exports[_0x1878('0x20')]=function(_0x2ff3b9){return function(){return client[_0x1878('0x3')]('GetCmHopperPreview',{'options':{'where':{'id':_0x2ff3b9},'include':[{'model':_0x1878('0x16'),'as':_0x1878('0x5')},{'model':_0x1878('0x21'),'as':_0x1878('0x22'),'attributes':['id',_0x1878('0x23')]},{'model':'VoiceQueue','as':_0x1878('0x24'),'attributes':['id',_0x1878('0x23')]}],'raw':!![]},'log':_0x1878('0x6')});};};exports[_0x1878('0x25')]=function(_0x480a37,_0x110aa2,_0x57cc60){return client[_0x1878('0x3')](_0x1878('0x8'),{'body':_0x480a37,'options':{'where':{'id':_0x110aa2},'limit':_0x57cc60},'log':_0x1878('0x8')});};exports[_0x1878('0x26')]=function(_0x49112c,_0x35750c){return function(){return client[_0x1878('0x3')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x49112c,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x1878('0xa'))},'UserId':{'$in':_0x35750c}},'order':[['priority','DESC'],[_0x1878('0x18'),_0x1878('0x17')],['id',_0x1878('0x13')]],'include':[{'model':'CmContact','as':_0x1878('0x5')},{'model':_0x1878('0x21'),'as':_0x1878('0x22'),'attributes':['id',_0x1878('0x23'),'voicePause']}],'group':_0x1878('0x27'),'raw':!![]},'log':_0x1878('0x14')});};};exports[_0x1878('0x28')]=function(_0x5702f6,_0x4f3cc9){return client[_0x1878('0x3')]('ResetActiveCalls',{'body':_0x5702f6,'options':_0x4f3cc9||{},'log':_0x1878('0x29')});};exports[_0x1878('0x2a')]=function(_0x4ebdbe,_0x5a4dfb,_0x53b5b2){return function(){return client[_0x1878('0x3')](_0x1878('0x2b'),{'body':{'where':{'voiceQueueIds':_0x4ebdbe,'interval':_0x5a4dfb,'availableAgentsIds':_0x53b5b2}},'log':_0x1878('0x2a')});};};