a5d9ccca1dbd1d84681a1267caf898516c0ba961
[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 _0x98ff=['DESC','scheduledat','getContactDialerIvr','priority','ASC','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','Agent','VoiceQueue','Queue','name','unlockContact','GetContactRecallMe','User','voicePause','db.CmHopper.UserId','../client','moment','lodash','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer'];(function(_0x21f4ec,_0x10230a){var _0x8b6a3f=function(_0x12123e){while(--_0x12123e){_0x21f4ec['push'](_0x21f4ec['shift']());}};_0x8b6a3f(++_0x10230a);}(_0x98ff,0x187));var _0xf98f=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0x98ff[_0x13ea00];return _0x1f7347;};'use strict';var client=require(_0xf98f('0x0'));var moment=require(_0xf98f('0x1'));var _=require(_0xf98f('0x2'));exports[_0xf98f('0x3')]=function(_0x1e8529,_0x24ff3b){return function(){return client[_0xf98f('0x4')](_0xf98f('0x5'),{'options':{'where':{'VoiceQueueId':_0x1e8529},'include':[{'model':_0xf98f('0x6'),'as':_0xf98f('0x7')}],'limit':_0x24ff3b,'raw':![]},'log':_0xf98f('0x8')});};};exports['updateContacts']=function(_0x4b1f9d,_0x34959d,_0x426fe6){return function(){return client[_0xf98f('0x4')](_0xf98f('0x9'),{'body':_0x4b1f9d,'options':{'where':{'VoiceQueueId':_0x34959d,'scheduledat':{'$lte':moment()[_0xf98f('0xa')](_0xf98f('0xb'))}},'limit':_0x426fe6},'log':_0xf98f('0x9')});};};exports['rescheduleContact']=function(_0xade64){return function(){return client[_0xf98f('0x4')](_0xf98f('0x9'),{'body':_0xade64,'options':{'where':{'ContactId':_0xade64[_0xf98f('0xc')],'ListId':_0xade64[_0xf98f('0xd')],'VoiceQueueId':_0xade64[_0xf98f('0xe')],'CampaignId':_0xade64[_0xf98f('0xf')]}},'log':'rescheduleContact'});};};exports[_0xf98f('0x10')]=function(_0x3ec642,_0x93855d,_0x3845e8){return function(){return client['Request']('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x3ec642,'ListId':_0x93855d,'ContactId':_0x3845e8}},'log':_0xf98f('0x11')});};};exports['getContactDialer']=function(_0x365d2e,_0x1bf7ad,_0x17a23b,_0xed15){return function(){return client[_0xf98f('0x4')](_0xf98f('0x12'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x365d2e,'active':![],'scheduledat':{'$lte':moment()[_0xf98f('0xa')](_0xf98f('0xb'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x1bf7ad}}]},'order':[['priority',_0xf98f('0x13')],[_0xf98f('0x14'),_0xed15],['id','ASC']],'raw':!![],'limit':_0x17a23b},'log':_0xf98f('0x12')});};};exports[_0xf98f('0x15')]=function(_0x40b072,_0x256edd,_0x1e902c){return function(){return client[_0xf98f('0x4')](_0xf98f('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x40b072,'active':![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0xf98f('0x6'),'as':_0xf98f('0x7')}],'order':[[_0xf98f('0x16'),'DESC'],[_0xf98f('0x14'),_0x1e902c],['id',_0xf98f('0x17')]],'raw':!![],'limit':_0x256edd},'log':_0xf98f('0x18')});};};exports[_0xf98f('0x19')]=function(_0x1859d8,_0x41236b){return function(){_0x1859d8['campaign']=_0x1859d8[_0xf98f('0x1a')];return client[_0xf98f('0x4')](_0xf98f('0x1b'),{'body':_0x1859d8,'options':{'where':{'ContactId':_0x1859d8[_0xf98f('0xc')],'ListId':_0x1859d8['ListId'],'VoiceQueueId':_0x1859d8['VoiceQueueId'],'CampaignId':_0x1859d8[_0xf98f('0xf')],'active':_0x41236b?undefined:!![]}},'log':'MoveContactManagedDialer'});};};exports[_0xf98f('0x1c')]=function(_0x2f1acf){return function(){return client['Request'](_0xf98f('0x1d'),{'options':{'where':{'VoiceQueueId':_0x2f1acf['id']?_0x2f1acf['id']||null:null}},'log':_0xf98f('0x1c')});};};exports[_0xf98f('0x1e')]=function(_0x21a2b2){return function(){return client[_0xf98f('0x4')](_0xf98f('0x1f'),{'options':{'where':{'id':_0x21a2b2},'include':[{'model':'CmContact','as':'Contact'},{'model':'User','as':_0xf98f('0x20'),'attributes':['id','name']},{'model':_0xf98f('0x21'),'as':_0xf98f('0x22'),'attributes':['id',_0xf98f('0x23')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xf98f('0x24')]=function(_0x139c3c,_0x1cad34,_0x419787){return function(){return client[_0xf98f('0x4')](_0xf98f('0x9'),{'body':_0x139c3c,'options':{'where':{'id':_0x1cad34},'limit':_0x419787},'log':'UpdateCmHopper'});};};exports['getContactRecallMe']=function(_0x21885d,_0x16b888){return function(){return client[_0xf98f('0x4')](_0xf98f('0x25'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x21885d,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0xf98f('0xb'))},'UserId':{'$in':_0x16b888}},'order':[['priority',_0xf98f('0x13')],[_0xf98f('0x14'),_0xf98f('0x13')],['id',_0xf98f('0x17')]],'include':[{'model':_0xf98f('0x6'),'as':'Contact'},{'model':_0xf98f('0x26'),'as':'Agent','attributes':['id',_0xf98f('0x23'),_0xf98f('0x27')]}],'group':_0xf98f('0x28'),'raw':!![]},'log':_0xf98f('0x12')});};};