Built motion from commit (unavailable).|2.5.30
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index 077c373..ad32a2c 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4b79=['bind','handleTimeout','timeout','drained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','push','routing','forcedOwnership','isAgentAvailable','busy','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','handleRun'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x4b79,0xdf));var _0x94b7=function(_0x44cf50,_0x5bbab4){_0x44cf50=_0x44cf50-0x0;var _0x46461c=_0x4b79[_0x44cf50];return _0x46461c;};'use strict';var _=require(_0x94b7('0x0'));var uuid=require(_0x94b7('0x1'));var util=require(_0x94b7('0x2'));var logger=require(_0x94b7('0x3'))('routing');var Agent=function(_0xf688f0,_0x3cd09d,_0x256c3e,_0x40479c){this[_0x94b7('0x4')]=uuid['v4']();this[_0x94b7('0x5')]=_0xf688f0;this[_0x94b7('0x6')]=_0x3cd09d;this['realtime']=_0x256c3e;this['routing']=_0x40479c;this[_0x94b7('0x5')]['push'](this[_0x94b7('0x7')][_0x94b7('0x8')](this),this[_0x94b7('0x9')][_0x94b7('0x8')](this));this[_0x94b7('0x5')]['on'](_0x94b7('0xa'),this['handleTimeout']['bind'](this));this[_0x94b7('0x5')]['on'](_0x94b7('0xb'),this['handleDrained'][_0x94b7('0x8')](this));};Agent['prototype']['push']=function(){this[_0x94b7('0x5')]['push'](this[_0x94b7('0x7')]['bind'](this),this[_0x94b7('0x9')][_0x94b7('0x8')](this));};Agent['prototype']['handleDrained']=function(){this[_0x94b7('0x9')](!![]);};Agent[_0x94b7('0xc')][_0x94b7('0x7')]=function(_0x56a087){logger[_0x94b7('0xd')](_0x94b7('0xe'),this['squeue']['id'],this[_0x94b7('0x6')]['id']);if(_[_0x94b7('0xf')](this[_0x94b7('0x10')][_0x94b7('0x11')][this['agent']['id']])){logger[_0x94b7('0xd')](_0x94b7('0x12'),this['squeue']['id'],this[_0x94b7('0x6')]['id']);setTimeout(this[_0x94b7('0x13')]['bind'](this),0x3e8);}else{if(this[_0x94b7('0x14')][_0x94b7('0x15')]||util[_0x94b7('0x16')](this[_0x94b7('0x5')]['id'],this[_0x94b7('0x10')][_0x94b7('0x11')][this[_0x94b7('0x6')]['id']],this['squeue']['channel'],![])){this['realtime'][_0x94b7('0x11')][this[_0x94b7('0x6')]['id']][_0x94b7('0x17')]=!![];this[_0x94b7('0x10')][_0x94b7('0x11')][this[_0x94b7('0x6')]['id']]['busyQueue']=undefined;util[_0x94b7('0x18')](this[_0x94b7('0x4')],this[_0x94b7('0x5')]['id'],this[_0x94b7('0x10')][_0x94b7('0x11')][this['agent']['id']],null,this[_0x94b7('0x14')]);util[_0x94b7('0x19')](this[_0x94b7('0x5')]['id'],this[_0x94b7('0x10')][_0x94b7('0x11')][this['agent']['id']],_0x94b7('0x1a')+(this[_0x94b7('0x14')][_0x94b7('0x15')]?_0x94b7('0x1b'):''));}else{logger[_0x94b7('0xd')](_0x94b7('0x1c'),this[_0x94b7('0x5')]['id'],this['agent']['id']);setTimeout(this['push'][_0x94b7('0x8')](this),0x3e8);}}};Agent[_0x94b7('0xc')][_0x94b7('0x9')]=function(_0x2852f6){if(_[_0x94b7('0xf')](this[_0x94b7('0x10')][_0x94b7('0x11')][this[_0x94b7('0x6')]['id']])){return logger[_0x94b7('0xd')](_0x94b7('0x12'),this['squeue']['id'],this[_0x94b7('0x6')]['id']);}else{logger[_0x94b7('0xd')](_0x94b7('0x1d'),this[_0x94b7('0x5')]['id'],this[_0x94b7('0x6')]['id']);util[_0x94b7('0x1e')](this[_0x94b7('0x4')],this[_0x94b7('0x5')]['id'],this[_0x94b7('0x10')]['agents'][this['agent']['id']],null,this[_0x94b7('0x14')]);this[_0x94b7('0x10')][_0x94b7('0x11')][this[_0x94b7('0x6')]['id']][_0x94b7('0x17')]=![];this['realtime'][_0x94b7('0x11')][this['agent']['id']]['busyQueue']=undefined;util[_0x94b7('0x19')](this['squeue']['id'],this[_0x94b7('0x10')]['agents'][this[_0x94b7('0x6')]['id']],_0x2852f6?_0x94b7('0x1f'):'TIMEOUT');}if(!_0x2852f6){setTimeout(this[_0x94b7('0x13')][_0x94b7('0x8')](this),0x3e8);}};function agent(_0x4af654,_0x31a791,_0x3b91ec,_0x3c99b8){return new Agent(_0x4af654,_0x31a791,_0x3b91ec,_0x3c99b8);}module[_0x94b7('0x20')]=agent;
\ No newline at end of file
+var _0xd0bb=['bind','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agent','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','handleTimeout'];(function(_0x2ab042,_0x21a39b){var _0x2a2b97=function(_0x206446){while(--_0x206446){_0x2ab042['push'](_0x2ab042['shift']());}};_0x2a2b97(++_0x21a39b);}(_0xd0bb,0x9c));var _0xbd0b=function(_0x3eb450,_0x592b0a){_0x3eb450=_0x3eb450-0x0;var _0x2c4cfd=_0xd0bb[_0x3eb450];return _0x2c4cfd;};'use strict';var _=require('lodash');var uuid=require(_0xbd0b('0x0'));var util=require('./util');var logger=require(_0xbd0b('0x1'))(_0xbd0b('0x2'));var Agent=function(_0x29ffbb,_0x1feb16,_0x27c438,_0x45bede){this[_0xbd0b('0x3')]=uuid['v4']();this[_0xbd0b('0x4')]=_0x29ffbb;this['agent']=_0x1feb16;this[_0xbd0b('0x5')]=_0x27c438;this[_0xbd0b('0x2')]=_0x45bede;this[_0xbd0b('0x4')][_0xbd0b('0x6')](this[_0xbd0b('0x7')]['bind'](this),this[_0xbd0b('0x8')][_0xbd0b('0x9')](this));this[_0xbd0b('0x4')]['on']('timeout',this[_0xbd0b('0x8')][_0xbd0b('0x9')](this));this[_0xbd0b('0x4')]['on'](_0xbd0b('0xa'),this[_0xbd0b('0xb')][_0xbd0b('0x9')](this));};Agent['prototype']['push']=function(){this[_0xbd0b('0x4')][_0xbd0b('0x6')](this[_0xbd0b('0x7')]['bind'](this),this[_0xbd0b('0x8')][_0xbd0b('0x9')](this));};Agent[_0xbd0b('0xc')][_0xbd0b('0xb')]=function(){this[_0xbd0b('0x8')](!![]);};Agent[_0xbd0b('0xc')][_0xbd0b('0x7')]=function(_0xf2b56){logger[_0xbd0b('0xd')](_0xbd0b('0xe'),this[_0xbd0b('0x4')]['id'],this[_0xbd0b('0xf')]['id']);if(_['isNil'](this[_0xbd0b('0x5')][_0xbd0b('0x10')][this['agent']['id']])){logger[_0xbd0b('0xd')](_0xbd0b('0x11'),this[_0xbd0b('0x4')]['id'],this[_0xbd0b('0xf')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this['routing'][_0xbd0b('0x12')]||util[_0xbd0b('0x13')](this[_0xbd0b('0x4')]['id'],this[_0xbd0b('0x5')][_0xbd0b('0x10')][this[_0xbd0b('0xf')]['id']],this[_0xbd0b('0x4')][_0xbd0b('0x14')],![])){this['realtime']['agents'][this[_0xbd0b('0xf')]['id']][_0xbd0b('0x15')]=!![];this[_0xbd0b('0x5')]['agents'][this[_0xbd0b('0xf')]['id']][_0xbd0b('0x16')]=undefined;util[_0xbd0b('0x17')](this[_0xbd0b('0x3')],this[_0xbd0b('0x4')]['id'],this[_0xbd0b('0x5')]['agents'][this[_0xbd0b('0xf')]['id']],null,this['routing']);util['writeLog'](this[_0xbd0b('0x4')]['id'],this[_0xbd0b('0x5')][_0xbd0b('0x10')][this['agent']['id']],_0xbd0b('0x18')+(this['routing'][_0xbd0b('0x12')]?_0xbd0b('0x19'):''));}else{logger[_0xbd0b('0xd')](_0xbd0b('0x1a'),this[_0xbd0b('0x4')]['id'],this[_0xbd0b('0xf')]['id']);setTimeout(this['push'][_0xbd0b('0x9')](this),0x3e8);}}};Agent[_0xbd0b('0xc')][_0xbd0b('0x8')]=function(_0x9e3eab){if(_[_0xbd0b('0x1b')](this[_0xbd0b('0x5')][_0xbd0b('0x10')][this['agent']['id']])){return logger[_0xbd0b('0xd')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbd0b('0x4')]['id'],this['agent']['id']);}else{logger['info'](_0xbd0b('0x1c'),this[_0xbd0b('0x4')]['id'],this[_0xbd0b('0xf')]['id']);util['hideNotification'](this[_0xbd0b('0x3')],this['squeue']['id'],this[_0xbd0b('0x5')][_0xbd0b('0x10')][this[_0xbd0b('0xf')]['id']],null,this[_0xbd0b('0x2')]);this['realtime'][_0xbd0b('0x10')][this[_0xbd0b('0xf')]['id']]['busy']=![];this['realtime']['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0xbd0b('0x1d')](this[_0xbd0b('0x4')]['id'],this['realtime'][_0xbd0b('0x10')][this['agent']['id']],_0x9e3eab?_0xbd0b('0x1e'):_0xbd0b('0x1f'));}if(!_0x9e3eab){setTimeout(this[_0xbd0b('0x6')][_0xbd0b('0x9')](this),0x3e8);}};function agent(_0xadfc45,_0x18fbf5,_0x17a796,_0x1c899f){return new Agent(_0xadfc45,_0x18fbf5,_0x17a796,_0x1c899f);}module[_0xbd0b('0x20')]=agent;
\ No newline at end of file