Built motion from commit ff78e754.|2.6.29
[motion2.git] / server / services / routing / server / applications / strategy / rrmemory.js
index 15c3aef..1129041 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xe760=['handleDrained','prototype','handleCheckReject','isAgentAvailable','agentId','channel','debug','[%s][QUEUE]\x20available\x20again\x20%s','done','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','busy','queue','name','saveWaitingNotification','showNotification','RINGING','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','[%s][QUEUE]\x20timeout\x20with\x20%s','hideNotification','TIMEOUT','busyQueue','removeWaitingNotification','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','intervals','push','handleRun','handleTimeout','bind','timeout','drained'];(function(_0x509273,_0x13fc9f){var _0x38ef40=function(_0xf8d4c9){while(--_0xf8d4c9){_0x509273['push'](_0x509273['shift']());}};_0x38ef40(++_0x13fc9f);}(_0xe760,0x1b4));var _0x0e76=function(_0x4bd6d6,_0x5579f6){_0x4bd6d6=_0x4bd6d6-0x0;var _0x589763=_0xe760[_0x4bd6d6];return _0x589763;};'use strict';var rr=require('rr');var _=require(_0x0e76('0x0'));var uuid=require(_0x0e76('0x1'));var util=require(_0x0e76('0x2'));var logger=require(_0x0e76('0x3'))(_0x0e76('0x4'));var RRMemory=function(_0x246d88,_0x1c2dc0,_0x4671b3,_0x4f1b36){this[_0x0e76('0x5')]=uuid['v4']();this[_0x0e76('0x6')]=_0x246d88;this['queue']=_0x1c2dc0;this[_0x0e76('0x7')]=_0x4671b3;this[_0x0e76('0x4')]=_0x4f1b36;this[_0x0e76('0x8')]={};this[_0x0e76('0x6')][_0x0e76('0x9')](this[_0x0e76('0xa')]['bind'](this),this[_0x0e76('0xb')][_0x0e76('0xc')](this),this['module']);this[_0x0e76('0x6')]['on'](_0x0e76('0xd'),this[_0x0e76('0xb')][_0x0e76('0xc')](this));this['squeue']['on'](_0x0e76('0xe'),this[_0x0e76('0xf')][_0x0e76('0xc')](this));};RRMemory[_0x0e76('0x10')][_0x0e76('0x9')]=function(){this[_0x0e76('0x6')][_0x0e76('0x9')](this['handleRun']['bind'](this),this[_0x0e76('0xb')][_0x0e76('0xc')](this));};RRMemory['prototype']['handleDrained']=function(){this[_0x0e76('0xb')](!![]);};RRMemory[_0x0e76('0x10')][_0x0e76('0x11')]=function(_0x4b952a){if(util[_0x0e76('0x12')](this[_0x0e76('0x6')]['id'],this[_0x0e76('0x7')]['agents'][this[_0x0e76('0x13')]],this[_0x0e76('0x6')][_0x0e76('0x14')],!![])){logger[_0x0e76('0x15')](_0x0e76('0x16'),this[_0x0e76('0x6')]['id'],this[_0x0e76('0x13')]);clearInterval(this['intervals'][this[_0x0e76('0x13')]]);_0x4b952a[_0x0e76('0x17')]();setTimeout(this[_0x0e76('0x9')]['bind'](this),0x3e8);}};RRMemory[_0x0e76('0x10')][_0x0e76('0xa')]=function(_0x34a0d6){this[_0x0e76('0x13')]=rr(this['queue'][_0x0e76('0x18')]);logger[_0x0e76('0x15')](_0x0e76('0x19'),this[_0x0e76('0x6')]['id'],this[_0x0e76('0x13')]);if(_[_0x0e76('0x1a')](this[_0x0e76('0x7')]['agents'][this[_0x0e76('0x13')]])){logger[_0x0e76('0x15')](_0x0e76('0x1b'),this[_0x0e76('0x6')]['id'],this[_0x0e76('0x13')]);_0x34a0d6[_0x0e76('0x17')]();setTimeout(this[_0x0e76('0x9')][_0x0e76('0xc')](this),0x3e8);}else{if(util['isAgentAvailable'](this['squeue']['id'],this[_0x0e76('0x7')][_0x0e76('0x1c')][this['agentId']],this[_0x0e76('0x6')][_0x0e76('0x14')],!![])){this['realtime']['agents'][this[_0x0e76('0x13')]][_0x0e76('0x1d')]=!![];this[_0x0e76('0x7')]['agents'][this['agentId']]['busyQueue']=this[_0x0e76('0x1e')][_0x0e76('0x1f')];util[_0x0e76('0x20')](this['realtime'],this['routing'],this[_0x0e76('0x7')][_0x0e76('0x1c')][this[_0x0e76('0x13')]],this['squeue'][_0x0e76('0x14')]);util[_0x0e76('0x21')](this[_0x0e76('0x5')],this[_0x0e76('0x6')]['id'],this[_0x0e76('0x7')][_0x0e76('0x1c')][this[_0x0e76('0x13')]],this['queue'],this['routing']);util['writeLog'](this[_0x0e76('0x6')]['id'],this[_0x0e76('0x7')][_0x0e76('0x1c')][this['agentId']],_0x0e76('0x22'));this[_0x0e76('0x8')][this['agentId']]=setInterval(this[_0x0e76('0x11')][_0x0e76('0xc')](this,_0x34a0d6),0x3e8);}else{logger[_0x0e76('0x15')](_0x0e76('0x23'),this[_0x0e76('0x6')]['id'],this['agentId']);_0x34a0d6[_0x0e76('0x17')]();setTimeout(this[_0x0e76('0x9')][_0x0e76('0xc')](this),0x3e8);}}};RRMemory['prototype'][_0x0e76('0xb')]=function(_0x32baff){logger[_0x0e76('0x15')](_0x0e76('0x24'),this['squeue']['id'],this[_0x0e76('0x13')]);if(_['isNil'](this[_0x0e76('0x7')][_0x0e76('0x1c')][this['agentId']])){logger[_0x0e76('0x15')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x0e76('0x6')]['id'],this['agentId']);}else{clearInterval(this[_0x0e76('0x8')][this['agentId']]);util[_0x0e76('0x25')](this[_0x0e76('0x5')],this[_0x0e76('0x6')]['id'],this[_0x0e76('0x7')][_0x0e76('0x1c')][this[_0x0e76('0x13')]],this[_0x0e76('0x1e')],this['routing']);util['writeLog'](this[_0x0e76('0x6')]['id'],this[_0x0e76('0x7')][_0x0e76('0x1c')][this[_0x0e76('0x13')]],_0x0e76('0x26'));this[_0x0e76('0x7')][_0x0e76('0x1c')][this[_0x0e76('0x13')]][_0x0e76('0x1d')]=![];this[_0x0e76('0x7')][_0x0e76('0x1c')][this[_0x0e76('0x13')]][_0x0e76('0x27')]=undefined;util[_0x0e76('0x28')](this[_0x0e76('0x7')],this[_0x0e76('0x4')],this[_0x0e76('0x7')][_0x0e76('0x1c')][this[_0x0e76('0x13')]],this[_0x0e76('0x6')][_0x0e76('0x14')]);}if(!_0x32baff){setTimeout(this[_0x0e76('0x9')][_0x0e76('0xc')](this),0x3e8);}};function rrmemory(_0x135998,_0x5bee75,_0x997e62,_0x920432){return new RRMemory(_0x135998,_0x5bee75,_0x997e62,_0x920432);}module['exports']=rrmemory;
\ No newline at end of file
+var _0xd011=['bind','handleTimeout','timeout','drained','prototype','handleDrained','handleCheckReject','isAgentAvailable','agents','agentId','channel','debug','[%s][QUEUE]\x20available\x20again\x20%s','done','queue','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s','busy','busyQueue','name','saveWaitingNotification','showNotification','writeLog','RINGING','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','[%s][QUEUE]\x20timeout\x20with\x20%s','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','notificationId','squeue','realtime','routing','intervals','push','handleRun'];(function(_0xf263f4,_0x34c181){var _0x2edc74=function(_0x11ed6f){while(--_0x11ed6f){_0xf263f4['push'](_0xf263f4['shift']());}};_0x2edc74(++_0x34c181);}(_0xd011,0xf2));var _0x1d01=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd011[_0x3dd15e];return _0x231fd0;};'use strict';var rr=require('rr');var _=require(_0x1d01('0x0'));var uuid=require(_0x1d01('0x1'));var util=require(_0x1d01('0x2'));var logger=require('../../../../../config/logger')('routing');var RRMemory=function(_0x1c142b,_0x245359,_0x4f599c,_0x3d0cb6){this[_0x1d01('0x3')]=uuid['v4']();this[_0x1d01('0x4')]=_0x1c142b;this['queue']=_0x245359;this[_0x1d01('0x5')]=_0x4f599c;this[_0x1d01('0x6')]=_0x3d0cb6;this[_0x1d01('0x7')]={};this[_0x1d01('0x4')][_0x1d01('0x8')](this[_0x1d01('0x9')][_0x1d01('0xa')](this),this[_0x1d01('0xb')][_0x1d01('0xa')](this),this['module']);this[_0x1d01('0x4')]['on'](_0x1d01('0xc'),this[_0x1d01('0xb')][_0x1d01('0xa')](this));this[_0x1d01('0x4')]['on'](_0x1d01('0xd'),this['handleDrained']['bind'](this));};RRMemory[_0x1d01('0xe')][_0x1d01('0x8')]=function(){this[_0x1d01('0x4')]['push'](this[_0x1d01('0x9')]['bind'](this),this['handleTimeout'][_0x1d01('0xa')](this));};RRMemory['prototype'][_0x1d01('0xf')]=function(){this[_0x1d01('0xb')](!![]);};RRMemory[_0x1d01('0xe')][_0x1d01('0x10')]=function(_0x463842){if(util[_0x1d01('0x11')](this[_0x1d01('0x4')]['id'],this['realtime'][_0x1d01('0x12')][this[_0x1d01('0x13')]],this['squeue'][_0x1d01('0x14')],!![])){logger[_0x1d01('0x15')](_0x1d01('0x16'),this[_0x1d01('0x4')]['id'],this[_0x1d01('0x13')]);clearInterval(this[_0x1d01('0x7')][this[_0x1d01('0x13')]]);_0x463842[_0x1d01('0x17')]();setTimeout(this[_0x1d01('0x8')][_0x1d01('0xa')](this),0x3e8);}};RRMemory[_0x1d01('0xe')][_0x1d01('0x9')]=function(_0x3b039e){this['agentId']=rr(this[_0x1d01('0x18')][_0x1d01('0x19')]);logger[_0x1d01('0x15')](_0x1d01('0x1a'),this[_0x1d01('0x4')]['id'],this[_0x1d01('0x13')]);if(_['isNil'](this['realtime']['agents'][this[_0x1d01('0x13')]])){logger[_0x1d01('0x15')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x1d01('0x4')]['id'],this[_0x1d01('0x13')]);_0x3b039e['done']();setTimeout(this['push'][_0x1d01('0xa')](this),0x3e8);}else{if(util[_0x1d01('0x11')](this['squeue']['id'],this[_0x1d01('0x5')][_0x1d01('0x12')][this[_0x1d01('0x13')]],this[_0x1d01('0x4')][_0x1d01('0x14')],!![])){this[_0x1d01('0x5')]['agents'][this['agentId']][_0x1d01('0x1b')]=!![];this['realtime'][_0x1d01('0x12')][this[_0x1d01('0x13')]][_0x1d01('0x1c')]=this['queue'][_0x1d01('0x1d')];util[_0x1d01('0x1e')](this['realtime'],this[_0x1d01('0x6')],this[_0x1d01('0x5')][_0x1d01('0x12')][this[_0x1d01('0x13')]],this[_0x1d01('0x4')][_0x1d01('0x14')]);util[_0x1d01('0x1f')](this[_0x1d01('0x3')],this[_0x1d01('0x4')]['id'],this[_0x1d01('0x5')][_0x1d01('0x12')][this[_0x1d01('0x13')]],this[_0x1d01('0x18')],this[_0x1d01('0x6')]);util[_0x1d01('0x20')](this['squeue']['id'],this[_0x1d01('0x5')][_0x1d01('0x12')][this['agentId']],_0x1d01('0x21'));this[_0x1d01('0x7')][this[_0x1d01('0x13')]]=setInterval(this['handleCheckReject']['bind'](this,_0x3b039e),0x3e8);}else{logger[_0x1d01('0x15')](_0x1d01('0x22'),this[_0x1d01('0x4')]['id'],this[_0x1d01('0x13')]);_0x3b039e[_0x1d01('0x17')]();setTimeout(this[_0x1d01('0x8')][_0x1d01('0xa')](this),0x3e8);}}};RRMemory[_0x1d01('0xe')][_0x1d01('0xb')]=function(_0x55dcb2){logger[_0x1d01('0x15')](_0x1d01('0x23'),this[_0x1d01('0x4')]['id'],this[_0x1d01('0x13')]);if(_[_0x1d01('0x24')](this[_0x1d01('0x5')][_0x1d01('0x12')][this[_0x1d01('0x13')]])){logger[_0x1d01('0x15')](_0x1d01('0x25'),this[_0x1d01('0x4')]['id'],this['agentId']);}else{clearInterval(this[_0x1d01('0x7')][this['agentId']]);util[_0x1d01('0x26')](this[_0x1d01('0x3')],this[_0x1d01('0x4')]['id'],this[_0x1d01('0x5')][_0x1d01('0x12')][this[_0x1d01('0x13')]],this[_0x1d01('0x18')],this['routing']);util[_0x1d01('0x20')](this[_0x1d01('0x4')]['id'],this[_0x1d01('0x5')][_0x1d01('0x12')][this[_0x1d01('0x13')]],_0x1d01('0x27'));this[_0x1d01('0x5')][_0x1d01('0x12')][this[_0x1d01('0x13')]]['busy']=![];this['realtime'][_0x1d01('0x12')][this[_0x1d01('0x13')]][_0x1d01('0x1c')]=undefined;util[_0x1d01('0x28')](this[_0x1d01('0x5')],this[_0x1d01('0x6')],this[_0x1d01('0x5')][_0x1d01('0x12')][this[_0x1d01('0x13')]],this['squeue'][_0x1d01('0x14')]);}if(!_0x55dcb2){setTimeout(this[_0x1d01('0x8')][_0x1d01('0xa')](this),0x3e8);}};function rrmemory(_0x1d6433,_0x55a552,_0x135011,_0x30bbdb){return new RRMemory(_0x1d6433,_0x55a552,_0x135011,_0x30bbdb);}module[_0x1d01('0x29')]=rrmemory;
\ No newline at end of file