Built motion from commit (unavailable).|2.5.9
[motion2.git] / server / services / routing / server / applications / strategy / rrmemory.js
index cf7f157..193cc4a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd7a6=['isAgentAvailable','agents','agentId','channel','info','[%s][QUEUE]\x20available\x20again\x20%s','done','queue','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s','isNil','realtime','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','busy','busyQueue','name','showNotification','writeLog','RINGING','handleCheckReject','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','hideNotification','TIMEOUT','lodash','./util','../../../../../config/logger','routing','notificationId','intervals','squeue','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype'];(function(_0x10b757,_0x3cf7ca){var _0x5fffd2=function(_0xd83dbc){while(--_0xd83dbc){_0x10b757['push'](_0x10b757['shift']());}};_0x5fffd2(++_0x3cf7ca);}(_0xd7a6,0x16d));var _0x6d7a=function(_0x474951,_0x543dd5){_0x474951=_0x474951-0x0;var _0x361a80=_0xd7a6[_0x474951];return _0x361a80;};'use strict';var rr=require('rr');var _=require(_0x6d7a('0x0'));var uuid=require('uuid');var util=require(_0x6d7a('0x1'));var logger=require(_0x6d7a('0x2'))(_0x6d7a('0x3'));var RRMemory=function(_0x4f0fe6,_0x496d7c,_0x43db2a,_0x194832){this[_0x6d7a('0x4')]=uuid['v4']();this['squeue']=_0x4f0fe6;this['queue']=_0x496d7c;this['realtime']=_0x43db2a;this['routing']=_0x194832;this[_0x6d7a('0x5')]={};this[_0x6d7a('0x6')][_0x6d7a('0x7')](this[_0x6d7a('0x8')][_0x6d7a('0x9')](this),this['handleTimeout'][_0x6d7a('0x9')](this),this['module']);this['squeue']['on'](_0x6d7a('0xa'),this[_0x6d7a('0xb')][_0x6d7a('0x9')](this));this[_0x6d7a('0x6')]['on'](_0x6d7a('0xc'),this[_0x6d7a('0xd')][_0x6d7a('0x9')](this));};RRMemory[_0x6d7a('0xe')]['push']=function(){this['squeue'][_0x6d7a('0x7')](this[_0x6d7a('0x8')][_0x6d7a('0x9')](this),this['handleTimeout'][_0x6d7a('0x9')](this));};RRMemory[_0x6d7a('0xe')][_0x6d7a('0xd')]=function(_0x29bf6e){this['handleTimeout'](!![]);};RRMemory[_0x6d7a('0xe')]['handleCheckReject']=function(_0x1b155c){if(util[_0x6d7a('0xf')](this[_0x6d7a('0x6')]['id'],this['realtime'][_0x6d7a('0x10')][this[_0x6d7a('0x11')]],this['squeue'][_0x6d7a('0x12')],!![])){logger[_0x6d7a('0x13')](_0x6d7a('0x14'),this[_0x6d7a('0x6')]['id'],this[_0x6d7a('0x11')]);clearInterval(this[_0x6d7a('0x5')][this['agentId']]);_0x1b155c[_0x6d7a('0x15')]();setTimeout(this['push'][_0x6d7a('0x9')](this),0x3e8);}};RRMemory[_0x6d7a('0xe')][_0x6d7a('0x8')]=function(_0x15293b){this[_0x6d7a('0x11')]=rr(this[_0x6d7a('0x16')][_0x6d7a('0x17')]);logger['info'](_0x6d7a('0x18'),this[_0x6d7a('0x6')]['id'],this[_0x6d7a('0x11')]);if(_[_0x6d7a('0x19')](this[_0x6d7a('0x1a')]['agents'][this[_0x6d7a('0x11')]])){logger[_0x6d7a('0x13')](_0x6d7a('0x1b'),this[_0x6d7a('0x6')]['id'],this[_0x6d7a('0x11')]);_0x15293b['done']();setTimeout(this[_0x6d7a('0x7')]['bind'](this),0x3e8);}else{if(util[_0x6d7a('0xf')](this['squeue']['id'],this['realtime'][_0x6d7a('0x10')][this[_0x6d7a('0x11')]],this[_0x6d7a('0x6')][_0x6d7a('0x12')],!![])){this['realtime'][_0x6d7a('0x10')][this[_0x6d7a('0x11')]][_0x6d7a('0x1c')]=!![];this[_0x6d7a('0x1a')][_0x6d7a('0x10')][this[_0x6d7a('0x11')]][_0x6d7a('0x1d')]=this[_0x6d7a('0x16')][_0x6d7a('0x1e')];util[_0x6d7a('0x1f')](this['notificationId'],this['squeue']['id'],this[_0x6d7a('0x1a')][_0x6d7a('0x10')][this['agentId']],this['queue'],this['routing']);util[_0x6d7a('0x20')](this[_0x6d7a('0x6')]['id'],this[_0x6d7a('0x1a')][_0x6d7a('0x10')][this['agentId']],_0x6d7a('0x21'));this[_0x6d7a('0x5')][this[_0x6d7a('0x11')]]=setInterval(this[_0x6d7a('0x22')][_0x6d7a('0x9')](this,_0x15293b),0x3e8);}else{logger[_0x6d7a('0x13')](_0x6d7a('0x23'),this[_0x6d7a('0x6')]['id'],this[_0x6d7a('0x11')]);_0x15293b['done']();setTimeout(this[_0x6d7a('0x7')][_0x6d7a('0x9')](this),0x3e8);}}};RRMemory[_0x6d7a('0xe')][_0x6d7a('0xb')]=function(_0x355dff){logger[_0x6d7a('0x13')]('[%s][QUEUE]\x20timeout\x20with\x20%s',this[_0x6d7a('0x6')]['id'],this['agentId']);if(_[_0x6d7a('0x19')](this[_0x6d7a('0x1a')][_0x6d7a('0x10')][this[_0x6d7a('0x11')]])){logger[_0x6d7a('0x13')](_0x6d7a('0x1b'),this[_0x6d7a('0x6')]['id'],this['agentId']);}else{clearInterval(this[_0x6d7a('0x5')][this['agentId']]);util[_0x6d7a('0x24')](this[_0x6d7a('0x4')],this['squeue']['id'],this['realtime'][_0x6d7a('0x10')][this[_0x6d7a('0x11')]],this[_0x6d7a('0x16')],this[_0x6d7a('0x3')]);util[_0x6d7a('0x20')](this[_0x6d7a('0x6')]['id'],this['realtime'][_0x6d7a('0x10')][this[_0x6d7a('0x11')]],_0x6d7a('0x25'));this['realtime'][_0x6d7a('0x10')][this[_0x6d7a('0x11')]][_0x6d7a('0x1c')]=![];this['realtime']['agents'][this['agentId']][_0x6d7a('0x1d')]=undefined;}if(!_0x355dff){setTimeout(this[_0x6d7a('0x7')]['bind'](this),0x3e8);}};function rrmemory(_0x4252ad,_0x2aa67f,_0x371768,_0xc6d778){return new RRMemory(_0x4252ad,_0x2aa67f,_0x371768,_0xc6d778);}module['exports']=rrmemory;
\ No newline at end of file
+var _0xc5aa=['exports','uuid','../../../../../config/logger','routing','squeue','queue','intervals','handleRun','handleTimeout','bind','module','timeout','push','prototype','handleCheckReject','isAgentAvailable','realtime','agents','agentId','info','[%s][QUEUE]\x20available\x20again\x20%s','done','[%s][QUEUE]\x20try\x20with\x20%s','channel','busyQueue','notificationId','writeLog','RINGING','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','[%s][QUEUE]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','busy'];(function(_0x4a4ccd,_0x28f074){var _0x5f440e=function(_0x11d1cf){while(--_0x11d1cf){_0x4a4ccd['push'](_0x4a4ccd['shift']());}};_0x5f440e(++_0x28f074);}(_0xc5aa,0x16c));var _0xac5a=function(_0x204265,_0x313c59){_0x204265=_0x204265-0x0;var _0x48940c=_0xc5aa[_0x204265];return _0x48940c;};'use strict';var rr=require('rr');var _=require('lodash');var uuid=require(_0xac5a('0x0'));var util=require('./util');var logger=require(_0xac5a('0x1'))(_0xac5a('0x2'));var RRMemory=function(_0xc8780b,_0x55d95d,_0x2e75da,_0x3b8d4a){this['notificationId']=uuid['v4']();this[_0xac5a('0x3')]=_0xc8780b;this[_0xac5a('0x4')]=_0x55d95d;this['realtime']=_0x2e75da;this['routing']=_0x3b8d4a;this[_0xac5a('0x5')]={};this[_0xac5a('0x3')]['push'](this[_0xac5a('0x6')]['bind'](this),this[_0xac5a('0x7')][_0xac5a('0x8')](this),this[_0xac5a('0x9')]);this[_0xac5a('0x3')]['on'](_0xac5a('0xa'),this[_0xac5a('0x7')][_0xac5a('0x8')](this));this[_0xac5a('0x3')]['on']('drained',this['handleDrained'][_0xac5a('0x8')](this));};RRMemory['prototype'][_0xac5a('0xb')]=function(){this['squeue'][_0xac5a('0xb')](this[_0xac5a('0x6')]['bind'](this),this[_0xac5a('0x7')][_0xac5a('0x8')](this));};RRMemory[_0xac5a('0xc')]['handleDrained']=function(_0x228929){this[_0xac5a('0x7')](!![]);};RRMemory['prototype'][_0xac5a('0xd')]=function(_0x150d5b){if(util[_0xac5a('0xe')](this[_0xac5a('0x3')]['id'],this[_0xac5a('0xf')][_0xac5a('0x10')][this[_0xac5a('0x11')]],this[_0xac5a('0x3')]['channel'],!![])){logger[_0xac5a('0x12')](_0xac5a('0x13'),this[_0xac5a('0x3')]['id'],this[_0xac5a('0x11')]);clearInterval(this[_0xac5a('0x5')][this[_0xac5a('0x11')]]);_0x150d5b[_0xac5a('0x14')]();setTimeout(this[_0xac5a('0xb')][_0xac5a('0x8')](this),0x3e8);}};RRMemory[_0xac5a('0xc')]['handleRun']=function(_0x49b388){this['agentId']=rr(this[_0xac5a('0x4')]['mapAgentsId']);logger['info'](_0xac5a('0x15'),this[_0xac5a('0x3')]['id'],this[_0xac5a('0x11')]);if(_['isNil'](this['realtime'][_0xac5a('0x10')][this[_0xac5a('0x11')]])){logger[_0xac5a('0x12')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xac5a('0x3')]['id'],this['agentId']);_0x49b388['done']();setTimeout(this[_0xac5a('0xb')][_0xac5a('0x8')](this),0x3e8);}else{if(util[_0xac5a('0xe')](this[_0xac5a('0x3')]['id'],this['realtime']['agents'][this[_0xac5a('0x11')]],this[_0xac5a('0x3')][_0xac5a('0x16')],!![])){this[_0xac5a('0xf')][_0xac5a('0x10')][this[_0xac5a('0x11')]]['busy']=!![];this[_0xac5a('0xf')][_0xac5a('0x10')][this['agentId']][_0xac5a('0x17')]=this[_0xac5a('0x4')]['name'];util['showNotification'](this[_0xac5a('0x18')],this['squeue']['id'],this[_0xac5a('0xf')][_0xac5a('0x10')][this[_0xac5a('0x11')]],this['queue'],this[_0xac5a('0x2')]);util[_0xac5a('0x19')](this[_0xac5a('0x3')]['id'],this[_0xac5a('0xf')][_0xac5a('0x10')][this['agentId']],_0xac5a('0x1a'));this[_0xac5a('0x5')][this['agentId']]=setInterval(this[_0xac5a('0xd')][_0xac5a('0x8')](this,_0x49b388),0x3e8);}else{logger[_0xac5a('0x12')](_0xac5a('0x1b'),this[_0xac5a('0x3')]['id'],this[_0xac5a('0x11')]);_0x49b388[_0xac5a('0x14')]();setTimeout(this['push'][_0xac5a('0x8')](this),0x3e8);}}};RRMemory[_0xac5a('0xc')][_0xac5a('0x7')]=function(_0x3a6f8e){logger[_0xac5a('0x12')](_0xac5a('0x1c'),this['squeue']['id'],this[_0xac5a('0x11')]);if(_['isNil'](this[_0xac5a('0xf')][_0xac5a('0x10')][this['agentId']])){logger['info']('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xac5a('0x11')]);}else{clearInterval(this[_0xac5a('0x5')][this[_0xac5a('0x11')]]);util[_0xac5a('0x1d')](this[_0xac5a('0x18')],this['squeue']['id'],this[_0xac5a('0xf')]['agents'][this[_0xac5a('0x11')]],this[_0xac5a('0x4')],this[_0xac5a('0x2')]);util[_0xac5a('0x19')](this['squeue']['id'],this[_0xac5a('0xf')][_0xac5a('0x10')][this[_0xac5a('0x11')]],_0xac5a('0x1e'));this[_0xac5a('0xf')]['agents'][this[_0xac5a('0x11')]][_0xac5a('0x1f')]=![];this[_0xac5a('0xf')][_0xac5a('0x10')][this[_0xac5a('0x11')]][_0xac5a('0x17')]=undefined;}if(!_0x3a6f8e){setTimeout(this[_0xac5a('0xb')][_0xac5a('0x8')](this),0x3e8);}};function rrmemory(_0x2e86ad,_0x2306c4,_0x431a36,_0x3b4740){return new RRMemory(_0x2e86ad,_0x2306c4,_0x431a36,_0x3b4740);}module[_0xac5a('0x20')]=rrmemory;
\ No newline at end of file