Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index bd94b5d..a5e20ef 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe746=['prototype','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','../../../../../config/logger','notificationId','agent','realtime','routing','squeue','handleRun','bind','timeout','drained','handleDrained','push','handleTimeout','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x182941,_0x2ee2ce){var _0x322428=function(_0x5e2c9d){while(--_0x5e2c9d){_0x182941['push'](_0x182941['shift']());}};_0x322428(++_0x2ee2ce);}(_0xe746,0xcc));var _0x6e74=function(_0x2407fa,_0x422faf){_0x2407fa=_0x2407fa-0x0;var _0x43f05e=_0xe746[_0x2407fa];return _0x43f05e;};'use strict';var _=require(_0x6e74('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require(_0x6e74('0x1'))('routing');var Agent=function(_0xaf65e6,_0x3fa18a,_0x3bfe84,_0x1b9ea5){this[_0x6e74('0x2')]=uuid['v4']();this['squeue']=_0xaf65e6;this[_0x6e74('0x3')]=_0x3fa18a;this[_0x6e74('0x4')]=_0x3bfe84;this[_0x6e74('0x5')]=_0x1b9ea5;this[_0x6e74('0x6')]['push'](this[_0x6e74('0x7')]['bind'](this),this['handleTimeout'][_0x6e74('0x8')](this));this[_0x6e74('0x6')]['on'](_0x6e74('0x9'),this['handleTimeout']['bind'](this));this[_0x6e74('0x6')]['on'](_0x6e74('0xa'),this[_0x6e74('0xb')]['bind'](this));};Agent['prototype'][_0x6e74('0xc')]=function(){this[_0x6e74('0x6')][_0x6e74('0xc')](this[_0x6e74('0x7')][_0x6e74('0x8')](this),this[_0x6e74('0xd')][_0x6e74('0x8')](this));};Agent['prototype'][_0x6e74('0xb')]=function(){this[_0x6e74('0xd')](!![]);};Agent['prototype'][_0x6e74('0x7')]=function(_0x3a423c){logger[_0x6e74('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x6e74('0x6')]['id'],this[_0x6e74('0x3')]['id']);if(_[_0x6e74('0xf')](this['realtime'][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']])){logger[_0x6e74('0xe')](_0x6e74('0x11'),this['squeue']['id'],this[_0x6e74('0x3')]['id']);setTimeout(this['push'][_0x6e74('0x8')](this),0x3e8);}else{if(this[_0x6e74('0x5')][_0x6e74('0x12')]||util[_0x6e74('0x13')](this['squeue']['id'],this['realtime']['agents'][this['agent']['id']],this['squeue'][_0x6e74('0x14')],![])){this[_0x6e74('0x4')][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']]['busy']=!![];this[_0x6e74('0x4')][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']][_0x6e74('0x15')]=undefined;util[_0x6e74('0x16')](this[_0x6e74('0x2')],this['squeue']['id'],this[_0x6e74('0x4')]['agents'][this['agent']['id']],null,this['routing']);util[_0x6e74('0x17')](this[_0x6e74('0x6')]['id'],this['realtime'][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']],_0x6e74('0x18')+(this[_0x6e74('0x5')][_0x6e74('0x12')]?_0x6e74('0x19'):''));}else{logger[_0x6e74('0xe')](_0x6e74('0x1a'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x6e74('0x8')](this),0x3e8);}}};Agent[_0x6e74('0x1b')]['handleTimeout']=function(_0x10db4e){if(_[_0x6e74('0xf')](this[_0x6e74('0x4')][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']])){return logger[_0x6e74('0xe')](_0x6e74('0x11'),this[_0x6e74('0x6')]['id'],this[_0x6e74('0x3')]['id']);}else{logger[_0x6e74('0xe')](_0x6e74('0x1c'),this[_0x6e74('0x6')]['id'],this[_0x6e74('0x3')]['id']);util[_0x6e74('0x1d')](this[_0x6e74('0x2')],this[_0x6e74('0x6')]['id'],this[_0x6e74('0x4')][_0x6e74('0x10')][this['agent']['id']],null,this[_0x6e74('0x5')]);this[_0x6e74('0x4')][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']]['busy']=![];this[_0x6e74('0x4')][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']][_0x6e74('0x15')]=undefined;util['writeLog'](this[_0x6e74('0x6')]['id'],this['realtime'][_0x6e74('0x10')][this[_0x6e74('0x3')]['id']],_0x10db4e?_0x6e74('0x1e'):_0x6e74('0x1f'));}if(!_0x10db4e){setTimeout(this[_0x6e74('0xc')][_0x6e74('0x8')](this),0x3e8);}};function agent(_0x38d45e,_0x17d7aa,_0x24d528,_0x38f7d5){return new Agent(_0x38d45e,_0x17d7aa,_0x24d528,_0x38f7d5);}module[_0x6e74('0x20')]=agent;
\ No newline at end of file
+var _0x51c7=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','push','handleRun','handleTimeout','timeout','bind','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','realtime','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','info','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x2a0ffd,_0x5e35fc){var _0x3f72e4=function(_0x5c192f){while(--_0x5c192f){_0x2a0ffd['push'](_0x2a0ffd['shift']());}};_0x3f72e4(++_0x5e35fc);}(_0x51c7,0x96));var _0x751c=function(_0x42d41d,_0x17b8ea){_0x42d41d=_0x42d41d-0x0;var _0x2e6184=_0x51c7[_0x42d41d];return _0x2e6184;};'use strict';var _=require(_0x751c('0x0'));var uuid=require(_0x751c('0x1'));var util=require(_0x751c('0x2'));var logger=require('../../../../../config/logger')(_0x751c('0x3'));var Agent=function(_0x1b4014,_0x5976a8,_0x3f38fb,_0x36f6b2){this[_0x751c('0x4')]=uuid['v4']();this['squeue']=_0x1b4014;this['agent']=_0x5976a8;this['realtime']=_0x3f38fb;this[_0x751c('0x3')]=_0x36f6b2;this[_0x751c('0x5')][_0x751c('0x6')](this[_0x751c('0x7')]['bind'](this),this[_0x751c('0x8')]['bind'](this));this[_0x751c('0x5')]['on'](_0x751c('0x9'),this[_0x751c('0x8')][_0x751c('0xa')](this));this[_0x751c('0x5')]['on'](_0x751c('0xb'),this[_0x751c('0xc')]['bind'](this));};Agent[_0x751c('0xd')][_0x751c('0x6')]=function(){this['squeue'][_0x751c('0x6')](this['handleRun'][_0x751c('0xa')](this),this[_0x751c('0x8')][_0x751c('0xa')](this));};Agent['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Agent[_0x751c('0xd')][_0x751c('0x7')]=function(_0x278fb1){logger['info'](_0x751c('0xe'),this[_0x751c('0x5')]['id'],this[_0x751c('0xf')]['id']);if(_[_0x751c('0x10')](this[_0x751c('0x11')][_0x751c('0x12')][this[_0x751c('0xf')]['id']])){logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x751c('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x751c('0x6')]['bind'](this),0x3e8);}else{if(this[_0x751c('0x3')][_0x751c('0x13')]||util[_0x751c('0x14')](this[_0x751c('0x5')]['id'],this[_0x751c('0x11')]['agents'][this['agent']['id']],this['squeue'][_0x751c('0x15')],![])){this['realtime']['agents'][this['agent']['id']][_0x751c('0x16')]=!![];this[_0x751c('0x11')][_0x751c('0x12')][this[_0x751c('0xf')]['id']][_0x751c('0x17')]=undefined;util[_0x751c('0x18')](this[_0x751c('0x4')],this[_0x751c('0x5')]['id'],this['realtime'][_0x751c('0x12')][this[_0x751c('0xf')]['id']],null,this[_0x751c('0x3')]);util[_0x751c('0x19')](this['squeue']['id'],this['realtime']['agents'][this[_0x751c('0xf')]['id']],_0x751c('0x1a')+(this[_0x751c('0x3')]['forcedOwnership']?_0x751c('0x1b'):''));}else{logger[_0x751c('0x1c')](_0x751c('0x1d'),this[_0x751c('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x751c('0x6')]['bind'](this),0x3e8);}}};Agent[_0x751c('0xd')][_0x751c('0x8')]=function(_0x4efbb1){if(_[_0x751c('0x10')](this[_0x751c('0x11')][_0x751c('0x12')][this[_0x751c('0xf')]['id']])){return logger[_0x751c('0x1c')](_0x751c('0x1e'),this[_0x751c('0x5')]['id'],this['agent']['id']);}else{logger[_0x751c('0x1c')](_0x751c('0x1f'),this[_0x751c('0x5')]['id'],this['agent']['id']);util[_0x751c('0x20')](this[_0x751c('0x4')],this[_0x751c('0x5')]['id'],this[_0x751c('0x11')][_0x751c('0x12')][this[_0x751c('0xf')]['id']],null,this[_0x751c('0x3')]);this[_0x751c('0x11')][_0x751c('0x12')][this['agent']['id']]['busy']=![];this[_0x751c('0x11')]['agents'][this['agent']['id']][_0x751c('0x17')]=undefined;util[_0x751c('0x19')](this[_0x751c('0x5')]['id'],this[_0x751c('0x11')][_0x751c('0x12')][this[_0x751c('0xf')]['id']],_0x4efbb1?_0x751c('0x21'):_0x751c('0x22'));}if(!_0x4efbb1){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x30f7d9,_0x3b81d3,_0x8dc3a0,_0x49c0d8){return new Agent(_0x30f7d9,_0x3b81d3,_0x8dc3a0,_0x49c0d8);}module[_0x751c('0x23')]=agent;
\ No newline at end of file