Built motion from commit b5413ace.|2.6.9
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index 60e2244..99da0ee 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb62d=['prototype','agent','isNil','realtime','debug','forcedOwnership','agents','busy','busyQueue','showNotification','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','routing','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0xefc063,_0x4adcba){var _0xa20bcf=function(_0x1c5bea){while(--_0x1c5bea){_0xefc063['push'](_0xefc063['shift']());}};_0xa20bcf(++_0x4adcba);}(_0xb62d,0x17e));var _0xdb62=function(_0x18be7d,_0x56ffc5){_0x18be7d=_0x18be7d-0x0;var _0x1ac672=_0xb62d[_0x18be7d];return _0x1ac672;};'use strict';var _=require(_0xdb62('0x0'));var uuid=require(_0xdb62('0x1'));var util=require(_0xdb62('0x2'));var logger=require(_0xdb62('0x3'))('routing');var Agent=function(_0xd0ab58,_0x37a40b,_0x38fe27,_0x4d8e4a){this[_0xdb62('0x4')]=uuid['v4']();this['squeue']=_0xd0ab58;this['agent']=_0x37a40b;this['realtime']=_0x38fe27;this[_0xdb62('0x5')]=_0x4d8e4a;this[_0xdb62('0x6')][_0xdb62('0x7')](this[_0xdb62('0x8')][_0xdb62('0x9')](this),this[_0xdb62('0xa')][_0xdb62('0x9')](this));this[_0xdb62('0x6')]['on'](_0xdb62('0xb'),this[_0xdb62('0xa')][_0xdb62('0x9')](this));this[_0xdb62('0x6')]['on'](_0xdb62('0xc'),this[_0xdb62('0xd')][_0xdb62('0x9')](this));};Agent[_0xdb62('0xe')][_0xdb62('0x7')]=function(){this['squeue'][_0xdb62('0x7')](this[_0xdb62('0x8')]['bind'](this),this[_0xdb62('0xa')]['bind'](this));};Agent[_0xdb62('0xe')][_0xdb62('0xd')]=function(){this['handleTimeout'](!![]);};Agent[_0xdb62('0xe')][_0xdb62('0x8')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this[_0xdb62('0xf')]['id']);if(_[_0xdb62('0x10')](this[_0xdb62('0x11')]['agents'][this['agent']['id']])){logger[_0xdb62('0x12')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xdb62('0x6')]['id'],this[_0xdb62('0xf')]['id']);setTimeout(this[_0xdb62('0x7')][_0xdb62('0x9')](this),0x3e8);}else{if(this[_0xdb62('0x5')][_0xdb62('0x13')]||util['isAgentAvailable'](this[_0xdb62('0x6')]['id'],this['realtime'][_0xdb62('0x14')][this[_0xdb62('0xf')]['id']],this[_0xdb62('0x6')]['channel'],![])){this[_0xdb62('0x11')]['agents'][this[_0xdb62('0xf')]['id']][_0xdb62('0x15')]=!![];this[_0xdb62('0x11')][_0xdb62('0x14')][this[_0xdb62('0xf')]['id']][_0xdb62('0x16')]=undefined;util[_0xdb62('0x17')](this['notificationId'],this[_0xdb62('0x6')]['id'],this[_0xdb62('0x11')][_0xdb62('0x14')][this[_0xdb62('0xf')]['id']],null,this[_0xdb62('0x5')]);util['writeLog'](this['squeue']['id'],this[_0xdb62('0x11')][_0xdb62('0x14')][this[_0xdb62('0xf')]['id']],_0xdb62('0x18')+(this[_0xdb62('0x5')]['forcedOwnership']?':FORCED':''));}else{logger[_0xdb62('0x12')](_0xdb62('0x19'),this[_0xdb62('0x6')]['id'],this['agent']['id']);setTimeout(this[_0xdb62('0x7')][_0xdb62('0x9')](this),0x3e8);}}};Agent['prototype'][_0xdb62('0xa')]=function(_0xfea23b){if(_[_0xdb62('0x10')](this[_0xdb62('0x11')][_0xdb62('0x14')][this[_0xdb62('0xf')]['id']])){return logger[_0xdb62('0x12')](_0xdb62('0x1a'),this['squeue']['id'],this[_0xdb62('0xf')]['id']);}else{logger[_0xdb62('0x12')](_0xdb62('0x1b'),this[_0xdb62('0x6')]['id'],this[_0xdb62('0xf')]['id']);util[_0xdb62('0x1c')](this[_0xdb62('0x4')],this[_0xdb62('0x6')]['id'],this[_0xdb62('0x11')][_0xdb62('0x14')][this[_0xdb62('0xf')]['id']],null,this['routing']);this[_0xdb62('0x11')][_0xdb62('0x14')][this['agent']['id']][_0xdb62('0x15')]=![];this[_0xdb62('0x11')][_0xdb62('0x14')][this[_0xdb62('0xf')]['id']]['busyQueue']=undefined;util[_0xdb62('0x1d')](this['squeue']['id'],this[_0xdb62('0x11')][_0xdb62('0x14')][this[_0xdb62('0xf')]['id']],_0xfea23b?_0xdb62('0x1e'):_0xdb62('0x1f'));}if(!_0xfea23b){setTimeout(this['push'][_0xdb62('0x9')](this),0x3e8);}};function agent(_0x307691,_0x4b9347,_0x54c433,_0xbc9103){return new Agent(_0x307691,_0x4b9347,_0x54c433,_0xbc9103);}module[_0xdb62('0x20')]=agent;
\ No newline at end of file
+var _0x1789=['writeLog','RINGING',':FORCED','[%s][AGENT]\x20timeout\x20with\x20%s','STOP','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','bind','handleTimeout','handleDrained','prototype','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','showNotification'];(function(_0x3a3a87,_0x3c5fa2){var _0x79fcd9=function(_0x25f13a){while(--_0x25f13a){_0x3a3a87['push'](_0x3a3a87['shift']());}};_0x79fcd9(++_0x3c5fa2);}(_0x1789,0xfe));var _0x9178=function(_0x45161c,_0x5494fc){_0x45161c=_0x45161c-0x0;var _0x186581=_0x1789[_0x45161c];return _0x186581;};'use strict';var _=require(_0x9178('0x0'));var uuid=require('uuid');var util=require(_0x9178('0x1'));var logger=require(_0x9178('0x2'))(_0x9178('0x3'));var Agent=function(_0x3cad44,_0xe8e825,_0x2c9d98,_0x4f1b53){this[_0x9178('0x4')]=uuid['v4']();this[_0x9178('0x5')]=_0x3cad44;this[_0x9178('0x6')]=_0xe8e825;this['realtime']=_0x2c9d98;this[_0x9178('0x3')]=_0x4f1b53;this[_0x9178('0x5')][_0x9178('0x7')](this['handleRun'][_0x9178('0x8')](this),this[_0x9178('0x9')][_0x9178('0x8')](this));this['squeue']['on']('timeout',this[_0x9178('0x9')][_0x9178('0x8')](this));this[_0x9178('0x5')]['on']('drained',this[_0x9178('0xa')][_0x9178('0x8')](this));};Agent[_0x9178('0xb')]['push']=function(){this['squeue'][_0x9178('0x7')](this['handleRun'][_0x9178('0x8')](this),this[_0x9178('0x9')]['bind'](this));};Agent[_0x9178('0xb')][_0x9178('0xa')]=function(){this[_0x9178('0x9')](!![]);};Agent[_0x9178('0xb')][_0x9178('0xc')]=function(){logger[_0x9178('0xd')](_0x9178('0xe'),this[_0x9178('0x5')]['id'],this['agent']['id']);if(_[_0x9178('0xf')](this[_0x9178('0x10')]['agents'][this[_0x9178('0x6')]['id']])){logger[_0x9178('0xd')](_0x9178('0x11'),this[_0x9178('0x5')]['id'],this[_0x9178('0x6')]['id']);setTimeout(this[_0x9178('0x7')][_0x9178('0x8')](this),0x3e8);}else{if(this['routing'][_0x9178('0x12')]||util[_0x9178('0x13')](this[_0x9178('0x5')]['id'],this[_0x9178('0x10')][_0x9178('0x14')][this[_0x9178('0x6')]['id']],this[_0x9178('0x5')][_0x9178('0x15')],![])){this[_0x9178('0x10')][_0x9178('0x14')][this[_0x9178('0x6')]['id']][_0x9178('0x16')]=!![];this[_0x9178('0x10')][_0x9178('0x14')][this['agent']['id']][_0x9178('0x17')]=undefined;util[_0x9178('0x18')](this['notificationId'],this[_0x9178('0x5')]['id'],this['realtime']['agents'][this[_0x9178('0x6')]['id']],null,this[_0x9178('0x3')]);util[_0x9178('0x19')](this['squeue']['id'],this[_0x9178('0x10')][_0x9178('0x14')][this[_0x9178('0x6')]['id']],_0x9178('0x1a')+(this['routing'][_0x9178('0x12')]?_0x9178('0x1b'):''));}else{logger['debug']('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x9178('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x9178('0x7')]['bind'](this),0x3e8);}}};Agent[_0x9178('0xb')][_0x9178('0x9')]=function(_0x2ee2c2){if(_[_0x9178('0xf')](this[_0x9178('0x10')][_0x9178('0x14')][this[_0x9178('0x6')]['id']])){return logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x9178('0x6')]['id']);}else{logger[_0x9178('0xd')](_0x9178('0x1c'),this[_0x9178('0x5')]['id'],this[_0x9178('0x6')]['id']);util['hideNotification'](this['notificationId'],this[_0x9178('0x5')]['id'],this[_0x9178('0x10')][_0x9178('0x14')][this['agent']['id']],null,this[_0x9178('0x3')]);this[_0x9178('0x10')][_0x9178('0x14')][this[_0x9178('0x6')]['id']][_0x9178('0x16')]=![];this[_0x9178('0x10')]['agents'][this[_0x9178('0x6')]['id']]['busyQueue']=undefined;util[_0x9178('0x19')](this['squeue']['id'],this[_0x9178('0x10')]['agents'][this[_0x9178('0x6')]['id']],_0x2ee2c2?_0x9178('0x1d'):'TIMEOUT');}if(!_0x2ee2c2){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x3f7b98,_0xfbbe46,_0x4c2c8d,_0x550195){return new Agent(_0x3f7b98,_0xfbbe46,_0x4c2c8d,_0x550195);}module[_0x9178('0x1e')]=agent;
\ No newline at end of file