Built motion from commit (unavailable).|2.5.0
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index a2c389f..7545fec 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xea12=['bind','handleDrained','prototype','info','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','channel','busy','busyQueue','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','notificationId','STOP','exports','lodash','uuid','./util','../../../../../config/logger','routing','squeue','agent','realtime','push','handleRun','handleTimeout','timeout'];(function(_0x4130f6,_0x10a2a3){var _0x28a921=function(_0xcf2ec7){while(--_0xcf2ec7){_0x4130f6['push'](_0x4130f6['shift']());}};_0x28a921(++_0x10a2a3);}(_0xea12,0x149));var _0x2ea1=function(_0x38a862,_0x3efd4d){_0x38a862=_0x38a862-0x0;var _0x1f6d43=_0xea12[_0x38a862];return _0x1f6d43;};'use strict';var _=require(_0x2ea1('0x0'));var uuid=require(_0x2ea1('0x1'));var util=require(_0x2ea1('0x2'));var logger=require(_0x2ea1('0x3'))(_0x2ea1('0x4'));var Agent=function(_0x1606a4,_0x4b8b1c,_0x424732,_0x2853db){this['notificationId']=uuid['v4']();this[_0x2ea1('0x5')]=_0x1606a4;this[_0x2ea1('0x6')]=_0x4b8b1c;this[_0x2ea1('0x7')]=_0x424732;this[_0x2ea1('0x4')]=_0x2853db;this['squeue'][_0x2ea1('0x8')](this[_0x2ea1('0x9')]['bind'](this),this[_0x2ea1('0xa')]['bind'](this));this[_0x2ea1('0x5')]['on'](_0x2ea1('0xb'),this[_0x2ea1('0xa')][_0x2ea1('0xc')](this));this[_0x2ea1('0x5')]['on']('drained',this[_0x2ea1('0xd')][_0x2ea1('0xc')](this));};Agent['prototype']['push']=function(){this[_0x2ea1('0x5')][_0x2ea1('0x8')](this['handleRun']['bind'](this),this[_0x2ea1('0xa')][_0x2ea1('0xc')](this));};Agent['prototype'][_0x2ea1('0xd')]=function(){this[_0x2ea1('0xa')](!![]);};Agent[_0x2ea1('0xe')][_0x2ea1('0x9')]=function(_0x228acb){logger[_0x2ea1('0xf')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x2ea1('0x5')]['id'],this['agent']['id']);if(_['isNil'](this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']])){logger[_0x2ea1('0xf')](_0x2ea1('0x11'),this['squeue']['id'],this[_0x2ea1('0x6')]['id']);setTimeout(this[_0x2ea1('0x8')][_0x2ea1('0xc')](this),0x3e8);}else{if(this[_0x2ea1('0x4')][_0x2ea1('0x12')]||util['isAgentAvailable'](this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x7')]['agents'][this[_0x2ea1('0x6')]['id']],this['squeue'][_0x2ea1('0x13')],![])){this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']][_0x2ea1('0x14')]=!![];this[_0x2ea1('0x7')]['agents'][this[_0x2ea1('0x6')]['id']][_0x2ea1('0x15')]=undefined;util[_0x2ea1('0x16')](this['notificationId'],this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']],null,this[_0x2ea1('0x4')]);util[_0x2ea1('0x17')](this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']],'RINGING'+(this[_0x2ea1('0x4')][_0x2ea1('0x12')]?_0x2ea1('0x18'):''));}else{logger[_0x2ea1('0xf')](_0x2ea1('0x19'),this[_0x2ea1('0x5')]['id'],this['agent']['id']);setTimeout(this[_0x2ea1('0x8')]['bind'](this),0x3e8);}}};Agent[_0x2ea1('0xe')][_0x2ea1('0xa')]=function(_0x2b0fff){if(_['isNil'](this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']])){return logger[_0x2ea1('0xf')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x6')]['id']);}else{logger[_0x2ea1('0xf')](_0x2ea1('0x1a'),this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x6')]['id']);util[_0x2ea1('0x1b')](this[_0x2ea1('0x1c')],this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x7')][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']],null,this['routing']);this[_0x2ea1('0x7')]['agents'][this['agent']['id']]['busy']=![];this['realtime'][_0x2ea1('0x10')][this[_0x2ea1('0x6')]['id']]['busyQueue']=undefined;util[_0x2ea1('0x17')](this[_0x2ea1('0x5')]['id'],this[_0x2ea1('0x7')][_0x2ea1('0x10')][this['agent']['id']],_0x2b0fff?_0x2ea1('0x1d'):'TIMEOUT');}if(!_0x2b0fff){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x1c0ba7,_0x3002bd,_0x4cc369,_0x50f678){return new Agent(_0x1c0ba7,_0x3002bd,_0x4cc369,_0x50f678);}module[_0x2ea1('0x1e')]=agent;
\ No newline at end of file
+var _0xb7d0=['exports','./util','notificationId','agent','realtime','routing','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','showNotification','writeLog',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','busyQueue','TIMEOUT'];(function(_0x42692b,_0x42ea7b){var _0x38fb92=function(_0x32ed43){while(--_0x32ed43){_0x42692b['push'](_0x42692b['shift']());}};_0x38fb92(++_0x42ea7b);}(_0xb7d0,0xf1));var _0x0b7d=function(_0x10745e,_0x4cd185){_0x10745e=_0x10745e-0x0;var _0x5bded5=_0xb7d0[_0x10745e];return _0x5bded5;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x0b7d('0x0'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x5ee1f7,_0x57b1a7,_0x3af953,_0x10d083){this[_0x0b7d('0x1')]=uuid['v4']();this['squeue']=_0x5ee1f7;this[_0x0b7d('0x2')]=_0x57b1a7;this[_0x0b7d('0x3')]=_0x3af953;this[_0x0b7d('0x4')]=_0x10d083;this[_0x0b7d('0x5')][_0x0b7d('0x6')](this[_0x0b7d('0x7')][_0x0b7d('0x8')](this),this[_0x0b7d('0x9')][_0x0b7d('0x8')](this));this[_0x0b7d('0x5')]['on'](_0x0b7d('0xa'),this['handleTimeout'][_0x0b7d('0x8')](this));this[_0x0b7d('0x5')]['on'](_0x0b7d('0xb'),this[_0x0b7d('0xc')][_0x0b7d('0x8')](this));};Agent[_0x0b7d('0xd')][_0x0b7d('0x6')]=function(){this['squeue'][_0x0b7d('0x6')](this[_0x0b7d('0x7')][_0x0b7d('0x8')](this),this[_0x0b7d('0x9')]['bind'](this));};Agent[_0x0b7d('0xd')][_0x0b7d('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0x0b7d('0xd')][_0x0b7d('0x7')]=function(_0x5d9a74){logger[_0x0b7d('0xe')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x0b7d('0x5')]['id'],this[_0x0b7d('0x2')]['id']);if(_[_0x0b7d('0xf')](this[_0x0b7d('0x3')][_0x0b7d('0x10')][this[_0x0b7d('0x2')]['id']])){logger[_0x0b7d('0xe')](_0x0b7d('0x11'),this[_0x0b7d('0x5')]['id'],this[_0x0b7d('0x2')]['id']);setTimeout(this[_0x0b7d('0x6')][_0x0b7d('0x8')](this),0x3e8);}else{if(this[_0x0b7d('0x4')][_0x0b7d('0x12')]||util[_0x0b7d('0x13')](this[_0x0b7d('0x5')]['id'],this[_0x0b7d('0x3')][_0x0b7d('0x10')][this[_0x0b7d('0x2')]['id']],this[_0x0b7d('0x5')]['channel'],![])){this[_0x0b7d('0x3')]['agents'][this['agent']['id']]['busy']=!![];this['realtime']['agents'][this['agent']['id']]['busyQueue']=undefined;util[_0x0b7d('0x14')](this[_0x0b7d('0x1')],this[_0x0b7d('0x5')]['id'],this[_0x0b7d('0x3')]['agents'][this['agent']['id']],null,this[_0x0b7d('0x4')]);util[_0x0b7d('0x15')](this[_0x0b7d('0x5')]['id'],this['realtime'][_0x0b7d('0x10')][this[_0x0b7d('0x2')]['id']],'RINGING'+(this[_0x0b7d('0x4')][_0x0b7d('0x12')]?_0x0b7d('0x16'):''));}else{logger['info'](_0x0b7d('0x17'),this['squeue']['id'],this[_0x0b7d('0x2')]['id']);setTimeout(this[_0x0b7d('0x6')][_0x0b7d('0x8')](this),0x3e8);}}};Agent[_0x0b7d('0xd')][_0x0b7d('0x9')]=function(_0x5a0eab){if(_[_0x0b7d('0xf')](this['realtime'][_0x0b7d('0x10')][this[_0x0b7d('0x2')]['id']])){return logger['info']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x0b7d('0x5')]['id'],this['agent']['id']);}else{logger[_0x0b7d('0xe')](_0x0b7d('0x18'),this[_0x0b7d('0x5')]['id'],this[_0x0b7d('0x2')]['id']);util[_0x0b7d('0x19')](this[_0x0b7d('0x1')],this[_0x0b7d('0x5')]['id'],this[_0x0b7d('0x3')][_0x0b7d('0x10')][this[_0x0b7d('0x2')]['id']],null,this[_0x0b7d('0x4')]);this['realtime']['agents'][this[_0x0b7d('0x2')]['id']][_0x0b7d('0x1a')]=![];this[_0x0b7d('0x3')][_0x0b7d('0x10')][this[_0x0b7d('0x2')]['id']][_0x0b7d('0x1b')]=undefined;util[_0x0b7d('0x15')](this['squeue']['id'],this[_0x0b7d('0x3')]['agents'][this['agent']['id']],_0x5a0eab?'STOP':_0x0b7d('0x1c'));}if(!_0x5a0eab){setTimeout(this[_0x0b7d('0x6')][_0x0b7d('0x8')](this),0x3e8);}};function agent(_0xc10add,_0x18dfe3,_0x9a8362,_0x22db68){return new Agent(_0xc10add,_0x18dfe3,_0x9a8362,_0x22db68);}module[_0x0b7d('0x1d')]=agent;
\ No newline at end of file