Built motion from commit c0cdc9d8.|2.6.28
[motion2.git] / server / services / routing / server / applications / strategy / rrmemory.js
index 4306673..8ff3f8d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x96ff=['saveWaitingNotification','showNotification','notificationId','[%s][QUEUE]\x20timeout\x20with\x20%s','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','routing','queue','intervals','squeue','push','handleRun','bind','handleTimeout','module','timeout','drained','prototype','handleDrained','handleCheckReject','isAgentAvailable','agents','agentId','debug','[%s][QUEUE]\x20available\x20again\x20%s','done','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s','isNil','realtime','channel','busy','busyQueue','name'];(function(_0x1d9974,_0x3ededa){var _0x4cb52f=function(_0x226ed4){while(--_0x226ed4){_0x1d9974['push'](_0x1d9974['shift']());}};_0x4cb52f(++_0x3ededa);}(_0x96ff,0x199));var _0xf96f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x96ff[_0x2641f9];return _0x585741;};'use strict';var rr=require('rr');var _=require(_0xf96f('0x0'));var uuid=require('uuid');var util=require(_0xf96f('0x1'));var logger=require(_0xf96f('0x2'))(_0xf96f('0x3'));var RRMemory=function(_0x46844b,_0x35e9f5,_0x299d33,_0x2fbe25){this['notificationId']=uuid['v4']();this['squeue']=_0x46844b;this[_0xf96f('0x4')]=_0x35e9f5;this['realtime']=_0x299d33;this[_0xf96f('0x3')]=_0x2fbe25;this[_0xf96f('0x5')]={};this[_0xf96f('0x6')][_0xf96f('0x7')](this[_0xf96f('0x8')][_0xf96f('0x9')](this),this[_0xf96f('0xa')][_0xf96f('0x9')](this),this[_0xf96f('0xb')]);this['squeue']['on'](_0xf96f('0xc'),this[_0xf96f('0xa')][_0xf96f('0x9')](this));this[_0xf96f('0x6')]['on'](_0xf96f('0xd'),this['handleDrained'][_0xf96f('0x9')](this));};RRMemory[_0xf96f('0xe')][_0xf96f('0x7')]=function(){this[_0xf96f('0x6')][_0xf96f('0x7')](this[_0xf96f('0x8')]['bind'](this),this['handleTimeout'][_0xf96f('0x9')](this));};RRMemory[_0xf96f('0xe')][_0xf96f('0xf')]=function(){this['handleTimeout'](!![]);};RRMemory[_0xf96f('0xe')][_0xf96f('0x10')]=function(_0x4baa40){if(util[_0xf96f('0x11')](this[_0xf96f('0x6')]['id'],this['realtime'][_0xf96f('0x12')][this[_0xf96f('0x13')]],this[_0xf96f('0x6')]['channel'],!![])){logger[_0xf96f('0x14')](_0xf96f('0x15'),this[_0xf96f('0x6')]['id'],this['agentId']);clearInterval(this[_0xf96f('0x5')][this['agentId']]);_0x4baa40[_0xf96f('0x16')]();setTimeout(this[_0xf96f('0x7')][_0xf96f('0x9')](this),0x3e8);}};RRMemory[_0xf96f('0xe')]['handleRun']=function(_0x306c55){this[_0xf96f('0x13')]=rr(this[_0xf96f('0x4')][_0xf96f('0x17')]);logger[_0xf96f('0x14')](_0xf96f('0x18'),this[_0xf96f('0x6')]['id'],this[_0xf96f('0x13')]);if(_[_0xf96f('0x19')](this[_0xf96f('0x1a')]['agents'][this[_0xf96f('0x13')]])){logger['debug']('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0xf96f('0x13')]);_0x306c55[_0xf96f('0x16')]();setTimeout(this[_0xf96f('0x7')][_0xf96f('0x9')](this),0x3e8);}else{if(util[_0xf96f('0x11')](this[_0xf96f('0x6')]['id'],this['realtime'][_0xf96f('0x12')][this[_0xf96f('0x13')]],this[_0xf96f('0x6')][_0xf96f('0x1b')],!![])){this[_0xf96f('0x1a')][_0xf96f('0x12')][this[_0xf96f('0x13')]][_0xf96f('0x1c')]=!![];this[_0xf96f('0x1a')][_0xf96f('0x12')][this[_0xf96f('0x13')]][_0xf96f('0x1d')]=this[_0xf96f('0x4')][_0xf96f('0x1e')];util[_0xf96f('0x1f')](this['realtime'],this[_0xf96f('0x3')],this[_0xf96f('0x1a')][_0xf96f('0x12')][this['agentId']],this['squeue'][_0xf96f('0x1b')]);util[_0xf96f('0x20')](this[_0xf96f('0x21')],this[_0xf96f('0x6')]['id'],this['realtime'][_0xf96f('0x12')][this[_0xf96f('0x13')]],this[_0xf96f('0x4')],this[_0xf96f('0x3')]);util['writeLog'](this[_0xf96f('0x6')]['id'],this[_0xf96f('0x1a')][_0xf96f('0x12')][this[_0xf96f('0x13')]],'RINGING');this[_0xf96f('0x5')][this[_0xf96f('0x13')]]=setInterval(this[_0xf96f('0x10')][_0xf96f('0x9')](this,_0x306c55),0x3e8);}else{logger[_0xf96f('0x14')]('[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s',this[_0xf96f('0x6')]['id'],this[_0xf96f('0x13')]);_0x306c55['done']();setTimeout(this[_0xf96f('0x7')][_0xf96f('0x9')](this),0x3e8);}}};RRMemory['prototype']['handleTimeout']=function(_0x4a86e4){logger[_0xf96f('0x14')](_0xf96f('0x22'),this[_0xf96f('0x6')]['id'],this[_0xf96f('0x13')]);if(_[_0xf96f('0x19')](this[_0xf96f('0x1a')][_0xf96f('0x12')][this['agentId']])){logger['debug'](_0xf96f('0x23'),this[_0xf96f('0x6')]['id'],this[_0xf96f('0x13')]);}else{clearInterval(this[_0xf96f('0x5')][this[_0xf96f('0x13')]]);util[_0xf96f('0x24')](this[_0xf96f('0x21')],this[_0xf96f('0x6')]['id'],this[_0xf96f('0x1a')][_0xf96f('0x12')][this['agentId']],this['queue'],this['routing']);util['writeLog'](this[_0xf96f('0x6')]['id'],this[_0xf96f('0x1a')]['agents'][this[_0xf96f('0x13')]],_0xf96f('0x25'));this[_0xf96f('0x1a')][_0xf96f('0x12')][this[_0xf96f('0x13')]]['busy']=![];this[_0xf96f('0x1a')]['agents'][this[_0xf96f('0x13')]]['busyQueue']=undefined;util[_0xf96f('0x26')](this[_0xf96f('0x1a')],this[_0xf96f('0x3')],this[_0xf96f('0x1a')][_0xf96f('0x12')][this[_0xf96f('0x13')]],this[_0xf96f('0x6')][_0xf96f('0x1b')]);}if(!_0x4a86e4){setTimeout(this['push']['bind'](this),0x3e8);}};function rrmemory(_0x251436,_0x3d5157,_0x17d698,_0x1bb8c1){return new RRMemory(_0x251436,_0x3d5157,_0x17d698,_0x1bb8c1);}module[_0xf96f('0x27')]=rrmemory;
\ No newline at end of file
+var _0xf37e=['timeout','drained','handleDrained','prototype','handleCheckReject','isAgentAvailable','agents','channel','debug','[%s][QUEUE]\x20available\x20again\x20%s','agentId','done','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','showNotification','writeLog','RINGING','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','isNil','hideNotification','notificationId','TIMEOUT','busy','busyQueue','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','routing','queue','realtime','intervals','push','handleRun','bind','handleTimeout','module','squeue'];(function(_0x4800d3,_0x1fb329){var _0x488e2f=function(_0xaeae52){while(--_0xaeae52){_0x4800d3['push'](_0x4800d3['shift']());}};_0x488e2f(++_0x1fb329);}(_0xf37e,0x123));var _0xef37=function(_0x4a7021,_0x542dfa){_0x4a7021=_0x4a7021-0x0;var _0x1fb6ae=_0xf37e[_0x4a7021];return _0x1fb6ae;};'use strict';var rr=require('rr');var _=require(_0xef37('0x0'));var uuid=require('uuid');var util=require(_0xef37('0x1'));var logger=require(_0xef37('0x2'))(_0xef37('0x3'));var RRMemory=function(_0x4b8121,_0x3f559a,_0x4c8106,_0xb8afb0){this['notificationId']=uuid['v4']();this['squeue']=_0x4b8121;this[_0xef37('0x4')]=_0x3f559a;this[_0xef37('0x5')]=_0x4c8106;this[_0xef37('0x3')]=_0xb8afb0;this[_0xef37('0x6')]={};this['squeue'][_0xef37('0x7')](this[_0xef37('0x8')][_0xef37('0x9')](this),this[_0xef37('0xa')]['bind'](this),this[_0xef37('0xb')]);this[_0xef37('0xc')]['on'](_0xef37('0xd'),this['handleTimeout'][_0xef37('0x9')](this));this['squeue']['on'](_0xef37('0xe'),this[_0xef37('0xf')][_0xef37('0x9')](this));};RRMemory[_0xef37('0x10')][_0xef37('0x7')]=function(){this[_0xef37('0xc')]['push'](this['handleRun'][_0xef37('0x9')](this),this[_0xef37('0xa')][_0xef37('0x9')](this));};RRMemory[_0xef37('0x10')][_0xef37('0xf')]=function(){this['handleTimeout'](!![]);};RRMemory[_0xef37('0x10')][_0xef37('0x11')]=function(_0x12507b){if(util[_0xef37('0x12')](this['squeue']['id'],this[_0xef37('0x5')][_0xef37('0x13')][this['agentId']],this[_0xef37('0xc')][_0xef37('0x14')],!![])){logger[_0xef37('0x15')](_0xef37('0x16'),this[_0xef37('0xc')]['id'],this[_0xef37('0x17')]);clearInterval(this[_0xef37('0x6')][this[_0xef37('0x17')]]);_0x12507b[_0xef37('0x18')]();setTimeout(this[_0xef37('0x7')][_0xef37('0x9')](this),0x3e8);}};RRMemory['prototype'][_0xef37('0x8')]=function(_0x85b9a6){this[_0xef37('0x17')]=rr(this[_0xef37('0x4')]['mapAgentsId']);logger[_0xef37('0x15')]('[%s][QUEUE]\x20try\x20with\x20%s',this[_0xef37('0xc')]['id'],this['agentId']);if(_['isNil'](this[_0xef37('0x5')][_0xef37('0x13')][this['agentId']])){logger['debug'](_0xef37('0x19'),this[_0xef37('0xc')]['id'],this[_0xef37('0x17')]);_0x85b9a6[_0xef37('0x18')]();setTimeout(this[_0xef37('0x7')][_0xef37('0x9')](this),0x3e8);}else{if(util[_0xef37('0x12')](this[_0xef37('0xc')]['id'],this[_0xef37('0x5')]['agents'][this[_0xef37('0x17')]],this[_0xef37('0xc')][_0xef37('0x14')],!![])){this[_0xef37('0x5')]['agents'][this[_0xef37('0x17')]]['busy']=!![];this['realtime']['agents'][this[_0xef37('0x17')]]['busyQueue']=this[_0xef37('0x4')]['name'];util['saveWaitingNotification'](this['realtime'],this[_0xef37('0x3')],this[_0xef37('0x5')][_0xef37('0x13')][this[_0xef37('0x17')]],this[_0xef37('0xc')][_0xef37('0x14')]);util[_0xef37('0x1a')](this['notificationId'],this['squeue']['id'],this[_0xef37('0x5')][_0xef37('0x13')][this[_0xef37('0x17')]],this['queue'],this[_0xef37('0x3')]);util[_0xef37('0x1b')](this[_0xef37('0xc')]['id'],this[_0xef37('0x5')][_0xef37('0x13')][this[_0xef37('0x17')]],_0xef37('0x1c'));this[_0xef37('0x6')][this['agentId']]=setInterval(this[_0xef37('0x11')][_0xef37('0x9')](this,_0x85b9a6),0x3e8);}else{logger[_0xef37('0x15')](_0xef37('0x1d'),this[_0xef37('0xc')]['id'],this[_0xef37('0x17')]);_0x85b9a6[_0xef37('0x18')]();setTimeout(this['push'][_0xef37('0x9')](this),0x3e8);}}};RRMemory['prototype'][_0xef37('0xa')]=function(_0x15c25a){logger['debug']('[%s][QUEUE]\x20timeout\x20with\x20%s',this[_0xef37('0xc')]['id'],this['agentId']);if(_[_0xef37('0x1e')](this[_0xef37('0x5')]['agents'][this[_0xef37('0x17')]])){logger[_0xef37('0x15')](_0xef37('0x19'),this[_0xef37('0xc')]['id'],this[_0xef37('0x17')]);}else{clearInterval(this['intervals'][this[_0xef37('0x17')]]);util[_0xef37('0x1f')](this[_0xef37('0x20')],this[_0xef37('0xc')]['id'],this[_0xef37('0x5')][_0xef37('0x13')][this[_0xef37('0x17')]],this['queue'],this[_0xef37('0x3')]);util['writeLog'](this[_0xef37('0xc')]['id'],this[_0xef37('0x5')][_0xef37('0x13')][this[_0xef37('0x17')]],_0xef37('0x21'));this[_0xef37('0x5')][_0xef37('0x13')][this['agentId']][_0xef37('0x22')]=![];this['realtime'][_0xef37('0x13')][this[_0xef37('0x17')]][_0xef37('0x23')]=undefined;util[_0xef37('0x24')](this['realtime'],this[_0xef37('0x3')],this[_0xef37('0x5')][_0xef37('0x13')][this[_0xef37('0x17')]],this[_0xef37('0xc')][_0xef37('0x14')]);}if(!_0x15c25a){setTimeout(this[_0xef37('0x7')][_0xef37('0x9')](this),0x3e8);}};function rrmemory(_0x2372b5,_0x4649be,_0x4e1428,_0xc6f5f7){return new RRMemory(_0x2372b5,_0x4649be,_0x4e1428,_0xc6f5f7);}module[_0xef37('0x25')]=rrmemory;
\ No newline at end of file