Built motion from commit 167bccf5.|2.6.7
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index 141dafa..1424e7f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3d4f=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busy','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','timeout','drained','handleDrained','prototype','handleTimeout','debug','isNil','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busyQueue','showNotification','writeLog','RINGING'];(function(_0xc9fef,_0x5c422e){var _0x41cc04=function(_0x2fa453){while(--_0x2fa453){_0xc9fef['push'](_0xc9fef['shift']());}};_0x41cc04(++_0x5c422e);}(_0x3d4f,0x9f));var _0xf3d4=function(_0x5837d1,_0x4661e0){_0x5837d1=_0x5837d1-0x0;var _0x43b3b7=_0x3d4f[_0x5837d1];return _0x43b3b7;};'use strict';var _=require(_0xf3d4('0x0'));var uuid=require(_0xf3d4('0x1'));var util=require(_0xf3d4('0x2'));var logger=require(_0xf3d4('0x3'))(_0xf3d4('0x4'));var Agent=function(_0x2561cd,_0x5ebfcb,_0x32ca59,_0x5cc8f7){this[_0xf3d4('0x5')]=uuid['v4']();this[_0xf3d4('0x6')]=_0x2561cd;this['agent']=_0x5ebfcb;this[_0xf3d4('0x7')]=_0x32ca59;this['routing']=_0x5cc8f7;this[_0xf3d4('0x6')][_0xf3d4('0x8')](this[_0xf3d4('0x9')][_0xf3d4('0xa')](this),this['handleTimeout'][_0xf3d4('0xa')](this));this[_0xf3d4('0x6')]['on'](_0xf3d4('0xb'),this['handleTimeout'][_0xf3d4('0xa')](this));this['squeue']['on'](_0xf3d4('0xc'),this[_0xf3d4('0xd')][_0xf3d4('0xa')](this));};Agent[_0xf3d4('0xe')][_0xf3d4('0x8')]=function(){this[_0xf3d4('0x6')][_0xf3d4('0x8')](this[_0xf3d4('0x9')][_0xf3d4('0xa')](this),this[_0xf3d4('0xf')][_0xf3d4('0xa')](this));};Agent[_0xf3d4('0xe')][_0xf3d4('0xd')]=function(){this[_0xf3d4('0xf')](!![]);};Agent[_0xf3d4('0xe')][_0xf3d4('0x9')]=function(){logger[_0xf3d4('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_[_0xf3d4('0x11')](this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']])){logger[_0xf3d4('0x10')](_0xf3d4('0x14'),this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x13')]['id']);setTimeout(this[_0xf3d4('0x8')][_0xf3d4('0xa')](this),0x3e8);}else{if(this['routing'][_0xf3d4('0x15')]||util['isAgentAvailable'](this['squeue']['id'],this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']],this[_0xf3d4('0x6')][_0xf3d4('0x16')],![])){this['realtime']['agents'][this[_0xf3d4('0x13')]['id']]['busy']=!![];this['realtime'][_0xf3d4('0x12')][this['agent']['id']][_0xf3d4('0x17')]=undefined;util[_0xf3d4('0x18')](this[_0xf3d4('0x5')],this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x7')]['agents'][this[_0xf3d4('0x13')]['id']],null,this[_0xf3d4('0x4')]);util[_0xf3d4('0x19')](this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x7')]['agents'][this[_0xf3d4('0x13')]['id']],_0xf3d4('0x1a')+(this[_0xf3d4('0x4')][_0xf3d4('0x15')]?':FORCED':''));}else{logger['debug'](_0xf3d4('0x1b'),this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x13')]['id']);setTimeout(this['push'][_0xf3d4('0xa')](this),0x3e8);}}};Agent['prototype']['handleTimeout']=function(_0x5d8d15){if(_[_0xf3d4('0x11')](this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']])){return logger['debug'](_0xf3d4('0x14'),this[_0xf3d4('0x6')]['id'],this['agent']['id']);}else{logger[_0xf3d4('0x10')](_0xf3d4('0x1c'),this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x13')]['id']);util['hideNotification'](this[_0xf3d4('0x5')],this['squeue']['id'],this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']],null,this['routing']);this['realtime']['agents'][this[_0xf3d4('0x13')]['id']][_0xf3d4('0x1d')]=![];this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']][_0xf3d4('0x17')]=undefined;util['writeLog'](this[_0xf3d4('0x6')]['id'],this[_0xf3d4('0x7')][_0xf3d4('0x12')][this[_0xf3d4('0x13')]['id']],_0x5d8d15?'STOP':'TIMEOUT');}if(!_0x5d8d15){setTimeout(this[_0xf3d4('0x8')]['bind'](this),0x3e8);}};function agent(_0x1deb7e,_0x25dadc,_0x56c610,_0x157ba8){return new Agent(_0x1deb7e,_0x25dadc,_0x56c610,_0x157ba8);}module[_0xf3d4('0x1e')]=agent;
\ No newline at end of file
+var _0x4c8f=['./util','../../../../../config/logger','squeue','agent','realtime','routing','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','TIMEOUT','exports','lodash','uuid'];(function(_0xbdfc6e,_0x17cfdd){var _0x30d911=function(_0x11d601){while(--_0x11d601){_0xbdfc6e['push'](_0xbdfc6e['shift']());}};_0x30d911(++_0x17cfdd);}(_0x4c8f,0xd7));var _0xf4c8=function(_0x113426,_0x392950){_0x113426=_0x113426-0x0;var _0x131c6f=_0x4c8f[_0x113426];return _0x131c6f;};'use strict';var _=require(_0xf4c8('0x0'));var uuid=require(_0xf4c8('0x1'));var util=require(_0xf4c8('0x2'));var logger=require(_0xf4c8('0x3'))('routing');var Agent=function(_0x51a524,_0x580657,_0xef1e28,_0x21476f){this['notificationId']=uuid['v4']();this[_0xf4c8('0x4')]=_0x51a524;this[_0xf4c8('0x5')]=_0x580657;this[_0xf4c8('0x6')]=_0xef1e28;this[_0xf4c8('0x7')]=_0x21476f;this[_0xf4c8('0x4')][_0xf4c8('0x8')](this[_0xf4c8('0x9')][_0xf4c8('0xa')](this),this['handleTimeout']['bind'](this));this['squeue']['on'](_0xf4c8('0xb'),this[_0xf4c8('0xc')][_0xf4c8('0xa')](this));this[_0xf4c8('0x4')]['on'](_0xf4c8('0xd'),this[_0xf4c8('0xe')][_0xf4c8('0xa')](this));};Agent['prototype']['push']=function(){this['squeue']['push'](this['handleRun']['bind'](this),this[_0xf4c8('0xc')][_0xf4c8('0xa')](this));};Agent[_0xf4c8('0xf')]['handleDrained']=function(){this[_0xf4c8('0xc')](!![]);};Agent['prototype'][_0xf4c8('0x9')]=function(){logger['debug'](_0xf4c8('0x10'),this['squeue']['id'],this[_0xf4c8('0x5')]['id']);if(_[_0xf4c8('0x11')](this[_0xf4c8('0x6')][_0xf4c8('0x12')][this[_0xf4c8('0x5')]['id']])){logger[_0xf4c8('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x5')]['id']);setTimeout(this[_0xf4c8('0x8')][_0xf4c8('0xa')](this),0x3e8);}else{if(this[_0xf4c8('0x7')][_0xf4c8('0x14')]||util[_0xf4c8('0x15')](this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x6')]['agents'][this[_0xf4c8('0x5')]['id']],this['squeue']['channel'],![])){this[_0xf4c8('0x6')]['agents'][this[_0xf4c8('0x5')]['id']][_0xf4c8('0x16')]=!![];this[_0xf4c8('0x6')][_0xf4c8('0x12')][this[_0xf4c8('0x5')]['id']][_0xf4c8('0x17')]=undefined;util['showNotification'](this['notificationId'],this['squeue']['id'],this['realtime'][_0xf4c8('0x12')][this[_0xf4c8('0x5')]['id']],null,this[_0xf4c8('0x7')]);util[_0xf4c8('0x18')](this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x6')][_0xf4c8('0x12')][this[_0xf4c8('0x5')]['id']],_0xf4c8('0x19')+(this[_0xf4c8('0x7')][_0xf4c8('0x14')]?_0xf4c8('0x1a'):''));}else{logger[_0xf4c8('0x13')](_0xf4c8('0x1b'),this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x5')]['id']);setTimeout(this[_0xf4c8('0x8')][_0xf4c8('0xa')](this),0x3e8);}}};Agent['prototype'][_0xf4c8('0xc')]=function(_0x2b38a5){if(_[_0xf4c8('0x11')](this[_0xf4c8('0x6')][_0xf4c8('0x12')][this['agent']['id']])){return logger[_0xf4c8('0x13')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x5')]['id']);}else{logger['debug']('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x5')]['id']);util[_0xf4c8('0x1c')](this['notificationId'],this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x6')]['agents'][this['agent']['id']],null,this[_0xf4c8('0x7')]);this[_0xf4c8('0x6')][_0xf4c8('0x12')][this['agent']['id']][_0xf4c8('0x16')]=![];this[_0xf4c8('0x6')][_0xf4c8('0x12')][this['agent']['id']][_0xf4c8('0x17')]=undefined;util[_0xf4c8('0x18')](this[_0xf4c8('0x4')]['id'],this[_0xf4c8('0x6')][_0xf4c8('0x12')][this['agent']['id']],_0x2b38a5?'STOP':_0xf4c8('0x1d'));}if(!_0x2b38a5){setTimeout(this[_0xf4c8('0x8')][_0xf4c8('0xa')](this),0x3e8);}};function agent(_0x236742,_0x1f0061,_0x25bc08,_0x3862d9){return new Agent(_0x236742,_0x1f0061,_0x25bc08,_0x3862d9);}module[_0xf4c8('0x1e')]=agent;
\ No newline at end of file