0475dde9db2a4d4f114ad00628cf12b6dc5ee885
[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 _0x7923=['format','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','getContactDialerIvr','CmContact','GetContactDialerIvr','campaign','queue','MoveContactManagedDialer','ContactId','countReScheduled','CountReScheduled','getContactPreview','User','VoiceQueue','Queue','unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','Contact','UpdateCmHopper','rescheduleContact','ListId','VoiceQueueId','CampaignId','getContactDialer','GetContactDialer'];(function(_0xcba4b6,_0x1ecf6a){var _0x2bd8bf=function(_0x46812a){while(--_0x46812a){_0xcba4b6['push'](_0xcba4b6['shift']());}};_0x2bd8bf(++_0x1ecf6a);}(_0x7923,0x8f));var _0x3792=function(_0x2aee82,_0x38724d){_0x2aee82=_0x2aee82-0x0;var _0x2ea60f=_0x7923[_0x2aee82];return _0x2ea60f;};'use strict';var client=require(_0x3792('0x0'));var moment=require(_0x3792('0x1'));exports[_0x3792('0x2')]=function(_0xdc0c64,_0xfd3952){return function(){return client[_0x3792('0x3')](_0x3792('0x4'),{'options':{'where':{'VoiceQueueId':_0xdc0c64},'include':[{'model':'CmContact','as':_0x3792('0x5')}],'limit':_0xfd3952,'raw':![]},'log':'getCmHopper'});};};exports['updateContacts']=function(_0x3fc684,_0x4f98c6,_0x326cc2){return function(){return client[_0x3792('0x3')](_0x3792('0x6'),{'body':_0x3fc684,'options':{'where':{'VoiceQueueId':_0x4f98c6,'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x326cc2},'log':_0x3792('0x6')});};};exports[_0x3792('0x7')]=function(_0x4ac53c){return client[_0x3792('0x3')](_0x3792('0x6'),{'body':_0x4ac53c,'options':{'where':{'ContactId':_0x4ac53c['ContactId'],'ListId':_0x4ac53c[_0x3792('0x8')],'VoiceQueueId':_0x4ac53c[_0x3792('0x9')],'CampaignId':_0x4ac53c[_0x3792('0xa')]}},'log':'rescheduleContact'});};exports['destroyContact']=function(_0x8ed062,_0x3d0c76,_0x33e47a){return function(){return client[_0x3792('0x3')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x8ed062,'ListId':_0x3d0c76,'ContactId':_0x33e47a}},'log':'DestroyCmHopper'});};};exports[_0x3792('0xb')]=function(_0x346d22,_0x362845,_0x3530fe,_0x10913e){return client[_0x3792('0x3')](_0x3792('0xc'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x346d22,'active':![],'scheduledat':{'$lte':moment()[_0x3792('0xd')](_0x3792('0xe'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x362845}}]},'order':[[_0x3792('0xf'),_0x3792('0x10')],[_0x3792('0x11'),_0x10913e],['id',_0x3792('0x12')]],'raw':!![],'limit':_0x3530fe},'log':_0x3792('0xc')});};exports[_0x3792('0x13')]=function(_0x683ede,_0x28ad67,_0x4a8e1c){return client[_0x3792('0x3')](_0x3792('0xc'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x683ede,'active':![],'scheduledat':{'$lte':moment()[_0x3792('0xd')](_0x3792('0xe'))}},'include':[{'model':_0x3792('0x14'),'as':'Contact'}],'order':[[_0x3792('0xf'),_0x3792('0x10')],[_0x3792('0x11'),_0x4a8e1c],['id',_0x3792('0x12')]],'raw':!![],'limit':_0x28ad67},'log':_0x3792('0x15')});};exports['moveContactManagedDialer']=function(_0x4cd50b,_0x2c1f8a){_0x4cd50b[_0x3792('0x16')]=_0x4cd50b[_0x3792('0x17')];return client[_0x3792('0x3')](_0x3792('0x18'),{'body':_0x4cd50b,'options':{'where':{'ContactId':_0x4cd50b[_0x3792('0x19')],'ListId':_0x4cd50b['ListId'],'VoiceQueueId':_0x4cd50b['VoiceQueueId'],'CampaignId':_0x4cd50b[_0x3792('0xa')],'active':_0x2c1f8a?undefined:!![]}},'log':_0x3792('0x18')});};exports[_0x3792('0x1a')]=function(_0x7a0f3f){return client['Request'](_0x3792('0x1b'),{'options':{'where':{'VoiceQueueId':_0x7a0f3f['id']?_0x7a0f3f['id']||null:null}},'log':'countReScheduled'});};exports[_0x3792('0x1c')]=function(_0x3608da){return function(){return client['Request']('GetCmHopperPreview',{'options':{'where':{'id':_0x3608da},'include':[{'model':_0x3792('0x14'),'as':_0x3792('0x5')},{'model':_0x3792('0x1d'),'as':'Agent','attributes':['id','name']},{'model':_0x3792('0x1e'),'as':_0x3792('0x1f'),'attributes':['id','name']}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x3792('0x20')]=function(_0x223b6b,_0x1334d2,_0x2908ab){return client['Request']('UpdateCmHopper',{'body':_0x223b6b,'options':{'where':{'id':_0x1334d2},'limit':_0x2908ab},'log':_0x3792('0x6')});};exports[_0x3792('0x21')]=function(_0x3b9b67,_0x2d3131){return function(){return client[_0x3792('0x3')](_0x3792('0x22'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3b9b67,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x3792('0xd')](_0x3792('0xe'))},'UserId':{'$in':_0x2d3131}},'order':[[_0x3792('0xf'),'DESC'],[_0x3792('0x11'),_0x3792('0x10')],['id',_0x3792('0x12')]],'include':[{'model':_0x3792('0x14'),'as':_0x3792('0x5')},{'model':'User','as':'Agent','attributes':['id','name',_0x3792('0x23')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x3792('0xc')});};};exports['resetActiveCalls']=function(_0x345dcf,_0x2b6167){return client[_0x3792('0x3')](_0x3792('0x24'),{'body':_0x345dcf,'options':_0x2b6167||{},'log':'ResetActiveCalls'});};exports[_0x3792('0x25')]=function(_0x58c4a2,_0x51ec56,_0x1ae6e4){return function(){return client[_0x3792('0x3')](_0x3792('0x26'),{'body':{'where':{'voiceQueueIds':_0x58c4a2,'interval':_0x51ec56,'availableAgentsIds':_0x1ae6e4}},'log':_0x3792('0x25')});};};