Built motion from commit (unavailable).|2.4.5
[motion2.git] / server / services / routing / server / applications / strategy / rrmemory.js
index 77c903f..2d2118d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6bc8=['routing','handleRun','bind','timeout','handleTimeout','drained','handleDrained','push','prototype','handleCheckReject','agents','agentId','channel','info','[%s][QUEUE]\x20available\x20again\x20%s','intervals','done','queue','mapAgentsId','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','busy','busyQueue','showNotification','writeLog','[%s][QUEUE]\x20timeout\x20with\x20%s','hideNotification','exports','lodash','./util','../../../../../config/logger','notificationId','squeue','realtime'];(function(_0x3b211f,_0x447485){var _0x5ddca9=function(_0x291bf1){while(--_0x291bf1){_0x3b211f['push'](_0x3b211f['shift']());}};_0x5ddca9(++_0x447485);}(_0x6bc8,0x1e4));var _0x86bc=function(_0x4d217b,_0x57b380){_0x4d217b=_0x4d217b-0x0;var _0x12da8f=_0x6bc8[_0x4d217b];return _0x12da8f;};'use strict';var rr=require('rr');var _=require(_0x86bc('0x0'));var uuid=require('uuid');var util=require(_0x86bc('0x1'));var logger=require(_0x86bc('0x2'))('routing');var RRMemory=function(_0x18b63d,_0x835b1e,_0x4b409d,_0x2365d7){this[_0x86bc('0x3')]=uuid['v4']();this[_0x86bc('0x4')]=_0x18b63d;this['queue']=_0x835b1e;this[_0x86bc('0x5')]=_0x4b409d;this[_0x86bc('0x6')]=_0x2365d7;this['intervals']={};this[_0x86bc('0x4')]['push'](this[_0x86bc('0x7')]['bind'](this),this['handleTimeout'][_0x86bc('0x8')](this),this['module']);this[_0x86bc('0x4')]['on'](_0x86bc('0x9'),this[_0x86bc('0xa')][_0x86bc('0x8')](this));this[_0x86bc('0x4')]['on'](_0x86bc('0xb'),this[_0x86bc('0xc')][_0x86bc('0x8')](this));};RRMemory['prototype'][_0x86bc('0xd')]=function(){this['squeue'][_0x86bc('0xd')](this[_0x86bc('0x7')][_0x86bc('0x8')](this),this['handleTimeout'][_0x86bc('0x8')](this));};RRMemory[_0x86bc('0xe')][_0x86bc('0xc')]=function(_0x23765d){this[_0x86bc('0xa')](!![]);};RRMemory[_0x86bc('0xe')][_0x86bc('0xf')]=function(_0x520e87){if(util['isAgentAvailable'](this[_0x86bc('0x4')]['id'],this['realtime'][_0x86bc('0x10')][this[_0x86bc('0x11')]],this[_0x86bc('0x4')][_0x86bc('0x12')],!![])){logger[_0x86bc('0x13')](_0x86bc('0x14'),this[_0x86bc('0x4')]['id'],this[_0x86bc('0x11')]);clearInterval(this[_0x86bc('0x15')][this[_0x86bc('0x11')]]);_0x520e87[_0x86bc('0x16')]();setTimeout(this[_0x86bc('0xd')][_0x86bc('0x8')](this),0x3e8);}};RRMemory[_0x86bc('0xe')][_0x86bc('0x7')]=function(_0x5d3549){this[_0x86bc('0x11')]=rr(this[_0x86bc('0x17')][_0x86bc('0x18')]);logger[_0x86bc('0x13')]('[%s][QUEUE]\x20try\x20with\x20%s',this[_0x86bc('0x4')]['id'],this['agentId']);if(_[_0x86bc('0x19')](this[_0x86bc('0x5')][_0x86bc('0x10')][this['agentId']])){logger[_0x86bc('0x13')](_0x86bc('0x1a'),this[_0x86bc('0x4')]['id'],this[_0x86bc('0x11')]);_0x5d3549['done']();setTimeout(this[_0x86bc('0xd')][_0x86bc('0x8')](this),0x3e8);}else{if(util[_0x86bc('0x1b')](this[_0x86bc('0x4')]['id'],this['realtime'][_0x86bc('0x10')][this[_0x86bc('0x11')]],this['squeue'][_0x86bc('0x12')],!![])){this['realtime'][_0x86bc('0x10')][this['agentId']][_0x86bc('0x1c')]=!![];this[_0x86bc('0x5')][_0x86bc('0x10')][this['agentId']][_0x86bc('0x1d')]=this['queue']['name'];util[_0x86bc('0x1e')](this[_0x86bc('0x3')],this[_0x86bc('0x4')]['id'],this[_0x86bc('0x5')][_0x86bc('0x10')][this[_0x86bc('0x11')]],this[_0x86bc('0x17')],this[_0x86bc('0x6')]);util[_0x86bc('0x1f')](this[_0x86bc('0x4')]['id'],this['realtime'][_0x86bc('0x10')][this[_0x86bc('0x11')]],'RINGING');this['intervals'][this['agentId']]=setInterval(this[_0x86bc('0xf')]['bind'](this,_0x5d3549),0x3e8);}else{logger[_0x86bc('0x13')]('[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s',this[_0x86bc('0x4')]['id'],this[_0x86bc('0x11')]);_0x5d3549[_0x86bc('0x16')]();setTimeout(this['push']['bind'](this),0x3e8);}}};RRMemory[_0x86bc('0xe')][_0x86bc('0xa')]=function(_0x26794f){logger['info'](_0x86bc('0x20'),this[_0x86bc('0x4')]['id'],this['agentId']);if(_[_0x86bc('0x19')](this[_0x86bc('0x5')][_0x86bc('0x10')][this['agentId']])){logger[_0x86bc('0x13')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],this[_0x86bc('0x11')]);}else{clearInterval(this[_0x86bc('0x15')][this[_0x86bc('0x11')]]);util[_0x86bc('0x21')](this['notificationId'],this['squeue']['id'],this[_0x86bc('0x5')][_0x86bc('0x10')][this[_0x86bc('0x11')]],this[_0x86bc('0x17')],this[_0x86bc('0x6')]);util[_0x86bc('0x1f')](this['squeue']['id'],this[_0x86bc('0x5')][_0x86bc('0x10')][this[_0x86bc('0x11')]],'TIMEOUT');this['realtime'][_0x86bc('0x10')][this[_0x86bc('0x11')]]['busy']=![];this[_0x86bc('0x5')][_0x86bc('0x10')][this[_0x86bc('0x11')]][_0x86bc('0x1d')]=undefined;}if(!_0x26794f){setTimeout(this[_0x86bc('0xd')][_0x86bc('0x8')](this),0x3e8);}};function rrmemory(_0xaa8b51,_0x12c39c,_0x2612b4,_0x1a5289){return new RRMemory(_0xaa8b51,_0x12c39c,_0x2612b4,_0x1a5289);}module[_0x86bc('0x22')]=rrmemory;
\ No newline at end of file
+var _0xe86a=['uuid','./util','../../../../../config/logger','squeue','queue','realtime','routing','intervals','push','handleRun','bind','timeout','handleTimeout','drained','prototype','handleDrained','agents','agentId','channel','info','[%s][QUEUE]\x20available\x20again\x20%s','mapAgentsId','[%s][QUEUE]\x20try\x20with\x20%s','done','isAgentAvailable','name','showNotification','notificationId','writeLog','RINGING','handleCheckReject','[%s][QUEUE]\x20agent\x20skipped,\x20not\x20available\x20id\x20%s','[%s][QUEUE]\x20timeout\x20with\x20%s','isNil','TIMEOUT','busy'];(function(_0x188ea1,_0x5a3698){var _0x3749a7=function(_0x459ffc){while(--_0x459ffc){_0x188ea1['push'](_0x188ea1['shift']());}};_0x3749a7(++_0x5a3698);}(_0xe86a,0x120));var _0xae86=function(_0xf499c7,_0x41f36a){_0xf499c7=_0xf499c7-0x0;var _0x11deb0=_0xe86a[_0xf499c7];return _0x11deb0;};'use strict';var rr=require('rr');var _=require('lodash');var uuid=require(_0xae86('0x0'));var util=require(_0xae86('0x1'));var logger=require(_0xae86('0x2'))('routing');var RRMemory=function(_0x390754,_0x585949,_0x148d70,_0x477316){this['notificationId']=uuid['v4']();this[_0xae86('0x3')]=_0x390754;this[_0xae86('0x4')]=_0x585949;this[_0xae86('0x5')]=_0x148d70;this[_0xae86('0x6')]=_0x477316;this[_0xae86('0x7')]={};this[_0xae86('0x3')][_0xae86('0x8')](this[_0xae86('0x9')][_0xae86('0xa')](this),this['handleTimeout']['bind'](this),this['module']);this['squeue']['on'](_0xae86('0xb'),this[_0xae86('0xc')][_0xae86('0xa')](this));this[_0xae86('0x3')]['on'](_0xae86('0xd'),this['handleDrained'][_0xae86('0xa')](this));};RRMemory[_0xae86('0xe')]['push']=function(){this[_0xae86('0x3')]['push'](this[_0xae86('0x9')][_0xae86('0xa')](this),this['handleTimeout']['bind'](this));};RRMemory[_0xae86('0xe')][_0xae86('0xf')]=function(_0x49f1fc){this[_0xae86('0xc')](!![]);};RRMemory[_0xae86('0xe')]['handleCheckReject']=function(_0x57d56b){if(util['isAgentAvailable'](this['squeue']['id'],this[_0xae86('0x5')][_0xae86('0x10')][this[_0xae86('0x11')]],this[_0xae86('0x3')][_0xae86('0x12')],!![])){logger[_0xae86('0x13')](_0xae86('0x14'),this['squeue']['id'],this['agentId']);clearInterval(this['intervals'][this[_0xae86('0x11')]]);_0x57d56b['done']();setTimeout(this[_0xae86('0x8')][_0xae86('0xa')](this),0x3e8);}};RRMemory['prototype'][_0xae86('0x9')]=function(_0x1c14d1){this[_0xae86('0x11')]=rr(this['queue'][_0xae86('0x15')]);logger[_0xae86('0x13')](_0xae86('0x16'),this[_0xae86('0x3')]['id'],this['agentId']);if(_['isNil'](this[_0xae86('0x5')][_0xae86('0x10')][this[_0xae86('0x11')]])){logger['info']('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xae86('0x3')]['id'],this[_0xae86('0x11')]);_0x1c14d1[_0xae86('0x17')]();setTimeout(this[_0xae86('0x8')][_0xae86('0xa')](this),0x3e8);}else{if(util[_0xae86('0x18')](this['squeue']['id'],this[_0xae86('0x5')][_0xae86('0x10')][this[_0xae86('0x11')]],this[_0xae86('0x3')][_0xae86('0x12')],!![])){this[_0xae86('0x5')]['agents'][this[_0xae86('0x11')]]['busy']=!![];this[_0xae86('0x5')]['agents'][this[_0xae86('0x11')]]['busyQueue']=this[_0xae86('0x4')][_0xae86('0x19')];util[_0xae86('0x1a')](this[_0xae86('0x1b')],this[_0xae86('0x3')]['id'],this[_0xae86('0x5')]['agents'][this[_0xae86('0x11')]],this[_0xae86('0x4')],this['routing']);util[_0xae86('0x1c')](this['squeue']['id'],this[_0xae86('0x5')][_0xae86('0x10')][this[_0xae86('0x11')]],_0xae86('0x1d'));this[_0xae86('0x7')][this['agentId']]=setInterval(this[_0xae86('0x1e')]['bind'](this,_0x1c14d1),0x3e8);}else{logger[_0xae86('0x13')](_0xae86('0x1f'),this[_0xae86('0x3')]['id'],this[_0xae86('0x11')]);_0x1c14d1[_0xae86('0x17')]();setTimeout(this['push']['bind'](this),0x3e8);}}};RRMemory[_0xae86('0xe')]['handleTimeout']=function(_0x51e7e8){logger[_0xae86('0x13')](_0xae86('0x20'),this[_0xae86('0x3')]['id'],this[_0xae86('0x11')]);if(_[_0xae86('0x21')](this[_0xae86('0x5')][_0xae86('0x10')][this[_0xae86('0x11')]])){logger[_0xae86('0x13')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xae86('0x3')]['id'],this['agentId']);}else{clearInterval(this[_0xae86('0x7')][this[_0xae86('0x11')]]);util['hideNotification'](this['notificationId'],this[_0xae86('0x3')]['id'],this[_0xae86('0x5')][_0xae86('0x10')][this[_0xae86('0x11')]],this[_0xae86('0x4')],this[_0xae86('0x6')]);util[_0xae86('0x1c')](this[_0xae86('0x3')]['id'],this['realtime'][_0xae86('0x10')][this[_0xae86('0x11')]],_0xae86('0x22'));this[_0xae86('0x5')]['agents'][this[_0xae86('0x11')]][_0xae86('0x23')]=![];this['realtime'][_0xae86('0x10')][this['agentId']]['busyQueue']=undefined;}if(!_0x51e7e8){setTimeout(this[_0xae86('0x8')][_0xae86('0xa')](this),0x3e8);}};function rrmemory(_0x44ff86,_0x27301f,_0x400c49,_0x58d491){return new RRMemory(_0x44ff86,_0x27301f,_0x400c49,_0x58d491);}module['exports']=rrmemory;
\ No newline at end of file