Built motion from commit db94841.|2.5.3
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index 6fa808b..f3081bd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xdf52=['timeout','handleDrained','prototype','handleTimeout','[%s][AGENT]\x20try\x20with\x20%s','isNil','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','agents','channel','busy','busyQueue','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','STOP','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xdf52,0x8b));var _0x2df5=function(_0x50fd6f,_0x124d57){_0x50fd6f=_0x50fd6f-0x0;var _0x29a903=_0xdf52[_0x50fd6f];return _0x29a903;};'use strict';var _=require(_0x2df5('0x0'));var uuid=require(_0x2df5('0x1'));var util=require('./util');var logger=require(_0x2df5('0x2'))(_0x2df5('0x3'));var Agent=function(_0x4e0a4a,_0x4a180d,_0x5edd9e,_0x455781){this[_0x2df5('0x4')]=uuid['v4']();this[_0x2df5('0x5')]=_0x4e0a4a;this[_0x2df5('0x6')]=_0x4a180d;this[_0x2df5('0x7')]=_0x5edd9e;this['routing']=_0x455781;this[_0x2df5('0x5')][_0x2df5('0x8')](this[_0x2df5('0x9')][_0x2df5('0xa')](this),this['handleTimeout']['bind'](this));this[_0x2df5('0x5')]['on'](_0x2df5('0xb'),this['handleTimeout']['bind'](this));this[_0x2df5('0x5')]['on']('drained',this[_0x2df5('0xc')][_0x2df5('0xa')](this));};Agent[_0x2df5('0xd')]['push']=function(){this['squeue'][_0x2df5('0x8')](this[_0x2df5('0x9')][_0x2df5('0xa')](this),this[_0x2df5('0xe')]['bind'](this));};Agent['prototype'][_0x2df5('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0x2df5('0xd')][_0x2df5('0x9')]=function(_0x18f2e7){logger['info'](_0x2df5('0xf'),this[_0x2df5('0x5')]['id'],this[_0x2df5('0x6')]['id']);if(_[_0x2df5('0x10')](this[_0x2df5('0x7')]['agents'][this[_0x2df5('0x6')]['id']])){logger[_0x2df5('0x11')](_0x2df5('0x12'),this['squeue']['id'],this[_0x2df5('0x6')]['id']);setTimeout(this[_0x2df5('0x8')][_0x2df5('0xa')](this),0x3e8);}else{if(this[_0x2df5('0x3')][_0x2df5('0x13')]||util[_0x2df5('0x14')](this[_0x2df5('0x5')]['id'],this['realtime'][_0x2df5('0x15')][this[_0x2df5('0x6')]['id']],this[_0x2df5('0x5')][_0x2df5('0x16')],![])){this['realtime'][_0x2df5('0x15')][this[_0x2df5('0x6')]['id']][_0x2df5('0x17')]=!![];this[_0x2df5('0x7')][_0x2df5('0x15')][this[_0x2df5('0x6')]['id']][_0x2df5('0x18')]=undefined;util['showNotification'](this[_0x2df5('0x4')],this[_0x2df5('0x5')]['id'],this[_0x2df5('0x7')][_0x2df5('0x15')][this[_0x2df5('0x6')]['id']],null,this[_0x2df5('0x3')]);util[_0x2df5('0x19')](this[_0x2df5('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],_0x2df5('0x1a')+(this[_0x2df5('0x3')][_0x2df5('0x13')]?_0x2df5('0x1b'):''));}else{logger[_0x2df5('0x11')](_0x2df5('0x1c'),this[_0x2df5('0x5')]['id'],this[_0x2df5('0x6')]['id']);setTimeout(this['push'][_0x2df5('0xa')](this),0x3e8);}}};Agent['prototype'][_0x2df5('0xe')]=function(_0x52fc33){if(_[_0x2df5('0x10')](this[_0x2df5('0x7')][_0x2df5('0x15')][this['agent']['id']])){return logger[_0x2df5('0x11')](_0x2df5('0x12'),this[_0x2df5('0x5')]['id'],this[_0x2df5('0x6')]['id']);}else{logger[_0x2df5('0x11')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this['agent']['id']);util['hideNotification'](this[_0x2df5('0x4')],this[_0x2df5('0x5')]['id'],this[_0x2df5('0x7')]['agents'][this['agent']['id']],null,this[_0x2df5('0x3')]);this[_0x2df5('0x7')][_0x2df5('0x15')][this['agent']['id']][_0x2df5('0x17')]=![];this[_0x2df5('0x7')]['agents'][this[_0x2df5('0x6')]['id']][_0x2df5('0x18')]=undefined;util[_0x2df5('0x19')](this[_0x2df5('0x5')]['id'],this[_0x2df5('0x7')][_0x2df5('0x15')][this[_0x2df5('0x6')]['id']],_0x52fc33?_0x2df5('0x1d'):'TIMEOUT');}if(!_0x52fc33){setTimeout(this[_0x2df5('0x8')][_0x2df5('0xa')](this),0x3e8);}};function agent(_0xf5512e,_0x42b0c5,_0x27e2ac,_0x4775a0){return new Agent(_0xf5512e,_0x42b0c5,_0x27e2ac,_0x4775a0);}module['exports']=agent;
\ No newline at end of file
+var _0x2751=[':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','routing','busy','busyQueue','STOP','TIMEOUT','exports','lodash','uuid','./util','notificationId','squeue','agent','realtime','bind','handleTimeout','drained','handleDrained','handleRun','prototype','isNil','agents','info','push','isAgentAvailable','writeLog','forcedOwnership'];(function(_0x1a6143,_0x4b107f){var _0x199684=function(_0x1fae6a){while(--_0x1fae6a){_0x1a6143['push'](_0x1a6143['shift']());}};_0x199684(++_0x4b107f);}(_0x2751,0xbe));var _0x1275=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2751[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1275('0x0'));var uuid=require(_0x1275('0x1'));var util=require(_0x1275('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x4b9837,_0x16cf01,_0x54f70d,_0x2221fe){this[_0x1275('0x3')]=uuid['v4']();this[_0x1275('0x4')]=_0x4b9837;this[_0x1275('0x5')]=_0x16cf01;this[_0x1275('0x6')]=_0x54f70d;this['routing']=_0x2221fe;this[_0x1275('0x4')]['push'](this['handleRun']['bind'](this),this['handleTimeout'][_0x1275('0x7')](this));this[_0x1275('0x4')]['on']('timeout',this[_0x1275('0x8')][_0x1275('0x7')](this));this[_0x1275('0x4')]['on'](_0x1275('0x9'),this[_0x1275('0xa')]['bind'](this));};Agent['prototype']['push']=function(){this['squeue']['push'](this[_0x1275('0xb')]['bind'](this),this[_0x1275('0x8')]['bind'](this));};Agent[_0x1275('0xc')][_0x1275('0xa')]=function(){this[_0x1275('0x8')](!![]);};Agent['prototype'][_0x1275('0xb')]=function(_0x37e4d5){logger['info']('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_[_0x1275('0xd')](this[_0x1275('0x6')][_0x1275('0xe')][this[_0x1275('0x5')]['id']])){logger[_0x1275('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x1275('0x4')]['id'],this[_0x1275('0x5')]['id']);setTimeout(this[_0x1275('0x10')][_0x1275('0x7')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x1275('0x11')](this['squeue']['id'],this[_0x1275('0x6')][_0x1275('0xe')][this[_0x1275('0x5')]['id']],this[_0x1275('0x4')]['channel'],![])){this['realtime']['agents'][this[_0x1275('0x5')]['id']]['busy']=!![];this[_0x1275('0x6')]['agents'][this[_0x1275('0x5')]['id']]['busyQueue']=undefined;util['showNotification'](this['notificationId'],this[_0x1275('0x4')]['id'],this[_0x1275('0x6')][_0x1275('0xe')][this[_0x1275('0x5')]['id']],null,this['routing']);util[_0x1275('0x12')](this['squeue']['id'],this[_0x1275('0x6')][_0x1275('0xe')][this[_0x1275('0x5')]['id']],'RINGING'+(this['routing'][_0x1275('0x13')]?_0x1275('0x14'):''));}else{logger[_0x1275('0xf')](_0x1275('0x15'),this[_0x1275('0x4')]['id'],this[_0x1275('0x5')]['id']);setTimeout(this[_0x1275('0x10')]['bind'](this),0x3e8);}}};Agent[_0x1275('0xc')][_0x1275('0x8')]=function(_0x535600){if(_['isNil'](this[_0x1275('0x6')][_0x1275('0xe')][this[_0x1275('0x5')]['id']])){return logger[_0x1275('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x1275('0x5')]['id']);}else{logger[_0x1275('0xf')](_0x1275('0x16'),this[_0x1275('0x4')]['id'],this[_0x1275('0x5')]['id']);util[_0x1275('0x17')](this[_0x1275('0x3')],this['squeue']['id'],this[_0x1275('0x6')][_0x1275('0xe')][this[_0x1275('0x5')]['id']],null,this[_0x1275('0x18')]);this[_0x1275('0x6')][_0x1275('0xe')][this[_0x1275('0x5')]['id']][_0x1275('0x19')]=![];this[_0x1275('0x6')][_0x1275('0xe')][this[_0x1275('0x5')]['id']][_0x1275('0x1a')]=undefined;util['writeLog'](this[_0x1275('0x4')]['id'],this[_0x1275('0x6')][_0x1275('0xe')][this[_0x1275('0x5')]['id']],_0x535600?_0x1275('0x1b'):_0x1275('0x1c'));}if(!_0x535600){setTimeout(this[_0x1275('0x10')][_0x1275('0x7')](this),0x3e8);}};function agent(_0x59bb99,_0xef2b05,_0x27a4fc,_0x7ebbe5){return new Agent(_0x59bb99,_0xef2b05,_0x27a4fc,_0x7ebbe5);}module[_0x1275('0x1d')]=agent;
\ No newline at end of file