Built motion from commit c738b9ac.|2.6.25
[motion2.git] / server / services / routing / server / applications / strategy / beepall.js
index bf08123..adba40f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8fb0=['push','handleRun','bind','handleTimeout','squeue','drained','handleDrained','isNil','queue','Agents','length','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','agents','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','prototype','hideNotification','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','../../../../../config/logger','notificationId','realtime','routing'];(function(_0x3e7e96,_0x5683ca){var _0x13f6f0=function(_0x320767){while(--_0x320767){_0x3e7e96['push'](_0x3e7e96['shift']());}};_0x13f6f0(++_0x5683ca);}(_0x8fb0,0x14e));var _0x08fb=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x8fb0[_0x35da42];return _0x370035;};'use strict';var _=require(_0x08fb('0x0'));var uuid=require(_0x08fb('0x1'));var util=require('./util');var logger=require(_0x08fb('0x2'))('routing');var Beepall=function(_0x32975c,_0x419f53,_0x50f61e,_0x2e9198){this[_0x08fb('0x3')]=uuid['v4']();this['squeue']=_0x32975c;this['queue']=_0x419f53;this[_0x08fb('0x4')]=_0x50f61e;this[_0x08fb('0x5')]=_0x2e9198;this['squeue'][_0x08fb('0x6')](this[_0x08fb('0x7')][_0x08fb('0x8')](this),this[_0x08fb('0x9')][_0x08fb('0x8')](this));this[_0x08fb('0xa')]['on']('timeout',this[_0x08fb('0x9')]['bind'](this));this[_0x08fb('0xa')]['on'](_0x08fb('0xb'),this[_0x08fb('0xc')][_0x08fb('0x8')](this));};Beepall['prototype'][_0x08fb('0x6')]=function(){this['squeue'][_0x08fb('0x6')](this[_0x08fb('0x7')][_0x08fb('0x8')](this),this[_0x08fb('0x9')]['bind'](this));};Beepall['prototype']['handleDrained']=function(){this[_0x08fb('0x9')](!![]);};Beepall['prototype'][_0x08fb('0x7')]=function(){var _0x266b95=!![];if(!_['isNil'](this['queue'])&&!_[_0x08fb('0xd')](this[_0x08fb('0xe')][_0x08fb('0xf')])&&this[_0x08fb('0xe')][_0x08fb('0xf')][_0x08fb('0x10')]>0x0){for(var _0x330ea1=0x0,_0x3ab745;_0x330ea1<this[_0x08fb('0xe')][_0x08fb('0xf')][_0x08fb('0x10')];_0x330ea1+=0x1){_0x3ab745=this['queue'][_0x08fb('0xf')][_0x330ea1]['id'];if(_[_0x08fb('0xd')](this[_0x08fb('0x4')]['agents'][_0x3ab745])){logger[_0x08fb('0x11')](_0x08fb('0x12'),this[_0x08fb('0xa')]['id'],_0x3ab745);}else{if(util[_0x08fb('0x13')](this[_0x08fb('0xa')]['id'],this['realtime']['agents'][_0x3ab745],this[_0x08fb('0xa')][_0x08fb('0x14')],!![])){_0x266b95=![];util[_0x08fb('0x15')](this['squeue']['id'],this[_0x08fb('0x4')]['agents'][_0x3ab745],_0x08fb('0x16'));this[_0x08fb('0x4')]['agents'][_0x3ab745][_0x08fb('0x17')]=!![];this[_0x08fb('0x4')]['agents'][_0x3ab745][_0x08fb('0x18')]=this[_0x08fb('0xe')]['name'];util['saveWaitingNotification'](this[_0x08fb('0x4')],this[_0x08fb('0x5')],this[_0x08fb('0xe')][_0x08fb('0xf')][_0x330ea1],this[_0x08fb('0xa')][_0x08fb('0x14')]);util['showNotification'](this['notificationId'],this[_0x08fb('0xa')]['id'],this['realtime'][_0x08fb('0x19')][_0x3ab745],this['queue'],this['routing']);}}}if(_0x266b95){logger[_0x08fb('0x11')](_0x08fb('0x1a'),this[_0x08fb('0xa')]['id']);setTimeout(this[_0x08fb('0x6')][_0x08fb('0x8')](this),0x3e8);}}else{logger[_0x08fb('0x11')](_0x08fb('0x1b'),this['squeue']['id']);setTimeout(this[_0x08fb('0x6')][_0x08fb('0x8')](this),0x3e8);}};Beepall[_0x08fb('0x1c')]['handleTimeout']=function(_0xcaaa27){if(!_[_0x08fb('0xd')](this[_0x08fb('0xe')])&&!_[_0x08fb('0xd')](this[_0x08fb('0xe')][_0x08fb('0xf')])){for(var _0x46c466=0x0,_0xbe2a7c;_0x46c466<this['queue'][_0x08fb('0xf')][_0x08fb('0x10')];_0x46c466+=0x1){_0xbe2a7c=this[_0x08fb('0xe')][_0x08fb('0xf')][_0x46c466]['id'];if(_[_0x08fb('0xd')](this[_0x08fb('0x4')][_0x08fb('0x19')][_0xbe2a7c])){logger[_0x08fb('0x11')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x08fb('0xa')]['id'],_0xbe2a7c);}else{util[_0x08fb('0x1d')](this[_0x08fb('0x3')],this[_0x08fb('0xa')]['id'],this['realtime']['agents'][_0xbe2a7c],this[_0x08fb('0xe')],this[_0x08fb('0x5')]);util['writeLog'](this[_0x08fb('0xa')]['id'],this[_0x08fb('0x4')][_0x08fb('0x19')][_0xbe2a7c],_0xcaaa27?_0x08fb('0x1e'):_0x08fb('0x1f'));this[_0x08fb('0x4')]['agents'][_0xbe2a7c][_0x08fb('0x17')]=![];this['realtime'][_0x08fb('0x19')][_0xbe2a7c][_0x08fb('0x18')]=undefined;util[_0x08fb('0x20')](this[_0x08fb('0x4')],this['routing'],this[_0x08fb('0x4')][_0x08fb('0x19')][_0xbe2a7c],this['squeue']['channel']);}}}if(!_0xcaaa27){setTimeout(this[_0x08fb('0x6')][_0x08fb('0x8')](this),0x3e8);}};function beepall(_0x1a3259,_0x27c924,_0x25cd4a,_0x271d4b){return new Beepall(_0x1a3259,_0x27c924,_0x25cd4a,_0x271d4b);}module[_0x08fb('0x21')]=beepall;
\ No newline at end of file
+var _0xcf38=['notificationId','squeue','queue','routing','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busy','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','busyQueue','uuid','../../../../../config/logger'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0xcf38,0x169));var _0x8cf3=function(_0x17b2ab,_0x43a8dd){_0x17b2ab=_0x17b2ab-0x0;var _0x242a20=_0xcf38[_0x17b2ab];return _0x242a20;};'use strict';var _=require('lodash');var uuid=require(_0x8cf3('0x0'));var util=require('./util');var logger=require(_0x8cf3('0x1'))('routing');var Beepall=function(_0x2f8723,_0x4a4d4b,_0x209ddd,_0x49ae89){this[_0x8cf3('0x2')]=uuid['v4']();this[_0x8cf3('0x3')]=_0x2f8723;this[_0x8cf3('0x4')]=_0x4a4d4b;this['realtime']=_0x209ddd;this[_0x8cf3('0x5')]=_0x49ae89;this[_0x8cf3('0x3')][_0x8cf3('0x6')](this[_0x8cf3('0x7')]['bind'](this),this[_0x8cf3('0x8')][_0x8cf3('0x9')](this));this[_0x8cf3('0x3')]['on'](_0x8cf3('0xa'),this['handleTimeout'][_0x8cf3('0x9')](this));this['squeue']['on'](_0x8cf3('0xb'),this[_0x8cf3('0xc')]['bind'](this));};Beepall['prototype'][_0x8cf3('0x6')]=function(){this[_0x8cf3('0x3')][_0x8cf3('0x6')](this[_0x8cf3('0x7')]['bind'](this),this[_0x8cf3('0x8')]['bind'](this));};Beepall[_0x8cf3('0xd')][_0x8cf3('0xc')]=function(){this[_0x8cf3('0x8')](!![]);};Beepall[_0x8cf3('0xd')][_0x8cf3('0x7')]=function(){var _0x34580a=!![];if(!_[_0x8cf3('0xe')](this[_0x8cf3('0x4')])&&!_[_0x8cf3('0xe')](this['queue'][_0x8cf3('0xf')])&&this[_0x8cf3('0x4')]['Agents'][_0x8cf3('0x10')]>0x0){for(var _0x55333f=0x0,_0x4f7215;_0x55333f<this['queue'][_0x8cf3('0xf')][_0x8cf3('0x10')];_0x55333f+=0x1){_0x4f7215=this[_0x8cf3('0x4')][_0x8cf3('0xf')][_0x55333f]['id'];if(_[_0x8cf3('0xe')](this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x4f7215])){logger[_0x8cf3('0x13')](_0x8cf3('0x14'),this['squeue']['id'],_0x4f7215);}else{if(util['isAgentAvailable'](this[_0x8cf3('0x3')]['id'],this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x4f7215],this[_0x8cf3('0x3')][_0x8cf3('0x15')],!![])){_0x34580a=![];util[_0x8cf3('0x16')](this[_0x8cf3('0x3')]['id'],this['realtime'][_0x8cf3('0x12')][_0x4f7215],_0x8cf3('0x17'));this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x4f7215][_0x8cf3('0x18')]=!![];this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x4f7215]['busyQueue']=this['queue'][_0x8cf3('0x19')];util[_0x8cf3('0x1a')](this[_0x8cf3('0x11')],this[_0x8cf3('0x5')],this[_0x8cf3('0x4')][_0x8cf3('0xf')][_0x55333f],this[_0x8cf3('0x3')][_0x8cf3('0x15')]);util[_0x8cf3('0x1b')](this[_0x8cf3('0x2')],this[_0x8cf3('0x3')]['id'],this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x4f7215],this[_0x8cf3('0x4')],this[_0x8cf3('0x5')]);}}}if(_0x34580a){logger[_0x8cf3('0x13')](_0x8cf3('0x1c'),this['squeue']['id']);setTimeout(this[_0x8cf3('0x6')][_0x8cf3('0x9')](this),0x3e8);}}else{logger[_0x8cf3('0x13')]('[%s][QUEUE]\x20EMPTY',this[_0x8cf3('0x3')]['id']);setTimeout(this[_0x8cf3('0x6')][_0x8cf3('0x9')](this),0x3e8);}};Beepall[_0x8cf3('0xd')][_0x8cf3('0x8')]=function(_0x5aaf0a){if(!_[_0x8cf3('0xe')](this['queue'])&&!_[_0x8cf3('0xe')](this[_0x8cf3('0x4')][_0x8cf3('0xf')])){for(var _0x227901=0x0,_0x17c07e;_0x227901<this['queue'][_0x8cf3('0xf')][_0x8cf3('0x10')];_0x227901+=0x1){_0x17c07e=this[_0x8cf3('0x4')][_0x8cf3('0xf')][_0x227901]['id'];if(_[_0x8cf3('0xe')](this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x17c07e])){logger[_0x8cf3('0x13')](_0x8cf3('0x14'),this[_0x8cf3('0x3')]['id'],_0x17c07e);}else{util[_0x8cf3('0x1d')](this[_0x8cf3('0x2')],this[_0x8cf3('0x3')]['id'],this['realtime']['agents'][_0x17c07e],this[_0x8cf3('0x4')],this[_0x8cf3('0x5')]);util[_0x8cf3('0x16')](this[_0x8cf3('0x3')]['id'],this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x17c07e],_0x5aaf0a?_0x8cf3('0x1e'):_0x8cf3('0x1f'));this['realtime'][_0x8cf3('0x12')][_0x17c07e][_0x8cf3('0x18')]=![];this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x17c07e][_0x8cf3('0x20')]=undefined;util['removeWaitingNotification'](this[_0x8cf3('0x11')],this['routing'],this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x17c07e],this[_0x8cf3('0x3')][_0x8cf3('0x15')]);}}}if(!_0x5aaf0a){setTimeout(this[_0x8cf3('0x6')][_0x8cf3('0x9')](this),0x3e8);}};function beepall(_0x508814,_0x7ea748,_0x1289ab,_0x3bd2f0){return new Beepall(_0x508814,_0x7ea748,_0x1289ab,_0x3bd2f0);}module['exports']=beepall;
\ No newline at end of file