Built motion from commit (unavailable).|2.5.31
[motion2.git] / server / services / routing / server / applications / strategy / rrmemory.js
index 39daad0..b2803b1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6bb4=['isNil','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busy','busyQueue','name','showNotification','notificationId','writeLog','RINGING','info','hideNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','queue','realtime','intervals','squeue','handleRun','bind','module','timeout','drained','handleDrained','prototype','push','handleTimeout','handleCheckReject','isAgentAvailable','agentId','channel','done','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s'];(function(_0x2699a1,_0x12f532){var _0x4b4265=function(_0x5b3631){while(--_0x5b3631){_0x2699a1['push'](_0x2699a1['shift']());}};_0x4b4265(++_0x12f532);}(_0x6bb4,0x16d));var _0x46bb=function(_0x2a2394,_0x3ec47e){_0x2a2394=_0x2a2394-0x0;var _0x105467=_0x6bb4[_0x2a2394];return _0x105467;};'use strict';var rr=require('rr');var _=require(_0x46bb('0x0'));var uuid=require(_0x46bb('0x1'));var util=require(_0x46bb('0x2'));var logger=require(_0x46bb('0x3'))(_0x46bb('0x4'));var RRMemory=function(_0x55343a,_0x5f2011,_0x438c45,_0x481b9c){this['notificationId']=uuid['v4']();this['squeue']=_0x55343a;this[_0x46bb('0x5')]=_0x5f2011;this[_0x46bb('0x6')]=_0x438c45;this[_0x46bb('0x4')]=_0x481b9c;this[_0x46bb('0x7')]={};this[_0x46bb('0x8')]['push'](this[_0x46bb('0x9')][_0x46bb('0xa')](this),this['handleTimeout'][_0x46bb('0xa')](this),this[_0x46bb('0xb')]);this[_0x46bb('0x8')]['on'](_0x46bb('0xc'),this['handleTimeout'][_0x46bb('0xa')](this));this[_0x46bb('0x8')]['on'](_0x46bb('0xd'),this[_0x46bb('0xe')][_0x46bb('0xa')](this));};RRMemory[_0x46bb('0xf')][_0x46bb('0x10')]=function(){this[_0x46bb('0x8')][_0x46bb('0x10')](this[_0x46bb('0x9')]['bind'](this),this['handleTimeout'][_0x46bb('0xa')](this));};RRMemory[_0x46bb('0xf')][_0x46bb('0xe')]=function(_0x387c73){this[_0x46bb('0x11')](!![]);};RRMemory[_0x46bb('0xf')][_0x46bb('0x12')]=function(_0x3d2b32){if(util[_0x46bb('0x13')](this['squeue']['id'],this[_0x46bb('0x6')]['agents'][this[_0x46bb('0x14')]],this[_0x46bb('0x8')][_0x46bb('0x15')],!![])){logger['info']('[%s][QUEUE]\x20available\x20again\x20%s',this[_0x46bb('0x8')]['id'],this['agentId']);clearInterval(this[_0x46bb('0x7')][this['agentId']]);_0x3d2b32[_0x46bb('0x16')]();setTimeout(this[_0x46bb('0x10')][_0x46bb('0xa')](this),0x3e8);}};RRMemory[_0x46bb('0xf')][_0x46bb('0x9')]=function(_0x1c4c3a){this[_0x46bb('0x14')]=rr(this[_0x46bb('0x5')][_0x46bb('0x17')]);logger['info'](_0x46bb('0x18'),this[_0x46bb('0x8')]['id'],this[_0x46bb('0x14')]);if(_[_0x46bb('0x19')](this[_0x46bb('0x6')][_0x46bb('0x1a')][this['agentId']])){logger['info'](_0x46bb('0x1b'),this[_0x46bb('0x8')]['id'],this[_0x46bb('0x14')]);_0x1c4c3a[_0x46bb('0x16')]();setTimeout(this[_0x46bb('0x10')][_0x46bb('0xa')](this),0x3e8);}else{if(util[_0x46bb('0x13')](this[_0x46bb('0x8')]['id'],this[_0x46bb('0x6')][_0x46bb('0x1a')][this[_0x46bb('0x14')]],this[_0x46bb('0x8')][_0x46bb('0x15')],!![])){this[_0x46bb('0x6')]['agents'][this['agentId']][_0x46bb('0x1c')]=!![];this[_0x46bb('0x6')][_0x46bb('0x1a')][this[_0x46bb('0x14')]][_0x46bb('0x1d')]=this[_0x46bb('0x5')][_0x46bb('0x1e')];util[_0x46bb('0x1f')](this[_0x46bb('0x20')],this[_0x46bb('0x8')]['id'],this['realtime']['agents'][this[_0x46bb('0x14')]],this[_0x46bb('0x5')],this[_0x46bb('0x4')]);util[_0x46bb('0x21')](this[_0x46bb('0x8')]['id'],this[_0x46bb('0x6')][_0x46bb('0x1a')][this[_0x46bb('0x14')]],_0x46bb('0x22'));this[_0x46bb('0x7')][this['agentId']]=setInterval(this[_0x46bb('0x12')][_0x46bb('0xa')](this,_0x1c4c3a),0x3e8);}else{logger[_0x46bb('0x23')]('[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s',this[_0x46bb('0x8')]['id'],this[_0x46bb('0x14')]);_0x1c4c3a[_0x46bb('0x16')]();setTimeout(this['push']['bind'](this),0x3e8);}}};RRMemory[_0x46bb('0xf')][_0x46bb('0x11')]=function(_0x165e8b){logger[_0x46bb('0x23')]('[%s][QUEUE]\x20timeout\x20with\x20%s',this[_0x46bb('0x8')]['id'],this[_0x46bb('0x14')]);if(_['isNil'](this[_0x46bb('0x6')][_0x46bb('0x1a')][this[_0x46bb('0x14')]])){logger[_0x46bb('0x23')](_0x46bb('0x1b'),this[_0x46bb('0x8')]['id'],this[_0x46bb('0x14')]);}else{clearInterval(this[_0x46bb('0x7')][this[_0x46bb('0x14')]]);util[_0x46bb('0x24')](this[_0x46bb('0x20')],this['squeue']['id'],this[_0x46bb('0x6')][_0x46bb('0x1a')][this['agentId']],this[_0x46bb('0x5')],this[_0x46bb('0x4')]);util['writeLog'](this[_0x46bb('0x8')]['id'],this[_0x46bb('0x6')][_0x46bb('0x1a')][this[_0x46bb('0x14')]],_0x46bb('0x25'));this[_0x46bb('0x6')]['agents'][this[_0x46bb('0x14')]][_0x46bb('0x1c')]=![];this['realtime'][_0x46bb('0x1a')][this[_0x46bb('0x14')]][_0x46bb('0x1d')]=undefined;}if(!_0x165e8b){setTimeout(this[_0x46bb('0x10')][_0x46bb('0xa')](this),0x3e8);}};function rrmemory(_0x512295,_0x2b0813,_0x216e9b,_0xc0ebfa){return new RRMemory(_0x512295,_0x2b0813,_0x216e9b,_0xc0ebfa);}module[_0x46bb('0x26')]=rrmemory;
\ No newline at end of file
+var _0x760e=['lodash','routing','notificationId','queue','realtime','intervals','squeue','push','handleRun','bind','handleTimeout','module','timeout','handleDrained','prototype','handleCheckReject','agents','agentId','channel','info','[%s][QUEUE]\x20available\x20again\x20%s','done','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s','isNil','isAgentAvailable','busyQueue','name','writeLog','RINGING','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','exports'];(function(_0x4796dd,_0x1fd7c6){var _0x290fe5=function(_0x9411ab){while(--_0x9411ab){_0x4796dd['push'](_0x4796dd['shift']());}};_0x290fe5(++_0x1fd7c6);}(_0x760e,0x176));var _0xe760=function(_0x345f08,_0xc9930e){_0x345f08=_0x345f08-0x0;var _0x57f2d8=_0x760e[_0x345f08];return _0x57f2d8;};'use strict';var rr=require('rr');var _=require(_0xe760('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')(_0xe760('0x1'));var RRMemory=function(_0x193459,_0x121473,_0x1d81aa,_0x3e9338){this[_0xe760('0x2')]=uuid['v4']();this['squeue']=_0x193459;this[_0xe760('0x3')]=_0x121473;this[_0xe760('0x4')]=_0x1d81aa;this['routing']=_0x3e9338;this[_0xe760('0x5')]={};this[_0xe760('0x6')][_0xe760('0x7')](this[_0xe760('0x8')][_0xe760('0x9')](this),this[_0xe760('0xa')]['bind'](this),this[_0xe760('0xb')]);this['squeue']['on'](_0xe760('0xc'),this[_0xe760('0xa')][_0xe760('0x9')](this));this[_0xe760('0x6')]['on']('drained',this[_0xe760('0xd')][_0xe760('0x9')](this));};RRMemory[_0xe760('0xe')][_0xe760('0x7')]=function(){this[_0xe760('0x6')][_0xe760('0x7')](this[_0xe760('0x8')][_0xe760('0x9')](this),this[_0xe760('0xa')][_0xe760('0x9')](this));};RRMemory['prototype']['handleDrained']=function(_0x286adc){this['handleTimeout'](!![]);};RRMemory[_0xe760('0xe')][_0xe760('0xf')]=function(_0x142cfb){if(util['isAgentAvailable'](this[_0xe760('0x6')]['id'],this[_0xe760('0x4')][_0xe760('0x10')][this[_0xe760('0x11')]],this[_0xe760('0x6')][_0xe760('0x12')],!![])){logger[_0xe760('0x13')](_0xe760('0x14'),this[_0xe760('0x6')]['id'],this['agentId']);clearInterval(this['intervals'][this[_0xe760('0x11')]]);_0x142cfb[_0xe760('0x15')]();setTimeout(this[_0xe760('0x7')]['bind'](this),0x3e8);}};RRMemory[_0xe760('0xe')][_0xe760('0x8')]=function(_0x3fdb50){this[_0xe760('0x11')]=rr(this[_0xe760('0x3')][_0xe760('0x16')]);logger['info'](_0xe760('0x17'),this[_0xe760('0x6')]['id'],this[_0xe760('0x11')]);if(_[_0xe760('0x18')](this[_0xe760('0x4')][_0xe760('0x10')][this[_0xe760('0x11')]])){logger[_0xe760('0x13')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xe760('0x11')]);_0x3fdb50[_0xe760('0x15')]();setTimeout(this[_0xe760('0x7')]['bind'](this),0x3e8);}else{if(util[_0xe760('0x19')](this[_0xe760('0x6')]['id'],this[_0xe760('0x4')][_0xe760('0x10')][this[_0xe760('0x11')]],this['squeue'][_0xe760('0x12')],!![])){this[_0xe760('0x4')][_0xe760('0x10')][this[_0xe760('0x11')]]['busy']=!![];this[_0xe760('0x4')][_0xe760('0x10')][this[_0xe760('0x11')]][_0xe760('0x1a')]=this[_0xe760('0x3')][_0xe760('0x1b')];util['showNotification'](this['notificationId'],this[_0xe760('0x6')]['id'],this[_0xe760('0x4')][_0xe760('0x10')][this[_0xe760('0x11')]],this['queue'],this[_0xe760('0x1')]);util[_0xe760('0x1c')](this[_0xe760('0x6')]['id'],this[_0xe760('0x4')][_0xe760('0x10')][this['agentId']],_0xe760('0x1d'));this['intervals'][this[_0xe760('0x11')]]=setInterval(this[_0xe760('0xf')][_0xe760('0x9')](this,_0x3fdb50),0x3e8);}else{logger[_0xe760('0x13')]('[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s',this[_0xe760('0x6')]['id'],this[_0xe760('0x11')]);_0x3fdb50[_0xe760('0x15')]();setTimeout(this['push'][_0xe760('0x9')](this),0x3e8);}}};RRMemory['prototype'][_0xe760('0xa')]=function(_0x8069ca){logger[_0xe760('0x13')]('[%s][QUEUE]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0xe760('0x11')]);if(_[_0xe760('0x18')](this[_0xe760('0x4')]['agents'][this['agentId']])){logger[_0xe760('0x13')](_0xe760('0x1e'),this[_0xe760('0x6')]['id'],this['agentId']);}else{clearInterval(this[_0xe760('0x5')][this[_0xe760('0x11')]]);util[_0xe760('0x1f')](this['notificationId'],this[_0xe760('0x6')]['id'],this[_0xe760('0x4')][_0xe760('0x10')][this[_0xe760('0x11')]],this[_0xe760('0x3')],this['routing']);util[_0xe760('0x1c')](this['squeue']['id'],this[_0xe760('0x4')][_0xe760('0x10')][this['agentId']],_0xe760('0x20'));this[_0xe760('0x4')][_0xe760('0x10')][this['agentId']]['busy']=![];this[_0xe760('0x4')][_0xe760('0x10')][this['agentId']][_0xe760('0x1a')]=undefined;}if(!_0x8069ca){setTimeout(this[_0xe760('0x7')][_0xe760('0x9')](this),0x3e8);}};function rrmemory(_0x288b75,_0x2c3e14,_0x5536e1,_0x3ff663){return new RRMemory(_0x288b75,_0x2c3e14,_0x5536e1,_0x3ff663);}module[_0xe760('0x21')]=rrmemory;
\ No newline at end of file