Built motion from commit dc14b02d.|2.6.27
[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 _0xa786=['rescheduleContact','Request','ContactId','VoiceQueueId','CampaignId','DestroyCmHopper','getContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','User','Agent','VoiceQueue','name','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','moment','getContacts','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa786,0x71));var _0x6a78=function(_0x2d70fe,_0x42d205){_0x2d70fe=_0x2d70fe-0x0;var _0x5c0c7a=_0xa786[_0x2d70fe];return _0x5c0c7a;};'use strict';var client=require(_0x6a78('0x0'));var moment=require(_0x6a78('0x1'));exports[_0x6a78('0x2')]=function(_0x4a3fd4,_0x30bd42){return function(){return client['Request']('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x4a3fd4},'include':[{'model':_0x6a78('0x3'),'as':_0x6a78('0x4')}],'limit':_0x30bd42,'raw':![]},'log':_0x6a78('0x5')});};};exports[_0x6a78('0x6')]=function(_0x41bb73,_0x112e35,_0x386861){return function(){return client['Request'](_0x6a78('0x7'),{'body':_0x41bb73,'options':{'where':{'VoiceQueueId':_0x112e35,'scheduledat':{'$lte':moment()[_0x6a78('0x8')](_0x6a78('0x9'))}},'limit':_0x386861},'log':_0x6a78('0x7')});};};exports[_0x6a78('0xa')]=function(_0x217b2c){return client[_0x6a78('0xb')](_0x6a78('0x7'),{'body':_0x217b2c,'options':{'where':{'ContactId':_0x217b2c[_0x6a78('0xc')],'ListId':_0x217b2c['ListId'],'VoiceQueueId':_0x217b2c[_0x6a78('0xd')],'CampaignId':_0x217b2c[_0x6a78('0xe')]}},'log':_0x6a78('0xa')});};exports['destroyContact']=function(_0x2a433a,_0x439ef1,_0x328130){return function(){return client[_0x6a78('0xb')](_0x6a78('0xf'),{'options':{'where':{'VoiceQueueId':_0x2a433a,'ListId':_0x439ef1,'ContactId':_0x328130}},'log':'DestroyCmHopper'});};};exports[_0x6a78('0x10')]=function(_0xb88919,_0x1324c1,_0x4dce44,_0x44c863){return client[_0x6a78('0xb')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xb88919,'active':![],'scheduledat':{'$lte':moment()[_0x6a78('0x8')](_0x6a78('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x1324c1}}]},'order':[[_0x6a78('0x11'),_0x6a78('0x12')],[_0x6a78('0x13'),_0x44c863],['id',_0x6a78('0x14')]],'raw':!![],'limit':_0x4dce44},'log':'GetContactDialer'});};exports[_0x6a78('0x15')]=function(_0x122362,_0x4746c0,_0x265f90){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x122362,'active':![],'scheduledat':{'$lte':moment()[_0x6a78('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':'CmContact','as':'Contact'}],'order':[[_0x6a78('0x11'),_0x6a78('0x12')],[_0x6a78('0x13'),_0x265f90],['id','ASC']],'raw':!![],'limit':_0x4746c0},'log':'GetContactDialerIvr'});};exports[_0x6a78('0x16')]=function(_0x29dec5,_0x356b93){_0x29dec5[_0x6a78('0x17')]=_0x29dec5['queue'];return client['Request']('MoveContactManagedDialer',{'body':_0x29dec5,'options':{'where':{'ContactId':_0x29dec5[_0x6a78('0xc')],'ListId':_0x29dec5['ListId'],'VoiceQueueId':_0x29dec5[_0x6a78('0xd')],'CampaignId':_0x29dec5[_0x6a78('0xe')],'active':_0x356b93?undefined:!![]}},'log':_0x6a78('0x18')});};exports['countReScheduled']=function(_0x49f711){return client[_0x6a78('0xb')](_0x6a78('0x19'),{'options':{'where':{'VoiceQueueId':_0x49f711['id']?_0x49f711['id']||null:null}},'log':_0x6a78('0x1a')});};exports[_0x6a78('0x1b')]=function(_0xb86669){return function(){return client[_0x6a78('0xb')](_0x6a78('0x1c'),{'options':{'where':{'id':_0xb86669},'include':[{'model':'CmContact','as':_0x6a78('0x4')},{'model':_0x6a78('0x1d'),'as':_0x6a78('0x1e'),'attributes':['id','name']},{'model':_0x6a78('0x1f'),'as':'Queue','attributes':['id',_0x6a78('0x20')]}],'raw':!![]},'log':_0x6a78('0x5')});};};exports['unlockContact']=function(_0x1154d2,_0x159b96,_0xfdd266){return client[_0x6a78('0xb')]('UpdateCmHopper',{'body':_0x1154d2,'options':{'where':{'id':_0x159b96},'limit':_0xfdd266},'log':_0x6a78('0x7')});};exports[_0x6a78('0x21')]=function(_0x273a73,_0x12e0c5){return function(){return client['Request'](_0x6a78('0x22'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x273a73,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x6a78('0x8')](_0x6a78('0x9'))},'UserId':{'$in':_0x12e0c5}},'order':[['priority',_0x6a78('0x12')],[_0x6a78('0x13'),'DESC'],['id',_0x6a78('0x14')]],'include':[{'model':_0x6a78('0x3'),'as':_0x6a78('0x4')},{'model':_0x6a78('0x1d'),'as':_0x6a78('0x1e'),'attributes':['id','name',_0x6a78('0x23')]}],'group':_0x6a78('0x24'),'raw':!![]},'log':'GetContactDialer'});};};exports[_0x6a78('0x25')]=function(_0x25cdf6,_0x19f317){return client[_0x6a78('0xb')](_0x6a78('0x26'),{'body':_0x25cdf6,'options':_0x19f317||{},'log':_0x6a78('0x26')});};exports['handlePreviewRecallNotifications']=function(_0x307661,_0x494a14,_0x23d91f){return function(){return client[_0x6a78('0xb')](_0x6a78('0x27'),{'body':{'where':{'voiceQueueIds':_0x307661,'interval':_0x494a14,'availableAgentsIds':_0x23d91f}},'log':_0x6a78('0x28')});};};