Built motion from commit fade34fd.|2.5.41
[motion2.git] / server / services / routing / server / applications / strategy / beepall.js
index 99f861d..c2fc2f5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa9b1=['../../../../../config/logger','routing','queue','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','Agents','length','isNil','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','RINGING','busy','name','showNotification','info','[%s][QUEUE]\x20EMPTY','STOP','busyQueue','./util'];(function(_0x5642e1,_0x3c638f){var _0x11cc37=function(_0x53cfa7){while(--_0x53cfa7){_0x5642e1['push'](_0x5642e1['shift']());}};_0x11cc37(++_0x3c638f);}(_0xa9b1,0x133));var _0x1a9b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa9b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x1a9b('0x0'));var logger=require(_0x1a9b('0x1'))(_0x1a9b('0x2'));var Beepall=function(_0x3f42db,_0xc88712,_0x10c90c,_0x52f55f){this['notificationId']=uuid['v4']();this['squeue']=_0x3f42db;this[_0x1a9b('0x3')]=_0xc88712;this[_0x1a9b('0x4')]=_0x10c90c;this[_0x1a9b('0x2')]=_0x52f55f;this[_0x1a9b('0x5')][_0x1a9b('0x6')](this[_0x1a9b('0x7')][_0x1a9b('0x8')](this),this[_0x1a9b('0x9')][_0x1a9b('0x8')](this));this[_0x1a9b('0x5')]['on'](_0x1a9b('0xa'),this[_0x1a9b('0x9')]['bind'](this));this['squeue']['on'](_0x1a9b('0xb'),this[_0x1a9b('0xc')][_0x1a9b('0x8')](this));};Beepall['prototype']['push']=function(){this['squeue'][_0x1a9b('0x6')](this[_0x1a9b('0x7')][_0x1a9b('0x8')](this),this[_0x1a9b('0x9')][_0x1a9b('0x8')](this));};Beepall[_0x1a9b('0xd')]['handleDrained']=function(_0x3c1ba4){this[_0x1a9b('0x9')](!![]);};Beepall[_0x1a9b('0xd')]['handleRun']=function(_0x439646){var _0x38145b=!![];if(!_['isNil'](this[_0x1a9b('0x3')])&&!_['isNil'](this[_0x1a9b('0x3')][_0x1a9b('0xe')])&&this[_0x1a9b('0x3')][_0x1a9b('0xe')][_0x1a9b('0xf')]>0x0){for(var _0x20b8dc=0x0,_0x37057a;_0x20b8dc<this[_0x1a9b('0x3')][_0x1a9b('0xe')][_0x1a9b('0xf')];_0x20b8dc+=0x1){_0x37057a=this['queue'][_0x1a9b('0xe')][_0x20b8dc]['id'];if(_[_0x1a9b('0x10')](this[_0x1a9b('0x4')][_0x1a9b('0x11')][_0x37057a])){logger['info'](_0x1a9b('0x12'),this[_0x1a9b('0x5')]['id'],_0x37057a);}else{if(util['isAgentAvailable'](this[_0x1a9b('0x5')]['id'],this[_0x1a9b('0x4')][_0x1a9b('0x11')][_0x37057a],this[_0x1a9b('0x5')][_0x1a9b('0x13')],!![])){_0x38145b=![];util['writeLog'](this[_0x1a9b('0x5')]['id'],this[_0x1a9b('0x4')][_0x1a9b('0x11')][_0x37057a],_0x1a9b('0x14'));this[_0x1a9b('0x4')][_0x1a9b('0x11')][_0x37057a][_0x1a9b('0x15')]=!![];this['realtime'][_0x1a9b('0x11')][_0x37057a]['busyQueue']=this[_0x1a9b('0x3')][_0x1a9b('0x16')];util[_0x1a9b('0x17')](this['notificationId'],this[_0x1a9b('0x5')]['id'],this[_0x1a9b('0x4')][_0x1a9b('0x11')][_0x37057a],this[_0x1a9b('0x3')],this[_0x1a9b('0x2')]);}}}if(_0x38145b){logger[_0x1a9b('0x18')]('[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY',this[_0x1a9b('0x5')]['id']);setTimeout(this[_0x1a9b('0x6')]['bind'](this),0x3e8);}}else{logger[_0x1a9b('0x18')](_0x1a9b('0x19'),this['squeue']['id']);setTimeout(this['push'][_0x1a9b('0x8')](this),0x3e8);}};Beepall[_0x1a9b('0xd')]['handleTimeout']=function(_0x30278b){if(!_[_0x1a9b('0x10')](this[_0x1a9b('0x3')])&&!_[_0x1a9b('0x10')](this[_0x1a9b('0x3')][_0x1a9b('0xe')])){for(var _0x26949c=0x0,_0x5ed1e3;_0x26949c<this[_0x1a9b('0x3')][_0x1a9b('0xe')][_0x1a9b('0xf')];_0x26949c+=0x1){_0x5ed1e3=this[_0x1a9b('0x3')][_0x1a9b('0xe')][_0x26949c]['id'];if(_[_0x1a9b('0x10')](this[_0x1a9b('0x4')][_0x1a9b('0x11')][_0x5ed1e3])){logger[_0x1a9b('0x18')](_0x1a9b('0x12'),this[_0x1a9b('0x5')]['id'],_0x5ed1e3);}else{util['hideNotification'](this['notificationId'],this[_0x1a9b('0x5')]['id'],this[_0x1a9b('0x4')][_0x1a9b('0x11')][_0x5ed1e3],this['queue'],this[_0x1a9b('0x2')]);util['writeLog'](this[_0x1a9b('0x5')]['id'],this['realtime'][_0x1a9b('0x11')][_0x5ed1e3],_0x30278b?_0x1a9b('0x1a'):'TIMEOUT');this[_0x1a9b('0x4')]['agents'][_0x5ed1e3][_0x1a9b('0x15')]=![];this[_0x1a9b('0x4')][_0x1a9b('0x11')][_0x5ed1e3][_0x1a9b('0x1b')]=undefined;}}}if(!_0x30278b){setTimeout(this['push'][_0x1a9b('0x8')](this),0x3e8);}};function beepall(_0x31dae0,_0x26bcb6,_0x5ceda8,_0x126f89){return new Beepall(_0x31dae0,_0x26bcb6,_0x5ceda8,_0x126f89);}module['exports']=beepall;
\ No newline at end of file
+var _0x5e11=['STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','queue','realtime','squeue','push','bind','handleTimeout','handleDrained','prototype','handleRun','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','RINGING','busy','busyQueue','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification'];(function(_0x28551f,_0x5650ae){var _0x3d4de8=function(_0x4c906d){while(--_0x4c906d){_0x28551f['push'](_0x28551f['shift']());}};_0x3d4de8(++_0x5650ae);}(_0x5e11,0x1c3));var _0x15e1=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x5e11[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x15e1('0x0'));var uuid=require('uuid');var util=require(_0x15e1('0x1'));var logger=require(_0x15e1('0x2'))(_0x15e1('0x3'));var Beepall=function(_0xd2c9d9,_0x82943a,_0x289592,_0x598eda){this[_0x15e1('0x4')]=uuid['v4']();this['squeue']=_0xd2c9d9;this[_0x15e1('0x5')]=_0x82943a;this[_0x15e1('0x6')]=_0x289592;this[_0x15e1('0x3')]=_0x598eda;this[_0x15e1('0x7')][_0x15e1('0x8')](this['handleRun'][_0x15e1('0x9')](this),this[_0x15e1('0xa')][_0x15e1('0x9')](this));this[_0x15e1('0x7')]['on']('timeout',this[_0x15e1('0xa')][_0x15e1('0x9')](this));this[_0x15e1('0x7')]['on']('drained',this[_0x15e1('0xb')][_0x15e1('0x9')](this));};Beepall[_0x15e1('0xc')][_0x15e1('0x8')]=function(){this[_0x15e1('0x7')][_0x15e1('0x8')](this[_0x15e1('0xd')][_0x15e1('0x9')](this),this[_0x15e1('0xa')][_0x15e1('0x9')](this));};Beepall[_0x15e1('0xc')][_0x15e1('0xb')]=function(_0x577e9a){this[_0x15e1('0xa')](!![]);};Beepall[_0x15e1('0xc')][_0x15e1('0xd')]=function(_0x56b623){var _0x3cd5c3=!![];if(!_[_0x15e1('0xe')](this['queue'])&&!_[_0x15e1('0xe')](this[_0x15e1('0x5')][_0x15e1('0xf')])&&this[_0x15e1('0x5')][_0x15e1('0xf')][_0x15e1('0x10')]>0x0){for(var _0x376500=0x0,_0x32008a;_0x376500<this[_0x15e1('0x5')][_0x15e1('0xf')][_0x15e1('0x10')];_0x376500+=0x1){_0x32008a=this[_0x15e1('0x5')][_0x15e1('0xf')][_0x376500]['id'];if(_[_0x15e1('0xe')](this[_0x15e1('0x6')][_0x15e1('0x11')][_0x32008a])){logger['info'](_0x15e1('0x12'),this[_0x15e1('0x7')]['id'],_0x32008a);}else{if(util['isAgentAvailable'](this[_0x15e1('0x7')]['id'],this[_0x15e1('0x6')][_0x15e1('0x11')][_0x32008a],this[_0x15e1('0x7')]['channel'],!![])){_0x3cd5c3=![];util['writeLog'](this[_0x15e1('0x7')]['id'],this[_0x15e1('0x6')][_0x15e1('0x11')][_0x32008a],_0x15e1('0x13'));this[_0x15e1('0x6')][_0x15e1('0x11')][_0x32008a][_0x15e1('0x14')]=!![];this['realtime']['agents'][_0x32008a][_0x15e1('0x15')]=this[_0x15e1('0x5')]['name'];util['showNotification'](this[_0x15e1('0x4')],this[_0x15e1('0x7')]['id'],this['realtime'][_0x15e1('0x11')][_0x32008a],this[_0x15e1('0x5')],this[_0x15e1('0x3')]);}}}if(_0x3cd5c3){logger[_0x15e1('0x16')](_0x15e1('0x17'),this['squeue']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}else{logger[_0x15e1('0x16')]('[%s][QUEUE]\x20EMPTY',this[_0x15e1('0x7')]['id']);setTimeout(this[_0x15e1('0x8')][_0x15e1('0x9')](this),0x3e8);}};Beepall[_0x15e1('0xc')][_0x15e1('0xa')]=function(_0x4e1dcf){if(!_[_0x15e1('0xe')](this['queue'])&&!_[_0x15e1('0xe')](this['queue']['Agents'])){for(var _0x2bc1e6=0x0,_0x5e8eb7;_0x2bc1e6<this['queue']['Agents'][_0x15e1('0x10')];_0x2bc1e6+=0x1){_0x5e8eb7=this[_0x15e1('0x5')]['Agents'][_0x2bc1e6]['id'];if(_[_0x15e1('0xe')](this[_0x15e1('0x6')]['agents'][_0x5e8eb7])){logger[_0x15e1('0x16')](_0x15e1('0x12'),this[_0x15e1('0x7')]['id'],_0x5e8eb7);}else{util[_0x15e1('0x18')](this['notificationId'],this[_0x15e1('0x7')]['id'],this[_0x15e1('0x6')]['agents'][_0x5e8eb7],this['queue'],this[_0x15e1('0x3')]);util['writeLog'](this['squeue']['id'],this['realtime'][_0x15e1('0x11')][_0x5e8eb7],_0x4e1dcf?_0x15e1('0x19'):_0x15e1('0x1a'));this[_0x15e1('0x6')][_0x15e1('0x11')][_0x5e8eb7][_0x15e1('0x14')]=![];this[_0x15e1('0x6')][_0x15e1('0x11')][_0x5e8eb7][_0x15e1('0x15')]=undefined;}}}if(!_0x4e1dcf){setTimeout(this[_0x15e1('0x8')][_0x15e1('0x9')](this),0x3e8);}};function beepall(_0x141306,_0x49866d,_0x4c74e9,_0x5e743b){return new Beepall(_0x141306,_0x49866d,_0x4c74e9,_0x5e743b);}module[_0x15e1('0x1b')]=beepall;
\ No newline at end of file