0d0fccc16551436f9aeab7854d169270444de4c9
[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 _0xc949=['updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','scheduledat','getContactDialerIvr','DESC','ASC','GetContactDialerIvr','campaign','queue','MoveContactManagedDialer','VoiceQueueId','countReScheduled','getContactPreview','GetCmHopperPreview','User','name','VoiceQueue','unlockContact','GetContactRecallMe','Agent','resetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','getContacts','Request','CmContact','Contact'];(function(_0x30a87a,_0x3f9c41){var _0x51cb58=function(_0x3470d2){while(--_0x3470d2){_0x30a87a['push'](_0x30a87a['shift']());}};_0x51cb58(++_0x3f9c41);}(_0xc949,0x181));var _0x9c94=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xc949[_0x138f59];return _0x3d114d;};'use strict';var client=require(_0x9c94('0x0'));var moment=require('moment');exports[_0x9c94('0x1')]=function(_0x322fed,_0x209cd8){return function(){return client[_0x9c94('0x2')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x322fed},'include':[{'model':_0x9c94('0x3'),'as':_0x9c94('0x4')}],'limit':_0x209cd8,'raw':![]},'log':'getCmHopper'});};};exports[_0x9c94('0x5')]=function(_0x1b60a1,_0x46d560,_0x1357ac){return function(){return client['Request'](_0x9c94('0x6'),{'body':_0x1b60a1,'options':{'where':{'VoiceQueueId':_0x46d560,'scheduledat':{'$lte':moment()[_0x9c94('0x7')](_0x9c94('0x8'))}},'limit':_0x1357ac},'log':_0x9c94('0x6')});};};exports[_0x9c94('0x9')]=function(_0x423e62){return client[_0x9c94('0x2')](_0x9c94('0x6'),{'body':_0x423e62,'options':{'where':{'ContactId':_0x423e62[_0x9c94('0xa')],'ListId':_0x423e62[_0x9c94('0xb')],'VoiceQueueId':_0x423e62['VoiceQueueId'],'CampaignId':_0x423e62[_0x9c94('0xc')]}},'log':_0x9c94('0x9')});};exports[_0x9c94('0xd')]=function(_0x20fc5a,_0x2ce750,_0x2fba75){return function(){return client[_0x9c94('0x2')](_0x9c94('0xe'),{'options':{'where':{'VoiceQueueId':_0x20fc5a,'ListId':_0x2ce750,'ContactId':_0x2fba75}},'log':_0x9c94('0xe')});};};exports[_0x9c94('0xf')]=function(_0x4440b2,_0x25c444,_0x369d70,_0x15c51c){return client['Request'](_0x9c94('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x4440b2,'active':![],'scheduledat':{'$lte':moment()['format'](_0x9c94('0x8'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x25c444}}]},'order':[[_0x9c94('0x11'),'DESC'],[_0x9c94('0x12'),_0x15c51c],['id','ASC']],'raw':!![],'limit':_0x369d70},'log':'GetContactDialer'});};exports[_0x9c94('0x13')]=function(_0x48d121,_0x60e4e2,_0x33bd19){return client['Request'](_0x9c94('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x48d121,'active':![],'scheduledat':{'$lte':moment()[_0x9c94('0x7')](_0x9c94('0x8'))}},'include':[{'model':_0x9c94('0x3'),'as':_0x9c94('0x4')}],'order':[[_0x9c94('0x11'),_0x9c94('0x14')],['scheduledat',_0x33bd19],['id',_0x9c94('0x15')]],'raw':!![],'limit':_0x60e4e2},'log':_0x9c94('0x16')});};exports['moveContactManagedDialer']=function(_0x141801,_0x845304){_0x141801[_0x9c94('0x17')]=_0x141801[_0x9c94('0x18')];return client[_0x9c94('0x2')](_0x9c94('0x19'),{'body':_0x141801,'options':{'where':{'ContactId':_0x141801[_0x9c94('0xa')],'ListId':_0x141801[_0x9c94('0xb')],'VoiceQueueId':_0x141801[_0x9c94('0x1a')],'CampaignId':_0x141801[_0x9c94('0xc')],'active':_0x845304?undefined:!![]}},'log':_0x9c94('0x19')});};exports[_0x9c94('0x1b')]=function(_0x44d732){return client[_0x9c94('0x2')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x44d732['id']?_0x44d732['id']||null:null}},'log':_0x9c94('0x1b')});};exports[_0x9c94('0x1c')]=function(_0x5c2647){return function(){return client[_0x9c94('0x2')](_0x9c94('0x1d'),{'options':{'where':{'id':_0x5c2647},'include':[{'model':_0x9c94('0x3'),'as':_0x9c94('0x4')},{'model':_0x9c94('0x1e'),'as':'Agent','attributes':['id',_0x9c94('0x1f')]},{'model':_0x9c94('0x20'),'as':'Queue','attributes':['id',_0x9c94('0x1f')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x9c94('0x21')]=function(_0x14d41b,_0x330bd4,_0x4008e8){return client[_0x9c94('0x2')](_0x9c94('0x6'),{'body':_0x14d41b,'options':{'where':{'id':_0x330bd4},'limit':_0x4008e8},'log':_0x9c94('0x6')});};exports['getContactRecallMe']=function(_0x5a6b1c,_0xc4a819){return function(){return client[_0x9c94('0x2')](_0x9c94('0x22'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x5a6b1c,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x9c94('0x8'))},'UserId':{'$in':_0xc4a819}},'order':[['priority',_0x9c94('0x14')],[_0x9c94('0x12'),_0x9c94('0x14')],['id','ASC']],'include':[{'model':'CmContact','as':_0x9c94('0x4')},{'model':_0x9c94('0x1e'),'as':_0x9c94('0x23'),'attributes':['id','name','voicePause']}],'group':'db.CmHopper.UserId','raw':!![]},'log':'GetContactDialer'});};};exports[_0x9c94('0x24')]=function(_0x49dbf2,_0x125bbf){return client[_0x9c94('0x2')]('ResetActiveCalls',{'body':_0x49dbf2,'options':_0x125bbf||{},'log':'ResetActiveCalls'});};exports[_0x9c94('0x25')]=function(_0x6b1b1a,_0x3c59ef,_0x8eb925){return function(){return client[_0x9c94('0x2')](_0x9c94('0x26'),{'body':{'where':{'voiceQueueIds':_0x6b1b1a,'interval':_0x3c59ef,'availableAgentsIds':_0x8eb925}},'log':_0x9c94('0x25')});};};