Built motion from commit 0415ced0.|2.6.28
[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 _0xf987=['getContactRecallMe','GetContactRecallMe','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','rescheduleContact','ListId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','YYYY-MM-DD\x20HH:mm:ss','priority','DESC','ASC','scheduledat','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ContactId','CampaignId','countReScheduled','CountReScheduled','GetCmHopperPreview','User','Agent','name','VoiceQueue','Queue','unlockContact'];(function(_0x15a27d,_0x298e87){var _0xff4ccf=function(_0x5ca6a9){while(--_0x5ca6a9){_0x15a27d['push'](_0x15a27d['shift']());}};_0xff4ccf(++_0x298e87);}(_0xf987,0x18a));var _0x7f98=function(_0x28d180,_0x52beb3){_0x28d180=_0x28d180-0x0;var _0x3a796a=_0xf987[_0x28d180];return _0x3a796a;};'use strict';var client=require('../client');var moment=require('moment');exports[_0x7f98('0x0')]=function(_0x159dd6,_0x4d17d6){return function(){return client[_0x7f98('0x1')](_0x7f98('0x2'),{'options':{'where':{'VoiceQueueId':_0x159dd6},'include':[{'model':_0x7f98('0x3'),'as':_0x7f98('0x4')}],'limit':_0x4d17d6,'raw':![]},'log':_0x7f98('0x5')});};};exports[_0x7f98('0x6')]=function(_0xc72f22,_0x3b5abb,_0x3fb8e2){return function(){return client[_0x7f98('0x1')](_0x7f98('0x7'),{'body':_0xc72f22,'options':{'where':{'VoiceQueueId':_0x3b5abb,'scheduledat':{'$lte':moment()[_0x7f98('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x3fb8e2},'log':_0x7f98('0x7')});};};exports[_0x7f98('0x9')]=function(_0x229951){return client[_0x7f98('0x1')](_0x7f98('0x7'),{'body':_0x229951,'options':{'where':{'ContactId':_0x229951['ContactId'],'ListId':_0x229951[_0x7f98('0xa')],'VoiceQueueId':_0x229951['VoiceQueueId'],'CampaignId':_0x229951['CampaignId']}},'log':_0x7f98('0x9')});};exports[_0x7f98('0xb')]=function(_0x2b9328,_0x895ef2,_0x4c04a4){return function(){return client[_0x7f98('0x1')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x2b9328,'ListId':_0x895ef2,'ContactId':_0x4c04a4}},'log':_0x7f98('0xc')});};};exports[_0x7f98('0xd')]=function(_0x40ca0a,_0x3ab2b8,_0x2b9b17,_0x11b1f8){return client[_0x7f98('0x1')](_0x7f98('0xe'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x40ca0a,'active':![],'scheduledat':{'$lte':moment()[_0x7f98('0x8')](_0x7f98('0xf'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x3ab2b8}}]},'order':[[_0x7f98('0x10'),_0x7f98('0x11')],['scheduledat',_0x11b1f8],['id',_0x7f98('0x12')]],'raw':!![],'limit':_0x2b9b17},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x3ac563,_0xeef3b1,_0x585a1a){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x3ac563,'active':![],'scheduledat':{'$lte':moment()['format'](_0x7f98('0xf'))}},'include':[{'model':_0x7f98('0x3'),'as':'Contact'}],'order':[['priority','DESC'],[_0x7f98('0x13'),_0x585a1a],['id','ASC']],'raw':!![],'limit':_0xeef3b1},'log':_0x7f98('0x14')});};exports[_0x7f98('0x15')]=function(_0x3e78e2,_0x446dd5){_0x3e78e2[_0x7f98('0x16')]=_0x3e78e2[_0x7f98('0x17')];return client[_0x7f98('0x1')](_0x7f98('0x18'),{'body':_0x3e78e2,'options':{'where':{'ContactId':_0x3e78e2[_0x7f98('0x19')],'ListId':_0x3e78e2['ListId'],'VoiceQueueId':_0x3e78e2['VoiceQueueId'],'CampaignId':_0x3e78e2[_0x7f98('0x1a')],'active':_0x446dd5?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports[_0x7f98('0x1b')]=function(_0x2d9e09){return client['Request'](_0x7f98('0x1c'),{'options':{'where':{'VoiceQueueId':_0x2d9e09['id']?_0x2d9e09['id']||null:null}},'log':_0x7f98('0x1b')});};exports['getContactPreview']=function(_0x37c56d){return function(){return client[_0x7f98('0x1')](_0x7f98('0x1d'),{'options':{'where':{'id':_0x37c56d},'include':[{'model':_0x7f98('0x3'),'as':_0x7f98('0x4')},{'model':_0x7f98('0x1e'),'as':_0x7f98('0x1f'),'attributes':['id',_0x7f98('0x20')]},{'model':_0x7f98('0x21'),'as':_0x7f98('0x22'),'attributes':['id',_0x7f98('0x20')]}],'raw':!![]},'log':_0x7f98('0x5')});};};exports[_0x7f98('0x23')]=function(_0x51cf96,_0x4c9809,_0xc9432c){return client[_0x7f98('0x1')](_0x7f98('0x7'),{'body':_0x51cf96,'options':{'where':{'id':_0x4c9809},'limit':_0xc9432c},'log':_0x7f98('0x7')});};exports[_0x7f98('0x24')]=function(_0x16a8cb,_0x20ff8d){return function(){return client[_0x7f98('0x1')](_0x7f98('0x25'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x16a8cb,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x7f98('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x20ff8d}},'order':[[_0x7f98('0x10'),_0x7f98('0x11')],['scheduledat',_0x7f98('0x11')],['id',_0x7f98('0x12')]],'include':[{'model':_0x7f98('0x3'),'as':'Contact'},{'model':_0x7f98('0x1e'),'as':'Agent','attributes':['id',_0x7f98('0x20'),'voicePause']}],'group':_0x7f98('0x26'),'raw':!![]},'log':_0x7f98('0xe')});};};exports[_0x7f98('0x27')]=function(_0x185a02,_0x1757b0){return client[_0x7f98('0x1')](_0x7f98('0x28'),{'body':_0x185a02,'options':_0x1757b0||{},'log':'ResetActiveCalls'});};exports['handlePreviewRecallNotifications']=function(_0x2e7bd9,_0x46773a,_0x4671e6){return function(){return client[_0x7f98('0x1')](_0x7f98('0x29'),{'body':{'where':{'voiceQueueIds':_0x2e7bd9,'interval':_0x46773a,'availableAgentsIds':_0x4671e6}},'log':_0x7f98('0x2a')});};};