Built motion from commit e781dc3c.|2.5.42
[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 _0x896e=['destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','VoiceQueueId','countReScheduled','CountReScheduled','GetCmHopperPreview','Agent','name','unlockContact','GetContactRecallMe','User','voicePause','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','CmContact','Contact','getCmHopper','updateContacts','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','Request','ContactId','ListId','CampaignId'];(function(_0x3a7d5e,_0x4843c7){var _0x34ab97=function(_0x270294){while(--_0x270294){_0x3a7d5e['push'](_0x3a7d5e['shift']());}};_0x34ab97(++_0x4843c7);}(_0x896e,0xed));var _0xe896=function(_0xf0dfbd,_0x354385){_0xf0dfbd=_0xf0dfbd-0x0;var _0x4a01c1=_0x896e[_0xf0dfbd];return _0x4a01c1;};'use strict';var client=require(_0xe896('0x0'));var moment=require(_0xe896('0x1'));var _=require('lodash');exports[_0xe896('0x2')]=function(_0x28726d,_0xfab7f8){return function(){return client['Request']('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x28726d},'include':[{'model':_0xe896('0x3'),'as':_0xe896('0x4')}],'limit':_0xfab7f8,'raw':![]},'log':_0xe896('0x5')});};};exports[_0xe896('0x6')]=function(_0x46f625,_0x1982da,_0x560226){return function(){return client['Request']('UpdateCmHopper',{'body':_0x46f625,'options':{'where':{'VoiceQueueId':_0x1982da,'scheduledat':{'$lte':moment()[_0xe896('0x7')](_0xe896('0x8'))}},'limit':_0x560226},'log':_0xe896('0x9')});};};exports[_0xe896('0xa')]=function(_0x2b0b2a){return function(){return client[_0xe896('0xb')](_0xe896('0x9'),{'body':_0x2b0b2a,'options':{'where':{'ContactId':_0x2b0b2a[_0xe896('0xc')],'ListId':_0x2b0b2a[_0xe896('0xd')],'VoiceQueueId':_0x2b0b2a['VoiceQueueId'],'CampaignId':_0x2b0b2a[_0xe896('0xe')]}},'log':_0xe896('0xa')});};};exports[_0xe896('0xf')]=function(_0x42cf01,_0x4127ce,_0x42117a){return function(){return client[_0xe896('0xb')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x42cf01,'ListId':_0x4127ce,'ContactId':_0x42117a}},'log':_0xe896('0x10')});};};exports[_0xe896('0x11')]=function(_0x740eea,_0x4f9b46,_0x1ad60a,_0x5a8a3e){return function(){return client[_0xe896('0xb')](_0xe896('0x12'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x740eea,'active':![],'scheduledat':{'$lte':moment()[_0xe896('0x7')](_0xe896('0x8'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4f9b46}}]},'order':[[_0xe896('0x13'),_0xe896('0x14')],[_0xe896('0x15'),_0x5a8a3e],['id',_0xe896('0x16')]],'raw':!![],'limit':_0x1ad60a},'log':_0xe896('0x12')});};};exports[_0xe896('0x17')]=function(_0x5cad5e,_0x182792,_0x3e849e){return function(){return client['Request'](_0xe896('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5cad5e,'active':![],'scheduledat':{'$lte':moment()[_0xe896('0x7')](_0xe896('0x8'))}},'include':[{'model':_0xe896('0x3'),'as':'Contact'}],'order':[[_0xe896('0x13'),_0xe896('0x14')],[_0xe896('0x15'),_0x3e849e],['id',_0xe896('0x16')]],'raw':!![],'limit':_0x182792},'log':'GetContactDialerIvr'});};};exports[_0xe896('0x18')]=function(_0x281ebb,_0x50a60d){return function(){_0x281ebb[_0xe896('0x19')]=_0x281ebb[_0xe896('0x1a')];return client[_0xe896('0xb')](_0xe896('0x1b'),{'body':_0x281ebb,'options':{'where':{'ContactId':_0x281ebb[_0xe896('0xc')],'ListId':_0x281ebb[_0xe896('0xd')],'VoiceQueueId':_0x281ebb[_0xe896('0x1c')],'CampaignId':_0x281ebb[_0xe896('0xe')],'active':_0x50a60d?undefined:!![]}},'log':_0xe896('0x1b')});};};exports[_0xe896('0x1d')]=function(_0x30c4d4){return function(){return client[_0xe896('0xb')](_0xe896('0x1e'),{'options':{'where':{'VoiceQueueId':_0x30c4d4['id']?_0x30c4d4['id']||null:null}},'log':'countReScheduled'});};};exports['getContactPreview']=function(_0x532a98){return function(){return client[_0xe896('0xb')](_0xe896('0x1f'),{'options':{'where':{'id':_0x532a98},'include':[{'model':'CmContact','as':_0xe896('0x4')},{'model':'User','as':_0xe896('0x20'),'attributes':['id',_0xe896('0x21')]},{'model':'VoiceQueue','as':'Queue','attributes':['id',_0xe896('0x21')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xe896('0x22')]=function(_0x239bf1,_0xfff0d2,_0x55063a){return function(){return client[_0xe896('0xb')](_0xe896('0x9'),{'body':_0x239bf1,'options':{'where':{'id':_0xfff0d2},'limit':_0x55063a},'log':'UpdateCmHopper'});};};exports['getContactRecallMe']=function(_0x63c73d,_0x4bfa25){return function(){return client[_0xe896('0xb')](_0xe896('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x63c73d,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x4bfa25}},'order':[[_0xe896('0x13'),_0xe896('0x14')],[_0xe896('0x15'),_0xe896('0x14')],['id',_0xe896('0x16')]],'include':[{'model':_0xe896('0x3'),'as':'Contact'},{'model':_0xe896('0x24'),'as':'Agent','attributes':['id',_0xe896('0x21'),_0xe896('0x25')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0xe896('0x12')});};};exports[_0xe896('0x26')]=function(_0x3f0a60){return function(){return client[_0xe896('0xb')]('ResetActiveCalls',{'body':_0x3f0a60,'options':{},'log':_0xe896('0x27')});};};exports[_0xe896('0x28')]=function(_0x28cc93,_0x19de2b){return function(){return client[_0xe896('0xb')](_0xe896('0x29'),{'body':{'where':{'voiceQueueId':_0x28cc93,'interval':_0x19de2b}},'log':'handlePreviewRecallNotifications'});};};