2180d23573ffe0ce253f896443cbad78af889198
[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 _0x55a4=['VoiceQueue','unlockContact','User','voicePause','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','lodash','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','DESC','scheduledat','ASC','priority','GetContactDialerIvr','queue','VoiceQueueId','MoveContactManagedDialer','countReScheduled','getContactPreview','Agent','name'];(function(_0x3400ca,_0x14da2c){var _0x5ea6ba=function(_0x1784e0){while(--_0x1784e0){_0x3400ca['push'](_0x3400ca['shift']());}};_0x5ea6ba(++_0x14da2c);}(_0x55a4,0x111));var _0x455a=function(_0x285b34,_0x26ae8c){_0x285b34=_0x285b34-0x0;var _0x39eba9=_0x55a4[_0x285b34];return _0x39eba9;};'use strict';var client=require(_0x455a('0x0'));var moment=require('moment');var _=require(_0x455a('0x1'));exports[_0x455a('0x2')]=function(_0x4c1b6e,_0x6f5cd3){return function(){return client[_0x455a('0x3')](_0x455a('0x4'),{'options':{'where':{'VoiceQueueId':_0x4c1b6e},'include':[{'model':_0x455a('0x5'),'as':_0x455a('0x6')}],'limit':_0x6f5cd3,'raw':![]},'log':_0x455a('0x7')});};};exports['updateContacts']=function(_0x1ab672,_0x5b39f6,_0xf851f){return function(){return client[_0x455a('0x3')](_0x455a('0x8'),{'body':_0x1ab672,'options':{'where':{'VoiceQueueId':_0x5b39f6,'scheduledat':{'$lte':moment()[_0x455a('0x9')](_0x455a('0xa'))}},'limit':_0xf851f},'log':_0x455a('0x8')});};};exports[_0x455a('0xb')]=function(_0x371a27){return function(){return client[_0x455a('0x3')]('UpdateCmHopper',{'body':_0x371a27,'options':{'where':{'ContactId':_0x371a27[_0x455a('0xc')],'ListId':_0x371a27[_0x455a('0xd')],'VoiceQueueId':_0x371a27['VoiceQueueId'],'CampaignId':_0x371a27[_0x455a('0xe')]}},'log':_0x455a('0xb')});};};exports[_0x455a('0xf')]=function(_0x19d09a,_0x2dc450,_0x47dcc3){return function(){return client[_0x455a('0x3')](_0x455a('0x10'),{'options':{'where':{'VoiceQueueId':_0x19d09a,'ListId':_0x2dc450,'ContactId':_0x47dcc3}},'log':_0x455a('0x10')});};};exports[_0x455a('0x11')]=function(_0xcb3d94,_0x52468c,_0x3de14c,_0x2502dd){return function(){return client[_0x455a('0x3')](_0x455a('0x12'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xcb3d94,'active':![],'scheduledat':{'$lte':moment()[_0x455a('0x9')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x52468c}}]},'order':[['priority',_0x455a('0x13')],[_0x455a('0x14'),_0x2502dd],['id',_0x455a('0x15')]],'raw':!![],'limit':_0x3de14c},'log':_0x455a('0x12')});};};exports['getContactDialerIvr']=function(_0x41f03f,_0x31d20a,_0x5177cd){return function(){return client[_0x455a('0x3')](_0x455a('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x41f03f,'active':![],'scheduledat':{'$lte':moment()[_0x455a('0x9')](_0x455a('0xa'))}},'include':[{'model':_0x455a('0x5'),'as':_0x455a('0x6')}],'order':[[_0x455a('0x16'),'DESC'],[_0x455a('0x14'),_0x5177cd],['id',_0x455a('0x15')]],'raw':!![],'limit':_0x31d20a},'log':_0x455a('0x17')});};};exports['moveContactManagedDialer']=function(_0x527c20,_0x15c4ad){return function(){_0x527c20['campaign']=_0x527c20[_0x455a('0x18')];return client[_0x455a('0x3')]('MoveContactManagedDialer',{'body':_0x527c20,'options':{'where':{'ContactId':_0x527c20['ContactId'],'ListId':_0x527c20['ListId'],'VoiceQueueId':_0x527c20[_0x455a('0x19')],'CampaignId':_0x527c20[_0x455a('0xe')],'active':_0x15c4ad?undefined:!![]}},'log':_0x455a('0x1a')});};};exports[_0x455a('0x1b')]=function(_0x33dda3){return function(){return client['Request']('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x33dda3['id']?_0x33dda3['id']||null:null}},'log':_0x455a('0x1b')});};};exports[_0x455a('0x1c')]=function(_0xaaf6ba){return function(){return client['Request']('GetCmHopperPreview',{'options':{'where':{'id':_0xaaf6ba},'include':[{'model':_0x455a('0x5'),'as':_0x455a('0x6')},{'model':'User','as':_0x455a('0x1d'),'attributes':['id',_0x455a('0x1e')]},{'model':_0x455a('0x1f'),'as':'Queue','attributes':['id','name']}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x455a('0x20')]=function(_0x136263,_0x561d06,_0x5ca1e5){return function(){return client[_0x455a('0x3')](_0x455a('0x8'),{'body':_0x136263,'options':{'where':{'id':_0x561d06},'limit':_0x5ca1e5},'log':_0x455a('0x8')});};};exports['getContactRecallMe']=function(_0x38bb82,_0x477452){return function(){return client['Request']('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x38bb82,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x455a('0x9')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x477452}},'order':[['priority','DESC'],[_0x455a('0x14'),_0x455a('0x13')],['id',_0x455a('0x15')]],'include':[{'model':_0x455a('0x5'),'as':_0x455a('0x6')},{'model':_0x455a('0x21'),'as':'Agent','attributes':['id',_0x455a('0x1e'),_0x455a('0x22')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x455a('0x12')});};};exports['resetActiveCalls']=function(_0x38a141){return function(){return client[_0x455a('0x3')](_0x455a('0x23'),{'body':_0x38a141,'options':{},'log':_0x455a('0x23')});};};exports[_0x455a('0x24')]=function(_0x27c07b,_0x279f73){return function(){return client['Request'](_0x455a('0x25'),{'body':{'where':{'voiceQueueId':_0x27c07b,'interval':_0x279f73}},'log':'handlePreviewRecallNotifications'});};};