Built motion from commit d6d69adf.|2.6.33
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index 5b22092..1d40d11 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x34e8=['busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','notificationId','squeue','agent','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel'];(function(_0x46cf00,_0x457a43){var _0x3974dc=function(_0x4b5d0a){while(--_0x4b5d0a){_0x46cf00['push'](_0x46cf00['shift']());}};_0x3974dc(++_0x457a43);}(_0x34e8,0x12c));var _0x834e=function(_0x7fe28e,_0x296bb0){_0x7fe28e=_0x7fe28e-0x0;var _0xedfeec=_0x34e8[_0x7fe28e];return _0xedfeec;};'use strict';var _=require(_0x834e('0x0'));var uuid=require(_0x834e('0x1'));var util=require(_0x834e('0x2'));var logger=require(_0x834e('0x3'))('routing');var Agent=function(_0x832422,_0x21e2e0,_0x472111,_0x31bf20){this[_0x834e('0x4')]=uuid['v4']();this[_0x834e('0x5')]=_0x832422;this[_0x834e('0x6')]=_0x21e2e0;this['realtime']=_0x472111;this[_0x834e('0x7')]=_0x31bf20;this['squeue'][_0x834e('0x8')](this[_0x834e('0x9')][_0x834e('0xa')](this),this[_0x834e('0xb')][_0x834e('0xa')](this));this[_0x834e('0x5')]['on'](_0x834e('0xc'),this[_0x834e('0xb')][_0x834e('0xa')](this));this[_0x834e('0x5')]['on'](_0x834e('0xd'),this[_0x834e('0xe')][_0x834e('0xa')](this));};Agent[_0x834e('0xf')][_0x834e('0x8')]=function(){this[_0x834e('0x5')][_0x834e('0x8')](this['handleRun'][_0x834e('0xa')](this),this[_0x834e('0xb')]['bind'](this));};Agent[_0x834e('0xf')][_0x834e('0xe')]=function(){this[_0x834e('0xb')](!![]);};Agent[_0x834e('0xf')]['handleRun']=function(){logger[_0x834e('0x10')](_0x834e('0x11'),this['squeue']['id'],this[_0x834e('0x6')]['id']);if(_['isNil'](this[_0x834e('0x12')][_0x834e('0x13')][this['agent']['id']])){logger[_0x834e('0x10')](_0x834e('0x14'),this[_0x834e('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x834e('0x8')][_0x834e('0xa')](this),0x3e8);}else{if(this[_0x834e('0x7')][_0x834e('0x15')]||util[_0x834e('0x16')](this[_0x834e('0x5')]['id'],this[_0x834e('0x12')]['agents'][this[_0x834e('0x6')]['id']],this[_0x834e('0x5')][_0x834e('0x17')],![])){this[_0x834e('0x12')]['agents'][this[_0x834e('0x6')]['id']][_0x834e('0x18')]=!![];this['realtime'][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x19')]=undefined;util['saveWaitingNotification'](this['realtime'],this[_0x834e('0x7')],this[_0x834e('0x6')],this['squeue'][_0x834e('0x17')]);util[_0x834e('0x1a')](this['notificationId'],this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this['agent']['id']],null,this[_0x834e('0x7')]);util[_0x834e('0x1b')](this['squeue']['id'],this['realtime'][_0x834e('0x13')][this['agent']['id']],_0x834e('0x1c')+(this[_0x834e('0x7')][_0x834e('0x15')]?_0x834e('0x1d'):''));}else{logger[_0x834e('0x10')](_0x834e('0x1e'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x834e('0xf')][_0x834e('0xb')]=function(_0x106d6a){if(_['isNil'](this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']])){return logger[_0x834e('0x10')](_0x834e('0x14'),this[_0x834e('0x5')]['id'],this[_0x834e('0x6')]['id']);}else{logger[_0x834e('0x10')](_0x834e('0x1f'),this['squeue']['id'],this[_0x834e('0x6')]['id']);util['hideNotification'](this[_0x834e('0x4')],this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']],null,this[_0x834e('0x7')]);this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x18')]=![];this['realtime'][_0x834e('0x13')][this[_0x834e('0x6')]['id']][_0x834e('0x19')]=undefined;util[_0x834e('0x20')](this['realtime'],this[_0x834e('0x7')],this[_0x834e('0x6')],this['squeue']['channel']);util['writeLog'](this[_0x834e('0x5')]['id'],this[_0x834e('0x12')][_0x834e('0x13')][this[_0x834e('0x6')]['id']],_0x106d6a?_0x834e('0x21'):_0x834e('0x22'));}if(!_0x106d6a){setTimeout(this['push'][_0x834e('0xa')](this),0x3e8);}};function agent(_0x513f36,_0xe103fe,_0x6a3ac,_0x47abed){return new Agent(_0x513f36,_0xe103fe,_0x6a3ac,_0x47abed);}module[_0x834e('0x23')]=agent;
\ No newline at end of file
+var _0xb458=['[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','squeue','routing','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','agent','isNil','realtime','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','notificationId','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x564390,_0x309f73){var _0x1c740f=function(_0x52b076){while(--_0x52b076){_0x564390['push'](_0x564390['shift']());}};_0x1c740f(++_0x309f73);}(_0xb458,0x103));var _0x8b45=function(_0x9e1984,_0xb2f245){_0x9e1984=_0x9e1984-0x0;var _0x1b0b0b=_0xb458[_0x9e1984];return _0x1b0b0b;};'use strict';var _=require(_0x8b45('0x0'));var uuid=require(_0x8b45('0x1'));var util=require(_0x8b45('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0xdf89d4,_0x93d9cd,_0x141a44,_0x13a8c6){this['notificationId']=uuid['v4']();this[_0x8b45('0x3')]=_0xdf89d4;this['agent']=_0x93d9cd;this['realtime']=_0x141a44;this[_0x8b45('0x4')]=_0x13a8c6;this[_0x8b45('0x3')][_0x8b45('0x5')](this[_0x8b45('0x6')][_0x8b45('0x7')](this),this['handleTimeout'][_0x8b45('0x7')](this));this[_0x8b45('0x3')]['on'](_0x8b45('0x8'),this[_0x8b45('0x9')][_0x8b45('0x7')](this));this['squeue']['on'](_0x8b45('0xa'),this[_0x8b45('0xb')]['bind'](this));};Agent['prototype']['push']=function(){this['squeue'][_0x8b45('0x5')](this[_0x8b45('0x6')][_0x8b45('0x7')](this),this['handleTimeout'][_0x8b45('0x7')](this));};Agent[_0x8b45('0xc')][_0x8b45('0xb')]=function(){this[_0x8b45('0x9')](!![]);};Agent[_0x8b45('0xc')][_0x8b45('0x6')]=function(){logger['debug']('[%s][AGENT]\x20try\x20with\x20%s',this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);if(_[_0x8b45('0xe')](this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']])){logger[_0x8b45('0x11')](_0x8b45('0x12'),this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);setTimeout(this[_0x8b45('0x5')][_0x8b45('0x7')](this),0x3e8);}else{if(this[_0x8b45('0x4')][_0x8b45('0x13')]||util[_0x8b45('0x14')](this[_0x8b45('0x3')]['id'],this[_0x8b45('0xf')][_0x8b45('0x10')][this['agent']['id']],this[_0x8b45('0x3')][_0x8b45('0x15')],![])){this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']][_0x8b45('0x16')]=!![];this[_0x8b45('0xf')][_0x8b45('0x10')][this['agent']['id']]['busyQueue']=undefined;util[_0x8b45('0x17')](this['realtime'],this[_0x8b45('0x4')],this[_0x8b45('0xd')],this[_0x8b45('0x3')][_0x8b45('0x15')]);util[_0x8b45('0x18')](this[_0x8b45('0x19')],this[_0x8b45('0x3')]['id'],this['realtime']['agents'][this[_0x8b45('0xd')]['id']],null,this[_0x8b45('0x4')]);util['writeLog'](this['squeue']['id'],this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']],_0x8b45('0x1a')+(this['routing'][_0x8b45('0x13')]?_0x8b45('0x1b'):''));}else{logger[_0x8b45('0x11')](_0x8b45('0x1c'),this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);setTimeout(this[_0x8b45('0x5')][_0x8b45('0x7')](this),0x3e8);}}};Agent[_0x8b45('0xc')][_0x8b45('0x9')]=function(_0x339c73){if(_[_0x8b45('0xe')](this[_0x8b45('0xf')]['agents'][this[_0x8b45('0xd')]['id']])){return logger[_0x8b45('0x11')](_0x8b45('0x12'),this[_0x8b45('0x3')]['id'],this[_0x8b45('0xd')]['id']);}else{logger[_0x8b45('0x11')](_0x8b45('0x1d'),this[_0x8b45('0x3')]['id'],this['agent']['id']);util[_0x8b45('0x1e')](this[_0x8b45('0x19')],this[_0x8b45('0x3')]['id'],this[_0x8b45('0xf')][_0x8b45('0x10')][this['agent']['id']],null,this[_0x8b45('0x4')]);this['realtime']['agents'][this[_0x8b45('0xd')]['id']][_0x8b45('0x16')]=![];this[_0x8b45('0xf')][_0x8b45('0x10')][this[_0x8b45('0xd')]['id']][_0x8b45('0x1f')]=undefined;util['removeWaitingNotification'](this[_0x8b45('0xf')],this[_0x8b45('0x4')],this[_0x8b45('0xd')],this[_0x8b45('0x3')]['channel']);util[_0x8b45('0x20')](this[_0x8b45('0x3')]['id'],this[_0x8b45('0xf')]['agents'][this[_0x8b45('0xd')]['id']],_0x339c73?_0x8b45('0x21'):_0x8b45('0x22'));}if(!_0x339c73){setTimeout(this['push'][_0x8b45('0x7')](this),0x3e8);}};function agent(_0x348a13,_0x3452fb,_0x4016b7,_0x58d94f){return new Agent(_0x348a13,_0x3452fb,_0x4016b7,_0x58d94f);}module[_0x8b45('0x23')]=agent;
\ No newline at end of file