Built motion from commit (unavailable).|2.5.21
[motion2.git] / server / services / routing / server / applications / strategy / beepall.js
index 51533af..d6a075a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf32e=['[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','busy','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','bind','timeout','handleTimeout','prototype','push','handleDrained','handleRun','isNil','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','writeLog','RINGING','busyQueue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf32e,0x167));var _0xef32=function(_0x3def72,_0x218642){_0x3def72=_0x3def72-0x0;var _0x366424=_0xf32e[_0x3def72];return _0x366424;};'use strict';var _=require(_0xef32('0x0'));var uuid=require(_0xef32('0x1'));var util=require(_0xef32('0x2'));var logger=require(_0xef32('0x3'))(_0xef32('0x4'));var Beepall=function(_0x424fde,_0x2c6e5a,_0x53af1c,_0x539998){this[_0xef32('0x5')]=uuid['v4']();this[_0xef32('0x6')]=_0x424fde;this['queue']=_0x2c6e5a;this[_0xef32('0x7')]=_0x53af1c;this['routing']=_0x539998;this['squeue']['push'](this['handleRun']['bind'](this),this['handleTimeout'][_0xef32('0x8')](this));this[_0xef32('0x6')]['on'](_0xef32('0x9'),this[_0xef32('0xa')][_0xef32('0x8')](this));this['squeue']['on']('drained',this['handleDrained'][_0xef32('0x8')](this));};Beepall[_0xef32('0xb')][_0xef32('0xc')]=function(){this['squeue']['push'](this['handleRun']['bind'](this),this[_0xef32('0xa')]['bind'](this));};Beepall[_0xef32('0xb')][_0xef32('0xd')]=function(_0x37a10c){this[_0xef32('0xa')](!![]);};Beepall[_0xef32('0xb')][_0xef32('0xe')]=function(_0x5ba56d){var _0x38ef12=!![];if(!_[_0xef32('0xf')](this[_0xef32('0x10')])&&!_['isNil'](this[_0xef32('0x10')]['Agents'])&&this[_0xef32('0x10')][_0xef32('0x11')]['length']>0x0){for(var _0x2852be=0x0,_0x2b0fe;_0x2852be<this[_0xef32('0x10')][_0xef32('0x11')][_0xef32('0x12')];_0x2852be+=0x1){_0x2b0fe=this['queue'][_0xef32('0x11')][_0x2852be]['id'];if(_[_0xef32('0xf')](this[_0xef32('0x7')][_0xef32('0x13')][_0x2b0fe])){logger[_0xef32('0x14')](_0xef32('0x15'),this[_0xef32('0x6')]['id'],_0x2b0fe);}else{if(util['isAgentAvailable'](this['squeue']['id'],this[_0xef32('0x7')][_0xef32('0x13')][_0x2b0fe],this[_0xef32('0x6')]['channel'],!![])){_0x38ef12=![];util[_0xef32('0x16')](this['squeue']['id'],this['realtime'][_0xef32('0x13')][_0x2b0fe],_0xef32('0x17'));this[_0xef32('0x7')]['agents'][_0x2b0fe]['busy']=!![];this[_0xef32('0x7')][_0xef32('0x13')][_0x2b0fe][_0xef32('0x18')]=this[_0xef32('0x10')]['name'];util['showNotification'](this['notificationId'],this[_0xef32('0x6')]['id'],this['realtime']['agents'][_0x2b0fe],this[_0xef32('0x10')],this[_0xef32('0x4')]);}}}if(_0x38ef12){logger[_0xef32('0x14')](_0xef32('0x19'),this[_0xef32('0x6')]['id']);setTimeout(this[_0xef32('0xc')]['bind'](this),0x3e8);}}else{logger[_0xef32('0x14')](_0xef32('0x1a'),this[_0xef32('0x6')]['id']);setTimeout(this['push'][_0xef32('0x8')](this),0x3e8);}};Beepall[_0xef32('0xb')][_0xef32('0xa')]=function(_0x568457){if(!_[_0xef32('0xf')](this[_0xef32('0x10')])&&!_['isNil'](this[_0xef32('0x10')]['Agents'])){for(var _0x10318d=0x0,_0x726e7b;_0x10318d<this[_0xef32('0x10')]['Agents'][_0xef32('0x12')];_0x10318d+=0x1){_0x726e7b=this['queue']['Agents'][_0x10318d]['id'];if(_[_0xef32('0xf')](this[_0xef32('0x7')][_0xef32('0x13')][_0x726e7b])){logger['info'](_0xef32('0x15'),this[_0xef32('0x6')]['id'],_0x726e7b);}else{util[_0xef32('0x1b')](this[_0xef32('0x5')],this[_0xef32('0x6')]['id'],this['realtime'][_0xef32('0x13')][_0x726e7b],this['queue'],this[_0xef32('0x4')]);util[_0xef32('0x16')](this[_0xef32('0x6')]['id'],this[_0xef32('0x7')][_0xef32('0x13')][_0x726e7b],_0x568457?_0xef32('0x1c'):_0xef32('0x1d'));this[_0xef32('0x7')]['agents'][_0x726e7b][_0xef32('0x1e')]=![];this[_0xef32('0x7')][_0xef32('0x13')][_0x726e7b][_0xef32('0x18')]=undefined;}}}if(!_0x568457){setTimeout(this[_0xef32('0xc')]['bind'](this),0x3e8);}};function beepall(_0x253743,_0xcefb58,_0x34e96b,_0x3236c1){return new Beepall(_0x253743,_0xcefb58,_0x34e96b,_0x3236c1);}module[_0xef32('0x1f')]=beepall;
\ No newline at end of file
+var _0xaf20=['RINGING','busy','busyQueue','name','showNotification','notificationId','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','isNil','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','routing','STOP','exports','lodash','uuid','./util','../../../../../config/logger','squeue','queue','push','bind','handleTimeout','timeout','drained','handleDrained','prototype','handleRun','Agents','length','agents','channel','realtime'];(function(_0x2e846f,_0x57929a){var _0x42f147=function(_0x3fff97){while(--_0x3fff97){_0x2e846f['push'](_0x2e846f['shift']());}};_0x42f147(++_0x57929a);}(_0xaf20,0x11f));var _0x0af2=function(_0x4fbaa0,_0x1569eb){_0x4fbaa0=_0x4fbaa0-0x0;var _0x34072f=_0xaf20[_0x4fbaa0];return _0x34072f;};'use strict';var _=require(_0x0af2('0x0'));var uuid=require(_0x0af2('0x1'));var util=require(_0x0af2('0x2'));var logger=require(_0x0af2('0x3'))('routing');var Beepall=function(_0x2165ba,_0x1d1d0b,_0x110d59,_0x15a5e4){this['notificationId']=uuid['v4']();this[_0x0af2('0x4')]=_0x2165ba;this[_0x0af2('0x5')]=_0x1d1d0b;this['realtime']=_0x110d59;this['routing']=_0x15a5e4;this[_0x0af2('0x4')][_0x0af2('0x6')](this['handleRun'][_0x0af2('0x7')](this),this[_0x0af2('0x8')][_0x0af2('0x7')](this));this['squeue']['on'](_0x0af2('0x9'),this[_0x0af2('0x8')]['bind'](this));this['squeue']['on'](_0x0af2('0xa'),this[_0x0af2('0xb')][_0x0af2('0x7')](this));};Beepall[_0x0af2('0xc')][_0x0af2('0x6')]=function(){this[_0x0af2('0x4')][_0x0af2('0x6')](this[_0x0af2('0xd')][_0x0af2('0x7')](this),this[_0x0af2('0x8')][_0x0af2('0x7')](this));};Beepall[_0x0af2('0xc')][_0x0af2('0xb')]=function(_0xa13ed4){this[_0x0af2('0x8')](!![]);};Beepall[_0x0af2('0xc')][_0x0af2('0xd')]=function(_0x1a2ffc){var _0x57fd9e=!![];if(!_['isNil'](this['queue'])&&!_['isNil'](this['queue']['Agents'])&&this['queue'][_0x0af2('0xe')][_0x0af2('0xf')]>0x0){for(var _0xaff3da=0x0,_0x377a82;_0xaff3da<this['queue'][_0x0af2('0xe')][_0x0af2('0xf')];_0xaff3da+=0x1){_0x377a82=this['queue'][_0x0af2('0xe')][_0xaff3da]['id'];if(_['isNil'](this['realtime'][_0x0af2('0x10')][_0x377a82])){logger['info']('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this['squeue']['id'],_0x377a82);}else{if(util['isAgentAvailable'](this['squeue']['id'],this['realtime'][_0x0af2('0x10')][_0x377a82],this[_0x0af2('0x4')][_0x0af2('0x11')],!![])){_0x57fd9e=![];util['writeLog'](this[_0x0af2('0x4')]['id'],this[_0x0af2('0x12')][_0x0af2('0x10')][_0x377a82],_0x0af2('0x13'));this[_0x0af2('0x12')][_0x0af2('0x10')][_0x377a82][_0x0af2('0x14')]=!![];this[_0x0af2('0x12')][_0x0af2('0x10')][_0x377a82][_0x0af2('0x15')]=this[_0x0af2('0x5')][_0x0af2('0x16')];util[_0x0af2('0x17')](this[_0x0af2('0x18')],this[_0x0af2('0x4')]['id'],this[_0x0af2('0x12')][_0x0af2('0x10')][_0x377a82],this[_0x0af2('0x5')],this['routing']);}}}if(_0x57fd9e){logger[_0x0af2('0x19')](_0x0af2('0x1a'),this[_0x0af2('0x4')]['id']);setTimeout(this[_0x0af2('0x6')][_0x0af2('0x7')](this),0x3e8);}}else{logger[_0x0af2('0x19')](_0x0af2('0x1b'),this['squeue']['id']);setTimeout(this[_0x0af2('0x6')]['bind'](this),0x3e8);}};Beepall[_0x0af2('0xc')]['handleTimeout']=function(_0x217764){if(!_['isNil'](this[_0x0af2('0x5')])&&!_[_0x0af2('0x1c')](this['queue'][_0x0af2('0xe')])){for(var _0x27d79c=0x0,_0x23fc5b;_0x27d79c<this[_0x0af2('0x5')][_0x0af2('0xe')][_0x0af2('0xf')];_0x27d79c+=0x1){_0x23fc5b=this['queue'][_0x0af2('0xe')][_0x27d79c]['id'];if(_[_0x0af2('0x1c')](this['realtime']['agents'][_0x23fc5b])){logger[_0x0af2('0x19')](_0x0af2('0x1d'),this[_0x0af2('0x4')]['id'],_0x23fc5b);}else{util[_0x0af2('0x1e')](this['notificationId'],this[_0x0af2('0x4')]['id'],this[_0x0af2('0x12')]['agents'][_0x23fc5b],this[_0x0af2('0x5')],this[_0x0af2('0x1f')]);util['writeLog'](this[_0x0af2('0x4')]['id'],this[_0x0af2('0x12')][_0x0af2('0x10')][_0x23fc5b],_0x217764?_0x0af2('0x20'):'TIMEOUT');this[_0x0af2('0x12')][_0x0af2('0x10')][_0x23fc5b]['busy']=![];this[_0x0af2('0x12')][_0x0af2('0x10')][_0x23fc5b][_0x0af2('0x15')]=undefined;}}}if(!_0x217764){setTimeout(this[_0x0af2('0x6')][_0x0af2('0x7')](this),0x3e8);}};function beepall(_0x361d6f,_0x16cc3e,_0x267817,_0x3636b6){return new Beepall(_0x361d6f,_0x16cc3e,_0x267817,_0x3636b6);}module[_0x0af2('0x21')]=beepall;
\ No newline at end of file