Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index 8054177..8bb8569 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5e24=['RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','hideNotification','STOP','TIMEOUT','lodash','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','handleRun','handleTimeout','bind','timeout','drained','push','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','busy','busyQueue','showNotification','writeLog'];(function(_0x2d2a4f,_0xd30b5e){var _0x5c430e=function(_0x3359be){while(--_0x3359be){_0x2d2a4f['push'](_0x2d2a4f['shift']());}};_0x5c430e(++_0xd30b5e);}(_0x5e24,0x1e6));var _0x45e2=function(_0x2123e2,_0x35c3d7){_0x2123e2=_0x2123e2-0x0;var _0x8f317c=_0x5e24[_0x2123e2];return _0x8f317c;};'use strict';var _=require(_0x45e2('0x0'));var uuid=require(_0x45e2('0x1'));var util=require('./util');var logger=require(_0x45e2('0x2'))(_0x45e2('0x3'));var Agent=function(_0x9ff310,_0x544731,_0x318274,_0x25adca){this[_0x45e2('0x4')]=uuid['v4']();this['squeue']=_0x9ff310;this[_0x45e2('0x5')]=_0x544731;this[_0x45e2('0x6')]=_0x318274;this['routing']=_0x25adca;this[_0x45e2('0x7')]['push'](this[_0x45e2('0x8')]['bind'](this),this[_0x45e2('0x9')][_0x45e2('0xa')](this));this[_0x45e2('0x7')]['on'](_0x45e2('0xb'),this['handleTimeout']['bind'](this));this[_0x45e2('0x7')]['on'](_0x45e2('0xc'),this['handleDrained']['bind'](this));};Agent['prototype'][_0x45e2('0xd')]=function(){this[_0x45e2('0x7')][_0x45e2('0xd')](this[_0x45e2('0x8')]['bind'](this),this[_0x45e2('0x9')]['bind'](this));};Agent[_0x45e2('0xe')]['handleDrained']=function(){this[_0x45e2('0x9')](!![]);};Agent['prototype'][_0x45e2('0x8')]=function(_0x461860){logger[_0x45e2('0xf')](_0x45e2('0x10'),this[_0x45e2('0x7')]['id'],this[_0x45e2('0x5')]['id']);if(_[_0x45e2('0x11')](this[_0x45e2('0x6')]['agents'][this[_0x45e2('0x5')]['id']])){logger[_0x45e2('0xf')](_0x45e2('0x12'),this['squeue']['id'],this[_0x45e2('0x5')]['id']);setTimeout(this['push'][_0x45e2('0xa')](this),0x3e8);}else{if(this['routing'][_0x45e2('0x13')]||util[_0x45e2('0x14')](this[_0x45e2('0x7')]['id'],this['realtime']['agents'][this['agent']['id']],this[_0x45e2('0x7')]['channel'],![])){this['realtime'][_0x45e2('0x15')][this[_0x45e2('0x5')]['id']][_0x45e2('0x16')]=!![];this[_0x45e2('0x6')]['agents'][this[_0x45e2('0x5')]['id']][_0x45e2('0x17')]=undefined;util[_0x45e2('0x18')](this[_0x45e2('0x4')],this['squeue']['id'],this[_0x45e2('0x6')]['agents'][this[_0x45e2('0x5')]['id']],null,this[_0x45e2('0x3')]);util[_0x45e2('0x19')](this[_0x45e2('0x7')]['id'],this[_0x45e2('0x6')]['agents'][this['agent']['id']],_0x45e2('0x1a')+(this[_0x45e2('0x3')][_0x45e2('0x13')]?_0x45e2('0x1b'):''));}else{logger[_0x45e2('0xf')](_0x45e2('0x1c'),this[_0x45e2('0x7')]['id'],this[_0x45e2('0x5')]['id']);setTimeout(this['push'][_0x45e2('0xa')](this),0x3e8);}}};Agent[_0x45e2('0xe')][_0x45e2('0x9')]=function(_0x6375bf){if(_[_0x45e2('0x11')](this[_0x45e2('0x6')][_0x45e2('0x15')][this[_0x45e2('0x5')]['id']])){return logger[_0x45e2('0xf')](_0x45e2('0x12'),this['squeue']['id'],this[_0x45e2('0x5')]['id']);}else{logger[_0x45e2('0xf')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x45e2('0x7')]['id'],this[_0x45e2('0x5')]['id']);util[_0x45e2('0x1d')](this[_0x45e2('0x4')],this[_0x45e2('0x7')]['id'],this[_0x45e2('0x6')][_0x45e2('0x15')][this[_0x45e2('0x5')]['id']],null,this[_0x45e2('0x3')]);this[_0x45e2('0x6')][_0x45e2('0x15')][this[_0x45e2('0x5')]['id']][_0x45e2('0x16')]=![];this[_0x45e2('0x6')][_0x45e2('0x15')][this[_0x45e2('0x5')]['id']]['busyQueue']=undefined;util[_0x45e2('0x19')](this[_0x45e2('0x7')]['id'],this['realtime']['agents'][this['agent']['id']],_0x6375bf?_0x45e2('0x1e'):_0x45e2('0x1f'));}if(!_0x6375bf){setTimeout(this[_0x45e2('0xd')]['bind'](this),0x3e8);}};function agent(_0x383211,_0x2e3698,_0x1101e6,_0x4a8035){return new Agent(_0x383211,_0x2e3698,_0x1101e6,_0x4a8035);}module['exports']=agent;
\ No newline at end of file
+var _0x2285=['exports','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','notificationId','STOP','TIMEOUT'];(function(_0x17a1a8,_0x15056a){var _0x1aa85d=function(_0x484816){while(--_0x484816){_0x17a1a8['push'](_0x17a1a8['shift']());}};_0x1aa85d(++_0x15056a);}(_0x2285,0x177));var _0x5228=function(_0x13448e,_0x5bb123){_0x13448e=_0x13448e-0x0;var _0x1b46aa=_0x2285[_0x13448e];return _0x1b46aa;};'use strict';var _=require('lodash');var uuid=require(_0x5228('0x0'));var util=require(_0x5228('0x1'));var logger=require(_0x5228('0x2'))(_0x5228('0x3'));var Agent=function(_0x3d4b29,_0x4f0eae,_0x2cb384,_0x527cb3){this['notificationId']=uuid['v4']();this[_0x5228('0x4')]=_0x3d4b29;this[_0x5228('0x5')]=_0x4f0eae;this[_0x5228('0x6')]=_0x2cb384;this['routing']=_0x527cb3;this[_0x5228('0x4')][_0x5228('0x7')](this[_0x5228('0x8')][_0x5228('0x9')](this),this[_0x5228('0xa')][_0x5228('0x9')](this));this[_0x5228('0x4')]['on'](_0x5228('0xb'),this[_0x5228('0xa')][_0x5228('0x9')](this));this['squeue']['on'](_0x5228('0xc'),this[_0x5228('0xd')][_0x5228('0x9')](this));};Agent[_0x5228('0xe')]['push']=function(){this[_0x5228('0x4')][_0x5228('0x7')](this[_0x5228('0x8')][_0x5228('0x9')](this),this['handleTimeout'][_0x5228('0x9')](this));};Agent[_0x5228('0xe')][_0x5228('0xd')]=function(){this[_0x5228('0xa')](!![]);};Agent[_0x5228('0xe')][_0x5228('0x8')]=function(_0x4d74d7){logger[_0x5228('0xf')](_0x5228('0x10'),this['squeue']['id'],this[_0x5228('0x5')]['id']);if(_[_0x5228('0x11')](this['realtime'][_0x5228('0x12')][this[_0x5228('0x5')]['id']])){logger[_0x5228('0xf')](_0x5228('0x13'),this['squeue']['id'],this[_0x5228('0x5')]['id']);setTimeout(this[_0x5228('0x7')]['bind'](this),0x3e8);}else{if(this[_0x5228('0x3')][_0x5228('0x14')]||util[_0x5228('0x15')](this['squeue']['id'],this[_0x5228('0x6')]['agents'][this[_0x5228('0x5')]['id']],this[_0x5228('0x4')][_0x5228('0x16')],![])){this['realtime'][_0x5228('0x12')][this[_0x5228('0x5')]['id']][_0x5228('0x17')]=!![];this[_0x5228('0x6')]['agents'][this['agent']['id']][_0x5228('0x18')]=undefined;util[_0x5228('0x19')](this['notificationId'],this[_0x5228('0x4')]['id'],this[_0x5228('0x6')][_0x5228('0x12')][this[_0x5228('0x5')]['id']],null,this[_0x5228('0x3')]);util[_0x5228('0x1a')](this[_0x5228('0x4')]['id'],this['realtime'][_0x5228('0x12')][this['agent']['id']],_0x5228('0x1b')+(this[_0x5228('0x3')]['forcedOwnership']?':FORCED':''));}else{logger['info'](_0x5228('0x1c'),this[_0x5228('0x4')]['id'],this[_0x5228('0x5')]['id']);setTimeout(this['push'][_0x5228('0x9')](this),0x3e8);}}};Agent[_0x5228('0xe')][_0x5228('0xa')]=function(_0x5dcac9){if(_[_0x5228('0x11')](this[_0x5228('0x6')][_0x5228('0x12')][this[_0x5228('0x5')]['id']])){return logger[_0x5228('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x5228('0x4')]['id'],this[_0x5228('0x5')]['id']);}else{logger[_0x5228('0xf')](_0x5228('0x1d'),this[_0x5228('0x4')]['id'],this['agent']['id']);util['hideNotification'](this[_0x5228('0x1e')],this[_0x5228('0x4')]['id'],this['realtime']['agents'][this[_0x5228('0x5')]['id']],null,this['routing']);this[_0x5228('0x6')][_0x5228('0x12')][this['agent']['id']][_0x5228('0x17')]=![];this['realtime']['agents'][this[_0x5228('0x5')]['id']][_0x5228('0x18')]=undefined;util[_0x5228('0x1a')](this[_0x5228('0x4')]['id'],this['realtime'][_0x5228('0x12')][this[_0x5228('0x5')]['id']],_0x5dcac9?_0x5228('0x1f'):_0x5228('0x20'));}if(!_0x5dcac9){setTimeout(this[_0x5228('0x7')][_0x5228('0x9')](this),0x3e8);}};function agent(_0x4b9b52,_0x26d31b,_0x5dce78,_0x1ca305){return new Agent(_0x4b9b52,_0x26d31b,_0x5dce78,_0x1ca305);}module[_0x5228('0x21')]=agent;
\ No newline at end of file