Built motion from commit (unavailable).|2.5.21
[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 _0x09a3=['ListId','rescheduleContact','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','YYYY-MM-DD\x20HH:mm:ss','scheduledat','ASC','getContactDialerIvr','priority','DESC','GetContactDialerIvr','campaign','queue','MoveContactManagedDialer','VoiceQueueId','CampaignId','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','User','name','VoiceQueue','Queue','getCmHopper','unlockContact','GetContactRecallMe','voicePause','../client','moment','lodash','getContacts','GetCmHopper','CmContact','Contact','updateContacts','Request','UpdateCmHopper','format','ContactId'];(function(_0x42ef14,_0x4d4750){var _0x22e9d8=function(_0x37cc42){while(--_0x37cc42){_0x42ef14['push'](_0x42ef14['shift']());}};_0x22e9d8(++_0x4d4750);}(_0x09a3,0x9c));var _0x309a=function(_0x534a60,_0x44d881){_0x534a60=_0x534a60-0x0;var _0x4fe018=_0x09a3[_0x534a60];return _0x4fe018;};'use strict';var client=require(_0x309a('0x0'));var moment=require(_0x309a('0x1'));var _=require(_0x309a('0x2'));exports[_0x309a('0x3')]=function(_0x8c7e1c,_0x3aedaa){return function(){return client['Request'](_0x309a('0x4'),{'options':{'where':{'VoiceQueueId':_0x8c7e1c},'include':[{'model':_0x309a('0x5'),'as':_0x309a('0x6')}],'limit':_0x3aedaa,'raw':![]},'log':'getCmHopper'});};};exports[_0x309a('0x7')]=function(_0x21621b,_0x32ba8c,_0x1c5f51){return function(){return client[_0x309a('0x8')](_0x309a('0x9'),{'body':_0x21621b,'options':{'where':{'VoiceQueueId':_0x32ba8c,'scheduledat':{'$lte':moment()[_0x309a('0xa')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x1c5f51},'log':'UpdateCmHopper'});};};exports['rescheduleContact']=function(_0x2ca869){return function(){return client[_0x309a('0x8')](_0x309a('0x9'),{'body':_0x2ca869,'options':{'where':{'ContactId':_0x2ca869[_0x309a('0xb')],'ListId':_0x2ca869[_0x309a('0xc')],'VoiceQueueId':_0x2ca869['VoiceQueueId'],'CampaignId':_0x2ca869['CampaignId']}},'log':_0x309a('0xd')});};};exports[_0x309a('0xe')]=function(_0x28adcd,_0x47372d,_0x4d7ad9){return function(){return client[_0x309a('0x8')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x28adcd,'ListId':_0x47372d,'ContactId':_0x4d7ad9}},'log':_0x309a('0xf')});};};exports[_0x309a('0x10')]=function(_0x4a5f22,_0x52df2d,_0x5c11b2,_0x3ef6df){return function(){return client[_0x309a('0x8')](_0x309a('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x4a5f22,'active':![],'scheduledat':{'$lte':moment()[_0x309a('0xa')](_0x309a('0x12'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x52df2d}}]},'order':[['priority','DESC'],[_0x309a('0x13'),_0x3ef6df],['id',_0x309a('0x14')]],'raw':!![],'limit':_0x5c11b2},'log':_0x309a('0x11')});};};exports[_0x309a('0x15')]=function(_0x1cae40,_0x2db950,_0x39a63e){return function(){return client[_0x309a('0x8')](_0x309a('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x1cae40,'active':![],'scheduledat':{'$lte':moment()['format'](_0x309a('0x12'))}},'include':[{'model':_0x309a('0x5'),'as':'Contact'}],'order':[[_0x309a('0x16'),_0x309a('0x17')],[_0x309a('0x13'),_0x39a63e],['id',_0x309a('0x14')]],'raw':!![],'limit':_0x2db950},'log':_0x309a('0x18')});};};exports['moveContactManagedDialer']=function(_0x19de98,_0x403405){return function(){_0x19de98[_0x309a('0x19')]=_0x19de98[_0x309a('0x1a')];return client[_0x309a('0x8')](_0x309a('0x1b'),{'body':_0x19de98,'options':{'where':{'ContactId':_0x19de98[_0x309a('0xb')],'ListId':_0x19de98['ListId'],'VoiceQueueId':_0x19de98[_0x309a('0x1c')],'CampaignId':_0x19de98[_0x309a('0x1d')],'active':_0x403405?undefined:!![]}},'log':'MoveContactManagedDialer'});};};exports[_0x309a('0x1e')]=function(_0x2debcd){return function(){return client[_0x309a('0x8')](_0x309a('0x1f'),{'options':{'where':{'VoiceQueueId':_0x2debcd['id']?_0x2debcd['id']||null:null}},'log':_0x309a('0x1e')});};};exports[_0x309a('0x20')]=function(_0x1423f6){return function(){return client[_0x309a('0x8')](_0x309a('0x21'),{'options':{'where':{'id':_0x1423f6},'include':[{'model':_0x309a('0x5'),'as':_0x309a('0x6')},{'model':_0x309a('0x22'),'as':'Agent','attributes':['id',_0x309a('0x23')]},{'model':_0x309a('0x24'),'as':_0x309a('0x25'),'attributes':['id',_0x309a('0x23')]}],'raw':!![]},'log':_0x309a('0x26')});};};exports[_0x309a('0x27')]=function(_0x3d15a2,_0x5ca983,_0x1095e0){return function(){return client[_0x309a('0x8')](_0x309a('0x9'),{'body':_0x3d15a2,'options':{'where':{'id':_0x5ca983},'limit':_0x1095e0},'log':_0x309a('0x9')});};};exports['getContactRecallMe']=function(_0x5e1b30,_0x4005bd){return function(){return client[_0x309a('0x8')](_0x309a('0x28'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x5e1b30,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x309a('0xa')](_0x309a('0x12'))},'UserId':{'$in':_0x4005bd}},'order':[['priority',_0x309a('0x17')],[_0x309a('0x13'),_0x309a('0x17')],['id','ASC']],'include':[{'model':'CmContact','as':_0x309a('0x6')},{'model':_0x309a('0x22'),'as':'Agent','attributes':['id',_0x309a('0x23'),_0x309a('0x29')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x309a('0x11')});};};