14ac5a979e1c071c132a41e149912ec9bc891400
[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 _0x4c02=['Contact','getCmHopper','updateContacts','UpdateCmHopper','format','rescheduleContact','ContactId','CampaignId','DestroyCmHopper','getContactDialer','GetContactDialer','DESC','ASC','getContactDialerIvr','YYYY-MM-DD\x20HH:mm:ss','priority','scheduledat','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','VoiceQueueId','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','Agent','name','Queue','unlockContact','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','lodash','Request','GetCmHopper','CmContact'];(function(_0x146f59,_0x16e733){var _0x59d0cc=function(_0x8b7fb9){while(--_0x8b7fb9){_0x146f59['push'](_0x146f59['shift']());}};_0x59d0cc(++_0x16e733);}(_0x4c02,0x11a));var _0x24c0=function(_0x255be9,_0x3345d9){_0x255be9=_0x255be9-0x0;var _0x34fedf=_0x4c02[_0x255be9];return _0x34fedf;};'use strict';var client=require(_0x24c0('0x0'));var moment=require('moment');var _=require(_0x24c0('0x1'));exports['getContacts']=function(_0x3a48b0,_0x329fd2){return function(){return client[_0x24c0('0x2')](_0x24c0('0x3'),{'options':{'where':{'VoiceQueueId':_0x3a48b0},'include':[{'model':_0x24c0('0x4'),'as':_0x24c0('0x5')}],'limit':_0x329fd2,'raw':![]},'log':_0x24c0('0x6')});};};exports[_0x24c0('0x7')]=function(_0x1f81af,_0x4c3638,_0x37518d){return function(){return client[_0x24c0('0x2')](_0x24c0('0x8'),{'body':_0x1f81af,'options':{'where':{'VoiceQueueId':_0x4c3638,'scheduledat':{'$lte':moment()[_0x24c0('0x9')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x37518d},'log':_0x24c0('0x8')});};};exports[_0x24c0('0xa')]=function(_0x4ee4fb){return function(){return client[_0x24c0('0x2')](_0x24c0('0x8'),{'body':_0x4ee4fb,'options':{'where':{'ContactId':_0x4ee4fb[_0x24c0('0xb')],'ListId':_0x4ee4fb['ListId'],'VoiceQueueId':_0x4ee4fb['VoiceQueueId'],'CampaignId':_0x4ee4fb[_0x24c0('0xc')]}},'log':_0x24c0('0xa')});};};exports['destroyContact']=function(_0x5ec223,_0x4d9d77,_0x26eca2){return function(){return client[_0x24c0('0x2')](_0x24c0('0xd'),{'options':{'where':{'VoiceQueueId':_0x5ec223,'ListId':_0x4d9d77,'ContactId':_0x26eca2}},'log':_0x24c0('0xd')});};};exports[_0x24c0('0xe')]=function(_0x3b3af3,_0x3431a3,_0x57ebf7,_0x40df6d){return function(){return client[_0x24c0('0x2')](_0x24c0('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3b3af3,'active':![],'scheduledat':{'$lte':moment()[_0x24c0('0x9')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x3431a3}}]},'order':[['priority',_0x24c0('0x10')],['scheduledat',_0x40df6d],['id',_0x24c0('0x11')]],'raw':!![],'limit':_0x57ebf7},'log':_0x24c0('0xf')});};};exports[_0x24c0('0x12')]=function(_0x52f6c4,_0xfcc8b4,_0x4931aa){return function(){return client[_0x24c0('0x2')](_0x24c0('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x52f6c4,'active':![],'scheduledat':{'$lte':moment()[_0x24c0('0x9')](_0x24c0('0x13'))}},'include':[{'model':_0x24c0('0x4'),'as':_0x24c0('0x5')}],'order':[[_0x24c0('0x14'),'DESC'],[_0x24c0('0x15'),_0x4931aa],['id',_0x24c0('0x11')]],'raw':!![],'limit':_0xfcc8b4},'log':_0x24c0('0x16')});};};exports[_0x24c0('0x17')]=function(_0x466000,_0x4129b0){return function(){_0x466000['campaign']=_0x466000[_0x24c0('0x18')];return client[_0x24c0('0x2')](_0x24c0('0x19'),{'body':_0x466000,'options':{'where':{'ContactId':_0x466000[_0x24c0('0xb')],'ListId':_0x466000['ListId'],'VoiceQueueId':_0x466000[_0x24c0('0x1a')],'CampaignId':_0x466000[_0x24c0('0xc')],'active':_0x4129b0?undefined:!![]}},'log':_0x24c0('0x19')});};};exports['countReScheduled']=function(_0x4fa7ca){return function(){return client[_0x24c0('0x2')](_0x24c0('0x1b'),{'options':{'where':{'VoiceQueueId':_0x4fa7ca['id']?_0x4fa7ca['id']||null:null}},'log':_0x24c0('0x1c')});};};exports[_0x24c0('0x1d')]=function(_0x1da39a){return function(){return client[_0x24c0('0x2')](_0x24c0('0x1e'),{'options':{'where':{'id':_0x1da39a},'include':[{'model':'CmContact','as':_0x24c0('0x5')},{'model':'User','as':_0x24c0('0x1f'),'attributes':['id',_0x24c0('0x20')]},{'model':'VoiceQueue','as':_0x24c0('0x21'),'attributes':['id',_0x24c0('0x20')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x24c0('0x22')]=function(_0x5d610a,_0x2e7d1c,_0x49dbc1){return function(){return client['Request'](_0x24c0('0x8'),{'body':_0x5d610a,'options':{'where':{'id':_0x2e7d1c},'limit':_0x49dbc1},'log':_0x24c0('0x8')});};};exports['getContactRecallMe']=function(_0x52899f,_0x400fb4){return function(){return client[_0x24c0('0x2')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x52899f,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x400fb4}},'order':[[_0x24c0('0x14'),_0x24c0('0x10')],[_0x24c0('0x15'),_0x24c0('0x10')],['id',_0x24c0('0x11')]],'include':[{'model':_0x24c0('0x4'),'as':_0x24c0('0x5')},{'model':'User','as':_0x24c0('0x1f'),'attributes':['id','name',_0x24c0('0x23')]}],'group':_0x24c0('0x24'),'raw':!![]},'log':'GetContactDialer'});};};exports[_0x24c0('0x25')]=function(_0x2af46c){return function(){return client[_0x24c0('0x2')](_0x24c0('0x26'),{'body':_0x2af46c,'options':{},'log':_0x24c0('0x26')});};};exports[_0x24c0('0x27')]=function(_0x286301,_0x56d260){return function(){return client['Request'](_0x24c0('0x28'),{'body':{'where':{'voiceQueueId':_0x286301,'interval':_0x56d260}},'log':_0x24c0('0x27')});};};