Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index a128a9c..2fdde25 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa767=['busyQueue','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','prototype','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','forcedOwnership','isAgentAvailable','agents'];(function(_0x302180,_0x18366e){var _0x45a0c2=function(_0x3d4e59){while(--_0x3d4e59){_0x302180['push'](_0x302180['shift']());}};_0x45a0c2(++_0x18366e);}(_0xa767,0x12a));var _0x7a76=function(_0x56cd22,_0xd4c827){_0x56cd22=_0x56cd22-0x0;var _0x57918f=_0xa767[_0x56cd22];return _0x57918f;};'use strict';var _=require('lodash');var uuid=require(_0x7a76('0x0'));var util=require(_0x7a76('0x1'));var logger=require(_0x7a76('0x2'))(_0x7a76('0x3'));var Agent=function(_0x4876b4,_0x21b43e,_0xf13668,_0xe0e5c0){this[_0x7a76('0x4')]=uuid['v4']();this['squeue']=_0x4876b4;this[_0x7a76('0x5')]=_0x21b43e;this[_0x7a76('0x6')]=_0xf13668;this[_0x7a76('0x3')]=_0xe0e5c0;this[_0x7a76('0x7')][_0x7a76('0x8')](this[_0x7a76('0x9')][_0x7a76('0xa')](this),this[_0x7a76('0xb')]['bind'](this));this['squeue']['on'](_0x7a76('0xc'),this[_0x7a76('0xb')][_0x7a76('0xa')](this));this['squeue']['on'](_0x7a76('0xd'),this['handleDrained'][_0x7a76('0xa')](this));};Agent[_0x7a76('0xe')]['push']=function(){this[_0x7a76('0x7')][_0x7a76('0x8')](this['handleRun']['bind'](this),this[_0x7a76('0xb')][_0x7a76('0xa')](this));};Agent[_0x7a76('0xe')][_0x7a76('0xf')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x7a76('0x9')]=function(_0x42e7de){logger[_0x7a76('0x10')](_0x7a76('0x11'),this[_0x7a76('0x7')]['id'],this['agent']['id']);if(_[_0x7a76('0x12')](this[_0x7a76('0x6')]['agents'][this[_0x7a76('0x5')]['id']])){logger[_0x7a76('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x7a76('0xa')](this),0x3e8);}else{if(this['routing'][_0x7a76('0x13')]||util[_0x7a76('0x14')](this[_0x7a76('0x7')]['id'],this[_0x7a76('0x6')]['agents'][this[_0x7a76('0x5')]['id']],this['squeue']['channel'],![])){this[_0x7a76('0x6')]['agents'][this[_0x7a76('0x5')]['id']]['busy']=!![];this[_0x7a76('0x6')][_0x7a76('0x15')][this[_0x7a76('0x5')]['id']][_0x7a76('0x16')]=undefined;util[_0x7a76('0x17')](this[_0x7a76('0x4')],this['squeue']['id'],this[_0x7a76('0x6')]['agents'][this[_0x7a76('0x5')]['id']],null,this['routing']);util[_0x7a76('0x18')](this[_0x7a76('0x7')]['id'],this[_0x7a76('0x6')]['agents'][this[_0x7a76('0x5')]['id']],_0x7a76('0x19')+(this[_0x7a76('0x3')][_0x7a76('0x13')]?':FORCED':''));}else{logger[_0x7a76('0x10')](_0x7a76('0x1a'),this[_0x7a76('0x7')]['id'],this[_0x7a76('0x5')]['id']);setTimeout(this[_0x7a76('0x8')][_0x7a76('0xa')](this),0x3e8);}}};Agent[_0x7a76('0xe')][_0x7a76('0xb')]=function(_0x2f12b9){if(_[_0x7a76('0x12')](this[_0x7a76('0x6')][_0x7a76('0x15')][this[_0x7a76('0x5')]['id']])){return logger[_0x7a76('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x7a76('0x7')]['id'],this['agent']['id']);}else{logger['info'](_0x7a76('0x1b'),this[_0x7a76('0x7')]['id'],this['agent']['id']);util[_0x7a76('0x1c')](this[_0x7a76('0x4')],this[_0x7a76('0x7')]['id'],this[_0x7a76('0x6')][_0x7a76('0x15')][this[_0x7a76('0x5')]['id']],null,this[_0x7a76('0x3')]);this[_0x7a76('0x6')][_0x7a76('0x15')][this['agent']['id']][_0x7a76('0x1d')]=![];this[_0x7a76('0x6')][_0x7a76('0x15')][this[_0x7a76('0x5')]['id']]['busyQueue']=undefined;util[_0x7a76('0x18')](this[_0x7a76('0x7')]['id'],this[_0x7a76('0x6')][_0x7a76('0x15')][this['agent']['id']],_0x2f12b9?'STOP':_0x7a76('0x1e'));}if(!_0x2f12b9){setTimeout(this[_0x7a76('0x8')]['bind'](this),0x3e8);}};function agent(_0x2b12be,_0x5e06af,_0x274bce,_0x25dcfb){return new Agent(_0x2b12be,_0x5e06af,_0x274bce,_0x25dcfb);}module[_0x7a76('0x1f')]=agent;
\ No newline at end of file
+var _0xadc1=['RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','showNotification','writeLog'];(function(_0x16bb4b,_0x5fe431){var _0x8aeb84=function(_0x36ba6e){while(--_0x36ba6e){_0x16bb4b['push'](_0x16bb4b['shift']());}};_0x8aeb84(++_0x5fe431);}(_0xadc1,0x80));var _0x1adc=function(_0x3a04ab,_0x31b9fd){_0x3a04ab=_0x3a04ab-0x0;var _0x4bff6d=_0xadc1[_0x3a04ab];return _0x4bff6d;};'use strict';var _=require(_0x1adc('0x0'));var uuid=require('uuid');var util=require(_0x1adc('0x1'));var logger=require(_0x1adc('0x2'))(_0x1adc('0x3'));var Agent=function(_0x2d5df1,_0x4837c4,_0x3288d3,_0x57e89a){this[_0x1adc('0x4')]=uuid['v4']();this[_0x1adc('0x5')]=_0x2d5df1;this[_0x1adc('0x6')]=_0x4837c4;this[_0x1adc('0x7')]=_0x3288d3;this['routing']=_0x57e89a;this['squeue'][_0x1adc('0x8')](this[_0x1adc('0x9')]['bind'](this),this[_0x1adc('0xa')][_0x1adc('0xb')](this));this[_0x1adc('0x5')]['on'](_0x1adc('0xc'),this[_0x1adc('0xa')][_0x1adc('0xb')](this));this[_0x1adc('0x5')]['on'](_0x1adc('0xd'),this[_0x1adc('0xe')][_0x1adc('0xb')](this));};Agent[_0x1adc('0xf')][_0x1adc('0x8')]=function(){this[_0x1adc('0x5')][_0x1adc('0x8')](this[_0x1adc('0x9')][_0x1adc('0xb')](this),this[_0x1adc('0xa')][_0x1adc('0xb')](this));};Agent[_0x1adc('0xf')]['handleDrained']=function(){this[_0x1adc('0xa')](!![]);};Agent[_0x1adc('0xf')]['handleRun']=function(_0xac8a13){logger[_0x1adc('0x10')](_0x1adc('0x11'),this[_0x1adc('0x5')]['id'],this[_0x1adc('0x6')]['id']);if(_[_0x1adc('0x12')](this['realtime'][_0x1adc('0x13')][this['agent']['id']])){logger[_0x1adc('0x10')](_0x1adc('0x14'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push'][_0x1adc('0xb')](this),0x3e8);}else{if(this[_0x1adc('0x3')][_0x1adc('0x15')]||util['isAgentAvailable'](this[_0x1adc('0x5')]['id'],this[_0x1adc('0x7')]['agents'][this[_0x1adc('0x6')]['id']],this[_0x1adc('0x5')][_0x1adc('0x16')],![])){this[_0x1adc('0x7')]['agents'][this[_0x1adc('0x6')]['id']][_0x1adc('0x17')]=!![];this[_0x1adc('0x7')][_0x1adc('0x13')][this[_0x1adc('0x6')]['id']][_0x1adc('0x18')]=undefined;util[_0x1adc('0x19')](this['notificationId'],this[_0x1adc('0x5')]['id'],this[_0x1adc('0x7')][_0x1adc('0x13')][this['agent']['id']],null,this['routing']);util[_0x1adc('0x1a')](this[_0x1adc('0x5')]['id'],this[_0x1adc('0x7')]['agents'][this['agent']['id']],_0x1adc('0x1b')+(this[_0x1adc('0x3')][_0x1adc('0x15')]?':FORCED':''));}else{logger[_0x1adc('0x10')](_0x1adc('0x1c'),this['squeue']['id'],this[_0x1adc('0x6')]['id']);setTimeout(this['push'][_0x1adc('0xb')](this),0x3e8);}}};Agent[_0x1adc('0xf')][_0x1adc('0xa')]=function(_0x5b6cc1){if(_['isNil'](this['realtime'][_0x1adc('0x13')][this[_0x1adc('0x6')]['id']])){return logger[_0x1adc('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x1adc('0x5')]['id'],this[_0x1adc('0x6')]['id']);}else{logger[_0x1adc('0x10')](_0x1adc('0x1d'),this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0x1adc('0x4')],this[_0x1adc('0x5')]['id'],this['realtime'][_0x1adc('0x13')][this[_0x1adc('0x6')]['id']],null,this[_0x1adc('0x3')]);this['realtime'][_0x1adc('0x13')][this[_0x1adc('0x6')]['id']]['busy']=![];this[_0x1adc('0x7')]['agents'][this[_0x1adc('0x6')]['id']][_0x1adc('0x18')]=undefined;util[_0x1adc('0x1a')](this[_0x1adc('0x5')]['id'],this[_0x1adc('0x7')][_0x1adc('0x13')][this[_0x1adc('0x6')]['id']],_0x5b6cc1?'STOP':'TIMEOUT');}if(!_0x5b6cc1){setTimeout(this[_0x1adc('0x8')]['bind'](this),0x3e8);}};function agent(_0x37ffb2,_0x3359e1,_0xec452,_0x207cba){return new Agent(_0x37ffb2,_0x3359e1,_0xec452,_0x207cba);}module[_0x1adc('0x1e')]=agent;
\ No newline at end of file