10ca52612937dfb659717c2e274f6112915f0015
[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 _0xc350=['getContactDialer','GetContactDialer','format','DESC','ASC','priority','scheduledat','GetContactDialerIvr','moveContactManagedDialer','campaign','MoveContactManagedDialer','countReScheduled','CountReScheduled','GetCmHopperPreview','User','Agent','VoiceQueue','Queue','unlockContact','getContactRecallMe','db.CmHopper.UserId','moment','Request','GetCmHopper','CmContact','Contact','getCmHopper','UpdateCmHopper','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId','VoiceQueueId','CampaignId','DestroyCmHopper'];(function(_0x353660,_0x89a1eb){var _0x1309ac=function(_0x414a24){while(--_0x414a24){_0x353660['push'](_0x353660['shift']());}};_0x1309ac(++_0x89a1eb);}(_0xc350,0x1f1));var _0x0c35=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0xc350[_0x4b7895];return _0x264180;};'use strict';var client=require('../client');var moment=require(_0x0c35('0x0'));var _=require('lodash');exports['getContacts']=function(_0x4ef5d2,_0x1762d0){return function(){return client[_0x0c35('0x1')](_0x0c35('0x2'),{'options':{'where':{'VoiceQueueId':_0x4ef5d2},'include':[{'model':_0x0c35('0x3'),'as':_0x0c35('0x4')}],'limit':_0x1762d0,'raw':![]},'log':_0x0c35('0x5')});};};exports['updateContacts']=function(_0x630cb4,_0x13ac35,_0x3f66fc){return function(){return client[_0x0c35('0x1')](_0x0c35('0x6'),{'body':_0x630cb4,'options':{'where':{'VoiceQueueId':_0x13ac35,'scheduledat':{'$lte':moment()['format'](_0x0c35('0x7'))}},'limit':_0x3f66fc},'log':_0x0c35('0x6')});};};exports[_0x0c35('0x8')]=function(_0x71dddf){return function(){return client[_0x0c35('0x1')](_0x0c35('0x6'),{'body':_0x71dddf,'options':{'where':{'ContactId':_0x71dddf['ContactId'],'ListId':_0x71dddf[_0x0c35('0x9')],'VoiceQueueId':_0x71dddf[_0x0c35('0xa')],'CampaignId':_0x71dddf[_0x0c35('0xb')]}},'log':'rescheduleContact'});};};exports['destroyContact']=function(_0x108f37,_0x118bfc,_0x5873eb){return function(){return client['Request'](_0x0c35('0xc'),{'options':{'where':{'VoiceQueueId':_0x108f37,'ListId':_0x118bfc,'ContactId':_0x5873eb}},'log':_0x0c35('0xc')});};};exports[_0x0c35('0xd')]=function(_0x5d64af,_0x1dae09,_0x364954,_0x56beb4){return function(){return client[_0x0c35('0x1')](_0x0c35('0xe'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x5d64af,'active':![],'scheduledat':{'$lte':moment()[_0x0c35('0xf')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x1dae09}}]},'order':[['priority',_0x0c35('0x10')],['scheduledat',_0x56beb4],['id',_0x0c35('0x11')]],'raw':!![],'limit':_0x364954},'log':'GetContactDialer'});};};exports['getContactDialerIvr']=function(_0xa3625c,_0x230f45,_0x113c26){return function(){return client[_0x0c35('0x1')](_0x0c35('0xe'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0xa3625c,'active':![],'scheduledat':{'$lte':moment()['format'](_0x0c35('0x7'))}},'include':[{'model':'CmContact','as':'Contact'}],'order':[[_0x0c35('0x12'),_0x0c35('0x10')],[_0x0c35('0x13'),_0x113c26],['id',_0x0c35('0x11')]],'raw':!![],'limit':_0x230f45},'log':_0x0c35('0x14')});};};exports[_0x0c35('0x15')]=function(_0x4f423f,_0x2bf022){return function(){_0x4f423f[_0x0c35('0x16')]=_0x4f423f['queue'];return client[_0x0c35('0x1')](_0x0c35('0x17'),{'body':_0x4f423f,'options':{'where':{'ContactId':_0x4f423f['ContactId'],'ListId':_0x4f423f[_0x0c35('0x9')],'VoiceQueueId':_0x4f423f[_0x0c35('0xa')],'CampaignId':_0x4f423f[_0x0c35('0xb')],'active':_0x2bf022?undefined:!![]}},'log':_0x0c35('0x17')});};};exports[_0x0c35('0x18')]=function(_0xab970){return function(){return client[_0x0c35('0x1')](_0x0c35('0x19'),{'options':{'where':{'VoiceQueueId':_0xab970['id']?_0xab970['id']||null:null}},'log':'countReScheduled'});};};exports['getContactPreview']=function(_0x46058c){return function(){return client['Request'](_0x0c35('0x1a'),{'options':{'where':{'id':_0x46058c},'include':[{'model':_0x0c35('0x3'),'as':_0x0c35('0x4')},{'model':_0x0c35('0x1b'),'as':_0x0c35('0x1c'),'attributes':['id','name']},{'model':_0x0c35('0x1d'),'as':_0x0c35('0x1e'),'attributes':['id','name']}],'raw':!![]},'log':_0x0c35('0x5')});};};exports[_0x0c35('0x1f')]=function(_0xce6d34,_0x400897,_0x17498c){return function(){return client['Request']('UpdateCmHopper',{'body':_0xce6d34,'options':{'where':{'id':_0x400897},'limit':_0x17498c},'log':_0x0c35('0x6')});};};exports[_0x0c35('0x20')]=function(_0x5157a8,_0xd2f8ef){return function(){return client[_0x0c35('0x1')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x5157a8,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x0c35('0x7'))},'UserId':{'$in':_0xd2f8ef}},'order':[[_0x0c35('0x12'),_0x0c35('0x10')],[_0x0c35('0x13'),_0x0c35('0x10')],['id','ASC']],'include':[{'model':_0x0c35('0x3'),'as':_0x0c35('0x4')},{'model':_0x0c35('0x1b'),'as':'Agent','attributes':['id','name','voicePause']}],'group':_0x0c35('0x21'),'raw':!![]},'log':'GetContactDialer'});};};