Built motion from commit b5996064.|2.6.21
[motion2.git] / server / services / routing / server / applications / strategy / beepall.js
index 63ab5c7..7b9b3fb 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4c71=['queue','realtime','push','handleRun','bind','handleTimeout','timeout','prototype','handleDrained','Agents','length','isNil','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','busy','busyQueue','saveWaitingNotification','channel','showNotification','STOP','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue'];(function(_0x35e52b,_0x15fa96){var _0xae9711=function(_0x52c307){while(--_0x52c307){_0x35e52b['push'](_0x35e52b['shift']());}};_0xae9711(++_0x15fa96);}(_0x4c71,0x185));var _0x14c7=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x4c71[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x14c7('0x0'));var uuid=require(_0x14c7('0x1'));var util=require(_0x14c7('0x2'));var logger=require(_0x14c7('0x3'))(_0x14c7('0x4'));var Beepall=function(_0x5a55a3,_0xb2d5e0,_0x1791a2,_0x2192ae){this[_0x14c7('0x5')]=uuid['v4']();this[_0x14c7('0x6')]=_0x5a55a3;this[_0x14c7('0x7')]=_0xb2d5e0;this[_0x14c7('0x8')]=_0x1791a2;this[_0x14c7('0x4')]=_0x2192ae;this[_0x14c7('0x6')][_0x14c7('0x9')](this[_0x14c7('0xa')][_0x14c7('0xb')](this),this[_0x14c7('0xc')][_0x14c7('0xb')](this));this['squeue']['on'](_0x14c7('0xd'),this[_0x14c7('0xc')][_0x14c7('0xb')](this));this[_0x14c7('0x6')]['on']('drained',this['handleDrained'][_0x14c7('0xb')](this));};Beepall[_0x14c7('0xe')][_0x14c7('0x9')]=function(){this[_0x14c7('0x6')][_0x14c7('0x9')](this[_0x14c7('0xa')]['bind'](this),this['handleTimeout'][_0x14c7('0xb')](this));};Beepall['prototype'][_0x14c7('0xf')]=function(){this[_0x14c7('0xc')](!![]);};Beepall[_0x14c7('0xe')][_0x14c7('0xa')]=function(){var _0x2d6546=!![];if(!_['isNil'](this[_0x14c7('0x7')])&&!_['isNil'](this[_0x14c7('0x7')][_0x14c7('0x10')])&&this['queue'][_0x14c7('0x10')][_0x14c7('0x11')]>0x0){for(var _0x295377=0x0,_0x4b4908;_0x295377<this[_0x14c7('0x7')]['Agents'][_0x14c7('0x11')];_0x295377+=0x1){_0x4b4908=this[_0x14c7('0x7')][_0x14c7('0x10')][_0x295377]['id'];if(_[_0x14c7('0x12')](this[_0x14c7('0x8')][_0x14c7('0x13')][_0x4b4908])){logger[_0x14c7('0x14')](_0x14c7('0x15'),this[_0x14c7('0x6')]['id'],_0x4b4908);}else{if(util[_0x14c7('0x16')](this[_0x14c7('0x6')]['id'],this[_0x14c7('0x8')]['agents'][_0x4b4908],this[_0x14c7('0x6')]['channel'],!![])){_0x2d6546=![];util[_0x14c7('0x17')](this[_0x14c7('0x6')]['id'],this[_0x14c7('0x8')][_0x14c7('0x13')][_0x4b4908],_0x14c7('0x18'));this[_0x14c7('0x8')]['agents'][_0x4b4908][_0x14c7('0x19')]=!![];this[_0x14c7('0x8')]['agents'][_0x4b4908][_0x14c7('0x1a')]=this['queue']['name'];util[_0x14c7('0x1b')](this[_0x14c7('0x8')],this[_0x14c7('0x4')],this[_0x14c7('0x7')][_0x14c7('0x10')][_0x295377],this[_0x14c7('0x6')][_0x14c7('0x1c')]);util[_0x14c7('0x1d')](this['notificationId'],this[_0x14c7('0x6')]['id'],this[_0x14c7('0x8')][_0x14c7('0x13')][_0x4b4908],this[_0x14c7('0x7')],this[_0x14c7('0x4')]);}}}if(_0x2d6546){logger[_0x14c7('0x14')]('[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY',this[_0x14c7('0x6')]['id']);setTimeout(this['push'][_0x14c7('0xb')](this),0x3e8);}}else{logger[_0x14c7('0x14')]('[%s][QUEUE]\x20EMPTY',this[_0x14c7('0x6')]['id']);setTimeout(this['push'][_0x14c7('0xb')](this),0x3e8);}};Beepall['prototype'][_0x14c7('0xc')]=function(_0x209b11){if(!_[_0x14c7('0x12')](this[_0x14c7('0x7')])&&!_[_0x14c7('0x12')](this[_0x14c7('0x7')][_0x14c7('0x10')])){for(var _0xca530d=0x0,_0x3ed5a0;_0xca530d<this[_0x14c7('0x7')][_0x14c7('0x10')][_0x14c7('0x11')];_0xca530d+=0x1){_0x3ed5a0=this[_0x14c7('0x7')][_0x14c7('0x10')][_0xca530d]['id'];if(_[_0x14c7('0x12')](this[_0x14c7('0x8')]['agents'][_0x3ed5a0])){logger[_0x14c7('0x14')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x14c7('0x6')]['id'],_0x3ed5a0);}else{util['hideNotification'](this[_0x14c7('0x5')],this[_0x14c7('0x6')]['id'],this['realtime'][_0x14c7('0x13')][_0x3ed5a0],this[_0x14c7('0x7')],this[_0x14c7('0x4')]);util[_0x14c7('0x17')](this['squeue']['id'],this['realtime']['agents'][_0x3ed5a0],_0x209b11?_0x14c7('0x1e'):'TIMEOUT');this[_0x14c7('0x8')]['agents'][_0x3ed5a0][_0x14c7('0x19')]=![];this[_0x14c7('0x8')][_0x14c7('0x13')][_0x3ed5a0]['busyQueue']=undefined;util[_0x14c7('0x1f')](this[_0x14c7('0x8')],this[_0x14c7('0x4')],this[_0x14c7('0x8')][_0x14c7('0x13')][_0x3ed5a0],this['squeue'][_0x14c7('0x1c')]);}}}if(!_0x209b11){setTimeout(this[_0x14c7('0x9')][_0x14c7('0xb')](this),0x3e8);}};function beepall(_0x39ae5c,_0x35f94d,_0x120db8,_0x37905a){return new Beepall(_0x39ae5c,_0x35f94d,_0x120db8,_0x37905a);}module[_0x14c7('0x20')]=beepall;
\ No newline at end of file
+var _0xf480=['isNil','Agents','length','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','RINGING','busy','name','saveWaitingNotification','channel','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','STOP','busyQueue','removeWaitingNotification','exports','lodash','uuid','../../../../../config/logger','routing','notificationId','squeue','queue','push','bind','handleTimeout','drained','handleDrained','prototype','handleRun'];(function(_0x360139,_0x5cf060){var _0x3e5e5c=function(_0x583486){while(--_0x583486){_0x360139['push'](_0x360139['shift']());}};_0x3e5e5c(++_0x5cf060);}(_0xf480,0x76));var _0x0f48=function(_0x4fe1e8,_0x43afce){_0x4fe1e8=_0x4fe1e8-0x0;var _0x1791d6=_0xf480[_0x4fe1e8];return _0x1791d6;};'use strict';var _=require(_0x0f48('0x0'));var uuid=require(_0x0f48('0x1'));var util=require('./util');var logger=require(_0x0f48('0x2'))(_0x0f48('0x3'));var Beepall=function(_0x1eeeee,_0x1c877a,_0x39f1f5,_0xf36732){this[_0x0f48('0x4')]=uuid['v4']();this[_0x0f48('0x5')]=_0x1eeeee;this[_0x0f48('0x6')]=_0x1c877a;this['realtime']=_0x39f1f5;this[_0x0f48('0x3')]=_0xf36732;this['squeue'][_0x0f48('0x7')](this['handleRun'][_0x0f48('0x8')](this),this[_0x0f48('0x9')][_0x0f48('0x8')](this));this['squeue']['on']('timeout',this[_0x0f48('0x9')][_0x0f48('0x8')](this));this[_0x0f48('0x5')]['on'](_0x0f48('0xa'),this[_0x0f48('0xb')]['bind'](this));};Beepall[_0x0f48('0xc')]['push']=function(){this[_0x0f48('0x5')][_0x0f48('0x7')](this[_0x0f48('0xd')][_0x0f48('0x8')](this),this[_0x0f48('0x9')][_0x0f48('0x8')](this));};Beepall[_0x0f48('0xc')][_0x0f48('0xb')]=function(){this[_0x0f48('0x9')](!![]);};Beepall[_0x0f48('0xc')][_0x0f48('0xd')]=function(){var _0x1fb04f=!![];if(!_['isNil'](this['queue'])&&!_[_0x0f48('0xe')](this[_0x0f48('0x6')]['Agents'])&&this[_0x0f48('0x6')][_0x0f48('0xf')][_0x0f48('0x10')]>0x0){for(var _0x45ac2c=0x0,_0x50e530;_0x45ac2c<this[_0x0f48('0x6')][_0x0f48('0xf')][_0x0f48('0x10')];_0x45ac2c+=0x1){_0x50e530=this[_0x0f48('0x6')][_0x0f48('0xf')][_0x45ac2c]['id'];if(_[_0x0f48('0xe')](this[_0x0f48('0x11')][_0x0f48('0x12')][_0x50e530])){logger[_0x0f48('0x13')](_0x0f48('0x14'),this['squeue']['id'],_0x50e530);}else{if(util[_0x0f48('0x15')](this['squeue']['id'],this['realtime'][_0x0f48('0x12')][_0x50e530],this[_0x0f48('0x5')]['channel'],!![])){_0x1fb04f=![];util['writeLog'](this[_0x0f48('0x5')]['id'],this[_0x0f48('0x11')]['agents'][_0x50e530],_0x0f48('0x16'));this[_0x0f48('0x11')]['agents'][_0x50e530][_0x0f48('0x17')]=!![];this['realtime'][_0x0f48('0x12')][_0x50e530]['busyQueue']=this[_0x0f48('0x6')][_0x0f48('0x18')];util[_0x0f48('0x19')](this[_0x0f48('0x11')],this['routing'],this[_0x0f48('0x6')][_0x0f48('0xf')][_0x45ac2c],this[_0x0f48('0x5')][_0x0f48('0x1a')]);util[_0x0f48('0x1b')](this['notificationId'],this[_0x0f48('0x5')]['id'],this[_0x0f48('0x11')]['agents'][_0x50e530],this[_0x0f48('0x6')],this[_0x0f48('0x3')]);}}}if(_0x1fb04f){logger[_0x0f48('0x13')](_0x0f48('0x1c'),this['squeue']['id']);setTimeout(this[_0x0f48('0x7')][_0x0f48('0x8')](this),0x3e8);}}else{logger[_0x0f48('0x13')]('[%s][QUEUE]\x20EMPTY',this[_0x0f48('0x5')]['id']);setTimeout(this[_0x0f48('0x7')][_0x0f48('0x8')](this),0x3e8);}};Beepall['prototype'][_0x0f48('0x9')]=function(_0x575f2e){if(!_[_0x0f48('0xe')](this[_0x0f48('0x6')])&&!_['isNil'](this[_0x0f48('0x6')][_0x0f48('0xf')])){for(var _0x16eb54=0x0,_0x4d35bc;_0x16eb54<this['queue'][_0x0f48('0xf')][_0x0f48('0x10')];_0x16eb54+=0x1){_0x4d35bc=this[_0x0f48('0x6')]['Agents'][_0x16eb54]['id'];if(_[_0x0f48('0xe')](this[_0x0f48('0x11')]['agents'][_0x4d35bc])){logger[_0x0f48('0x13')](_0x0f48('0x14'),this['squeue']['id'],_0x4d35bc);}else{util['hideNotification'](this['notificationId'],this['squeue']['id'],this[_0x0f48('0x11')][_0x0f48('0x12')][_0x4d35bc],this['queue'],this[_0x0f48('0x3')]);util['writeLog'](this[_0x0f48('0x5')]['id'],this[_0x0f48('0x11')]['agents'][_0x4d35bc],_0x575f2e?_0x0f48('0x1d'):'TIMEOUT');this[_0x0f48('0x11')][_0x0f48('0x12')][_0x4d35bc][_0x0f48('0x17')]=![];this['realtime']['agents'][_0x4d35bc][_0x0f48('0x1e')]=undefined;util[_0x0f48('0x1f')](this['realtime'],this[_0x0f48('0x3')],this['realtime']['agents'][_0x4d35bc],this[_0x0f48('0x5')][_0x0f48('0x1a')]);}}}if(!_0x575f2e){setTimeout(this['push'][_0x0f48('0x8')](this),0x3e8);}};function beepall(_0x579c5d,_0x52325f,_0x58a1a8,_0x4efd98){return new Beepall(_0x579c5d,_0x52325f,_0x58a1a8,_0x4efd98);}module[_0x0f48('0x20')]=beepall;
\ No newline at end of file