Built motion from commit 511216ff.|2.6.34
[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 _0xfc9b=['YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','getContactDialerIvr','CmContact','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ContactId','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue','Queue','getCmHopper','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','Contact','updateContacts','UpdateCmHopper','format','ListId','VoiceQueueId','CampaignId','rescheduleContact','destroyContact','DestroyCmHopper','GetContactDialer'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xfc9b,0x74));var _0xbfc9=function(_0x4548b7,_0x1133e2){_0x4548b7=_0x4548b7-0x0;var _0x12fdc9=_0xfc9b[_0x4548b7];return _0x12fdc9;};'use strict';var client=require(_0xbfc9('0x0'));var moment=require(_0xbfc9('0x1'));exports[_0xbfc9('0x2')]=function(_0x38f482,_0x29639e){return function(){return client[_0xbfc9('0x3')](_0xbfc9('0x4'),{'options':{'where':{'VoiceQueueId':_0x38f482},'include':[{'model':'CmContact','as':_0xbfc9('0x5')}],'limit':_0x29639e,'raw':![]},'log':'getCmHopper'});};};exports[_0xbfc9('0x6')]=function(_0x1f1a3f,_0x523ff1,_0x1dbece){return function(){return client[_0xbfc9('0x3')](_0xbfc9('0x7'),{'body':_0x1f1a3f,'options':{'where':{'VoiceQueueId':_0x523ff1,'scheduledat':{'$lte':moment()[_0xbfc9('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x1dbece},'log':_0xbfc9('0x7')});};};exports['rescheduleContact']=function(_0x32bee5){return client['Request'](_0xbfc9('0x7'),{'body':_0x32bee5,'options':{'where':{'ContactId':_0x32bee5['ContactId'],'ListId':_0x32bee5[_0xbfc9('0x9')],'VoiceQueueId':_0x32bee5[_0xbfc9('0xa')],'CampaignId':_0x32bee5[_0xbfc9('0xb')]}},'log':_0xbfc9('0xc')});};exports[_0xbfc9('0xd')]=function(_0x20ded8,_0x540738,_0x1776a5){return function(){return client[_0xbfc9('0x3')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x20ded8,'ListId':_0x540738,'ContactId':_0x1776a5}},'log':_0xbfc9('0xe')});};};exports['getContactDialer']=function(_0x40500b,_0x259940,_0x128af6,_0x2a5c78){return client['Request'](_0xbfc9('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x40500b,'active':![],'scheduledat':{'$lte':moment()[_0xbfc9('0x8')](_0xbfc9('0x10'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x259940}}]},'order':[[_0xbfc9('0x11'),_0xbfc9('0x12')],[_0xbfc9('0x13'),_0x2a5c78],['id',_0xbfc9('0x14')]],'raw':!![],'limit':_0x128af6},'log':_0xbfc9('0xf')});};exports[_0xbfc9('0x15')]=function(_0x42cacd,_0x3dd866,_0x1b6218){return client[_0xbfc9('0x3')](_0xbfc9('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x42cacd,'active':![],'scheduledat':{'$lte':moment()[_0xbfc9('0x8')](_0xbfc9('0x10'))}},'include':[{'model':_0xbfc9('0x16'),'as':_0xbfc9('0x5')}],'order':[[_0xbfc9('0x11'),_0xbfc9('0x12')],[_0xbfc9('0x13'),_0x1b6218],['id',_0xbfc9('0x14')]],'raw':!![],'limit':_0x3dd866},'log':'GetContactDialerIvr'});};exports[_0xbfc9('0x17')]=function(_0x1217f4,_0x237897){_0x1217f4[_0xbfc9('0x18')]=_0x1217f4[_0xbfc9('0x19')];return client[_0xbfc9('0x3')](_0xbfc9('0x1a'),{'body':_0x1217f4,'options':{'where':{'ContactId':_0x1217f4[_0xbfc9('0x1b')],'ListId':_0x1217f4[_0xbfc9('0x9')],'VoiceQueueId':_0x1217f4[_0xbfc9('0xa')],'CampaignId':_0x1217f4[_0xbfc9('0xb')],'active':_0x237897?undefined:!![]}},'log':_0xbfc9('0x1a')});};exports[_0xbfc9('0x1c')]=function(_0x7012e0){return client['Request'](_0xbfc9('0x1d'),{'options':{'where':{'VoiceQueueId':_0x7012e0['id']?_0x7012e0['id']||null:null}},'log':_0xbfc9('0x1c')});};exports[_0xbfc9('0x1e')]=function(_0x2ba7d6){return function(){return client[_0xbfc9('0x3')]('GetCmHopperPreview',{'options':{'where':{'id':_0x2ba7d6},'include':[{'model':_0xbfc9('0x16'),'as':_0xbfc9('0x5')},{'model':_0xbfc9('0x1f'),'as':_0xbfc9('0x20'),'attributes':['id',_0xbfc9('0x21')]},{'model':_0xbfc9('0x22'),'as':_0xbfc9('0x23'),'attributes':['id',_0xbfc9('0x21')]}],'raw':!![]},'log':_0xbfc9('0x24')});};};exports['unlockContact']=function(_0x5185e5,_0x555cf1,_0x1a02e3){return client['Request']('UpdateCmHopper',{'body':_0x5185e5,'options':{'where':{'id':_0x555cf1},'limit':_0x1a02e3},'log':_0xbfc9('0x7')});};exports[_0xbfc9('0x25')]=function(_0xfa1abc,_0x14e1ac){return function(){return client[_0xbfc9('0x3')](_0xbfc9('0x26'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xfa1abc,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xbfc9('0x8')](_0xbfc9('0x10'))},'UserId':{'$in':_0x14e1ac}},'order':[[_0xbfc9('0x11'),'DESC'],[_0xbfc9('0x13'),_0xbfc9('0x12')],['id',_0xbfc9('0x14')]],'include':[{'model':'CmContact','as':_0xbfc9('0x5')},{'model':_0xbfc9('0x1f'),'as':_0xbfc9('0x20'),'attributes':['id',_0xbfc9('0x21'),_0xbfc9('0x27')]}],'group':_0xbfc9('0x28'),'raw':!![]},'log':_0xbfc9('0xf')});};};exports[_0xbfc9('0x29')]=function(_0x23f96f,_0x157dd9){return client['Request']('ResetActiveCalls',{'body':_0x23f96f,'options':_0x157dd9||{},'log':_0xbfc9('0x2a')});};exports[_0xbfc9('0x2b')]=function(_0x3c1838,_0x1e2a10,_0x38bbd9){return function(){return client[_0xbfc9('0x3')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x3c1838,'interval':_0x1e2a10,'availableAgentsIds':_0x38bbd9}},'log':_0xbfc9('0x2b')});};};