Built motion from commit ce9a7520.|2.5.39
[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 _0xa41a=['ASC','getContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','VoiceQueueId','CountReScheduled','countReScheduled','GetCmHopperPreview','Contact','User','name','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','Agent','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','moment','lodash','getContacts','GetCmHopper','CmContact','getCmHopper','updateContacts','Request','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','CampaignId','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat'];(function(_0x3df303,_0xae11fe){var _0x3e4df8=function(_0x2caabc){while(--_0x2caabc){_0x3df303['push'](_0x3df303['shift']());}};_0x3e4df8(++_0xae11fe);}(_0xa41a,0x1b9));var _0xaa41=function(_0x3ede7e,_0xba4cd2){_0x3ede7e=_0x3ede7e-0x0;var _0x644681=_0xa41a[_0x3ede7e];return _0x644681;};'use strict';var client=require('../client');var moment=require(_0xaa41('0x0'));var _=require(_0xaa41('0x1'));exports[_0xaa41('0x2')]=function(_0x2b09c0,_0x4da574){return function(){return client['Request'](_0xaa41('0x3'),{'options':{'where':{'VoiceQueueId':_0x2b09c0},'include':[{'model':_0xaa41('0x4'),'as':'Contact'}],'limit':_0x4da574,'raw':![]},'log':_0xaa41('0x5')});};};exports[_0xaa41('0x6')]=function(_0x5ede52,_0x40d51f,_0x4c7003){return function(){return client[_0xaa41('0x7')](_0xaa41('0x8'),{'body':_0x5ede52,'options':{'where':{'VoiceQueueId':_0x40d51f,'scheduledat':{'$lte':moment()[_0xaa41('0x9')](_0xaa41('0xa'))}},'limit':_0x4c7003},'log':_0xaa41('0x8')});};};exports[_0xaa41('0xb')]=function(_0x12914a){return function(){return client[_0xaa41('0x7')](_0xaa41('0x8'),{'body':_0x12914a,'options':{'where':{'ContactId':_0x12914a[_0xaa41('0xc')],'ListId':_0x12914a[_0xaa41('0xd')],'VoiceQueueId':_0x12914a['VoiceQueueId'],'CampaignId':_0x12914a[_0xaa41('0xe')]}},'log':_0xaa41('0xb')});};};exports['destroyContact']=function(_0x2bcf16,_0x2f4511,_0x1ef1db){return function(){return client[_0xaa41('0x7')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x2bcf16,'ListId':_0x2f4511,'ContactId':_0x1ef1db}},'log':_0xaa41('0xf')});};};exports[_0xaa41('0x10')]=function(_0x45d916,_0x211732,_0x37b3d7,_0x3a6f3a){return function(){return client[_0xaa41('0x7')](_0xaa41('0x11'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x45d916,'active':![],'scheduledat':{'$lte':moment()[_0xaa41('0x9')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x211732}}]},'order':[[_0xaa41('0x12'),_0xaa41('0x13')],[_0xaa41('0x14'),_0x3a6f3a],['id',_0xaa41('0x15')]],'raw':!![],'limit':_0x37b3d7},'log':_0xaa41('0x11')});};};exports[_0xaa41('0x16')]=function(_0x38561d,_0x50a409,_0x5b8eba){return function(){return client[_0xaa41('0x7')](_0xaa41('0x11'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x38561d,'active':![],'scheduledat':{'$lte':moment()[_0xaa41('0x9')](_0xaa41('0xa'))}},'include':[{'model':_0xaa41('0x4'),'as':'Contact'}],'order':[['priority','DESC'],[_0xaa41('0x14'),_0x5b8eba],['id',_0xaa41('0x15')]],'raw':!![],'limit':_0x50a409},'log':'GetContactDialerIvr'});};};exports[_0xaa41('0x17')]=function(_0x39d5a8,_0xfca328){return function(){_0x39d5a8[_0xaa41('0x18')]=_0x39d5a8['queue'];return client[_0xaa41('0x7')](_0xaa41('0x19'),{'body':_0x39d5a8,'options':{'where':{'ContactId':_0x39d5a8[_0xaa41('0xc')],'ListId':_0x39d5a8[_0xaa41('0xd')],'VoiceQueueId':_0x39d5a8[_0xaa41('0x1a')],'CampaignId':_0x39d5a8[_0xaa41('0xe')],'active':_0xfca328?undefined:!![]}},'log':_0xaa41('0x19')});};};exports['countReScheduled']=function(_0x5cab51){return function(){return client[_0xaa41('0x7')](_0xaa41('0x1b'),{'options':{'where':{'VoiceQueueId':_0x5cab51['id']?_0x5cab51['id']||null:null}},'log':_0xaa41('0x1c')});};};exports['getContactPreview']=function(_0x428a35){return function(){return client['Request'](_0xaa41('0x1d'),{'options':{'where':{'id':_0x428a35},'include':[{'model':_0xaa41('0x4'),'as':_0xaa41('0x1e')},{'model':_0xaa41('0x1f'),'as':'Agent','attributes':['id',_0xaa41('0x20')]},{'model':'VoiceQueue','as':_0xaa41('0x21'),'attributes':['id','name']}],'raw':!![]},'log':_0xaa41('0x5')});};};exports[_0xaa41('0x22')]=function(_0x4e66a4,_0x323a68,_0x235369){return function(){return client[_0xaa41('0x7')](_0xaa41('0x8'),{'body':_0x4e66a4,'options':{'where':{'id':_0x323a68},'limit':_0x235369},'log':_0xaa41('0x8')});};};exports[_0xaa41('0x23')]=function(_0x2adbdb,_0x4f79ba){return function(){return client[_0xaa41('0x7')](_0xaa41('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2adbdb,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xaa41('0x9')](_0xaa41('0xa'))},'UserId':{'$in':_0x4f79ba}},'order':[['priority',_0xaa41('0x13')],[_0xaa41('0x14'),_0xaa41('0x13')],['id',_0xaa41('0x15')]],'include':[{'model':'CmContact','as':'Contact'},{'model':_0xaa41('0x1f'),'as':_0xaa41('0x25'),'attributes':['id','name',_0xaa41('0x26')]}],'group':_0xaa41('0x27'),'raw':!![]},'log':_0xaa41('0x11')});};};exports[_0xaa41('0x28')]=function(_0x59980d){return function(){return client[_0xaa41('0x7')](_0xaa41('0x29'),{'body':_0x59980d,'options':{},'log':_0xaa41('0x29')});};};