Built motion from commit (unavailable).|2.4.4
[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 _0x7a54=['CmContact','Contact','getCmHopper','updateContacts','Request','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','ListId','rescheduleContact','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','format','priority','DESC','scheduledat','getContactDialerIvr','ASC','GetContactDialerIvr','campaign','MoveContactManagedDialer','ContactId','CampaignId','CountReScheduled','countReScheduled','getContactPreview','Agent','name','VoiceQueue','Queue','unlockContact','GetContactRecallMe','db.CmHopper.UserId','../client','moment','lodash','GetCmHopper'];(function(_0x21a2b2,_0x22ba1e){var _0x2060b4=function(_0x38cfcb){while(--_0x38cfcb){_0x21a2b2['push'](_0x21a2b2['shift']());}};_0x2060b4(++_0x22ba1e);}(_0x7a54,0x106));var _0x47a5=function(_0x3739a7,_0x344b13){_0x3739a7=_0x3739a7-0x0;var _0x539cde=_0x7a54[_0x3739a7];return _0x539cde;};'use strict';var client=require(_0x47a5('0x0'));var moment=require(_0x47a5('0x1'));var _=require(_0x47a5('0x2'));exports['getContacts']=function(_0x1d33e,_0x4086cd){return function(){return client['Request'](_0x47a5('0x3'),{'options':{'where':{'VoiceQueueId':_0x1d33e},'include':[{'model':_0x47a5('0x4'),'as':_0x47a5('0x5')}],'limit':_0x4086cd,'raw':![]},'log':_0x47a5('0x6')});};};exports[_0x47a5('0x7')]=function(_0x545a97,_0x3d5629,_0x59199c){return function(){return client[_0x47a5('0x8')](_0x47a5('0x9'),{'body':_0x545a97,'options':{'where':{'VoiceQueueId':_0x3d5629,'scheduledat':{'$lte':moment()['format'](_0x47a5('0xa'))}},'limit':_0x59199c},'log':'UpdateCmHopper'});};};exports['rescheduleContact']=function(_0x582352){return function(){return client[_0x47a5('0x8')](_0x47a5('0x9'),{'body':_0x582352,'options':{'where':{'ContactId':_0x582352['ContactId'],'ListId':_0x582352[_0x47a5('0xb')],'VoiceQueueId':_0x582352['VoiceQueueId'],'CampaignId':_0x582352['CampaignId']}},'log':_0x47a5('0xc')});};};exports[_0x47a5('0xd')]=function(_0x2f399b,_0x250fad,_0xd612dd){return function(){return client[_0x47a5('0x8')](_0x47a5('0xe'),{'options':{'where':{'VoiceQueueId':_0x2f399b,'ListId':_0x250fad,'ContactId':_0xd612dd}},'log':'DestroyCmHopper'});};};exports[_0x47a5('0xf')]=function(_0x221b54,_0x1cf309,_0x711793,_0x139f25){return function(){return client[_0x47a5('0x8')](_0x47a5('0x10'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x221b54,'active':![],'scheduledat':{'$lte':moment()[_0x47a5('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x1cf309}}]},'include':[{'model':_0x47a5('0x4'),'as':_0x47a5('0x5')}],'order':[[_0x47a5('0x12'),_0x47a5('0x13')],[_0x47a5('0x14'),_0x139f25],['id','ASC']],'raw':!![],'limit':_0x711793},'log':'GetContactDialer'});};};exports[_0x47a5('0x15')]=function(_0x4b966e,_0x5247fd,_0x423a81){return function(){return client[_0x47a5('0x8')](_0x47a5('0x10'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x4b966e,'active':![],'scheduledat':{'$lte':moment()[_0x47a5('0x11')](_0x47a5('0xa'))}},'include':[{'model':_0x47a5('0x4'),'as':_0x47a5('0x5')}],'order':[[_0x47a5('0x12'),_0x47a5('0x13')],['scheduledat',_0x423a81],['id',_0x47a5('0x16')]],'raw':!![],'limit':_0x5247fd},'log':_0x47a5('0x17')});};};exports['moveContactManagedDialer']=function(_0x2b0360,_0x1f03f7){return function(){_0x2b0360[_0x47a5('0x18')]=_0x2b0360['queue'];return client[_0x47a5('0x8')](_0x47a5('0x19'),{'body':_0x2b0360,'options':{'where':{'ContactId':_0x2b0360[_0x47a5('0x1a')],'ListId':_0x2b0360[_0x47a5('0xb')],'VoiceQueueId':_0x2b0360['VoiceQueueId'],'CampaignId':_0x2b0360[_0x47a5('0x1b')],'active':_0x1f03f7?undefined:!![]}},'log':_0x47a5('0x19')});};};exports['countReScheduled']=function(_0x28747d){return function(){return client[_0x47a5('0x8')](_0x47a5('0x1c'),{'options':{'where':{'VoiceQueueId':_0x28747d['id']?_0x28747d['id']||null:null}},'log':_0x47a5('0x1d')});};};exports[_0x47a5('0x1e')]=function(_0x50bf17){return function(){return client['Request'](_0x47a5('0x3'),{'options':{'where':{'id':_0x50bf17},'include':[{'model':'CmContact','as':_0x47a5('0x5')},{'model':'User','as':_0x47a5('0x1f'),'attributes':['id',_0x47a5('0x20')]},{'model':_0x47a5('0x21'),'as':_0x47a5('0x22'),'attributes':['id',_0x47a5('0x20')]}],'raw':!![]},'log':_0x47a5('0x6')});};};exports[_0x47a5('0x23')]=function(_0x136b14,_0x16631f,_0x361bfa){return function(){return client[_0x47a5('0x8')](_0x47a5('0x9'),{'body':_0x136b14,'options':{'where':{'id':_0x16631f},'limit':_0x361bfa},'log':_0x47a5('0x9')});};};exports['getContactRecallMe']=function(_0x243210,_0x51833b){return function(){return client[_0x47a5('0x8')](_0x47a5('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x243210,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x47a5('0x11')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x51833b}},'order':[[_0x47a5('0x12'),_0x47a5('0x13')],[_0x47a5('0x14'),_0x47a5('0x13')],['id','ASC']],'include':[{'model':'CmContact','as':_0x47a5('0x5')}],'group':_0x47a5('0x25'),'raw':!![]},'log':'GetContactDialer'});};};