2ec073640dd4c813e7a7f7fdcf11ea3e05c24d5f
[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 _0x7ead=['DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','ASC','getContactDialerIvr','scheduledat','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','ContactId','MoveContactManagedDialer','countReScheduled','CountReScheduled','GetCmHopperPreview','Agent','name','unlockContact','UpdateCmHopper','getContactRecallMe','User','db.CmHopper.UserId','moment','lodash','getContacts','GetCmHopper','CmContact','Contact','getCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','Request','ListId','VoiceQueueId','CampaignId','destroyContact'];(function(_0x36c400,_0x1d9609){var _0xc117d3=function(_0x1d2276){while(--_0x1d2276){_0x36c400['push'](_0x36c400['shift']());}};_0xc117d3(++_0x1d9609);}(_0x7ead,0xb4));var _0xd7ea=function(_0x5ef942,_0x51bb4b){_0x5ef942=_0x5ef942-0x0;var _0x594b02=_0x7ead[_0x5ef942];return _0x594b02;};'use strict';var client=require('../client');var moment=require(_0xd7ea('0x0'));var _=require(_0xd7ea('0x1'));exports[_0xd7ea('0x2')]=function(_0x48c5d4,_0x2b777e){return function(){return client['Request'](_0xd7ea('0x3'),{'options':{'where':{'VoiceQueueId':_0x48c5d4},'include':[{'model':_0xd7ea('0x4'),'as':_0xd7ea('0x5')}],'limit':_0x2b777e,'raw':![]},'log':_0xd7ea('0x6')});};};exports['updateContacts']=function(_0x1e9b97,_0x3e1be4,_0x757c3e){return function(){return client['Request']('UpdateCmHopper',{'body':_0x1e9b97,'options':{'where':{'VoiceQueueId':_0x3e1be4,'scheduledat':{'$lte':moment()[_0xd7ea('0x7')](_0xd7ea('0x8'))}},'limit':_0x757c3e},'log':'UpdateCmHopper'});};};exports[_0xd7ea('0x9')]=function(_0x3468da){return function(){return client[_0xd7ea('0xa')]('UpdateCmHopper',{'body':_0x3468da,'options':{'where':{'ContactId':_0x3468da['ContactId'],'ListId':_0x3468da[_0xd7ea('0xb')],'VoiceQueueId':_0x3468da[_0xd7ea('0xc')],'CampaignId':_0x3468da[_0xd7ea('0xd')]}},'log':_0xd7ea('0x9')});};};exports[_0xd7ea('0xe')]=function(_0x77d8be,_0x38e739,_0x128fbc){return function(){return client[_0xd7ea('0xa')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x77d8be,'ListId':_0x38e739,'ContactId':_0x128fbc}},'log':_0xd7ea('0xf')});};};exports[_0xd7ea('0x10')]=function(_0x5b007b,_0x5711b0,_0x21da2f,_0x780c58){return function(){return client[_0xd7ea('0xa')](_0xd7ea('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x5b007b,'active':![],'scheduledat':{'$lte':moment()[_0xd7ea('0x7')](_0xd7ea('0x8'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x5711b0}}]},'order':[[_0xd7ea('0x12'),_0xd7ea('0x13')],['scheduledat',_0x780c58],['id',_0xd7ea('0x14')]],'raw':!![],'limit':_0x21da2f},'log':_0xd7ea('0x11')});};};exports[_0xd7ea('0x15')]=function(_0x27bf6a,_0x4c8d55,_0x181f68){return function(){return client[_0xd7ea('0xa')](_0xd7ea('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x27bf6a,'active':![],'scheduledat':{'$lte':moment()[_0xd7ea('0x7')](_0xd7ea('0x8'))}},'include':[{'model':'CmContact','as':_0xd7ea('0x5')}],'order':[[_0xd7ea('0x12'),_0xd7ea('0x13')],[_0xd7ea('0x16'),_0x181f68],['id','ASC']],'raw':!![],'limit':_0x4c8d55},'log':_0xd7ea('0x17')});};};exports[_0xd7ea('0x18')]=function(_0x1c65fc,_0x299dc8){return function(){_0x1c65fc[_0xd7ea('0x19')]=_0x1c65fc[_0xd7ea('0x1a')];return client['Request']('MoveContactManagedDialer',{'body':_0x1c65fc,'options':{'where':{'ContactId':_0x1c65fc[_0xd7ea('0x1b')],'ListId':_0x1c65fc[_0xd7ea('0xb')],'VoiceQueueId':_0x1c65fc['VoiceQueueId'],'CampaignId':_0x1c65fc[_0xd7ea('0xd')],'active':_0x299dc8?undefined:!![]}},'log':_0xd7ea('0x1c')});};};exports[_0xd7ea('0x1d')]=function(_0x35e037){return function(){return client[_0xd7ea('0xa')](_0xd7ea('0x1e'),{'options':{'where':{'VoiceQueueId':_0x35e037['id']?_0x35e037['id']||null:null}},'log':'countReScheduled'});};};exports['getContactPreview']=function(_0x4bcea5){return function(){return client[_0xd7ea('0xa')](_0xd7ea('0x1f'),{'options':{'where':{'id':_0x4bcea5},'include':[{'model':_0xd7ea('0x4'),'as':_0xd7ea('0x5')},{'model':'User','as':_0xd7ea('0x20'),'attributes':['id',_0xd7ea('0x21')]},{'model':'VoiceQueue','as':'Queue','attributes':['id',_0xd7ea('0x21')]}],'raw':!![]},'log':_0xd7ea('0x6')});};};exports[_0xd7ea('0x22')]=function(_0x3508b6,_0x4d0635,_0x4131b4){return function(){return client[_0xd7ea('0xa')](_0xd7ea('0x23'),{'body':_0x3508b6,'options':{'where':{'id':_0x4d0635},'limit':_0x4131b4},'log':_0xd7ea('0x23')});};};exports[_0xd7ea('0x24')]=function(_0x552d5a,_0x537a60){return function(){return client['Request']('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x552d5a,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xd7ea('0x7')](_0xd7ea('0x8'))},'UserId':{'$in':_0x537a60}},'order':[['priority','DESC'],[_0xd7ea('0x16'),'DESC'],['id',_0xd7ea('0x14')]],'include':[{'model':_0xd7ea('0x4'),'as':_0xd7ea('0x5')},{'model':_0xd7ea('0x25'),'as':_0xd7ea('0x20'),'attributes':['id','name','voicePause']}],'group':_0xd7ea('0x26'),'raw':!![]},'log':_0xd7ea('0x11')});};};