Built motion from commit ff78e754.|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 _0xf52f=['Contact','getCmHopper','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','CmContact','GetContactDialerIvr','campaign','queue','MoveContactManagedDialer','countReScheduled','GetCmHopperPreview','User','Agent','name','VoiceQueue','Queue','getContactRecallMe','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper'];(function(_0x2f4d41,_0x525047){var _0x3b0bb2=function(_0x19960d){while(--_0x19960d){_0x2f4d41['push'](_0x2f4d41['shift']());}};_0x3b0bb2(++_0x525047);}(_0xf52f,0x113));var _0xff52=function(_0x27e297,_0x789346){_0x27e297=_0x27e297-0x0;var _0x2c1458=_0xf52f[_0x27e297];return _0x2c1458;};'use strict';var client=require(_0xff52('0x0'));var moment=require(_0xff52('0x1'));exports[_0xff52('0x2')]=function(_0x4ff45d,_0x3ac63f){return function(){return client[_0xff52('0x3')](_0xff52('0x4'),{'options':{'where':{'VoiceQueueId':_0x4ff45d},'include':[{'model':'CmContact','as':_0xff52('0x5')}],'limit':_0x3ac63f,'raw':![]},'log':_0xff52('0x6')});};};exports['updateContacts']=function(_0x8aa64e,_0x3a3ca3,_0x2f8c21){return function(){return client[_0xff52('0x3')](_0xff52('0x7'),{'body':_0x8aa64e,'options':{'where':{'VoiceQueueId':_0x3a3ca3,'scheduledat':{'$lte':moment()[_0xff52('0x8')](_0xff52('0x9'))}},'limit':_0x2f8c21},'log':_0xff52('0x7')});};};exports[_0xff52('0xa')]=function(_0x12c89d){return client[_0xff52('0x3')](_0xff52('0x7'),{'body':_0x12c89d,'options':{'where':{'ContactId':_0x12c89d[_0xff52('0xb')],'ListId':_0x12c89d[_0xff52('0xc')],'VoiceQueueId':_0x12c89d[_0xff52('0xd')],'CampaignId':_0x12c89d[_0xff52('0xe')]}},'log':_0xff52('0xa')});};exports[_0xff52('0xf')]=function(_0x3a4856,_0x51debe,_0x4ca56d){return function(){return client[_0xff52('0x3')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x3a4856,'ListId':_0x51debe,'ContactId':_0x4ca56d}},'log':_0xff52('0x10')});};};exports[_0xff52('0x11')]=function(_0x1b87c8,_0xc4edf,_0x53ae02,_0x54eccf){return client['Request'](_0xff52('0x12'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1b87c8,'active':![],'scheduledat':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'$or':[{'UserId':null},{'UserId':{'$in':_0xc4edf}}]},'order':[[_0xff52('0x13'),_0xff52('0x14')],[_0xff52('0x15'),_0x54eccf],['id',_0xff52('0x16')]],'raw':!![],'limit':_0x53ae02},'log':_0xff52('0x12')});};exports['getContactDialerIvr']=function(_0x853d6b,_0x5ecf12,_0xc8d493){return client['Request']('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x853d6b,'active':![],'scheduledat':{'$lte':moment()[_0xff52('0x8')](_0xff52('0x9'))}},'include':[{'model':_0xff52('0x17'),'as':'Contact'}],'order':[['priority',_0xff52('0x14')],[_0xff52('0x15'),_0xc8d493],['id',_0xff52('0x16')]],'raw':!![],'limit':_0x5ecf12},'log':_0xff52('0x18')});};exports['moveContactManagedDialer']=function(_0x147db2,_0x45fe57){_0x147db2[_0xff52('0x19')]=_0x147db2[_0xff52('0x1a')];return client[_0xff52('0x3')](_0xff52('0x1b'),{'body':_0x147db2,'options':{'where':{'ContactId':_0x147db2[_0xff52('0xb')],'ListId':_0x147db2[_0xff52('0xc')],'VoiceQueueId':_0x147db2['VoiceQueueId'],'CampaignId':_0x147db2[_0xff52('0xe')],'active':_0x45fe57?undefined:!![]}},'log':_0xff52('0x1b')});};exports['countReScheduled']=function(_0x313ee0){return client[_0xff52('0x3')]('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0x313ee0['id']?_0x313ee0['id']||null:null}},'log':_0xff52('0x1c')});};exports['getContactPreview']=function(_0x5e94a7){return function(){return client['Request'](_0xff52('0x1d'),{'options':{'where':{'id':_0x5e94a7},'include':[{'model':_0xff52('0x17'),'as':_0xff52('0x5')},{'model':_0xff52('0x1e'),'as':_0xff52('0x1f'),'attributes':['id',_0xff52('0x20')]},{'model':_0xff52('0x21'),'as':_0xff52('0x22'),'attributes':['id',_0xff52('0x20')]}],'raw':!![]},'log':_0xff52('0x6')});};};exports['unlockContact']=function(_0x1f6805,_0x41e3bf,_0x485c9f){return client[_0xff52('0x3')](_0xff52('0x7'),{'body':_0x1f6805,'options':{'where':{'id':_0x41e3bf},'limit':_0x485c9f},'log':_0xff52('0x7')});};exports[_0xff52('0x23')]=function(_0x30fd72,_0x51d708){return function(){return client[_0xff52('0x3')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x30fd72,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xff52('0x8')](_0xff52('0x9'))},'UserId':{'$in':_0x51d708}},'order':[[_0xff52('0x13'),_0xff52('0x14')],[_0xff52('0x15'),'DESC'],['id','ASC']],'include':[{'model':_0xff52('0x17'),'as':_0xff52('0x5')},{'model':_0xff52('0x1e'),'as':'Agent','attributes':['id',_0xff52('0x20'),'voicePause']}],'group':_0xff52('0x24'),'raw':!![]},'log':_0xff52('0x12')});};};exports['resetActiveCalls']=function(_0x28da9a,_0x35db73){return client[_0xff52('0x3')](_0xff52('0x25'),{'body':_0x28da9a,'options':_0x35db73||{},'log':_0xff52('0x25')});};exports[_0xff52('0x26')]=function(_0x368a9d,_0x459cb9,_0x11b531){return function(){return client[_0xff52('0x3')](_0xff52('0x27'),{'body':{'where':{'voiceQueueIds':_0x368a9d,'interval':_0x459cb9,'availableAgentsIds':_0x11b531}},'log':'handlePreviewRecallNotifications'});};};