Built motion from commit f3da74b7.|2.5.36
[motion2.git] / server / services / routing / server / applications / strategy / beepall.js
index cc80b01..186ee76 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf88f=['exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','timeout','handleTimeout','drained','handleDrained','prototype','isNil','queue','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busy','busyQueue','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT'];(function(_0x13300a,_0x1b80aa){var _0xeecb0c=function(_0x10372f){while(--_0x10372f){_0x13300a['push'](_0x13300a['shift']());}};_0xeecb0c(++_0x1b80aa);}(_0xf88f,0x1bb));var _0xff88=function(_0x3d489b,_0x420673){_0x3d489b=_0x3d489b-0x0;var _0x538fff=_0xf88f[_0x3d489b];return _0x538fff;};'use strict';var _=require(_0xff88('0x0'));var uuid=require(_0xff88('0x1'));var util=require(_0xff88('0x2'));var logger=require(_0xff88('0x3'))(_0xff88('0x4'));var Beepall=function(_0x25c2a8,_0x184827,_0x47b3fe,_0x1bcee9){this[_0xff88('0x5')]=uuid['v4']();this[_0xff88('0x6')]=_0x25c2a8;this['queue']=_0x184827;this[_0xff88('0x7')]=_0x47b3fe;this[_0xff88('0x4')]=_0x1bcee9;this[_0xff88('0x6')][_0xff88('0x8')](this[_0xff88('0x9')][_0xff88('0xa')](this),this['handleTimeout'][_0xff88('0xa')](this));this[_0xff88('0x6')]['on'](_0xff88('0xb'),this[_0xff88('0xc')][_0xff88('0xa')](this));this[_0xff88('0x6')]['on'](_0xff88('0xd'),this[_0xff88('0xe')][_0xff88('0xa')](this));};Beepall[_0xff88('0xf')][_0xff88('0x8')]=function(){this[_0xff88('0x6')][_0xff88('0x8')](this[_0xff88('0x9')][_0xff88('0xa')](this),this['handleTimeout'][_0xff88('0xa')](this));};Beepall[_0xff88('0xf')][_0xff88('0xe')]=function(_0x50b341){this[_0xff88('0xc')](!![]);};Beepall[_0xff88('0xf')][_0xff88('0x9')]=function(_0x116712){var _0xcd256f=!![];if(!_[_0xff88('0x10')](this[_0xff88('0x11')])&&!_[_0xff88('0x10')](this['queue'][_0xff88('0x12')])&&this[_0xff88('0x11')]['Agents']['length']>0x0){for(var _0x1181a1=0x0,_0x23fbfc;_0x1181a1<this['queue'][_0xff88('0x12')][_0xff88('0x13')];_0x1181a1+=0x1){_0x23fbfc=this['queue'][_0xff88('0x12')][_0x1181a1]['id'];if(_[_0xff88('0x10')](this[_0xff88('0x7')][_0xff88('0x14')][_0x23fbfc])){logger[_0xff88('0x15')](_0xff88('0x16'),this[_0xff88('0x6')]['id'],_0x23fbfc);}else{if(util['isAgentAvailable'](this[_0xff88('0x6')]['id'],this[_0xff88('0x7')][_0xff88('0x14')][_0x23fbfc],this[_0xff88('0x6')][_0xff88('0x17')],!![])){_0xcd256f=![];util[_0xff88('0x18')](this['squeue']['id'],this[_0xff88('0x7')][_0xff88('0x14')][_0x23fbfc],_0xff88('0x19'));this[_0xff88('0x7')][_0xff88('0x14')][_0x23fbfc][_0xff88('0x1a')]=!![];this[_0xff88('0x7')]['agents'][_0x23fbfc][_0xff88('0x1b')]=this[_0xff88('0x11')]['name'];util[_0xff88('0x1c')](this[_0xff88('0x5')],this[_0xff88('0x6')]['id'],this['realtime'][_0xff88('0x14')][_0x23fbfc],this[_0xff88('0x11')],this['routing']);}}}if(_0xcd256f){logger[_0xff88('0x15')](_0xff88('0x1d'),this['squeue']['id']);setTimeout(this[_0xff88('0x8')][_0xff88('0xa')](this),0x3e8);}}else{logger[_0xff88('0x15')](_0xff88('0x1e'),this[_0xff88('0x6')]['id']);setTimeout(this[_0xff88('0x8')]['bind'](this),0x3e8);}};Beepall[_0xff88('0xf')][_0xff88('0xc')]=function(_0x58d521){if(!_[_0xff88('0x10')](this[_0xff88('0x11')])&&!_[_0xff88('0x10')](this[_0xff88('0x11')][_0xff88('0x12')])){for(var _0x68a5c0=0x0,_0x4e7569;_0x68a5c0<this[_0xff88('0x11')][_0xff88('0x12')][_0xff88('0x13')];_0x68a5c0+=0x1){_0x4e7569=this['queue'][_0xff88('0x12')][_0x68a5c0]['id'];if(_[_0xff88('0x10')](this[_0xff88('0x7')]['agents'][_0x4e7569])){logger['info'](_0xff88('0x16'),this[_0xff88('0x6')]['id'],_0x4e7569);}else{util[_0xff88('0x1f')](this[_0xff88('0x5')],this[_0xff88('0x6')]['id'],this[_0xff88('0x7')][_0xff88('0x14')][_0x4e7569],this[_0xff88('0x11')],this[_0xff88('0x4')]);util[_0xff88('0x18')](this[_0xff88('0x6')]['id'],this['realtime'][_0xff88('0x14')][_0x4e7569],_0x58d521?'STOP':_0xff88('0x20'));this[_0xff88('0x7')]['agents'][_0x4e7569][_0xff88('0x1a')]=![];this[_0xff88('0x7')][_0xff88('0x14')][_0x4e7569]['busyQueue']=undefined;}}}if(!_0x58d521){setTimeout(this[_0xff88('0x8')][_0xff88('0xa')](this),0x3e8);}};function beepall(_0x28ce5a,_0x46dd29,_0x127c5a,_0x3eecd4){return new Beepall(_0x28ce5a,_0x46dd29,_0x127c5a,_0x3eecd4);}module[_0xff88('0x21')]=beepall;
\ No newline at end of file
+var _0xce1a=['agents','RINGING','busy','busyQueue','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','lodash','routing','squeue','realtime','push','handleRun','bind','timeout','handleTimeout','handleDrained','prototype','isNil','queue','Agents','length','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog'];(function(_0x1bb11e,_0x58fd78){var _0x422492=function(_0x5d8dfd){while(--_0x5d8dfd){_0x1bb11e['push'](_0x1bb11e['shift']());}};_0x422492(++_0x58fd78);}(_0xce1a,0xbf));var _0xace1=function(_0x588138,_0x263e77){_0x588138=_0x588138-0x0;var _0x39c8d3=_0xce1a[_0x588138];return _0x39c8d3;};'use strict';var _=require(_0xace1('0x0'));var uuid=require('uuid');var util=require('./util');var logger=require('../../../../../config/logger')(_0xace1('0x1'));var Beepall=function(_0x386640,_0x19055c,_0xbca98c,_0xe23526){this['notificationId']=uuid['v4']();this[_0xace1('0x2')]=_0x386640;this['queue']=_0x19055c;this[_0xace1('0x3')]=_0xbca98c;this['routing']=_0xe23526;this[_0xace1('0x2')][_0xace1('0x4')](this[_0xace1('0x5')]['bind'](this),this['handleTimeout'][_0xace1('0x6')](this));this['squeue']['on'](_0xace1('0x7'),this[_0xace1('0x8')][_0xace1('0x6')](this));this[_0xace1('0x2')]['on']('drained',this[_0xace1('0x9')][_0xace1('0x6')](this));};Beepall['prototype'][_0xace1('0x4')]=function(){this[_0xace1('0x2')]['push'](this['handleRun']['bind'](this),this[_0xace1('0x8')][_0xace1('0x6')](this));};Beepall[_0xace1('0xa')]['handleDrained']=function(_0x54cb30){this['handleTimeout'](!![]);};Beepall[_0xace1('0xa')][_0xace1('0x5')]=function(_0x54b542){var _0x2ca339=!![];if(!_[_0xace1('0xb')](this[_0xace1('0xc')])&&!_[_0xace1('0xb')](this[_0xace1('0xc')]['Agents'])&&this['queue'][_0xace1('0xd')][_0xace1('0xe')]>0x0){for(var _0x49cb73=0x0,_0x38a9b0;_0x49cb73<this[_0xace1('0xc')][_0xace1('0xd')][_0xace1('0xe')];_0x49cb73+=0x1){_0x38a9b0=this[_0xace1('0xc')]['Agents'][_0x49cb73]['id'];if(_['isNil'](this[_0xace1('0x3')]['agents'][_0x38a9b0])){logger[_0xace1('0xf')](_0xace1('0x10'),this[_0xace1('0x2')]['id'],_0x38a9b0);}else{if(util['isAgentAvailable'](this[_0xace1('0x2')]['id'],this[_0xace1('0x3')]['agents'][_0x38a9b0],this[_0xace1('0x2')][_0xace1('0x11')],!![])){_0x2ca339=![];util[_0xace1('0x12')](this[_0xace1('0x2')]['id'],this[_0xace1('0x3')][_0xace1('0x13')][_0x38a9b0],_0xace1('0x14'));this[_0xace1('0x3')][_0xace1('0x13')][_0x38a9b0][_0xace1('0x15')]=!![];this[_0xace1('0x3')][_0xace1('0x13')][_0x38a9b0][_0xace1('0x16')]=this[_0xace1('0xc')]['name'];util[_0xace1('0x17')](this[_0xace1('0x18')],this[_0xace1('0x2')]['id'],this[_0xace1('0x3')]['agents'][_0x38a9b0],this[_0xace1('0xc')],this['routing']);}}}if(_0x2ca339){logger[_0xace1('0xf')](_0xace1('0x19'),this[_0xace1('0x2')]['id']);setTimeout(this[_0xace1('0x4')]['bind'](this),0x3e8);}}else{logger['info'](_0xace1('0x1a'),this[_0xace1('0x2')]['id']);setTimeout(this[_0xace1('0x4')][_0xace1('0x6')](this),0x3e8);}};Beepall['prototype']['handleTimeout']=function(_0xc16f19){if(!_[_0xace1('0xb')](this[_0xace1('0xc')])&&!_[_0xace1('0xb')](this[_0xace1('0xc')][_0xace1('0xd')])){for(var _0x356a8e=0x0,_0x9b5560;_0x356a8e<this[_0xace1('0xc')][_0xace1('0xd')][_0xace1('0xe')];_0x356a8e+=0x1){_0x9b5560=this[_0xace1('0xc')][_0xace1('0xd')][_0x356a8e]['id'];if(_[_0xace1('0xb')](this['realtime']['agents'][_0x9b5560])){logger[_0xace1('0xf')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xace1('0x2')]['id'],_0x9b5560);}else{util[_0xace1('0x1b')](this[_0xace1('0x18')],this[_0xace1('0x2')]['id'],this[_0xace1('0x3')][_0xace1('0x13')][_0x9b5560],this['queue'],this[_0xace1('0x1')]);util[_0xace1('0x12')](this[_0xace1('0x2')]['id'],this['realtime']['agents'][_0x9b5560],_0xc16f19?_0xace1('0x1c'):_0xace1('0x1d'));this[_0xace1('0x3')][_0xace1('0x13')][_0x9b5560][_0xace1('0x15')]=![];this[_0xace1('0x3')][_0xace1('0x13')][_0x9b5560][_0xace1('0x16')]=undefined;}}}if(!_0xc16f19){setTimeout(this[_0xace1('0x4')][_0xace1('0x6')](this),0x3e8);}};function beepall(_0x3c23b4,_0x3b6557,_0x374a11,_0x47a276){return new Beepall(_0x3c23b4,_0x3b6557,_0x374a11,_0x47a276);}module['exports']=beepall;
\ No newline at end of file