Built motion from commit (unavailable).|2.3.4
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index acaa051..1905dd8 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x64e6=['exports','uuid','./util','../../../../../config/logger','routing','agent','squeue','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','push','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','notificationId','writeLog','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT'];(function(_0x106c88,_0x1de8f1){var _0x264319=function(_0x52d235){while(--_0x52d235){_0x106c88['push'](_0x106c88['shift']());}};_0x264319(++_0x1de8f1);}(_0x64e6,0xcd));var _0x664e=function(_0x49e7af,_0x2b9474){_0x49e7af=_0x49e7af-0x0;var _0x5e8ffc=_0x64e6[_0x49e7af];return _0x5e8ffc;};'use strict';var _=require('lodash');var uuid=require(_0x664e('0x0'));var util=require(_0x664e('0x1'));var logger=require(_0x664e('0x2'))(_0x664e('0x3'));var Agent=function(_0x5839ff,_0x20d915,_0x274b2e,_0x4df447){this['notificationId']=uuid['v4']();this['squeue']=_0x5839ff;this[_0x664e('0x4')]=_0x20d915;this['realtime']=_0x274b2e;this[_0x664e('0x3')]=_0x4df447;this[_0x664e('0x5')]['push'](this[_0x664e('0x6')][_0x664e('0x7')](this),this[_0x664e('0x8')][_0x664e('0x7')](this));this[_0x664e('0x5')]['on'](_0x664e('0x9'),this['handleTimeout']['bind'](this));this[_0x664e('0x5')]['on'](_0x664e('0xa'),this[_0x664e('0xb')][_0x664e('0x7')](this));};Agent[_0x664e('0xc')][_0x664e('0xd')]=function(){this['squeue'][_0x664e('0xd')](this[_0x664e('0x6')]['bind'](this),this[_0x664e('0x8')]['bind'](this));};Agent[_0x664e('0xc')][_0x664e('0xb')]=function(){this[_0x664e('0x8')](!![]);};Agent['prototype'][_0x664e('0x6')]=function(_0x4837bd){logger[_0x664e('0xe')](_0x664e('0xf'),this[_0x664e('0x5')]['id'],this[_0x664e('0x4')]['id']);if(_[_0x664e('0x10')](this[_0x664e('0x11')][_0x664e('0x12')][this[_0x664e('0x4')]['id']])){logger['info'](_0x664e('0x13'),this[_0x664e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x664e('0xd')]['bind'](this),0x3e8);}else{if(this[_0x664e('0x3')][_0x664e('0x14')]||util[_0x664e('0x15')](this[_0x664e('0x5')]['id'],this[_0x664e('0x11')]['agents'][this[_0x664e('0x4')]['id']],this[_0x664e('0x5')]['channel'],![])){this[_0x664e('0x11')]['agents'][this[_0x664e('0x4')]['id']][_0x664e('0x16')]=!![];this[_0x664e('0x11')][_0x664e('0x12')][this['agent']['id']][_0x664e('0x17')]=undefined;util[_0x664e('0x18')](this[_0x664e('0x19')],this[_0x664e('0x5')]['id'],this[_0x664e('0x11')]['agents'][this[_0x664e('0x4')]['id']],null,this[_0x664e('0x3')]);util[_0x664e('0x1a')](this[_0x664e('0x5')]['id'],this[_0x664e('0x11')][_0x664e('0x12')][this['agent']['id']],_0x664e('0x1b')+(this[_0x664e('0x3')][_0x664e('0x14')]?_0x664e('0x1c'):''));}else{logger[_0x664e('0xe')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x664e('0x5')]['id'],this[_0x664e('0x4')]['id']);setTimeout(this['push'][_0x664e('0x7')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x7138f3){if(_[_0x664e('0x10')](this[_0x664e('0x11')]['agents'][this[_0x664e('0x4')]['id']])){return logger[_0x664e('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x664e('0x5')]['id'],this['agent']['id']);}else{logger[_0x664e('0xe')](_0x664e('0x1d'),this[_0x664e('0x5')]['id'],this[_0x664e('0x4')]['id']);util[_0x664e('0x1e')](this['notificationId'],this['squeue']['id'],this['realtime'][_0x664e('0x12')][this[_0x664e('0x4')]['id']],null,this[_0x664e('0x3')]);this[_0x664e('0x11')]['agents'][this[_0x664e('0x4')]['id']]['busy']=![];this[_0x664e('0x11')][_0x664e('0x12')][this[_0x664e('0x4')]['id']][_0x664e('0x17')]=undefined;util['writeLog'](this[_0x664e('0x5')]['id'],this[_0x664e('0x11')]['agents'][this[_0x664e('0x4')]['id']],_0x7138f3?_0x664e('0x1f'):_0x664e('0x20'));}if(!_0x7138f3){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x5353b4,_0x20165c,_0x56695e,_0x560279){return new Agent(_0x5353b4,_0x20165c,_0x56695e,_0x560279);}module[_0x664e('0x21')]=agent;
\ No newline at end of file
+var _0x54a1=['STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','notificationId','agent','realtime','squeue','push','handleRun','handleTimeout','bind','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','routing','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog'];(function(_0x50d0a3,_0xaa920e){var _0x1e4131=function(_0x27e84e){while(--_0x27e84e){_0x50d0a3['push'](_0x50d0a3['shift']());}};_0x1e4131(++_0xaa920e);}(_0x54a1,0xf1));var _0x154a=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x54a1[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require(_0x154a('0x0'));var uuid=require('uuid');var util=require(_0x154a('0x1'));var logger=require(_0x154a('0x2'))('routing');var Agent=function(_0x4de882,_0x57f29b,_0x1ee76d,_0x5de25e){this[_0x154a('0x3')]=uuid['v4']();this['squeue']=_0x4de882;this[_0x154a('0x4')]=_0x57f29b;this[_0x154a('0x5')]=_0x1ee76d;this['routing']=_0x5de25e;this[_0x154a('0x6')][_0x154a('0x7')](this[_0x154a('0x8')]['bind'](this),this[_0x154a('0x9')][_0x154a('0xa')](this));this['squeue']['on']('timeout',this[_0x154a('0x9')]['bind'](this));this[_0x154a('0x6')]['on']('drained',this[_0x154a('0xb')][_0x154a('0xa')](this));};Agent[_0x154a('0xc')][_0x154a('0x7')]=function(){this['squeue']['push'](this[_0x154a('0x8')][_0x154a('0xa')](this),this[_0x154a('0x9')]['bind'](this));};Agent[_0x154a('0xc')][_0x154a('0xb')]=function(){this[_0x154a('0x9')](!![]);};Agent['prototype'][_0x154a('0x8')]=function(_0x19af84){logger[_0x154a('0xd')](_0x154a('0xe'),this['squeue']['id'],this[_0x154a('0x4')]['id']);if(_[_0x154a('0xf')](this[_0x154a('0x5')][_0x154a('0x10')][this['agent']['id']])){logger[_0x154a('0xd')](_0x154a('0x11'),this[_0x154a('0x6')]['id'],this[_0x154a('0x4')]['id']);setTimeout(this[_0x154a('0x7')][_0x154a('0xa')](this),0x3e8);}else{if(this[_0x154a('0x12')][_0x154a('0x13')]||util[_0x154a('0x14')](this['squeue']['id'],this['realtime'][_0x154a('0x10')][this['agent']['id']],this[_0x154a('0x6')][_0x154a('0x15')],![])){this[_0x154a('0x5')][_0x154a('0x10')][this[_0x154a('0x4')]['id']][_0x154a('0x16')]=!![];this['realtime'][_0x154a('0x10')][this[_0x154a('0x4')]['id']][_0x154a('0x17')]=undefined;util[_0x154a('0x18')](this[_0x154a('0x3')],this[_0x154a('0x6')]['id'],this[_0x154a('0x5')]['agents'][this[_0x154a('0x4')]['id']],null,this[_0x154a('0x12')]);util['writeLog'](this[_0x154a('0x6')]['id'],this[_0x154a('0x5')]['agents'][this[_0x154a('0x4')]['id']],_0x154a('0x19')+(this[_0x154a('0x12')][_0x154a('0x13')]?_0x154a('0x1a'):''));}else{logger[_0x154a('0xd')](_0x154a('0x1b'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x154a('0x7')]['bind'](this),0x3e8);}}};Agent[_0x154a('0xc')][_0x154a('0x9')]=function(_0x743f6c){if(_[_0x154a('0xf')](this[_0x154a('0x5')]['agents'][this[_0x154a('0x4')]['id']])){return logger[_0x154a('0xd')](_0x154a('0x11'),this[_0x154a('0x6')]['id'],this[_0x154a('0x4')]['id']);}else{logger[_0x154a('0xd')](_0x154a('0x1c'),this[_0x154a('0x6')]['id'],this[_0x154a('0x4')]['id']);util[_0x154a('0x1d')](this[_0x154a('0x3')],this[_0x154a('0x6')]['id'],this['realtime'][_0x154a('0x10')][this['agent']['id']],null,this[_0x154a('0x12')]);this[_0x154a('0x5')][_0x154a('0x10')][this[_0x154a('0x4')]['id']][_0x154a('0x16')]=![];this[_0x154a('0x5')][_0x154a('0x10')][this['agent']['id']][_0x154a('0x17')]=undefined;util[_0x154a('0x1e')](this['squeue']['id'],this[_0x154a('0x5')]['agents'][this[_0x154a('0x4')]['id']],_0x743f6c?_0x154a('0x1f'):_0x154a('0x20'));}if(!_0x743f6c){setTimeout(this[_0x154a('0x7')][_0x154a('0xa')](this),0x3e8);}};function agent(_0x348512,_0x24fdc5,_0x112b52,_0x3a7b7a){return new Agent(_0x348512,_0x24fdc5,_0x112b52,_0x3a7b7a);}module[_0x154a('0x21')]=agent;
\ No newline at end of file