Built motion from commit 44b1f254.|2.6.26
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index f801010..923dcf2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5c12=['squeue','realtime','bind','handleTimeout','timeout','drained','handleDrained','push','handleRun','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','agents','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','prototype','isNil','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busyQueue','writeLog','STOP','TIMEOUT','exports','uuid','./util','routing','notificationId'];(function(_0x51667b,_0x4409ec){var _0x3ec7ff=function(_0x265e31){while(--_0x265e31){_0x51667b['push'](_0x51667b['shift']());}};_0x3ec7ff(++_0x4409ec);}(_0x5c12,0x188));var _0x25c1=function(_0x39609a,_0x28a563){_0x39609a=_0x39609a-0x0;var _0xecd92=_0x5c12[_0x39609a];return _0xecd92;};'use strict';var _=require('lodash');var uuid=require(_0x25c1('0x0'));var util=require(_0x25c1('0x1'));var logger=require('../../../../../config/logger')(_0x25c1('0x2'));var Agent=function(_0x1991e5,_0x4042fe,_0x10f10c,_0x2c5df0){this[_0x25c1('0x3')]=uuid['v4']();this[_0x25c1('0x4')]=_0x1991e5;this['agent']=_0x4042fe;this[_0x25c1('0x5')]=_0x10f10c;this[_0x25c1('0x2')]=_0x2c5df0;this[_0x25c1('0x4')]['push'](this['handleRun'][_0x25c1('0x6')](this),this[_0x25c1('0x7')][_0x25c1('0x6')](this));this[_0x25c1('0x4')]['on'](_0x25c1('0x8'),this['handleTimeout'][_0x25c1('0x6')](this));this[_0x25c1('0x4')]['on'](_0x25c1('0x9'),this[_0x25c1('0xa')][_0x25c1('0x6')](this));};Agent['prototype'][_0x25c1('0xb')]=function(){this[_0x25c1('0x4')]['push'](this[_0x25c1('0xc')][_0x25c1('0x6')](this),this[_0x25c1('0x7')][_0x25c1('0x6')](this));};Agent['prototype']['handleDrained']=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x25c1('0xc')]=function(){logger[_0x25c1('0xd')](_0x25c1('0xe'),this[_0x25c1('0x4')]['id'],this[_0x25c1('0xf')]['id']);if(_['isNil'](this[_0x25c1('0x5')]['agents'][this['agent']['id']])){logger['debug'](_0x25c1('0x10'),this[_0x25c1('0x4')]['id'],this['agent']['id']);setTimeout(this['push'][_0x25c1('0x6')](this),0x3e8);}else{if(this['routing'][_0x25c1('0x11')]||util[_0x25c1('0x12')](this['squeue']['id'],this['realtime']['agents'][this[_0x25c1('0xf')]['id']],this[_0x25c1('0x4')][_0x25c1('0x13')],![])){this[_0x25c1('0x5')]['agents'][this[_0x25c1('0xf')]['id']][_0x25c1('0x14')]=!![];this[_0x25c1('0x5')][_0x25c1('0x15')][this['agent']['id']]['busyQueue']=undefined;util[_0x25c1('0x16')](this[_0x25c1('0x5')],this[_0x25c1('0x2')],this[_0x25c1('0xf')],this[_0x25c1('0x4')][_0x25c1('0x13')]);util[_0x25c1('0x17')](this[_0x25c1('0x3')],this[_0x25c1('0x4')]['id'],this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']],null,this[_0x25c1('0x2')]);util['writeLog'](this[_0x25c1('0x4')]['id'],this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']],_0x25c1('0x18')+(this[_0x25c1('0x2')]['forcedOwnership']?_0x25c1('0x19'):''));}else{logger[_0x25c1('0xd')](_0x25c1('0x1a'),this[_0x25c1('0x4')]['id'],this[_0x25c1('0xf')]['id']);setTimeout(this[_0x25c1('0xb')]['bind'](this),0x3e8);}}};Agent[_0x25c1('0x1b')]['handleTimeout']=function(_0x76b360){if(_[_0x25c1('0x1c')](this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']])){return logger[_0x25c1('0xd')](_0x25c1('0x10'),this[_0x25c1('0x4')]['id'],this[_0x25c1('0xf')]['id']);}else{logger['debug'](_0x25c1('0x1d'),this['squeue']['id'],this['agent']['id']);util[_0x25c1('0x1e')](this[_0x25c1('0x3')],this['squeue']['id'],this[_0x25c1('0x5')]['agents'][this[_0x25c1('0xf')]['id']],null,this['routing']);this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']][_0x25c1('0x14')]=![];this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']][_0x25c1('0x1f')]=undefined;util['removeWaitingNotification'](this[_0x25c1('0x5')],this['routing'],this[_0x25c1('0xf')],this['squeue'][_0x25c1('0x13')]);util[_0x25c1('0x20')](this[_0x25c1('0x4')]['id'],this[_0x25c1('0x5')][_0x25c1('0x15')][this[_0x25c1('0xf')]['id']],_0x76b360?_0x25c1('0x21'):_0x25c1('0x22'));}if(!_0x76b360){setTimeout(this[_0x25c1('0xb')][_0x25c1('0x6')](this),0x3e8);}};function agent(_0x26ed98,_0x3f02f2,_0x1041a3,_0x1b6e92){return new Agent(_0x26ed98,_0x3f02f2,_0x1041a3,_0x1b6e92);}module[_0x25c1('0x23')]=agent;
\ No newline at end of file
+var _0xb821=['squeue','agent','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','channel','agents','busy','busyQueue','saveWaitingNotification','showNotification','forcedOwnership',':FORCED','debug','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','writeLog','STOP','TIMEOUT','exports','uuid','./util','notificationId'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb821,0xa7));var _0x1b82=function(_0x358f81,_0x445e75){_0x358f81=_0x358f81-0x0;var _0x206e91=_0xb821[_0x358f81];return _0x206e91;};'use strict';var _=require('lodash');var uuid=require(_0x1b82('0x0'));var util=require(_0x1b82('0x1'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0xbab478,_0x578a10,_0x4b1809,_0x3b1d14){this[_0x1b82('0x2')]=uuid['v4']();this[_0x1b82('0x3')]=_0xbab478;this[_0x1b82('0x4')]=_0x578a10;this['realtime']=_0x4b1809;this[_0x1b82('0x5')]=_0x3b1d14;this[_0x1b82('0x3')][_0x1b82('0x6')](this[_0x1b82('0x7')][_0x1b82('0x8')](this),this[_0x1b82('0x9')][_0x1b82('0x8')](this));this[_0x1b82('0x3')]['on'](_0x1b82('0xa'),this['handleTimeout'][_0x1b82('0x8')](this));this[_0x1b82('0x3')]['on'](_0x1b82('0xb'),this[_0x1b82('0xc')][_0x1b82('0x8')](this));};Agent[_0x1b82('0xd')][_0x1b82('0x6')]=function(){this[_0x1b82('0x3')]['push'](this[_0x1b82('0x7')][_0x1b82('0x8')](this),this[_0x1b82('0x9')][_0x1b82('0x8')](this));};Agent['prototype'][_0x1b82('0xc')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x1b82('0x7')]=function(){logger['debug'](_0x1b82('0xe'),this[_0x1b82('0x3')]['id'],this['agent']['id']);if(_[_0x1b82('0xf')](this['realtime']['agents'][this[_0x1b82('0x4')]['id']])){logger['debug'](_0x1b82('0x10'),this[_0x1b82('0x3')]['id'],this[_0x1b82('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}else{if(this[_0x1b82('0x5')]['forcedOwnership']||util[_0x1b82('0x11')](this[_0x1b82('0x3')]['id'],this[_0x1b82('0x12')]['agents'][this[_0x1b82('0x4')]['id']],this[_0x1b82('0x3')][_0x1b82('0x13')],![])){this[_0x1b82('0x12')][_0x1b82('0x14')][this['agent']['id']][_0x1b82('0x15')]=!![];this[_0x1b82('0x12')][_0x1b82('0x14')][this[_0x1b82('0x4')]['id']][_0x1b82('0x16')]=undefined;util[_0x1b82('0x17')](this[_0x1b82('0x12')],this['routing'],this[_0x1b82('0x4')],this[_0x1b82('0x3')]['channel']);util[_0x1b82('0x18')](this[_0x1b82('0x2')],this[_0x1b82('0x3')]['id'],this['realtime'][_0x1b82('0x14')][this['agent']['id']],null,this['routing']);util['writeLog'](this[_0x1b82('0x3')]['id'],this[_0x1b82('0x12')][_0x1b82('0x14')][this[_0x1b82('0x4')]['id']],'RINGING'+(this[_0x1b82('0x5')][_0x1b82('0x19')]?_0x1b82('0x1a'):''));}else{logger[_0x1b82('0x1b')](_0x1b82('0x1c'),this[_0x1b82('0x3')]['id'],this[_0x1b82('0x4')]['id']);setTimeout(this[_0x1b82('0x6')][_0x1b82('0x8')](this),0x3e8);}}};Agent[_0x1b82('0xd')][_0x1b82('0x9')]=function(_0x37275f){if(_[_0x1b82('0xf')](this['realtime'][_0x1b82('0x14')][this[_0x1b82('0x4')]['id']])){return logger[_0x1b82('0x1b')](_0x1b82('0x10'),this[_0x1b82('0x3')]['id'],this[_0x1b82('0x4')]['id']);}else{logger[_0x1b82('0x1b')](_0x1b82('0x1d'),this[_0x1b82('0x3')]['id'],this[_0x1b82('0x4')]['id']);util['hideNotification'](this[_0x1b82('0x2')],this[_0x1b82('0x3')]['id'],this[_0x1b82('0x12')][_0x1b82('0x14')][this['agent']['id']],null,this[_0x1b82('0x5')]);this[_0x1b82('0x12')]['agents'][this[_0x1b82('0x4')]['id']][_0x1b82('0x15')]=![];this[_0x1b82('0x12')]['agents'][this['agent']['id']][_0x1b82('0x16')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x1b82('0x5')],this[_0x1b82('0x4')],this[_0x1b82('0x3')]['channel']);util[_0x1b82('0x1e')](this[_0x1b82('0x3')]['id'],this[_0x1b82('0x12')][_0x1b82('0x14')][this['agent']['id']],_0x37275f?_0x1b82('0x1f'):_0x1b82('0x20'));}if(!_0x37275f){setTimeout(this[_0x1b82('0x6')]['bind'](this),0x3e8);}};function agent(_0x48fd54,_0x21e859,_0x5d7e6a,_0x1d3e68){return new Agent(_0x48fd54,_0x21e859,_0x5d7e6a,_0x1d3e68);}module[_0x1b82('0x21')]=agent;
\ No newline at end of file