Built motion from commit (unavailable).|2.5.1
[motion2.git] / server / services / routing / server / applications / strategy / agent.js
index bc9a73f..8cd4152 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc112=['handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','busyQueue','showNotification','writeLog','RINGING','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','squeue','agent','realtime','push'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc112,0xec));var _0x2c11=function(_0x2eb71c,_0x5a4b4d){_0x2eb71c=_0x2eb71c-0x0;var _0x41338c=_0xc112[_0x2eb71c];return _0x41338c;};'use strict';var _=require(_0x2c11('0x0'));var uuid=require(_0x2c11('0x1'));var util=require(_0x2c11('0x2'));var logger=require('../../../../../config/logger')(_0x2c11('0x3'));var Agent=function(_0x40da2e,_0x26e2a3,_0x170832,_0xaa8492){this[_0x2c11('0x4')]=uuid['v4']();this[_0x2c11('0x5')]=_0x40da2e;this[_0x2c11('0x6')]=_0x26e2a3;this[_0x2c11('0x7')]=_0x170832;this['routing']=_0xaa8492;this['squeue'][_0x2c11('0x8')](this[_0x2c11('0x9')][_0x2c11('0xa')](this),this[_0x2c11('0xb')]['bind'](this));this[_0x2c11('0x5')]['on'](_0x2c11('0xc'),this['handleTimeout'][_0x2c11('0xa')](this));this[_0x2c11('0x5')]['on'](_0x2c11('0xd'),this[_0x2c11('0xe')][_0x2c11('0xa')](this));};Agent['prototype'][_0x2c11('0x8')]=function(){this[_0x2c11('0x5')][_0x2c11('0x8')](this[_0x2c11('0x9')][_0x2c11('0xa')](this),this[_0x2c11('0xb')][_0x2c11('0xa')](this));};Agent['prototype'][_0x2c11('0xe')]=function(){this[_0x2c11('0xb')](!![]);};Agent[_0x2c11('0xf')][_0x2c11('0x9')]=function(_0x11e3ac){logger[_0x2c11('0x10')](_0x2c11('0x11'),this[_0x2c11('0x5')]['id'],this[_0x2c11('0x6')]['id']);if(_[_0x2c11('0x12')](this[_0x2c11('0x7')]['agents'][this[_0x2c11('0x6')]['id']])){logger[_0x2c11('0x10')](_0x2c11('0x13'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x2c11('0x8')][_0x2c11('0xa')](this),0x3e8);}else{if(this[_0x2c11('0x3')]['forcedOwnership']||util[_0x2c11('0x14')](this['squeue']['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],this[_0x2c11('0x5')][_0x2c11('0x16')],![])){this[_0x2c11('0x7')]['agents'][this['agent']['id']]['busy']=!![];this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']][_0x2c11('0x17')]=undefined;util[_0x2c11('0x18')](this[_0x2c11('0x4')],this['squeue']['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],null,this[_0x2c11('0x3')]);util[_0x2c11('0x19')](this[_0x2c11('0x5')]['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],_0x2c11('0x1a')+(this['routing'][_0x2c11('0x1b')]?_0x2c11('0x1c'):''));}else{logger[_0x2c11('0x10')](_0x2c11('0x1d'),this[_0x2c11('0x5')]['id'],this[_0x2c11('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x2c11('0xf')][_0x2c11('0xb')]=function(_0x21d905){if(_[_0x2c11('0x12')](this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']])){return logger['info'](_0x2c11('0x13'),this[_0x2c11('0x5')]['id'],this[_0x2c11('0x6')]['id']);}else{logger[_0x2c11('0x10')](_0x2c11('0x1e'),this['squeue']['id'],this['agent']['id']);util[_0x2c11('0x1f')](this[_0x2c11('0x4')],this[_0x2c11('0x5')]['id'],this['realtime']['agents'][this['agent']['id']],null,this[_0x2c11('0x3')]);this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']][_0x2c11('0x20')]=![];this['realtime'][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']]['busyQueue']=undefined;util[_0x2c11('0x19')](this[_0x2c11('0x5')]['id'],this[_0x2c11('0x7')][_0x2c11('0x15')][this[_0x2c11('0x6')]['id']],_0x21d905?'STOP':_0x2c11('0x21'));}if(!_0x21d905){setTimeout(this[_0x2c11('0x8')][_0x2c11('0xa')](this),0x3e8);}};function agent(_0xeba389,_0x415309,_0x471741,_0x3998aa){return new Agent(_0xeba389,_0x415309,_0x471741,_0x3998aa);}module[_0x2c11('0x22')]=agent;
\ No newline at end of file
+var _0x11a0=['hideNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','agent','realtime','routing','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','info','[%s][AGENT]\x20try\x20with\x20%s','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','showNotification','writeLog',':FORCED','isNil','[%s][AGENT]\x20timeout\x20with\x20%s'];(function(_0x59c132,_0x355a67){var _0x3db1cb=function(_0x48245a){while(--_0x48245a){_0x59c132['push'](_0x59c132['shift']());}};_0x3db1cb(++_0x355a67);}(_0x11a0,0x84));var _0x011a=function(_0x5a1490,_0x52286e){_0x5a1490=_0x5a1490-0x0;var _0x53c9a6=_0x11a0[_0x5a1490];return _0x53c9a6;};'use strict';var _=require(_0x011a('0x0'));var uuid=require('uuid');var util=require(_0x011a('0x1'));var logger=require(_0x011a('0x2'))('routing');var Agent=function(_0xf8e0ef,_0x5652c2,_0x394213,_0x5c44a6){this[_0x011a('0x3')]=uuid['v4']();this[_0x011a('0x4')]=_0xf8e0ef;this[_0x011a('0x5')]=_0x5652c2;this[_0x011a('0x6')]=_0x394213;this[_0x011a('0x7')]=_0x5c44a6;this['squeue'][_0x011a('0x8')](this[_0x011a('0x9')][_0x011a('0xa')](this),this[_0x011a('0xb')]['bind'](this));this[_0x011a('0x4')]['on'](_0x011a('0xc'),this[_0x011a('0xb')][_0x011a('0xa')](this));this['squeue']['on'](_0x011a('0xd'),this[_0x011a('0xe')]['bind'](this));};Agent[_0x011a('0xf')][_0x011a('0x8')]=function(){this[_0x011a('0x4')]['push'](this['handleRun'][_0x011a('0xa')](this),this[_0x011a('0xb')]['bind'](this));};Agent['prototype'][_0x011a('0xe')]=function(){this[_0x011a('0xb')](!![]);};Agent[_0x011a('0xf')]['handleRun']=function(_0x79f7f5){logger[_0x011a('0x10')](_0x011a('0x11'),this[_0x011a('0x4')]['id'],this[_0x011a('0x5')]['id']);if(_['isNil'](this[_0x011a('0x6')][_0x011a('0x12')][this[_0x011a('0x5')]['id']])){logger[_0x011a('0x10')](_0x011a('0x13'),this['squeue']['id'],this['agent']['id']);setTimeout(this[_0x011a('0x8')]['bind'](this),0x3e8);}else{if(this[_0x011a('0x7')][_0x011a('0x14')]||util[_0x011a('0x15')](this[_0x011a('0x4')]['id'],this['realtime'][_0x011a('0x12')][this[_0x011a('0x5')]['id']],this[_0x011a('0x4')]['channel'],![])){this['realtime'][_0x011a('0x12')][this[_0x011a('0x5')]['id']][_0x011a('0x16')]=!![];this[_0x011a('0x6')][_0x011a('0x12')][this[_0x011a('0x5')]['id']]['busyQueue']=undefined;util[_0x011a('0x17')](this[_0x011a('0x3')],this[_0x011a('0x4')]['id'],this[_0x011a('0x6')]['agents'][this[_0x011a('0x5')]['id']],null,this['routing']);util[_0x011a('0x18')](this['squeue']['id'],this[_0x011a('0x6')][_0x011a('0x12')][this['agent']['id']],'RINGING'+(this[_0x011a('0x7')][_0x011a('0x14')]?_0x011a('0x19'):''));}else{logger[_0x011a('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x011a('0x4')]['id'],this['agent']['id']);setTimeout(this[_0x011a('0x8')][_0x011a('0xa')](this),0x3e8);}}};Agent[_0x011a('0xf')][_0x011a('0xb')]=function(_0x3d9771){if(_[_0x011a('0x1a')](this[_0x011a('0x6')][_0x011a('0x12')][this[_0x011a('0x5')]['id']])){return logger[_0x011a('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x011a('0x4')]['id'],this[_0x011a('0x5')]['id']);}else{logger[_0x011a('0x10')](_0x011a('0x1b'),this[_0x011a('0x4')]['id'],this['agent']['id']);util[_0x011a('0x1c')](this[_0x011a('0x3')],this[_0x011a('0x4')]['id'],this[_0x011a('0x6')][_0x011a('0x12')][this[_0x011a('0x5')]['id']],null,this[_0x011a('0x7')]);this[_0x011a('0x6')][_0x011a('0x12')][this[_0x011a('0x5')]['id']][_0x011a('0x16')]=![];this[_0x011a('0x6')][_0x011a('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0x011a('0x18')](this[_0x011a('0x4')]['id'],this[_0x011a('0x6')][_0x011a('0x12')][this['agent']['id']],_0x3d9771?_0x011a('0x1d'):_0x011a('0x1e'));}if(!_0x3d9771){setTimeout(this[_0x011a('0x8')][_0x011a('0xa')](this),0x3e8);}};function agent(_0x51817f,_0x31be50,_0x233236,_0x346d25){return new Agent(_0x51817f,_0x31be50,_0x233236,_0x346d25);}module[_0x011a('0x1f')]=agent;
\ No newline at end of file