Built motion from commit (unavailable).|2.3.98
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index 88f0ded..9a86a2e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1b6d=['writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','exports','lodash','./util','routing','notificationId','squeue','realtime','push','handleRun','bind','timeout','drained','handleDrained','handleTimeout','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','agents','channel','busy','busyQueue'];(function(_0x3f59b2,_0x4a8407){var _0x355b8e=function(_0x2fe277){while(--_0x2fe277){_0x3f59b2['push'](_0x3f59b2['shift']());}};_0x355b8e(++_0x4a8407);}(_0x1b6d,0x1e6));var _0xd1b6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x1b6d[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xd1b6('0x0'));var uuid=require('uuid');var util=require(_0xd1b6('0x1'));var logger=require('../../../../../config/logger')(_0xd1b6('0x2'));var Agent=function(_0x1e2a75,_0x562baa,_0x21fa00,_0x2d2850){this[_0xd1b6('0x3')]=uuid['v4']();this[_0xd1b6('0x4')]=_0x1e2a75;this['agent']=_0x562baa;this[_0xd1b6('0x5')]=_0x21fa00;this['routing']=_0x2d2850;this['squeue'][_0xd1b6('0x6')](this[_0xd1b6('0x7')]['bind'](this),this['handleTimeout'][_0xd1b6('0x8')](this));this[_0xd1b6('0x4')]['on'](_0xd1b6('0x9'),this['handleTimeout'][_0xd1b6('0x8')](this));this[_0xd1b6('0x4')]['on'](_0xd1b6('0xa'),this[_0xd1b6('0xb')][_0xd1b6('0x8')](this));};Agent['prototype'][_0xd1b6('0x6')]=function(){this[_0xd1b6('0x4')]['push'](this['handleRun']['bind'](this),this[_0xd1b6('0xc')][_0xd1b6('0x8')](this));};Agent[_0xd1b6('0xd')][_0xd1b6('0xb')]=function(){this[_0xd1b6('0xc')](!![]);};Agent[_0xd1b6('0xd')][_0xd1b6('0x7')]=function(_0x7c6cea){logger[_0xd1b6('0xe')](_0xd1b6('0xf'),this[_0xd1b6('0x4')]['id'],this[_0xd1b6('0x10')]['id']);if(_[_0xd1b6('0x11')](this['realtime']['agents'][this[_0xd1b6('0x10')]['id']])){logger[_0xd1b6('0xe')](_0xd1b6('0x12'),this['squeue']['id'],this[_0xd1b6('0x10')]['id']);setTimeout(this[_0xd1b6('0x6')]['bind'](this),0x3e8);}else{if(this[_0xd1b6('0x2')][_0xd1b6('0x13')]||util['isAgentAvailable'](this[_0xd1b6('0x4')]['id'],this[_0xd1b6('0x5')][_0xd1b6('0x14')][this[_0xd1b6('0x10')]['id']],this['squeue'][_0xd1b6('0x15')],![])){this['realtime'][_0xd1b6('0x14')][this['agent']['id']][_0xd1b6('0x16')]=!![];this[_0xd1b6('0x5')]['agents'][this['agent']['id']][_0xd1b6('0x17')]=undefined;util['showNotification'](this['notificationId'],this[_0xd1b6('0x4')]['id'],this[_0xd1b6('0x5')][_0xd1b6('0x14')][this['agent']['id']],null,this[_0xd1b6('0x2')]);util[_0xd1b6('0x18')](this[_0xd1b6('0x4')]['id'],this[_0xd1b6('0x5')][_0xd1b6('0x14')][this[_0xd1b6('0x10')]['id']],_0xd1b6('0x19')+(this[_0xd1b6('0x2')][_0xd1b6('0x13')]?':FORCED':''));}else{logger[_0xd1b6('0xe')](_0xd1b6('0x1a'),this[_0xd1b6('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0xd1b6('0x8')](this),0x3e8);}}};Agent['prototype'][_0xd1b6('0xc')]=function(_0x3e56c2){if(_[_0xd1b6('0x11')](this['realtime']['agents'][this[_0xd1b6('0x10')]['id']])){return logger[_0xd1b6('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xd1b6('0x4')]['id'],this[_0xd1b6('0x10')]['id']);}else{logger[_0xd1b6('0xe')](_0xd1b6('0x1b'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0xd1b6('0x3')],this[_0xd1b6('0x4')]['id'],this['realtime'][_0xd1b6('0x14')][this[_0xd1b6('0x10')]['id']],null,this[_0xd1b6('0x2')]);this[_0xd1b6('0x5')]['agents'][this[_0xd1b6('0x10')]['id']][_0xd1b6('0x16')]=![];this[_0xd1b6('0x5')][_0xd1b6('0x14')][this[_0xd1b6('0x10')]['id']][_0xd1b6('0x17')]=undefined;util[_0xd1b6('0x18')](this[_0xd1b6('0x4')]['id'],this['realtime'][_0xd1b6('0x14')][this['agent']['id']],_0x3e56c2?_0xd1b6('0x1c'):'TIMEOUT');}if(!_0x3e56c2){setTimeout(this[_0xd1b6('0x6')][_0xd1b6('0x8')](this),0x3e8);}};function agent(_0x5041ea,_0x247ff4,_0x410f08,_0x28e31e){return new Agent(_0x5041ea,_0x247ff4,_0x410f08,_0x28e31e);}module[_0xd1b6('0x1d')]=agent;
\ No newline at end of file
+var _0x5f42=['handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','timeout','handleTimeout'];(function(_0x3c108f,_0x113009){var _0x376296=function(_0x1cb361){while(--_0x1cb361){_0x3c108f['push'](_0x3c108f['shift']());}};_0x376296(++_0x113009);}(_0x5f42,0x1c1));var _0x25f4=function(_0x4651f0,_0x42a139){_0x4651f0=_0x4651f0-0x0;var _0x207b83=_0x5f42[_0x4651f0];return _0x207b83;};'use strict';var _=require(_0x25f4('0x0'));var uuid=require(_0x25f4('0x1'));var util=require('./util');var logger=require(_0x25f4('0x2'))(_0x25f4('0x3'));var Agent=function(_0x46819d,_0x12196b,_0x58076a,_0x11cac8){this[_0x25f4('0x4')]=uuid['v4']();this[_0x25f4('0x5')]=_0x46819d;this[_0x25f4('0x6')]=_0x12196b;this[_0x25f4('0x7')]=_0x58076a;this[_0x25f4('0x3')]=_0x11cac8;this[_0x25f4('0x5')][_0x25f4('0x8')](this[_0x25f4('0x9')][_0x25f4('0xa')](this),this['handleTimeout'][_0x25f4('0xa')](this));this['squeue']['on'](_0x25f4('0xb'),this[_0x25f4('0xc')]['bind'](this));this[_0x25f4('0x5')]['on']('drained',this[_0x25f4('0xd')][_0x25f4('0xa')](this));};Agent[_0x25f4('0xe')][_0x25f4('0x8')]=function(){this['squeue'][_0x25f4('0x8')](this[_0x25f4('0x9')][_0x25f4('0xa')](this),this[_0x25f4('0xc')]['bind'](this));};Agent['prototype'][_0x25f4('0xd')]=function(){this[_0x25f4('0xc')](!![]);};Agent['prototype'][_0x25f4('0x9')]=function(_0x2c282d){logger[_0x25f4('0xf')](_0x25f4('0x10'),this['squeue']['id'],this['agent']['id']);if(_[_0x25f4('0x11')](this[_0x25f4('0x7')][_0x25f4('0x12')][this[_0x25f4('0x6')]['id']])){logger[_0x25f4('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x25f4('0x8')][_0x25f4('0xa')](this),0x3e8);}else{if(this[_0x25f4('0x3')][_0x25f4('0x13')]||util[_0x25f4('0x14')](this[_0x25f4('0x5')]['id'],this[_0x25f4('0x7')][_0x25f4('0x12')][this['agent']['id']],this[_0x25f4('0x5')]['channel'],![])){this[_0x25f4('0x7')]['agents'][this[_0x25f4('0x6')]['id']][_0x25f4('0x15')]=!![];this[_0x25f4('0x7')]['agents'][this[_0x25f4('0x6')]['id']][_0x25f4('0x16')]=undefined;util[_0x25f4('0x17')](this[_0x25f4('0x4')],this[_0x25f4('0x5')]['id'],this[_0x25f4('0x7')]['agents'][this[_0x25f4('0x6')]['id']],null,this[_0x25f4('0x3')]);util[_0x25f4('0x18')](this[_0x25f4('0x5')]['id'],this['realtime'][_0x25f4('0x12')][this[_0x25f4('0x6')]['id']],_0x25f4('0x19')+(this['routing'][_0x25f4('0x13')]?_0x25f4('0x1a'):''));}else{logger[_0x25f4('0xf')](_0x25f4('0x1b'),this['squeue']['id'],this[_0x25f4('0x6')]['id']);setTimeout(this['push'][_0x25f4('0xa')](this),0x3e8);}}};Agent[_0x25f4('0xe')]['handleTimeout']=function(_0x4dd927){if(_[_0x25f4('0x11')](this[_0x25f4('0x7')][_0x25f4('0x12')][this[_0x25f4('0x6')]['id']])){return logger[_0x25f4('0xf')](_0x25f4('0x1c'),this[_0x25f4('0x5')]['id'],this['agent']['id']);}else{logger[_0x25f4('0xf')](_0x25f4('0x1d'),this[_0x25f4('0x5')]['id'],this[_0x25f4('0x6')]['id']);util[_0x25f4('0x1e')](this[_0x25f4('0x4')],this[_0x25f4('0x5')]['id'],this[_0x25f4('0x7')][_0x25f4('0x12')][this['agent']['id']],null,this[_0x25f4('0x3')]);this[_0x25f4('0x7')][_0x25f4('0x12')][this[_0x25f4('0x6')]['id']][_0x25f4('0x15')]=![];this['realtime'][_0x25f4('0x12')][this[_0x25f4('0x6')]['id']]['busyQueue']=undefined;util[_0x25f4('0x18')](this[_0x25f4('0x5')]['id'],this[_0x25f4('0x7')][_0x25f4('0x12')][this[_0x25f4('0x6')]['id']],_0x4dd927?_0x25f4('0x1f'):'TIMEOUT');}if(!_0x4dd927){setTimeout(this[_0x25f4('0x8')][_0x25f4('0xa')](this),0x3e8);}};function agent(_0x1fde93,_0x3fc492,_0x41887f,_0x1ca014){return new Agent(_0x1fde93,_0x3fc492,_0x41887f,_0x1ca014);}module[_0x25f4('0x20')]=agent;
\ No newline at end of file