Built motion from commit 56b8093a.|2.6.29
[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 _0x7c22=['countReScheduled','getContactPreview','GetCmHopperPreview','Agent','name','VoiceQueue','Queue','getCmHopper','unlockContact','getContactRecallMe','GetContactRecallMe','scheduledat','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','GetCmHopper','CmContact','updateContacts','Request','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId','VoiceQueueId','CampaignId','DestroyCmHopper','getContactDialer','format','priority','DESC','ASC','GetContactDialer','getContactDialerIvr','Contact','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ContactId'];(function(_0x1281cb,_0x23b905){var _0x2f4698=function(_0x23ebf8){while(--_0x23ebf8){_0x1281cb['push'](_0x1281cb['shift']());}};_0x2f4698(++_0x23b905);}(_0x7c22,0x6c));var _0x27c2=function(_0x230a12,_0x37def9){_0x230a12=_0x230a12-0x0;var _0x599f24=_0x7c22[_0x230a12];return _0x599f24;};'use strict';var client=require(_0x27c2('0x0'));var moment=require(_0x27c2('0x1'));exports['getContacts']=function(_0x45a700,_0x117d29){return function(){return client['Request'](_0x27c2('0x2'),{'options':{'where':{'VoiceQueueId':_0x45a700},'include':[{'model':_0x27c2('0x3'),'as':'Contact'}],'limit':_0x117d29,'raw':![]},'log':'getCmHopper'});};};exports[_0x27c2('0x4')]=function(_0x4c7e96,_0x28548d,_0x5006bd){return function(){return client[_0x27c2('0x5')](_0x27c2('0x6'),{'body':_0x4c7e96,'options':{'where':{'VoiceQueueId':_0x28548d,'scheduledat':{'$lte':moment()['format'](_0x27c2('0x7'))}},'limit':_0x5006bd},'log':_0x27c2('0x6')});};};exports[_0x27c2('0x8')]=function(_0x84f4e5){return client[_0x27c2('0x5')]('UpdateCmHopper',{'body':_0x84f4e5,'options':{'where':{'ContactId':_0x84f4e5['ContactId'],'ListId':_0x84f4e5[_0x27c2('0x9')],'VoiceQueueId':_0x84f4e5[_0x27c2('0xa')],'CampaignId':_0x84f4e5[_0x27c2('0xb')]}},'log':_0x27c2('0x8')});};exports['destroyContact']=function(_0x4555ed,_0x14ff58,_0x212f1c){return function(){return client['Request']('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x4555ed,'ListId':_0x14ff58,'ContactId':_0x212f1c}},'log':_0x27c2('0xc')});};};exports[_0x27c2('0xd')]=function(_0x45a517,_0x3bdbba,_0x35fa3d,_0x599589){return client[_0x27c2('0x5')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x45a517,'active':![],'scheduledat':{'$lte':moment()[_0x27c2('0xe')](_0x27c2('0x7'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x3bdbba}}]},'order':[[_0x27c2('0xf'),_0x27c2('0x10')],['scheduledat',_0x599589],['id',_0x27c2('0x11')]],'raw':!![],'limit':_0x35fa3d},'log':_0x27c2('0x12')});};exports[_0x27c2('0x13')]=function(_0xdbe562,_0x3cd844,_0x2db0b6){return client[_0x27c2('0x5')](_0x27c2('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0xdbe562,'active':![],'scheduledat':{'$lte':moment()[_0x27c2('0xe')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0x27c2('0x3'),'as':_0x27c2('0x14')}],'order':[[_0x27c2('0xf'),_0x27c2('0x10')],['scheduledat',_0x2db0b6],['id','ASC']],'raw':!![],'limit':_0x3cd844},'log':_0x27c2('0x15')});};exports[_0x27c2('0x16')]=function(_0x25136d,_0x282cdb){_0x25136d[_0x27c2('0x17')]=_0x25136d[_0x27c2('0x18')];return client['Request'](_0x27c2('0x19'),{'body':_0x25136d,'options':{'where':{'ContactId':_0x25136d[_0x27c2('0x1a')],'ListId':_0x25136d[_0x27c2('0x9')],'VoiceQueueId':_0x25136d[_0x27c2('0xa')],'CampaignId':_0x25136d[_0x27c2('0xb')],'active':_0x282cdb?undefined:!![]}},'log':_0x27c2('0x19')});};exports[_0x27c2('0x1b')]=function(_0xb9af7f){return client['Request']('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0xb9af7f['id']?_0xb9af7f['id']||null:null}},'log':_0x27c2('0x1b')});};exports[_0x27c2('0x1c')]=function(_0x594001){return function(){return client[_0x27c2('0x5')](_0x27c2('0x1d'),{'options':{'where':{'id':_0x594001},'include':[{'model':_0x27c2('0x3'),'as':_0x27c2('0x14')},{'model':'User','as':_0x27c2('0x1e'),'attributes':['id',_0x27c2('0x1f')]},{'model':_0x27c2('0x20'),'as':_0x27c2('0x21'),'attributes':['id',_0x27c2('0x1f')]}],'raw':!![]},'log':_0x27c2('0x22')});};};exports[_0x27c2('0x23')]=function(_0x277e8f,_0x5d90fd,_0xc48b97){return client[_0x27c2('0x5')](_0x27c2('0x6'),{'body':_0x277e8f,'options':{'where':{'id':_0x5d90fd},'limit':_0xc48b97},'log':'UpdateCmHopper'});};exports[_0x27c2('0x24')]=function(_0x34cf90,_0x2b0b3){return function(){return client['Request'](_0x27c2('0x25'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x34cf90,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x27c2('0xe')](_0x27c2('0x7'))},'UserId':{'$in':_0x2b0b3}},'order':[[_0x27c2('0xf'),_0x27c2('0x10')],[_0x27c2('0x26'),'DESC'],['id',_0x27c2('0x11')]],'include':[{'model':_0x27c2('0x3'),'as':_0x27c2('0x14')},{'model':'User','as':_0x27c2('0x1e'),'attributes':['id',_0x27c2('0x1f'),_0x27c2('0x27')]}],'group':_0x27c2('0x28'),'raw':!![]},'log':'GetContactDialer'});};};exports[_0x27c2('0x29')]=function(_0x65d991,_0x3c7f7c){return client[_0x27c2('0x5')](_0x27c2('0x2a'),{'body':_0x65d991,'options':_0x3c7f7c||{},'log':_0x27c2('0x2a')});};exports[_0x27c2('0x2b')]=function(_0x131027,_0x139674,_0x4eb417){return function(){return client[_0x27c2('0x5')](_0x27c2('0x2c'),{'body':{'where':{'voiceQueueIds':_0x131027,'interval':_0x139674,'availableAgentsIds':_0x4eb417}},'log':_0x27c2('0x2b')});};};