Built motion from commit (unavailable).|2.4.0
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index 9a86a2e..cc082fc 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-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
+var _0x30cf=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','writeLog','STOP','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','realtime','routing','push','bind','handleTimeout','timeout','drained','prototype','handleRun','handleDrained','info','isNil','agents','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification'];(function(_0x3e000a,_0x84f846){var _0x2e119e=function(_0x3ccbdd){while(--_0x3ccbdd){_0x3e000a['push'](_0x3e000a['shift']());}};_0x2e119e(++_0x84f846);}(_0x30cf,0x8a));var _0xf30c=function(_0x2bc170,_0x4d1cb8){_0x2bc170=_0x2bc170-0x0;var _0x18d372=_0x30cf[_0x2bc170];return _0x18d372;};'use strict';var _=require(_0xf30c('0x0'));var uuid=require(_0xf30c('0x1'));var util=require(_0xf30c('0x2'));var logger=require(_0xf30c('0x3'))('routing');var Agent=function(_0x5d567b,_0x49c34e,_0x5a666e,_0x11b5fb){this[_0xf30c('0x4')]=uuid['v4']();this[_0xf30c('0x5')]=_0x5d567b;this['agent']=_0x49c34e;this[_0xf30c('0x6')]=_0x5a666e;this[_0xf30c('0x7')]=_0x11b5fb;this[_0xf30c('0x5')][_0xf30c('0x8')](this['handleRun'][_0xf30c('0x9')](this),this[_0xf30c('0xa')]['bind'](this));this[_0xf30c('0x5')]['on'](_0xf30c('0xb'),this[_0xf30c('0xa')]['bind'](this));this[_0xf30c('0x5')]['on'](_0xf30c('0xc'),this['handleDrained'][_0xf30c('0x9')](this));};Agent[_0xf30c('0xd')][_0xf30c('0x8')]=function(){this['squeue'][_0xf30c('0x8')](this[_0xf30c('0xe')][_0xf30c('0x9')](this),this['handleTimeout'][_0xf30c('0x9')](this));};Agent[_0xf30c('0xd')][_0xf30c('0xf')]=function(){this[_0xf30c('0xa')](!![]);};Agent['prototype'][_0xf30c('0xe')]=function(_0x5ad8ce){logger[_0xf30c('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_[_0xf30c('0x11')](this[_0xf30c('0x6')][_0xf30c('0x12')][this[_0xf30c('0x13')]['id']])){logger[_0xf30c('0x10')](_0xf30c('0x14'),this[_0xf30c('0x5')]['id'],this['agent']['id']);setTimeout(this[_0xf30c('0x8')][_0xf30c('0x9')](this),0x3e8);}else{if(this[_0xf30c('0x7')][_0xf30c('0x15')]||util[_0xf30c('0x16')](this['squeue']['id'],this[_0xf30c('0x6')][_0xf30c('0x12')][this['agent']['id']],this[_0xf30c('0x5')][_0xf30c('0x17')],![])){this['realtime'][_0xf30c('0x12')][this[_0xf30c('0x13')]['id']][_0xf30c('0x18')]=!![];this[_0xf30c('0x6')][_0xf30c('0x12')][this[_0xf30c('0x13')]['id']][_0xf30c('0x19')]=undefined;util[_0xf30c('0x1a')](this[_0xf30c('0x4')],this[_0xf30c('0x5')]['id'],this[_0xf30c('0x6')][_0xf30c('0x12')][this[_0xf30c('0x13')]['id']],null,this['routing']);util['writeLog'](this[_0xf30c('0x5')]['id'],this[_0xf30c('0x6')][_0xf30c('0x12')][this[_0xf30c('0x13')]['id']],'RINGING'+(this['routing'][_0xf30c('0x15')]?_0xf30c('0x1b'):''));}else{logger['info'](_0xf30c('0x1c'),this[_0xf30c('0x5')]['id'],this[_0xf30c('0x13')]['id']);setTimeout(this[_0xf30c('0x8')][_0xf30c('0x9')](this),0x3e8);}}};Agent[_0xf30c('0xd')][_0xf30c('0xa')]=function(_0x2e0153){if(_['isNil'](this[_0xf30c('0x6')][_0xf30c('0x12')][this[_0xf30c('0x13')]['id']])){return logger[_0xf30c('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xf30c('0x5')]['id'],this[_0xf30c('0x13')]['id']);}else{logger[_0xf30c('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0xf30c('0x5')]['id'],this['agent']['id']);util[_0xf30c('0x1d')](this[_0xf30c('0x4')],this[_0xf30c('0x5')]['id'],this[_0xf30c('0x6')][_0xf30c('0x12')][this[_0xf30c('0x13')]['id']],null,this[_0xf30c('0x7')]);this['realtime']['agents'][this[_0xf30c('0x13')]['id']][_0xf30c('0x18')]=![];this[_0xf30c('0x6')][_0xf30c('0x12')][this[_0xf30c('0x13')]['id']][_0xf30c('0x19')]=undefined;util[_0xf30c('0x1e')](this[_0xf30c('0x5')]['id'],this['realtime'][_0xf30c('0x12')][this[_0xf30c('0x13')]['id']],_0x2e0153?_0xf30c('0x1f'):'TIMEOUT');}if(!_0x2e0153){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x2a8a10,_0x2fc4de,_0x4e806e,_0x2bbdf0){return new Agent(_0x2a8a10,_0x2fc4de,_0x4e806e,_0x2bbdf0);}module[_0xf30c('0x20')]=agent;
\ No newline at end of file