Built motion from commit b0a9a629.|2.6.33
[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 _0x2070=['CmContact','getCmHopper','updateContacts','UpdateCmHopper','format','rescheduleContact','Request','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','GetContactDialer','priority','DESC','ASC','getContactDialerIvr','YYYY-MM-DD\x20HH:mm:ss','Contact','scheduledat','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','Agent','name','VoiceQueue','unlockContact','getContactRecallMe','User','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','getContacts','GetCmHopper'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x2070,0x1a2));var _0x0207=function(_0x54bbfd,_0x1ed496){_0x54bbfd=_0x54bbfd-0x0;var _0x1dd941=_0x2070[_0x54bbfd];return _0x1dd941;};'use strict';var client=require('../client');var moment=require('moment');exports[_0x0207('0x0')]=function(_0x146e2e,_0x37e734){return function(){return client['Request'](_0x0207('0x1'),{'options':{'where':{'VoiceQueueId':_0x146e2e},'include':[{'model':_0x0207('0x2'),'as':'Contact'}],'limit':_0x37e734,'raw':![]},'log':_0x0207('0x3')});};};exports[_0x0207('0x4')]=function(_0x5bce74,_0x5573e8,_0x5cf734){return function(){return client['Request'](_0x0207('0x5'),{'body':_0x5bce74,'options':{'where':{'VoiceQueueId':_0x5573e8,'scheduledat':{'$lte':moment()[_0x0207('0x6')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x5cf734},'log':_0x0207('0x5')});};};exports[_0x0207('0x7')]=function(_0x4bd107){return client[_0x0207('0x8')](_0x0207('0x5'),{'body':_0x4bd107,'options':{'where':{'ContactId':_0x4bd107[_0x0207('0x9')],'ListId':_0x4bd107[_0x0207('0xa')],'VoiceQueueId':_0x4bd107[_0x0207('0xb')],'CampaignId':_0x4bd107[_0x0207('0xc')]}},'log':_0x0207('0x7')});};exports[_0x0207('0xd')]=function(_0x2169c3,_0x4488ba,_0x2706ee){return function(){return client[_0x0207('0x8')](_0x0207('0xe'),{'options':{'where':{'VoiceQueueId':_0x2169c3,'ListId':_0x4488ba,'ContactId':_0x2706ee}},'log':_0x0207('0xe')});};};exports['getContactDialer']=function(_0x34db03,_0x5b2a38,_0xec6d19,_0x3bd0c4){return client[_0x0207('0x8')](_0x0207('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x34db03,'active':![],'scheduledat':{'$lte':moment()[_0x0207('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0x5b2a38}}]},'order':[[_0x0207('0x10'),_0x0207('0x11')],['scheduledat',_0x3bd0c4],['id',_0x0207('0x12')]],'raw':!![],'limit':_0xec6d19},'log':_0x0207('0xf')});};exports[_0x0207('0x13')]=function(_0x325eb1,_0x4aac04,_0x1bdc25){return client[_0x0207('0x8')](_0x0207('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x325eb1,'active':![],'scheduledat':{'$lte':moment()[_0x0207('0x6')](_0x0207('0x14'))}},'include':[{'model':_0x0207('0x2'),'as':_0x0207('0x15')}],'order':[[_0x0207('0x10'),_0x0207('0x11')],[_0x0207('0x16'),_0x1bdc25],['id',_0x0207('0x12')]],'raw':!![],'limit':_0x4aac04},'log':_0x0207('0x17')});};exports[_0x0207('0x18')]=function(_0xfc201,_0x3474f3){_0xfc201['campaign']=_0xfc201[_0x0207('0x19')];return client['Request'](_0x0207('0x1a'),{'body':_0xfc201,'options':{'where':{'ContactId':_0xfc201[_0x0207('0x9')],'ListId':_0xfc201[_0x0207('0xa')],'VoiceQueueId':_0xfc201['VoiceQueueId'],'CampaignId':_0xfc201[_0x0207('0xc')],'active':_0x3474f3?undefined:!![]}},'log':_0x0207('0x1a')});};exports['countReScheduled']=function(_0x16bf24){return client[_0x0207('0x8')](_0x0207('0x1b'),{'options':{'where':{'VoiceQueueId':_0x16bf24['id']?_0x16bf24['id']||null:null}},'log':_0x0207('0x1c')});};exports[_0x0207('0x1d')]=function(_0x520a88){return function(){return client[_0x0207('0x8')](_0x0207('0x1e'),{'options':{'where':{'id':_0x520a88},'include':[{'model':'CmContact','as':_0x0207('0x15')},{'model':'User','as':_0x0207('0x1f'),'attributes':['id',_0x0207('0x20')]},{'model':_0x0207('0x21'),'as':'Queue','attributes':['id',_0x0207('0x20')]}],'raw':!![]},'log':_0x0207('0x3')});};};exports[_0x0207('0x22')]=function(_0x35085c,_0x1bc810,_0x5cc816){return client[_0x0207('0x8')]('UpdateCmHopper',{'body':_0x35085c,'options':{'where':{'id':_0x1bc810},'limit':_0x5cc816},'log':_0x0207('0x5')});};exports[_0x0207('0x23')]=function(_0x435e79,_0x4e5e7b){return function(){return client[_0x0207('0x8')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x435e79,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()['format'](_0x0207('0x14'))},'UserId':{'$in':_0x4e5e7b}},'order':[[_0x0207('0x10'),_0x0207('0x11')],[_0x0207('0x16'),_0x0207('0x11')],['id','ASC']],'include':[{'model':_0x0207('0x2'),'as':_0x0207('0x15')},{'model':_0x0207('0x24'),'as':_0x0207('0x1f'),'attributes':['id','name',_0x0207('0x25')]}],'group':_0x0207('0x26'),'raw':!![]},'log':_0x0207('0xf')});};};exports[_0x0207('0x27')]=function(_0x1099e6,_0x2b9e2d){return client['Request']('ResetActiveCalls',{'body':_0x1099e6,'options':_0x2b9e2d||{},'log':_0x0207('0x28')});};exports['handlePreviewRecallNotifications']=function(_0x82b166,_0x15afd7,_0x37751f){return function(){return client[_0x0207('0x8')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x82b166,'interval':_0x15afd7,'availableAgentsIds':_0x37751f}},'log':_0x0207('0x29')});};};