Built motion from commit 6362bb75.|2.6.13
[motion2.git] / server / services / routing / server / applications / strategy / beepall.js
index 17b56c9..ad4fd5b 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x765a=['writeLog','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','bind','timeout','drained','prototype','handleTimeout','isNil','Agents','length','agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','RINGING','busy','busyQueue','name','saveWaitingNotification','showNotification','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification'];(function(_0x6f53dd,_0xdd1d95){var _0x424e15=function(_0x255e2d){while(--_0x255e2d){_0x6f53dd['push'](_0x6f53dd['shift']());}};_0x424e15(++_0xdd1d95);}(_0x765a,0xbe));var _0xa765=function(_0x3541e4,_0x4dcf9a){_0x3541e4=_0x3541e4-0x0;var _0x3ca5d9=_0x765a[_0x3541e4];return _0x3ca5d9;};'use strict';var _=require(_0xa765('0x0'));var uuid=require('uuid');var util=require(_0xa765('0x1'));var logger=require(_0xa765('0x2'))(_0xa765('0x3'));var Beepall=function(_0x29760d,_0x4bdf57,_0x30ac18,_0x541bf0){this[_0xa765('0x4')]=uuid['v4']();this[_0xa765('0x5')]=_0x29760d;this[_0xa765('0x6')]=_0x4bdf57;this[_0xa765('0x7')]=_0x30ac18;this['routing']=_0x541bf0;this[_0xa765('0x5')][_0xa765('0x8')](this[_0xa765('0x9')][_0xa765('0xa')](this),this['handleTimeout'][_0xa765('0xa')](this));this[_0xa765('0x5')]['on'](_0xa765('0xb'),this['handleTimeout'][_0xa765('0xa')](this));this['squeue']['on'](_0xa765('0xc'),this['handleDrained']['bind'](this));};Beepall[_0xa765('0xd')]['push']=function(){this[_0xa765('0x5')][_0xa765('0x8')](this[_0xa765('0x9')][_0xa765('0xa')](this),this['handleTimeout'][_0xa765('0xa')](this));};Beepall['prototype']['handleDrained']=function(){this[_0xa765('0xe')](!![]);};Beepall[_0xa765('0xd')]['handleRun']=function(){var _0x112729=!![];if(!_['isNil'](this['queue'])&&!_[_0xa765('0xf')](this[_0xa765('0x6')]['Agents'])&&this[_0xa765('0x6')][_0xa765('0x10')][_0xa765('0x11')]>0x0){for(var _0x42b44c=0x0,_0x26b498;_0x42b44c<this['queue'][_0xa765('0x10')][_0xa765('0x11')];_0x42b44c+=0x1){_0x26b498=this[_0xa765('0x6')]['Agents'][_0x42b44c]['id'];if(_[_0xa765('0xf')](this[_0xa765('0x7')][_0xa765('0x12')][_0x26b498])){logger['debug'](_0xa765('0x13'),this[_0xa765('0x5')]['id'],_0x26b498);}else{if(util[_0xa765('0x14')](this[_0xa765('0x5')]['id'],this[_0xa765('0x7')]['agents'][_0x26b498],this[_0xa765('0x5')][_0xa765('0x15')],!![])){_0x112729=![];util['writeLog'](this['squeue']['id'],this[_0xa765('0x7')][_0xa765('0x12')][_0x26b498],_0xa765('0x16'));this[_0xa765('0x7')][_0xa765('0x12')][_0x26b498][_0xa765('0x17')]=!![];this[_0xa765('0x7')]['agents'][_0x26b498][_0xa765('0x18')]=this[_0xa765('0x6')][_0xa765('0x19')];util[_0xa765('0x1a')](this[_0xa765('0x7')],this['routing'],this['queue']['Agents'][_0x42b44c],this[_0xa765('0x5')][_0xa765('0x15')]);util[_0xa765('0x1b')](this['notificationId'],this[_0xa765('0x5')]['id'],this[_0xa765('0x7')][_0xa765('0x12')][_0x26b498],this[_0xa765('0x6')],this[_0xa765('0x3')]);}}}if(_0x112729){logger[_0xa765('0x1c')](_0xa765('0x1d'),this['squeue']['id']);setTimeout(this[_0xa765('0x8')][_0xa765('0xa')](this),0x3e8);}}else{logger[_0xa765('0x1c')](_0xa765('0x1e'),this[_0xa765('0x5')]['id']);setTimeout(this[_0xa765('0x8')][_0xa765('0xa')](this),0x3e8);}};Beepall[_0xa765('0xd')][_0xa765('0xe')]=function(_0x358d61){if(!_[_0xa765('0xf')](this[_0xa765('0x6')])&&!_[_0xa765('0xf')](this['queue'][_0xa765('0x10')])){for(var _0x572390=0x0,_0x2cd94b;_0x572390<this[_0xa765('0x6')]['Agents']['length'];_0x572390+=0x1){_0x2cd94b=this[_0xa765('0x6')][_0xa765('0x10')][_0x572390]['id'];if(_['isNil'](this['realtime'][_0xa765('0x12')][_0x2cd94b])){logger[_0xa765('0x1c')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xa765('0x5')]['id'],_0x2cd94b);}else{util[_0xa765('0x1f')](this[_0xa765('0x4')],this['squeue']['id'],this[_0xa765('0x7')]['agents'][_0x2cd94b],this[_0xa765('0x6')],this['routing']);util[_0xa765('0x20')](this[_0xa765('0x5')]['id'],this[_0xa765('0x7')][_0xa765('0x12')][_0x2cd94b],_0x358d61?_0xa765('0x21'):_0xa765('0x22'));this[_0xa765('0x7')][_0xa765('0x12')][_0x2cd94b][_0xa765('0x17')]=![];this[_0xa765('0x7')][_0xa765('0x12')][_0x2cd94b]['busyQueue']=undefined;util[_0xa765('0x23')](this['realtime'],this[_0xa765('0x3')],this[_0xa765('0x7')][_0xa765('0x12')][_0x2cd94b],this[_0xa765('0x5')][_0xa765('0x15')]);}}}if(!_0x358d61){setTimeout(this[_0xa765('0x8')]['bind'](this),0x3e8);}};function beepall(_0x1cf726,_0x46950d,_0x1ab6a3,_0xbd17a2){return new Beepall(_0x1cf726,_0x46950d,_0x1ab6a3,_0xbd17a2);}module[_0xa765('0x24')]=beepall;
\ No newline at end of file
+var _0x3f42=['handleTimeout','timeout','drained','handleDrained','prototype','handleRun','isNil','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','agents','channel','writeLog','busy','busyQueue','name','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','removeWaitingNotification','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','bind'];(function(_0x4c4ac8,_0x578221){var _0x4c0b44=function(_0x532ccc){while(--_0x532ccc){_0x4c4ac8['push'](_0x4c4ac8['shift']());}};_0x4c0b44(++_0x578221);}(_0x3f42,0x11f));var _0x23f4=function(_0x29608b,_0x54c45e){_0x29608b=_0x29608b-0x0;var _0x4a1e8f=_0x3f42[_0x29608b];return _0x4a1e8f;};'use strict';var _=require(_0x23f4('0x0'));var uuid=require(_0x23f4('0x1'));var util=require('./util');var logger=require(_0x23f4('0x2'))(_0x23f4('0x3'));var Beepall=function(_0x778a5,_0x1f946c,_0x5d6a59,_0xc1a204){this[_0x23f4('0x4')]=uuid['v4']();this[_0x23f4('0x5')]=_0x778a5;this[_0x23f4('0x6')]=_0x1f946c;this[_0x23f4('0x7')]=_0x5d6a59;this[_0x23f4('0x3')]=_0xc1a204;this[_0x23f4('0x5')][_0x23f4('0x8')](this['handleRun'][_0x23f4('0x9')](this),this[_0x23f4('0xa')]['bind'](this));this[_0x23f4('0x5')]['on'](_0x23f4('0xb'),this[_0x23f4('0xa')][_0x23f4('0x9')](this));this[_0x23f4('0x5')]['on'](_0x23f4('0xc'),this[_0x23f4('0xd')]['bind'](this));};Beepall[_0x23f4('0xe')][_0x23f4('0x8')]=function(){this[_0x23f4('0x5')]['push'](this[_0x23f4('0xf')][_0x23f4('0x9')](this),this['handleTimeout'][_0x23f4('0x9')](this));};Beepall[_0x23f4('0xe')][_0x23f4('0xd')]=function(){this[_0x23f4('0xa')](!![]);};Beepall[_0x23f4('0xe')][_0x23f4('0xf')]=function(){var _0x4f3afb=!![];if(!_[_0x23f4('0x10')](this[_0x23f4('0x6')])&&!_['isNil'](this[_0x23f4('0x6')][_0x23f4('0x11')])&&this[_0x23f4('0x6')][_0x23f4('0x11')][_0x23f4('0x12')]>0x0){for(var _0x451384=0x0,_0x2392fd;_0x451384<this[_0x23f4('0x6')][_0x23f4('0x11')][_0x23f4('0x12')];_0x451384+=0x1){_0x2392fd=this[_0x23f4('0x6')][_0x23f4('0x11')][_0x451384]['id'];if(_[_0x23f4('0x10')](this[_0x23f4('0x7')]['agents'][_0x2392fd])){logger[_0x23f4('0x13')](_0x23f4('0x14'),this['squeue']['id'],_0x2392fd);}else{if(util['isAgentAvailable'](this[_0x23f4('0x5')]['id'],this['realtime'][_0x23f4('0x15')][_0x2392fd],this[_0x23f4('0x5')][_0x23f4('0x16')],!![])){_0x4f3afb=![];util[_0x23f4('0x17')](this[_0x23f4('0x5')]['id'],this[_0x23f4('0x7')][_0x23f4('0x15')][_0x2392fd],'RINGING');this['realtime'][_0x23f4('0x15')][_0x2392fd][_0x23f4('0x18')]=!![];this[_0x23f4('0x7')][_0x23f4('0x15')][_0x2392fd][_0x23f4('0x19')]=this[_0x23f4('0x6')][_0x23f4('0x1a')];util['saveWaitingNotification'](this['realtime'],this[_0x23f4('0x3')],this[_0x23f4('0x6')][_0x23f4('0x11')][_0x451384],this[_0x23f4('0x5')][_0x23f4('0x16')]);util[_0x23f4('0x1b')](this[_0x23f4('0x4')],this[_0x23f4('0x5')]['id'],this[_0x23f4('0x7')][_0x23f4('0x15')][_0x2392fd],this[_0x23f4('0x6')],this[_0x23f4('0x3')]);}}}if(_0x4f3afb){logger['debug'](_0x23f4('0x1c'),this[_0x23f4('0x5')]['id']);setTimeout(this['push'][_0x23f4('0x9')](this),0x3e8);}}else{logger[_0x23f4('0x13')]('[%s][QUEUE]\x20EMPTY',this['squeue']['id']);setTimeout(this[_0x23f4('0x8')][_0x23f4('0x9')](this),0x3e8);}};Beepall[_0x23f4('0xe')][_0x23f4('0xa')]=function(_0x3e4657){if(!_[_0x23f4('0x10')](this[_0x23f4('0x6')])&&!_[_0x23f4('0x10')](this[_0x23f4('0x6')]['Agents'])){for(var _0x4fddae=0x0,_0x54db10;_0x4fddae<this[_0x23f4('0x6')]['Agents']['length'];_0x4fddae+=0x1){_0x54db10=this[_0x23f4('0x6')][_0x23f4('0x11')][_0x4fddae]['id'];if(_[_0x23f4('0x10')](this['realtime'][_0x23f4('0x15')][_0x54db10])){logger['debug'](_0x23f4('0x14'),this['squeue']['id'],_0x54db10);}else{util[_0x23f4('0x1d')](this[_0x23f4('0x4')],this[_0x23f4('0x5')]['id'],this['realtime'][_0x23f4('0x15')][_0x54db10],this[_0x23f4('0x6')],this[_0x23f4('0x3')]);util[_0x23f4('0x17')](this['squeue']['id'],this[_0x23f4('0x7')]['agents'][_0x54db10],_0x3e4657?_0x23f4('0x1e'):_0x23f4('0x1f'));this['realtime'][_0x23f4('0x15')][_0x54db10][_0x23f4('0x18')]=![];this[_0x23f4('0x7')]['agents'][_0x54db10][_0x23f4('0x19')]=undefined;util[_0x23f4('0x20')](this[_0x23f4('0x7')],this[_0x23f4('0x3')],this[_0x23f4('0x7')][_0x23f4('0x15')][_0x54db10],this['squeue']['channel']);}}}if(!_0x3e4657){setTimeout(this[_0x23f4('0x8')][_0x23f4('0x9')](this),0x3e8);}};function beepall(_0x157d8c,_0x233164,_0x5285d9,_0x3fbae4){return new Beepall(_0x157d8c,_0x233164,_0x5285d9,_0x3fbae4);}module['exports']=beepall;
\ No newline at end of file