Built motion from commit (unavailable).|2.2.0
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index 3a4a2a5..a4172f6 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2085=['STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','realtime','push','handleRun','bind','squeue','timeout','handleTimeout','drained','prototype','handleDrained','info','isNil','agents','agent','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification'];(function(_0x435a2e,_0x2239a3){var _0x3d163f=function(_0x377bee){while(--_0x377bee){_0x435a2e['push'](_0x435a2e['shift']());}};_0x3d163f(++_0x2239a3);}(_0x2085,0x13e));var _0x5208=function(_0x30ad27,_0x750e0f){_0x30ad27=_0x30ad27-0x0;var _0x42242a=_0x2085[_0x30ad27];return _0x42242a;};'use strict';var _=require(_0x5208('0x0'));var uuid=require(_0x5208('0x1'));var util=require(_0x5208('0x2'));var logger=require(_0x5208('0x3'))(_0x5208('0x4'));var Agent=function(_0x29a5a6,_0x300e96,_0x359b3f,_0x31253e){this[_0x5208('0x5')]=uuid['v4']();this['squeue']=_0x29a5a6;this['agent']=_0x300e96;this[_0x5208('0x6')]=_0x359b3f;this['routing']=_0x31253e;this['squeue'][_0x5208('0x7')](this[_0x5208('0x8')][_0x5208('0x9')](this),this['handleTimeout'][_0x5208('0x9')](this));this[_0x5208('0xa')]['on'](_0x5208('0xb'),this[_0x5208('0xc')][_0x5208('0x9')](this));this[_0x5208('0xa')]['on'](_0x5208('0xd'),this['handleDrained']['bind'](this));};Agent[_0x5208('0xe')][_0x5208('0x7')]=function(){this[_0x5208('0xa')][_0x5208('0x7')](this['handleRun'][_0x5208('0x9')](this),this['handleTimeout'][_0x5208('0x9')](this));};Agent[_0x5208('0xe')][_0x5208('0xf')]=function(){this[_0x5208('0xc')](!![]);};Agent['prototype'][_0x5208('0x8')]=function(_0x19e00f){logger[_0x5208('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this['squeue']['id'],this['agent']['id']);if(_[_0x5208('0x11')](this[_0x5208('0x6')][_0x5208('0x12')][this[_0x5208('0x13')]['id']])){logger[_0x5208('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x5208('0xa')]['id'],this['agent']['id']);setTimeout(this[_0x5208('0x7')]['bind'](this),0x3e8);}else{if(this[_0x5208('0x4')][_0x5208('0x14')]||util[_0x5208('0x15')](this[_0x5208('0xa')]['id'],this[_0x5208('0x6')][_0x5208('0x12')][this[_0x5208('0x13')]['id']],this['squeue']['channel'],![])){this['realtime']['agents'][this[_0x5208('0x13')]['id']][_0x5208('0x16')]=!![];this['realtime'][_0x5208('0x12')][this[_0x5208('0x13')]['id']][_0x5208('0x17')]=undefined;util[_0x5208('0x18')](this[_0x5208('0x5')],this[_0x5208('0xa')]['id'],this[_0x5208('0x6')][_0x5208('0x12')][this[_0x5208('0x13')]['id']],null,this[_0x5208('0x4')]);util[_0x5208('0x19')](this['squeue']['id'],this['realtime']['agents'][this['agent']['id']],_0x5208('0x1a')+(this[_0x5208('0x4')][_0x5208('0x14')]?_0x5208('0x1b'):''));}else{logger[_0x5208('0x10')](_0x5208('0x1c'),this[_0x5208('0xa')]['id'],this[_0x5208('0x13')]['id']);setTimeout(this[_0x5208('0x7')][_0x5208('0x9')](this),0x3e8);}}};Agent[_0x5208('0xe')][_0x5208('0xc')]=function(_0x20105f){if(_[_0x5208('0x11')](this[_0x5208('0x6')][_0x5208('0x12')][this[_0x5208('0x13')]['id']])){return logger['info'](_0x5208('0x1d'),this[_0x5208('0xa')]['id'],this[_0x5208('0x13')]['id']);}else{logger[_0x5208('0x10')](_0x5208('0x1e'),this['squeue']['id'],this[_0x5208('0x13')]['id']);util[_0x5208('0x1f')](this[_0x5208('0x5')],this['squeue']['id'],this[_0x5208('0x6')][_0x5208('0x12')][this['agent']['id']],null,this['routing']);this[_0x5208('0x6')][_0x5208('0x12')][this[_0x5208('0x13')]['id']]['busy']=![];this[_0x5208('0x6')][_0x5208('0x12')][this['agent']['id']][_0x5208('0x17')]=undefined;util[_0x5208('0x19')](this[_0x5208('0xa')]['id'],this[_0x5208('0x6')]['agents'][this[_0x5208('0x13')]['id']],_0x20105f?_0x5208('0x20'):_0x5208('0x21'));}if(!_0x20105f){setTimeout(this[_0x5208('0x7')][_0x5208('0x9')](this),0x3e8);}};function agent(_0x43f1d3,_0xac2987,_0x53ec2b,_0x33ce72){return new Agent(_0x43f1d3,_0xac2987,_0x53ec2b,_0x33ce72);}module[_0x5208('0x22')]=agent;
\ No newline at end of file
+var _0x4256=['RINGING',':FORCED','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','busyQueue','showNotification','writeLog'];(function(_0x16ce17,_0x534653){var _0x107fc3=function(_0x543df2){while(--_0x543df2){_0x16ce17['push'](_0x16ce17['shift']());}};_0x107fc3(++_0x534653);}(_0x4256,0xce));var _0x6425=function(_0xa2c0a3,_0x5bbac0){_0xa2c0a3=_0xa2c0a3-0x0;var _0x52c618=_0x4256[_0xa2c0a3];return _0x52c618;};'use strict';var _=require('lodash');var uuid=require(_0x6425('0x0'));var util=require(_0x6425('0x1'));var logger=require(_0x6425('0x2'))(_0x6425('0x3'));var Agent=function(_0x39133b,_0xf0b1f8,_0x6dc061,_0x16f721){this[_0x6425('0x4')]=uuid['v4']();this[_0x6425('0x5')]=_0x39133b;this[_0x6425('0x6')]=_0xf0b1f8;this[_0x6425('0x7')]=_0x6dc061;this['routing']=_0x16f721;this[_0x6425('0x5')][_0x6425('0x8')](this[_0x6425('0x9')][_0x6425('0xa')](this),this[_0x6425('0xb')]['bind'](this));this['squeue']['on']('timeout',this[_0x6425('0xb')][_0x6425('0xa')](this));this[_0x6425('0x5')]['on'](_0x6425('0xc'),this[_0x6425('0xd')][_0x6425('0xa')](this));};Agent[_0x6425('0xe')][_0x6425('0x8')]=function(){this[_0x6425('0x5')][_0x6425('0x8')](this[_0x6425('0x9')][_0x6425('0xa')](this),this['handleTimeout']['bind'](this));};Agent[_0x6425('0xe')][_0x6425('0xd')]=function(){this[_0x6425('0xb')](!![]);};Agent[_0x6425('0xe')][_0x6425('0x9')]=function(_0x397cbb){logger[_0x6425('0xf')](_0x6425('0x10'),this[_0x6425('0x5')]['id'],this[_0x6425('0x6')]['id']);if(_['isNil'](this[_0x6425('0x7')][_0x6425('0x11')][this[_0x6425('0x6')]['id']])){logger[_0x6425('0xf')](_0x6425('0x12'),this[_0x6425('0x5')]['id'],this[_0x6425('0x6')]['id']);setTimeout(this[_0x6425('0x8')]['bind'](this),0x3e8);}else{if(this['routing'][_0x6425('0x13')]||util[_0x6425('0x14')](this[_0x6425('0x5')]['id'],this[_0x6425('0x7')]['agents'][this[_0x6425('0x6')]['id']],this[_0x6425('0x5')]['channel'],![])){this[_0x6425('0x7')][_0x6425('0x11')][this[_0x6425('0x6')]['id']][_0x6425('0x15')]=!![];this['realtime'][_0x6425('0x11')][this[_0x6425('0x6')]['id']][_0x6425('0x16')]=undefined;util[_0x6425('0x17')](this[_0x6425('0x4')],this[_0x6425('0x5')]['id'],this[_0x6425('0x7')][_0x6425('0x11')][this[_0x6425('0x6')]['id']],null,this[_0x6425('0x3')]);util[_0x6425('0x18')](this[_0x6425('0x5')]['id'],this['realtime'][_0x6425('0x11')][this[_0x6425('0x6')]['id']],_0x6425('0x19')+(this[_0x6425('0x3')][_0x6425('0x13')]?_0x6425('0x1a'):''));}else{logger[_0x6425('0xf')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x6425('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x6425('0x8')][_0x6425('0xa')](this),0x3e8);}}};Agent[_0x6425('0xe')][_0x6425('0xb')]=function(_0x1fcf75){if(_[_0x6425('0x1b')](this[_0x6425('0x7')][_0x6425('0x11')][this[_0x6425('0x6')]['id']])){return logger['info'](_0x6425('0x12'),this['squeue']['id'],this[_0x6425('0x6')]['id']);}else{logger[_0x6425('0xf')](_0x6425('0x1c'),this[_0x6425('0x5')]['id'],this['agent']['id']);util[_0x6425('0x1d')](this[_0x6425('0x4')],this[_0x6425('0x5')]['id'],this[_0x6425('0x7')][_0x6425('0x11')][this[_0x6425('0x6')]['id']],null,this[_0x6425('0x3')]);this[_0x6425('0x7')]['agents'][this['agent']['id']]['busy']=![];this['realtime'][_0x6425('0x11')][this[_0x6425('0x6')]['id']][_0x6425('0x16')]=undefined;util[_0x6425('0x18')](this[_0x6425('0x5')]['id'],this[_0x6425('0x7')][_0x6425('0x11')][this[_0x6425('0x6')]['id']],_0x1fcf75?_0x6425('0x1e'):_0x6425('0x1f'));}if(!_0x1fcf75){setTimeout(this[_0x6425('0x8')][_0x6425('0xa')](this),0x3e8);}};function agent(_0x472e93,_0x108758,_0x25a003,_0x3676c2){return new Agent(_0x472e93,_0x108758,_0x25a003,_0x3676c2);}module[_0x6425('0x20')]=agent;
\ No newline at end of file