Built motion from commit 3d6333b4.|2.6.31
[motion2.git] / server / services / routing / server / applications / strategy / beepall.js
index d5ef05c..aa8d4ed 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x80b1=['realtime','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','push','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','RINGING','busy','busyQueue','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','writeLog','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue'];(function(_0x4ed5b2,_0xc950dc){var _0x22eaa9=function(_0xa457be){while(--_0xa457be){_0x4ed5b2['push'](_0x4ed5b2['shift']());}};_0x22eaa9(++_0xc950dc);}(_0x80b1,0x85));var _0x180b=function(_0x2440fe,_0x281a11){_0x2440fe=_0x2440fe-0x0;var _0x5cf734=_0x80b1[_0x2440fe];return _0x5cf734;};'use strict';var _=require(_0x180b('0x0'));var uuid=require('uuid');var util=require(_0x180b('0x1'));var logger=require(_0x180b('0x2'))(_0x180b('0x3'));var Beepall=function(_0x492fdc,_0x11c6c8,_0x379a86,_0x34cf92){this[_0x180b('0x4')]=uuid['v4']();this[_0x180b('0x5')]=_0x492fdc;this[_0x180b('0x6')]=_0x11c6c8;this[_0x180b('0x7')]=_0x379a86;this[_0x180b('0x3')]=_0x34cf92;this[_0x180b('0x5')]['push'](this[_0x180b('0x8')]['bind'](this),this[_0x180b('0x9')][_0x180b('0xa')](this));this[_0x180b('0x5')]['on'](_0x180b('0xb'),this[_0x180b('0x9')][_0x180b('0xa')](this));this[_0x180b('0x5')]['on'](_0x180b('0xc'),this[_0x180b('0xd')][_0x180b('0xa')](this));};Beepall[_0x180b('0xe')][_0x180b('0xf')]=function(){this[_0x180b('0x5')]['push'](this['handleRun'][_0x180b('0xa')](this),this[_0x180b('0x9')][_0x180b('0xa')](this));};Beepall[_0x180b('0xe')][_0x180b('0xd')]=function(){this[_0x180b('0x9')](!![]);};Beepall[_0x180b('0xe')][_0x180b('0x8')]=function(){var _0x2a4bbf=!![];if(!_[_0x180b('0x10')](this['queue'])&&!_[_0x180b('0x10')](this['queue'][_0x180b('0x11')])&&this[_0x180b('0x6')][_0x180b('0x11')][_0x180b('0x12')]>0x0){for(var _0x3764dc=0x0,_0x1d8c51;_0x3764dc<this[_0x180b('0x6')][_0x180b('0x11')][_0x180b('0x12')];_0x3764dc+=0x1){_0x1d8c51=this[_0x180b('0x6')][_0x180b('0x11')][_0x3764dc]['id'];if(_[_0x180b('0x10')](this[_0x180b('0x7')][_0x180b('0x13')][_0x1d8c51])){logger[_0x180b('0x14')](_0x180b('0x15'),this[_0x180b('0x5')]['id'],_0x1d8c51);}else{if(util['isAgentAvailable'](this[_0x180b('0x5')]['id'],this[_0x180b('0x7')][_0x180b('0x13')][_0x1d8c51],this[_0x180b('0x5')][_0x180b('0x16')],!![])){_0x2a4bbf=![];util['writeLog'](this['squeue']['id'],this[_0x180b('0x7')][_0x180b('0x13')][_0x1d8c51],_0x180b('0x17'));this['realtime'][_0x180b('0x13')][_0x1d8c51][_0x180b('0x18')]=!![];this[_0x180b('0x7')]['agents'][_0x1d8c51][_0x180b('0x19')]=this[_0x180b('0x6')]['name'];util[_0x180b('0x1a')](this[_0x180b('0x7')],this['routing'],this[_0x180b('0x6')]['Agents'][_0x3764dc],this[_0x180b('0x5')][_0x180b('0x16')]);util[_0x180b('0x1b')](this[_0x180b('0x4')],this['squeue']['id'],this[_0x180b('0x7')][_0x180b('0x13')][_0x1d8c51],this[_0x180b('0x6')],this[_0x180b('0x3')]);}}}if(_0x2a4bbf){logger[_0x180b('0x14')](_0x180b('0x1c'),this['squeue']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}else{logger['debug'](_0x180b('0x1d'),this[_0x180b('0x5')]['id']);setTimeout(this[_0x180b('0xf')][_0x180b('0xa')](this),0x3e8);}};Beepall['prototype'][_0x180b('0x9')]=function(_0x10f494){if(!_[_0x180b('0x10')](this['queue'])&&!_[_0x180b('0x10')](this[_0x180b('0x6')][_0x180b('0x11')])){for(var _0x5cf0bb=0x0,_0x353b22;_0x5cf0bb<this[_0x180b('0x6')][_0x180b('0x11')][_0x180b('0x12')];_0x5cf0bb+=0x1){_0x353b22=this[_0x180b('0x6')]['Agents'][_0x5cf0bb]['id'];if(_[_0x180b('0x10')](this[_0x180b('0x7')]['agents'][_0x353b22])){logger[_0x180b('0x14')](_0x180b('0x15'),this[_0x180b('0x5')]['id'],_0x353b22);}else{util['hideNotification'](this['notificationId'],this[_0x180b('0x5')]['id'],this[_0x180b('0x7')][_0x180b('0x13')][_0x353b22],this['queue'],this[_0x180b('0x3')]);util[_0x180b('0x1e')](this[_0x180b('0x5')]['id'],this[_0x180b('0x7')]['agents'][_0x353b22],_0x10f494?_0x180b('0x1f'):_0x180b('0x20'));this[_0x180b('0x7')][_0x180b('0x13')][_0x353b22][_0x180b('0x18')]=![];this[_0x180b('0x7')]['agents'][_0x353b22][_0x180b('0x19')]=undefined;util[_0x180b('0x21')](this[_0x180b('0x7')],this[_0x180b('0x3')],this[_0x180b('0x7')][_0x180b('0x13')][_0x353b22],this[_0x180b('0x5')][_0x180b('0x16')]);}}}if(!_0x10f494){setTimeout(this[_0x180b('0xf')][_0x180b('0xa')](this),0x3e8);}};function beepall(_0x24ea49,_0x1ff3b4,_0x140de9,_0x2c4035){return new Beepall(_0x24ea49,_0x1ff3b4,_0x140de9,_0x2c4035);}module[_0x180b('0x22')]=beepall;
\ No newline at end of file
+var _0x1e84=['handleDrained','prototype','isNil','length','Agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','realtime','RINGING','busy','saveWaitingNotification','showNotification','hideNotification','TIMEOUT','busyQueue','removeWaitingNotification','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','queue','push','handleRun','bind','handleTimeout','timeout','drained'];(function(_0xe0ced1,_0x3a1d51){var _0x3fca6a=function(_0x331b98){while(--_0x331b98){_0xe0ced1['push'](_0xe0ced1['shift']());}};_0x3fca6a(++_0x3a1d51);}(_0x1e84,0xb9));var _0x41e8=function(_0x43444b,_0x8cf95b){_0x43444b=_0x43444b-0x0;var _0x392fe5=_0x1e84[_0x43444b];return _0x392fe5;};'use strict';var _=require(_0x41e8('0x0'));var uuid=require('uuid');var util=require(_0x41e8('0x1'));var logger=require(_0x41e8('0x2'))(_0x41e8('0x3'));var Beepall=function(_0x5213c7,_0x40464c,_0x37bcf5,_0x185dbb){this[_0x41e8('0x4')]=uuid['v4']();this[_0x41e8('0x5')]=_0x5213c7;this[_0x41e8('0x6')]=_0x40464c;this['realtime']=_0x37bcf5;this[_0x41e8('0x3')]=_0x185dbb;this[_0x41e8('0x5')][_0x41e8('0x7')](this[_0x41e8('0x8')][_0x41e8('0x9')](this),this[_0x41e8('0xa')]['bind'](this));this[_0x41e8('0x5')]['on'](_0x41e8('0xb'),this[_0x41e8('0xa')][_0x41e8('0x9')](this));this[_0x41e8('0x5')]['on'](_0x41e8('0xc'),this[_0x41e8('0xd')][_0x41e8('0x9')](this));};Beepall[_0x41e8('0xe')][_0x41e8('0x7')]=function(){this[_0x41e8('0x5')]['push'](this['handleRun'][_0x41e8('0x9')](this),this['handleTimeout'][_0x41e8('0x9')](this));};Beepall['prototype'][_0x41e8('0xd')]=function(){this['handleTimeout'](!![]);};Beepall[_0x41e8('0xe')][_0x41e8('0x8')]=function(){var _0x4d20ea=!![];if(!_[_0x41e8('0xf')](this[_0x41e8('0x6')])&&!_['isNil'](this['queue']['Agents'])&&this['queue']['Agents'][_0x41e8('0x10')]>0x0){for(var _0x232813=0x0,_0x55e96d;_0x232813<this[_0x41e8('0x6')][_0x41e8('0x11')][_0x41e8('0x10')];_0x232813+=0x1){_0x55e96d=this['queue'][_0x41e8('0x11')][_0x232813]['id'];if(_[_0x41e8('0xf')](this['realtime']['agents'][_0x55e96d])){logger[_0x41e8('0x12')](_0x41e8('0x13'),this[_0x41e8('0x5')]['id'],_0x55e96d);}else{if(util[_0x41e8('0x14')](this[_0x41e8('0x5')]['id'],this['realtime'][_0x41e8('0x15')][_0x55e96d],this[_0x41e8('0x5')][_0x41e8('0x16')],!![])){_0x4d20ea=![];util[_0x41e8('0x17')](this['squeue']['id'],this[_0x41e8('0x18')][_0x41e8('0x15')][_0x55e96d],_0x41e8('0x19'));this[_0x41e8('0x18')][_0x41e8('0x15')][_0x55e96d][_0x41e8('0x1a')]=!![];this[_0x41e8('0x18')][_0x41e8('0x15')][_0x55e96d]['busyQueue']=this[_0x41e8('0x6')]['name'];util[_0x41e8('0x1b')](this[_0x41e8('0x18')],this['routing'],this[_0x41e8('0x6')][_0x41e8('0x11')][_0x232813],this[_0x41e8('0x5')]['channel']);util[_0x41e8('0x1c')](this[_0x41e8('0x4')],this[_0x41e8('0x5')]['id'],this[_0x41e8('0x18')][_0x41e8('0x15')][_0x55e96d],this[_0x41e8('0x6')],this[_0x41e8('0x3')]);}}}if(_0x4d20ea){logger[_0x41e8('0x12')]('[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY',this[_0x41e8('0x5')]['id']);setTimeout(this[_0x41e8('0x7')]['bind'](this),0x3e8);}}else{logger[_0x41e8('0x12')]('[%s][QUEUE]\x20EMPTY',this[_0x41e8('0x5')]['id']);setTimeout(this['push'][_0x41e8('0x9')](this),0x3e8);}};Beepall[_0x41e8('0xe')][_0x41e8('0xa')]=function(_0x46309c){if(!_[_0x41e8('0xf')](this[_0x41e8('0x6')])&&!_[_0x41e8('0xf')](this[_0x41e8('0x6')][_0x41e8('0x11')])){for(var _0x4bf1d1=0x0,_0x52a83d;_0x4bf1d1<this[_0x41e8('0x6')][_0x41e8('0x11')][_0x41e8('0x10')];_0x4bf1d1+=0x1){_0x52a83d=this[_0x41e8('0x6')][_0x41e8('0x11')][_0x4bf1d1]['id'];if(_['isNil'](this[_0x41e8('0x18')][_0x41e8('0x15')][_0x52a83d])){logger['debug'](_0x41e8('0x13'),this[_0x41e8('0x5')]['id'],_0x52a83d);}else{util[_0x41e8('0x1d')](this[_0x41e8('0x4')],this[_0x41e8('0x5')]['id'],this['realtime'][_0x41e8('0x15')][_0x52a83d],this[_0x41e8('0x6')],this[_0x41e8('0x3')]);util[_0x41e8('0x17')](this[_0x41e8('0x5')]['id'],this[_0x41e8('0x18')]['agents'][_0x52a83d],_0x46309c?'STOP':_0x41e8('0x1e'));this[_0x41e8('0x18')]['agents'][_0x52a83d][_0x41e8('0x1a')]=![];this[_0x41e8('0x18')][_0x41e8('0x15')][_0x52a83d][_0x41e8('0x1f')]=undefined;util[_0x41e8('0x20')](this['realtime'],this[_0x41e8('0x3')],this[_0x41e8('0x18')][_0x41e8('0x15')][_0x52a83d],this['squeue'][_0x41e8('0x16')]);}}}if(!_0x46309c){setTimeout(this[_0x41e8('0x7')][_0x41e8('0x9')](this),0x3e8);}};function beepall(_0x2f1366,_0x4ef9a1,_0x3c574e,_0x33b234){return new Beepall(_0x2f1366,_0x4ef9a1,_0x3c574e,_0x33b234);}module['exports']=beepall;
\ No newline at end of file