Built motion from commit e781dc3c.|2.5.42
[motion2.git] / server / services / routing / server / applications / strategy / rrmemory.js
index 8be0a34..2d5c6d2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc1c9=['notificationId','realtime','routing','squeue','push','handleRun','timeout','bind','drained','handleDrained','prototype','handleTimeout','handleCheckReject','isAgentAvailable','agents','agentId','channel','info','[%s][QUEUE]\x20available\x20again\x20%s','intervals','queue','[%s][QUEUE]\x20try\x20with\x20%s','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','done','busy','name','showNotification','writeLog','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','hideNotification','busyQueue','exports','lodash','uuid','./util','../../../../../config/logger'];(function(_0x17f71c,_0x3bd4c6){var _0x5aa9f2=function(_0x414116){while(--_0x414116){_0x17f71c['push'](_0x17f71c['shift']());}};_0x5aa9f2(++_0x3bd4c6);}(_0xc1c9,0x149));var _0x9c1c=function(_0x31c27f,_0x40294c){_0x31c27f=_0x31c27f-0x0;var _0x28f9c6=_0xc1c9[_0x31c27f];return _0x28f9c6;};'use strict';var rr=require('rr');var _=require(_0x9c1c('0x0'));var uuid=require(_0x9c1c('0x1'));var util=require(_0x9c1c('0x2'));var logger=require(_0x9c1c('0x3'))('routing');var RRMemory=function(_0x565f3e,_0xcd2c0d,_0x12661a,_0x280040){this[_0x9c1c('0x4')]=uuid['v4']();this['squeue']=_0x565f3e;this['queue']=_0xcd2c0d;this[_0x9c1c('0x5')]=_0x12661a;this[_0x9c1c('0x6')]=_0x280040;this['intervals']={};this[_0x9c1c('0x7')][_0x9c1c('0x8')](this[_0x9c1c('0x9')]['bind'](this),this['handleTimeout']['bind'](this),this['module']);this[_0x9c1c('0x7')]['on'](_0x9c1c('0xa'),this['handleTimeout'][_0x9c1c('0xb')](this));this[_0x9c1c('0x7')]['on'](_0x9c1c('0xc'),this[_0x9c1c('0xd')][_0x9c1c('0xb')](this));};RRMemory[_0x9c1c('0xe')][_0x9c1c('0x8')]=function(){this[_0x9c1c('0x7')][_0x9c1c('0x8')](this[_0x9c1c('0x9')][_0x9c1c('0xb')](this),this[_0x9c1c('0xf')][_0x9c1c('0xb')](this));};RRMemory[_0x9c1c('0xe')][_0x9c1c('0xd')]=function(_0x1e9d81){this[_0x9c1c('0xf')](!![]);};RRMemory['prototype'][_0x9c1c('0x10')]=function(_0x338204){if(util[_0x9c1c('0x11')](this[_0x9c1c('0x7')]['id'],this['realtime'][_0x9c1c('0x12')][this[_0x9c1c('0x13')]],this['squeue'][_0x9c1c('0x14')],!![])){logger[_0x9c1c('0x15')](_0x9c1c('0x16'),this[_0x9c1c('0x7')]['id'],this[_0x9c1c('0x13')]);clearInterval(this[_0x9c1c('0x17')][this[_0x9c1c('0x13')]]);_0x338204['done']();setTimeout(this[_0x9c1c('0x8')][_0x9c1c('0xb')](this),0x3e8);}};RRMemory['prototype'][_0x9c1c('0x9')]=function(_0x3ecc44){this[_0x9c1c('0x13')]=rr(this[_0x9c1c('0x18')]['mapAgentsId']);logger[_0x9c1c('0x15')](_0x9c1c('0x19'),this[_0x9c1c('0x7')]['id'],this[_0x9c1c('0x13')]);if(_[_0x9c1c('0x1a')](this[_0x9c1c('0x5')][_0x9c1c('0x12')][this['agentId']])){logger[_0x9c1c('0x15')](_0x9c1c('0x1b'),this[_0x9c1c('0x7')]['id'],this[_0x9c1c('0x13')]);_0x3ecc44[_0x9c1c('0x1c')]();setTimeout(this[_0x9c1c('0x8')]['bind'](this),0x3e8);}else{if(util[_0x9c1c('0x11')](this[_0x9c1c('0x7')]['id'],this['realtime'][_0x9c1c('0x12')][this['agentId']],this[_0x9c1c('0x7')][_0x9c1c('0x14')],!![])){this[_0x9c1c('0x5')][_0x9c1c('0x12')][this[_0x9c1c('0x13')]][_0x9c1c('0x1d')]=!![];this[_0x9c1c('0x5')][_0x9c1c('0x12')][this[_0x9c1c('0x13')]]['busyQueue']=this[_0x9c1c('0x18')][_0x9c1c('0x1e')];util[_0x9c1c('0x1f')](this[_0x9c1c('0x4')],this[_0x9c1c('0x7')]['id'],this[_0x9c1c('0x5')][_0x9c1c('0x12')][this[_0x9c1c('0x13')]],this['queue'],this['routing']);util[_0x9c1c('0x20')](this['squeue']['id'],this[_0x9c1c('0x5')]['agents'][this[_0x9c1c('0x13')]],'RINGING');this[_0x9c1c('0x17')][this[_0x9c1c('0x13')]]=setInterval(this[_0x9c1c('0x10')][_0x9c1c('0xb')](this,_0x3ecc44),0x3e8);}else{logger[_0x9c1c('0x15')](_0x9c1c('0x21'),this[_0x9c1c('0x7')]['id'],this['agentId']);_0x3ecc44[_0x9c1c('0x1c')]();setTimeout(this[_0x9c1c('0x8')]['bind'](this),0x3e8);}}};RRMemory['prototype'][_0x9c1c('0xf')]=function(_0x45380a){logger['info']('[%s][QUEUE]\x20timeout\x20with\x20%s',this[_0x9c1c('0x7')]['id'],this['agentId']);if(_[_0x9c1c('0x1a')](this['realtime'][_0x9c1c('0x12')][this[_0x9c1c('0x13')]])){logger[_0x9c1c('0x15')](_0x9c1c('0x1b'),this[_0x9c1c('0x7')]['id'],this[_0x9c1c('0x13')]);}else{clearInterval(this[_0x9c1c('0x17')][this[_0x9c1c('0x13')]]);util[_0x9c1c('0x22')](this[_0x9c1c('0x4')],this['squeue']['id'],this['realtime'][_0x9c1c('0x12')][this['agentId']],this[_0x9c1c('0x18')],this['routing']);util[_0x9c1c('0x20')](this['squeue']['id'],this[_0x9c1c('0x5')][_0x9c1c('0x12')][this[_0x9c1c('0x13')]],'TIMEOUT');this[_0x9c1c('0x5')][_0x9c1c('0x12')][this[_0x9c1c('0x13')]][_0x9c1c('0x1d')]=![];this[_0x9c1c('0x5')]['agents'][this['agentId']][_0x9c1c('0x23')]=undefined;}if(!_0x45380a){setTimeout(this[_0x9c1c('0x8')][_0x9c1c('0xb')](this),0x3e8);}};function rrmemory(_0x51b8bf,_0x152e13,_0xb5a578,_0x364fb8){return new RRMemory(_0x51b8bf,_0x152e13,_0xb5a578,_0x364fb8);}module[_0x9c1c('0x24')]=rrmemory;
\ No newline at end of file
+var _0xeabd=['isNil','writeLog','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','queue','realtime','intervals','squeue','push','handleRun','bind','handleTimeout','module','drained','handleDrained','prototype','isAgentAvailable','agentId','channel','info','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s','agents','done','busy','busyQueue','name','showNotification','RINGING','handleCheckReject','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xeabd,0xdc));var _0xdeab=function(_0x3a9782,_0x2bac3b){_0x3a9782=_0x3a9782-0x0;var _0x1a8bee=_0xeabd[_0x3a9782];return _0x1a8bee;};'use strict';var rr=require('rr');var _=require(_0xdeab('0x0'));var uuid=require('uuid');var util=require(_0xdeab('0x1'));var logger=require(_0xdeab('0x2'))(_0xdeab('0x3'));var RRMemory=function(_0xc968ab,_0x733465,_0x508508,_0x270765){this[_0xdeab('0x4')]=uuid['v4']();this['squeue']=_0xc968ab;this[_0xdeab('0x5')]=_0x733465;this[_0xdeab('0x6')]=_0x508508;this['routing']=_0x270765;this[_0xdeab('0x7')]={};this[_0xdeab('0x8')][_0xdeab('0x9')](this[_0xdeab('0xa')][_0xdeab('0xb')](this),this[_0xdeab('0xc')][_0xdeab('0xb')](this),this[_0xdeab('0xd')]);this[_0xdeab('0x8')]['on']('timeout',this[_0xdeab('0xc')][_0xdeab('0xb')](this));this[_0xdeab('0x8')]['on'](_0xdeab('0xe'),this[_0xdeab('0xf')][_0xdeab('0xb')](this));};RRMemory[_0xdeab('0x10')][_0xdeab('0x9')]=function(){this[_0xdeab('0x8')]['push'](this[_0xdeab('0xa')]['bind'](this),this[_0xdeab('0xc')][_0xdeab('0xb')](this));};RRMemory[_0xdeab('0x10')][_0xdeab('0xf')]=function(_0x2c099f){this[_0xdeab('0xc')](!![]);};RRMemory['prototype']['handleCheckReject']=function(_0x37f390){if(util[_0xdeab('0x11')](this[_0xdeab('0x8')]['id'],this[_0xdeab('0x6')]['agents'][this[_0xdeab('0x12')]],this[_0xdeab('0x8')][_0xdeab('0x13')],!![])){logger[_0xdeab('0x14')]('[%s][QUEUE]\x20available\x20again\x20%s',this[_0xdeab('0x8')]['id'],this[_0xdeab('0x12')]);clearInterval(this[_0xdeab('0x7')][this[_0xdeab('0x12')]]);_0x37f390['done']();setTimeout(this[_0xdeab('0x9')][_0xdeab('0xb')](this),0x3e8);}};RRMemory[_0xdeab('0x10')]['handleRun']=function(_0x615c2){this[_0xdeab('0x12')]=rr(this['queue'][_0xdeab('0x15')]);logger['info'](_0xdeab('0x16'),this[_0xdeab('0x8')]['id'],this[_0xdeab('0x12')]);if(_['isNil'](this[_0xdeab('0x6')][_0xdeab('0x17')][this[_0xdeab('0x12')]])){logger['info']('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xdeab('0x8')]['id'],this[_0xdeab('0x12')]);_0x615c2[_0xdeab('0x18')]();setTimeout(this[_0xdeab('0x9')][_0xdeab('0xb')](this),0x3e8);}else{if(util[_0xdeab('0x11')](this['squeue']['id'],this['realtime']['agents'][this[_0xdeab('0x12')]],this[_0xdeab('0x8')][_0xdeab('0x13')],!![])){this['realtime'][_0xdeab('0x17')][this[_0xdeab('0x12')]][_0xdeab('0x19')]=!![];this[_0xdeab('0x6')]['agents'][this[_0xdeab('0x12')]][_0xdeab('0x1a')]=this[_0xdeab('0x5')][_0xdeab('0x1b')];util[_0xdeab('0x1c')](this['notificationId'],this['squeue']['id'],this['realtime']['agents'][this[_0xdeab('0x12')]],this[_0xdeab('0x5')],this['routing']);util['writeLog'](this[_0xdeab('0x8')]['id'],this[_0xdeab('0x6')][_0xdeab('0x17')][this[_0xdeab('0x12')]],_0xdeab('0x1d'));this[_0xdeab('0x7')][this[_0xdeab('0x12')]]=setInterval(this[_0xdeab('0x1e')][_0xdeab('0xb')](this,_0x615c2),0x3e8);}else{logger[_0xdeab('0x14')](_0xdeab('0x1f'),this['squeue']['id'],this[_0xdeab('0x12')]);_0x615c2[_0xdeab('0x18')]();setTimeout(this[_0xdeab('0x9')]['bind'](this),0x3e8);}}};RRMemory[_0xdeab('0x10')][_0xdeab('0xc')]=function(_0x6efbe4){logger[_0xdeab('0x14')]('[%s][QUEUE]\x20timeout\x20with\x20%s',this[_0xdeab('0x8')]['id'],this['agentId']);if(_[_0xdeab('0x20')](this[_0xdeab('0x6')][_0xdeab('0x17')][this[_0xdeab('0x12')]])){logger[_0xdeab('0x14')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xdeab('0x8')]['id'],this[_0xdeab('0x12')]);}else{clearInterval(this[_0xdeab('0x7')][this['agentId']]);util['hideNotification'](this[_0xdeab('0x4')],this['squeue']['id'],this['realtime']['agents'][this[_0xdeab('0x12')]],this['queue'],this['routing']);util[_0xdeab('0x21')](this[_0xdeab('0x8')]['id'],this['realtime'][_0xdeab('0x17')][this[_0xdeab('0x12')]],_0xdeab('0x22'));this['realtime'][_0xdeab('0x17')][this[_0xdeab('0x12')]][_0xdeab('0x19')]=![];this[_0xdeab('0x6')][_0xdeab('0x17')][this['agentId']]['busyQueue']=undefined;}if(!_0x6efbe4){setTimeout(this[_0xdeab('0x9')][_0xdeab('0xb')](this),0x3e8);}};function rrmemory(_0x1249b5,_0x16cb61,_0x4f0f32,_0x1f897a){return new RRMemory(_0x1249b5,_0x16cb61,_0x4f0f32,_0x1f897a);}module[_0xdeab('0x23')]=rrmemory;
\ No newline at end of file