Built motion from commit 10af8726.|2.6.34
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index 4403fdf..78c928e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1cc7=['forcedOwnership','channel','busy','busyQueue','saveWaitingNotification','showNotification','notificationId','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','prototype','handleDrained','debug','agent','isNil','agents','routing'];(function(_0x4a893c,_0x4f05ea){var _0x3a6668=function(_0x48e7e7){while(--_0x48e7e7){_0x4a893c['push'](_0x4a893c['shift']());}};_0x3a6668(++_0x4f05ea);}(_0x1cc7,0x15a));var _0x71cc=function(_0x11ae0b,_0x18a441){_0x11ae0b=_0x11ae0b-0x0;var _0x3e53b9=_0x1cc7[_0x11ae0b];return _0x3e53b9;};'use strict';var _=require(_0x71cc('0x0'));var uuid=require(_0x71cc('0x1'));var util=require(_0x71cc('0x2'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x547fe6,_0xe5d54e,_0x1fac93,_0x402191){this['notificationId']=uuid['v4']();this['squeue']=_0x547fe6;this['agent']=_0xe5d54e;this[_0x71cc('0x3')]=_0x1fac93;this['routing']=_0x402191;this[_0x71cc('0x4')][_0x71cc('0x5')](this[_0x71cc('0x6')][_0x71cc('0x7')](this),this[_0x71cc('0x8')]['bind'](this));this[_0x71cc('0x4')]['on'](_0x71cc('0x9'),this[_0x71cc('0x8')]['bind'](this));this['squeue']['on']('drained',this['handleDrained'][_0x71cc('0x7')](this));};Agent[_0x71cc('0xa')][_0x71cc('0x5')]=function(){this['squeue'][_0x71cc('0x5')](this['handleRun'][_0x71cc('0x7')](this),this['handleTimeout'][_0x71cc('0x7')](this));};Agent['prototype'][_0x71cc('0xb')]=function(){this[_0x71cc('0x8')](!![]);};Agent[_0x71cc('0xa')][_0x71cc('0x6')]=function(){logger[_0x71cc('0xc')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);if(_[_0x71cc('0xe')](this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']])){logger[_0x71cc('0xc')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);setTimeout(this[_0x71cc('0x5')][_0x71cc('0x7')](this),0x3e8);}else{if(this[_0x71cc('0x10')][_0x71cc('0x11')]||util['isAgentAvailable'](this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')]['agents'][this['agent']['id']],this[_0x71cc('0x4')][_0x71cc('0x12')],![])){this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']][_0x71cc('0x13')]=!![];this[_0x71cc('0x3')][_0x71cc('0xf')][this['agent']['id']][_0x71cc('0x14')]=undefined;util[_0x71cc('0x15')](this['realtime'],this[_0x71cc('0x10')],this[_0x71cc('0xd')],this[_0x71cc('0x4')][_0x71cc('0x12')]);util[_0x71cc('0x16')](this[_0x71cc('0x17')],this['squeue']['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],null,this[_0x71cc('0x10')]);util[_0x71cc('0x18')](this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],'RINGING'+(this[_0x71cc('0x10')][_0x71cc('0x11')]?_0x71cc('0x19'):''));}else{logger[_0x71cc('0xc')](_0x71cc('0x1a'),this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);setTimeout(this[_0x71cc('0x5')][_0x71cc('0x7')](this),0x3e8);}}};Agent[_0x71cc('0xa')][_0x71cc('0x8')]=function(_0x35f723){if(_[_0x71cc('0xe')](this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']])){return logger['debug'](_0x71cc('0x1b'),this[_0x71cc('0x4')]['id'],this[_0x71cc('0xd')]['id']);}else{logger[_0x71cc('0xc')](_0x71cc('0x1c'),this[_0x71cc('0x4')]['id'],this['agent']['id']);util[_0x71cc('0x1d')](this[_0x71cc('0x17')],this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],null,this[_0x71cc('0x10')]);this['realtime'][_0x71cc('0xf')][this['agent']['id']]['busy']=![];this[_0x71cc('0x3')]['agents'][this['agent']['id']][_0x71cc('0x14')]=undefined;util['removeWaitingNotification'](this[_0x71cc('0x3')],this['routing'],this[_0x71cc('0xd')],this[_0x71cc('0x4')]['channel']);util[_0x71cc('0x18')](this[_0x71cc('0x4')]['id'],this[_0x71cc('0x3')][_0x71cc('0xf')][this[_0x71cc('0xd')]['id']],_0x35f723?_0x71cc('0x1e'):_0x71cc('0x1f'));}if(!_0x35f723){setTimeout(this[_0x71cc('0x5')][_0x71cc('0x7')](this),0x3e8);}};function agent(_0x2f8a72,_0x4b7bc6,_0x4330f0,_0x54d16a){return new Agent(_0x2f8a72,_0x4b7bc6,_0x4330f0,_0x54d16a);}module[_0x71cc('0x20')]=agent;
\ No newline at end of file
+var _0xbec5=['bind','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','channel','showNotification','writeLog','RINGING','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','removeWaitingNotification','STOP','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','agent','push','handleRun'];(function(_0x4fce10,_0x596096){var _0x180848=function(_0x26c514){while(--_0x26c514){_0x4fce10['push'](_0x4fce10['shift']());}};_0x180848(++_0x596096);}(_0xbec5,0xe5));var _0x5bec=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0xbec5[_0x5cb1af];return _0x8d7940;};'use strict';var _=require(_0x5bec('0x0'));var uuid=require(_0x5bec('0x1'));var util=require('./util');var logger=require(_0x5bec('0x2'))(_0x5bec('0x3'));var Agent=function(_0x276b9e,_0x3859a1,_0x244027,_0x4ee982){this[_0x5bec('0x4')]=uuid['v4']();this[_0x5bec('0x5')]=_0x276b9e;this[_0x5bec('0x6')]=_0x3859a1;this['realtime']=_0x244027;this[_0x5bec('0x3')]=_0x4ee982;this[_0x5bec('0x5')][_0x5bec('0x7')](this[_0x5bec('0x8')][_0x5bec('0x9')](this),this[_0x5bec('0xa')][_0x5bec('0x9')](this));this[_0x5bec('0x5')]['on']('timeout',this[_0x5bec('0xa')]['bind'](this));this[_0x5bec('0x5')]['on'](_0x5bec('0xb'),this[_0x5bec('0xc')]['bind'](this));};Agent[_0x5bec('0xd')][_0x5bec('0x7')]=function(){this[_0x5bec('0x5')]['push'](this[_0x5bec('0x8')][_0x5bec('0x9')](this),this['handleTimeout'][_0x5bec('0x9')](this));};Agent[_0x5bec('0xd')][_0x5bec('0xc')]=function(){this[_0x5bec('0xa')](!![]);};Agent[_0x5bec('0xd')][_0x5bec('0x8')]=function(){logger[_0x5bec('0xe')](_0x5bec('0xf'),this[_0x5bec('0x5')]['id'],this[_0x5bec('0x6')]['id']);if(_[_0x5bec('0x10')](this[_0x5bec('0x11')][_0x5bec('0x12')][this['agent']['id']])){logger['debug'](_0x5bec('0x13'),this[_0x5bec('0x5')]['id'],this[_0x5bec('0x6')]['id']);setTimeout(this[_0x5bec('0x7')]['bind'](this),0x3e8);}else{if(this['routing'][_0x5bec('0x14')]||util[_0x5bec('0x15')](this['squeue']['id'],this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']],this[_0x5bec('0x5')]['channel'],![])){this[_0x5bec('0x11')]['agents'][this[_0x5bec('0x6')]['id']][_0x5bec('0x16')]=!![];this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']]['busyQueue']=undefined;util[_0x5bec('0x17')](this['realtime'],this[_0x5bec('0x3')],this[_0x5bec('0x6')],this['squeue'][_0x5bec('0x18')]);util[_0x5bec('0x19')](this['notificationId'],this[_0x5bec('0x5')]['id'],this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']],null,this[_0x5bec('0x3')]);util[_0x5bec('0x1a')](this[_0x5bec('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],_0x5bec('0x1b')+(this[_0x5bec('0x3')][_0x5bec('0x14')]?':FORCED':''));}else{logger[_0x5bec('0xe')](_0x5bec('0x1c'),this['squeue']['id'],this[_0x5bec('0x6')]['id']);setTimeout(this[_0x5bec('0x7')]['bind'](this),0x3e8);}}};Agent['prototype'][_0x5bec('0xa')]=function(_0x2a82d5){if(_[_0x5bec('0x10')](this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']])){return logger['debug'](_0x5bec('0x13'),this['squeue']['id'],this[_0x5bec('0x6')]['id']);}else{logger[_0x5bec('0xe')](_0x5bec('0x1d'),this[_0x5bec('0x5')]['id'],this['agent']['id']);util[_0x5bec('0x1e')](this[_0x5bec('0x4')],this[_0x5bec('0x5')]['id'],this['realtime'][_0x5bec('0x12')][this['agent']['id']],null,this[_0x5bec('0x3')]);this[_0x5bec('0x11')][_0x5bec('0x12')][this['agent']['id']][_0x5bec('0x16')]=![];this[_0x5bec('0x11')]['agents'][this[_0x5bec('0x6')]['id']][_0x5bec('0x1f')]=undefined;util[_0x5bec('0x20')](this[_0x5bec('0x11')],this[_0x5bec('0x3')],this['agent'],this[_0x5bec('0x5')]['channel']);util[_0x5bec('0x1a')](this[_0x5bec('0x5')]['id'],this[_0x5bec('0x11')][_0x5bec('0x12')][this[_0x5bec('0x6')]['id']],_0x2a82d5?_0x5bec('0x21'):'TIMEOUT');}if(!_0x2a82d5){setTimeout(this[_0x5bec('0x7')][_0x5bec('0x9')](this),0x3e8);}};function agent(_0x1d42b0,_0x5de683,_0x40db29,_0x355707){return new Agent(_0x1d42b0,_0x5de683,_0x40db29,_0x355707);}module['exports']=agent;
\ No newline at end of file