Built motion from commit 44b1f254.|2.6.26
[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 _0xdb70=['updateContacts','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','ContactId','ListId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','GetContactDialerIvr','moveContactManagedDialer','campaign','VoiceQueueId','MoveContactManagedDialer','countReScheduled','CountReScheduled','getContactPreview','GetCmHopperPreview','Queue','name','getContactRecallMe','GetContactRecallMe','Agent','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','CmContact','Contact','getCmHopper'];(function(_0x493d89,_0x51bda2){var _0x5aa421=function(_0x8465fb){while(--_0x8465fb){_0x493d89['push'](_0x493d89['shift']());}};_0x5aa421(++_0x51bda2);}(_0xdb70,0xa0));var _0x0db7=function(_0x2d048f,_0xf41e88){_0x2d048f=_0x2d048f-0x0;var _0x1222d5=_0xdb70[_0x2d048f];return _0x1222d5;};'use strict';var client=require(_0x0db7('0x0'));var moment=require(_0x0db7('0x1'));exports[_0x0db7('0x2')]=function(_0x53cf0e,_0x1ce3ac){return function(){return client[_0x0db7('0x3')](_0x0db7('0x4'),{'options':{'where':{'VoiceQueueId':_0x53cf0e},'include':[{'model':_0x0db7('0x5'),'as':_0x0db7('0x6')}],'limit':_0x1ce3ac,'raw':![]},'log':_0x0db7('0x7')});};};exports[_0x0db7('0x8')]=function(_0x22afd6,_0x13fcf7,_0xbefc2a){return function(){return client[_0x0db7('0x3')]('UpdateCmHopper',{'body':_0x22afd6,'options':{'where':{'VoiceQueueId':_0x13fcf7,'scheduledat':{'$lte':moment()[_0x0db7('0x9')](_0x0db7('0xa'))}},'limit':_0xbefc2a},'log':_0x0db7('0xb')});};};exports[_0x0db7('0xc')]=function(_0x117c06){return client[_0x0db7('0x3')]('UpdateCmHopper',{'body':_0x117c06,'options':{'where':{'ContactId':_0x117c06[_0x0db7('0xd')],'ListId':_0x117c06[_0x0db7('0xe')],'VoiceQueueId':_0x117c06['VoiceQueueId'],'CampaignId':_0x117c06[_0x0db7('0xf')]}},'log':_0x0db7('0xc')});};exports[_0x0db7('0x10')]=function(_0xf6b54a,_0x4e6f65,_0xda8b15){return function(){return client['Request'](_0x0db7('0x11'),{'options':{'where':{'VoiceQueueId':_0xf6b54a,'ListId':_0x4e6f65,'ContactId':_0xda8b15}},'log':_0x0db7('0x11')});};};exports[_0x0db7('0x12')]=function(_0x404322,_0x1ef17d,_0x58dfbb,_0x76c036){return client[_0x0db7('0x3')](_0x0db7('0x13'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x404322,'active':![],'scheduledat':{'$lte':moment()[_0x0db7('0x9')](_0x0db7('0xa'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x1ef17d}}]},'order':[[_0x0db7('0x14'),_0x0db7('0x15')],[_0x0db7('0x16'),_0x76c036],['id',_0x0db7('0x17')]],'raw':!![],'limit':_0x58dfbb},'log':_0x0db7('0x13')});};exports['getContactDialerIvr']=function(_0x21cd17,_0x389925,_0x18cf37){return client[_0x0db7('0x3')](_0x0db7('0x13'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x21cd17,'active':![],'scheduledat':{'$lte':moment()[_0x0db7('0x9')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':'CmContact','as':_0x0db7('0x6')}],'order':[[_0x0db7('0x14'),_0x0db7('0x15')],['scheduledat',_0x18cf37],['id',_0x0db7('0x17')]],'raw':!![],'limit':_0x389925},'log':_0x0db7('0x18')});};exports[_0x0db7('0x19')]=function(_0x211fc0,_0x5a0b04){_0x211fc0[_0x0db7('0x1a')]=_0x211fc0['queue'];return client[_0x0db7('0x3')]('MoveContactManagedDialer',{'body':_0x211fc0,'options':{'where':{'ContactId':_0x211fc0['ContactId'],'ListId':_0x211fc0[_0x0db7('0xe')],'VoiceQueueId':_0x211fc0[_0x0db7('0x1b')],'CampaignId':_0x211fc0[_0x0db7('0xf')],'active':_0x5a0b04?undefined:!![]}},'log':_0x0db7('0x1c')});};exports[_0x0db7('0x1d')]=function(_0x368243){return client[_0x0db7('0x3')](_0x0db7('0x1e'),{'options':{'where':{'VoiceQueueId':_0x368243['id']?_0x368243['id']||null:null}},'log':_0x0db7('0x1d')});};exports[_0x0db7('0x1f')]=function(_0x1a3977){return function(){return client[_0x0db7('0x3')](_0x0db7('0x20'),{'options':{'where':{'id':_0x1a3977},'include':[{'model':_0x0db7('0x5'),'as':'Contact'},{'model':'User','as':'Agent','attributes':['id','name']},{'model':'VoiceQueue','as':_0x0db7('0x21'),'attributes':['id',_0x0db7('0x22')]}],'raw':!![]},'log':_0x0db7('0x7')});};};exports['unlockContact']=function(_0x5d3091,_0x3279b5,_0x9d20d2){return client[_0x0db7('0x3')](_0x0db7('0xb'),{'body':_0x5d3091,'options':{'where':{'id':_0x3279b5},'limit':_0x9d20d2},'log':_0x0db7('0xb')});};exports[_0x0db7('0x23')]=function(_0x4ca418,_0x2de626){return function(){return client['Request'](_0x0db7('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x4ca418,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x0db7('0x9')](_0x0db7('0xa'))},'UserId':{'$in':_0x2de626}},'order':[[_0x0db7('0x14'),'DESC'],[_0x0db7('0x16'),'DESC'],['id',_0x0db7('0x17')]],'include':[{'model':_0x0db7('0x5'),'as':_0x0db7('0x6')},{'model':'User','as':_0x0db7('0x25'),'attributes':['id',_0x0db7('0x22'),'voicePause']}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0x0db7('0x13')});};};exports[_0x0db7('0x26')]=function(_0x2767d2,_0x558917){return client['Request'](_0x0db7('0x27'),{'body':_0x2767d2,'options':_0x558917||{},'log':_0x0db7('0x27')});};exports[_0x0db7('0x28')]=function(_0x499a1a,_0x39a005,_0x2ca599){return function(){return client[_0x0db7('0x3')](_0x0db7('0x29'),{'body':{'where':{'voiceQueueIds':_0x499a1a,'interval':_0x39a005,'availableAgentsIds':_0x2ca599}},'log':'handlePreviewRecallNotifications'});};};