Built motion from commit e8da49ee.|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 _0xeecc=['unlockContact','getContactRecallMe','GetContactRecallMe','voicePause','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','handlePreviewRecallNotifications','../client','moment','getContacts','Request','getCmHopper','updateContacts','format','YYYY-MM-DD\x20HH:mm:ss','UpdateCmHopper','rescheduleContact','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','DESC','scheduledat','ASC','GetContactDialer','getContactDialerIvr','CmContact','Contact','priority','GetContactDialerIvr','moveContactManagedDialer','queue','MoveContactManagedDialer','ContactId','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue'];(function(_0x593d51,_0x183f01){var _0x3799ec=function(_0x3bd3be){while(--_0x3bd3be){_0x593d51['push'](_0x593d51['shift']());}};_0x3799ec(++_0x183f01);}(_0xeecc,0x12d));var _0xceec=function(_0x3e9182,_0x46e628){_0x3e9182=_0x3e9182-0x0;var _0x911bd2=_0xeecc[_0x3e9182];return _0x911bd2;};'use strict';var client=require(_0xceec('0x0'));var moment=require(_0xceec('0x1'));exports[_0xceec('0x2')]=function(_0x34d9cc,_0x4974bf){return function(){return client[_0xceec('0x3')]('GetCmHopper',{'options':{'where':{'VoiceQueueId':_0x34d9cc},'include':[{'model':'CmContact','as':'Contact'}],'limit':_0x4974bf,'raw':![]},'log':_0xceec('0x4')});};};exports[_0xceec('0x5')]=function(_0x3a2c0a,_0x2ae233,_0x5889fb){return function(){return client[_0xceec('0x3')]('UpdateCmHopper',{'body':_0x3a2c0a,'options':{'where':{'VoiceQueueId':_0x2ae233,'scheduledat':{'$lte':moment()[_0xceec('0x6')](_0xceec('0x7'))}},'limit':_0x5889fb},'log':_0xceec('0x8')});};};exports[_0xceec('0x9')]=function(_0x36c362){return client[_0xceec('0x3')](_0xceec('0x8'),{'body':_0x36c362,'options':{'where':{'ContactId':_0x36c362['ContactId'],'ListId':_0x36c362[_0xceec('0xa')],'VoiceQueueId':_0x36c362[_0xceec('0xb')],'CampaignId':_0x36c362[_0xceec('0xc')]}},'log':_0xceec('0x9')});};exports[_0xceec('0xd')]=function(_0x503795,_0x1fe218,_0x299583){return function(){return client[_0xceec('0x3')](_0xceec('0xe'),{'options':{'where':{'VoiceQueueId':_0x503795,'ListId':_0x1fe218,'ContactId':_0x299583}},'log':_0xceec('0xe')});};};exports['getContactDialer']=function(_0x2fa641,_0x5b8216,_0x1df290,_0x11b183){return client[_0xceec('0x3')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x2fa641,'active':![],'scheduledat':{'$lte':moment()['format'](_0xceec('0x7'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x5b8216}}]},'order':[['priority',_0xceec('0xf')],[_0xceec('0x10'),_0x11b183],['id',_0xceec('0x11')]],'raw':!![],'limit':_0x1df290},'log':_0xceec('0x12')});};exports[_0xceec('0x13')]=function(_0x3fea07,_0x4470a8,_0x1c8429){return client[_0xceec('0x3')](_0xceec('0x12'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x3fea07,'active':![],'scheduledat':{'$lte':moment()[_0xceec('0x6')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0xceec('0x14'),'as':_0xceec('0x15')}],'order':[[_0xceec('0x16'),_0xceec('0xf')],[_0xceec('0x10'),_0x1c8429],['id',_0xceec('0x11')]],'raw':!![],'limit':_0x4470a8},'log':_0xceec('0x17')});};exports[_0xceec('0x18')]=function(_0x32778b,_0x134002){_0x32778b['campaign']=_0x32778b[_0xceec('0x19')];return client['Request'](_0xceec('0x1a'),{'body':_0x32778b,'options':{'where':{'ContactId':_0x32778b[_0xceec('0x1b')],'ListId':_0x32778b['ListId'],'VoiceQueueId':_0x32778b[_0xceec('0xb')],'CampaignId':_0x32778b['CampaignId'],'active':_0x134002?undefined:!![]}},'log':_0xceec('0x1a')});};exports[_0xceec('0x1c')]=function(_0x3600cb){return client[_0xceec('0x3')](_0xceec('0x1d'),{'options':{'where':{'VoiceQueueId':_0x3600cb['id']?_0x3600cb['id']||null:null}},'log':_0xceec('0x1c')});};exports[_0xceec('0x1e')]=function(_0x505b99){return function(){return client[_0xceec('0x3')]('GetCmHopperPreview',{'options':{'where':{'id':_0x505b99},'include':[{'model':_0xceec('0x14'),'as':_0xceec('0x15')},{'model':_0xceec('0x1f'),'as':_0xceec('0x20'),'attributes':['id',_0xceec('0x21')]},{'model':_0xceec('0x22'),'as':'Queue','attributes':['id',_0xceec('0x21')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0xceec('0x23')]=function(_0x3b3923,_0x3cb421,_0x1c991c){return client[_0xceec('0x3')](_0xceec('0x8'),{'body':_0x3b3923,'options':{'where':{'id':_0x3cb421},'limit':_0x1c991c},'log':_0xceec('0x8')});};exports[_0xceec('0x24')]=function(_0x475910,_0x500050){return function(){return client[_0xceec('0x3')](_0xceec('0x25'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x475910,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xceec('0x6')](_0xceec('0x7'))},'UserId':{'$in':_0x500050}},'order':[[_0xceec('0x16'),_0xceec('0xf')],[_0xceec('0x10'),_0xceec('0xf')],['id','ASC']],'include':[{'model':_0xceec('0x14'),'as':_0xceec('0x15')},{'model':_0xceec('0x1f'),'as':'Agent','attributes':['id','name',_0xceec('0x26')]}],'group':'db.CmHopper.UserId','raw':!![]},'log':_0xceec('0x12')});};};exports['resetActiveCalls']=function(_0x30949c,_0x2c93ce){return client[_0xceec('0x3')](_0xceec('0x27'),{'body':_0x30949c,'options':_0x2c93ce||{},'log':'ResetActiveCalls'});};exports['handlePreviewRecallNotifications']=function(_0x45f412,_0x452caf,_0x561893){return function(){return client['Request'](_0xceec('0x28'),{'body':{'where':{'voiceQueueIds':_0x45f412,'interval':_0x452caf,'availableAgentsIds':_0x561893}},'log':_0xceec('0x29')});};};