Built motion from commit fa4c4286.|2.6.29
[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 _0xdc03=['scheduledat','getContactDialerIvr','ASC','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','countReScheduled','GetCmHopperPreview','User','VoiceQueue','name','getContactRecallMe','GetContactRecallMe','Agent','voicePause','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','format','UpdateCmHopper','ContactId','ListId','VoiceQueueId','CampaignId','DestroyCmHopper','GetContactDialer','YYYY-MM-DD\x20HH:mm:ss','priority','DESC'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xdc03,0x65));var _0x3dc0=function(_0x2e483f,_0x3afca0){_0x2e483f=_0x2e483f-0x0;var _0x2fbdbf=_0xdc03[_0x2e483f];return _0x2fbdbf;};'use strict';var client=require(_0x3dc0('0x0'));var moment=require('moment');exports[_0x3dc0('0x1')]=function(_0x7104b6,_0x59a39c){return function(){return client[_0x3dc0('0x2')](_0x3dc0('0x3'),{'options':{'where':{'VoiceQueueId':_0x7104b6},'include':[{'model':_0x3dc0('0x4'),'as':_0x3dc0('0x5')}],'limit':_0x59a39c,'raw':![]},'log':_0x3dc0('0x6')});};};exports[_0x3dc0('0x7')]=function(_0x499cbe,_0x3c5407,_0x20c408){return function(){return client[_0x3dc0('0x2')]('UpdateCmHopper',{'body':_0x499cbe,'options':{'where':{'VoiceQueueId':_0x3c5407,'scheduledat':{'$lte':moment()[_0x3dc0('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x20c408},'log':'UpdateCmHopper'});};};exports['rescheduleContact']=function(_0x7d59a8){return client[_0x3dc0('0x2')](_0x3dc0('0x9'),{'body':_0x7d59a8,'options':{'where':{'ContactId':_0x7d59a8[_0x3dc0('0xa')],'ListId':_0x7d59a8[_0x3dc0('0xb')],'VoiceQueueId':_0x7d59a8[_0x3dc0('0xc')],'CampaignId':_0x7d59a8[_0x3dc0('0xd')]}},'log':'rescheduleContact'});};exports['destroyContact']=function(_0x14b474,_0x2952b1,_0x25485a){return function(){return client['Request']('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x14b474,'ListId':_0x2952b1,'ContactId':_0x25485a}},'log':_0x3dc0('0xe')});};};exports['getContactDialer']=function(_0x2dabd8,_0x49c112,_0x52147f,_0x297de8){return client[_0x3dc0('0x2')](_0x3dc0('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2dabd8,'active':![],'scheduledat':{'$lte':moment()[_0x3dc0('0x8')](_0x3dc0('0x10'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x49c112}}]},'order':[[_0x3dc0('0x11'),_0x3dc0('0x12')],[_0x3dc0('0x13'),_0x297de8],['id','ASC']],'raw':!![],'limit':_0x52147f},'log':_0x3dc0('0xf')});};exports[_0x3dc0('0x14')]=function(_0x5d8781,_0x465d7a,_0xd5b9f1){return client[_0x3dc0('0x2')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x5d8781,'active':![],'scheduledat':{'$lte':moment()[_0x3dc0('0x8')](_0x3dc0('0x10'))}},'include':[{'model':_0x3dc0('0x4'),'as':'Contact'}],'order':[[_0x3dc0('0x11'),_0x3dc0('0x12')],[_0x3dc0('0x13'),_0xd5b9f1],['id',_0x3dc0('0x15')]],'raw':!![],'limit':_0x465d7a},'log':_0x3dc0('0x16')});};exports[_0x3dc0('0x17')]=function(_0x379fff,_0x257696){_0x379fff[_0x3dc0('0x18')]=_0x379fff[_0x3dc0('0x19')];return client['Request'](_0x3dc0('0x1a'),{'body':_0x379fff,'options':{'where':{'ContactId':_0x379fff[_0x3dc0('0xa')],'ListId':_0x379fff[_0x3dc0('0xb')],'VoiceQueueId':_0x379fff['VoiceQueueId'],'CampaignId':_0x379fff['CampaignId'],'active':_0x257696?undefined:!![]}},'log':_0x3dc0('0x1a')});};exports[_0x3dc0('0x1b')]=function(_0x32f3a2){return client[_0x3dc0('0x2')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x32f3a2['id']?_0x32f3a2['id']||null:null}},'log':_0x3dc0('0x1b')});};exports['getContactPreview']=function(_0x58c3db){return function(){return client[_0x3dc0('0x2')](_0x3dc0('0x1c'),{'options':{'where':{'id':_0x58c3db},'include':[{'model':_0x3dc0('0x4'),'as':_0x3dc0('0x5')},{'model':_0x3dc0('0x1d'),'as':'Agent','attributes':['id','name']},{'model':_0x3dc0('0x1e'),'as':'Queue','attributes':['id',_0x3dc0('0x1f')]}],'raw':!![]},'log':_0x3dc0('0x6')});};};exports['unlockContact']=function(_0x3ebb0e,_0x57fb09,_0x3348b6){return client[_0x3dc0('0x2')]('UpdateCmHopper',{'body':_0x3ebb0e,'options':{'where':{'id':_0x57fb09},'limit':_0x3348b6},'log':'UpdateCmHopper'});};exports[_0x3dc0('0x20')]=function(_0x527252,_0x58add0){return function(){return client['Request'](_0x3dc0('0x21'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x527252,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x3dc0('0x8')](_0x3dc0('0x10'))},'UserId':{'$in':_0x58add0}},'order':[['priority',_0x3dc0('0x12')],[_0x3dc0('0x13'),_0x3dc0('0x12')],['id','ASC']],'include':[{'model':_0x3dc0('0x4'),'as':'Contact'},{'model':_0x3dc0('0x1d'),'as':_0x3dc0('0x22'),'attributes':['id',_0x3dc0('0x1f'),_0x3dc0('0x23')]}],'group':_0x3dc0('0x24'),'raw':!![]},'log':'GetContactDialer'});};};exports['resetActiveCalls']=function(_0x7fa507,_0x156a7c){return client[_0x3dc0('0x2')](_0x3dc0('0x25'),{'body':_0x7fa507,'options':_0x156a7c||{},'log':_0x3dc0('0x25')});};exports[_0x3dc0('0x26')]=function(_0x551723,_0x4c0ab4,_0x52db9f){return function(){return client[_0x3dc0('0x2')](_0x3dc0('0x27'),{'body':{'where':{'voiceQueueIds':_0x551723,'interval':_0x4c0ab4,'availableAgentsIds':_0x52db9f}},'log':_0x3dc0('0x26')});};};