Built motion from commit 58b0471d.|2.6.29
[motion2.git] / server / services / routing / server / applications / strategy / beepall.js
index e955761..6b995e0 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x710f=['writeLog','RINGING','agents','busy','busyQueue','name','debug','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','routing','notificationId','squeue','queue','push','handleRun','handleTimeout','bind','timeout','drained','prototype','isNil','Agents','length','realtime','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel'];(function(_0x4553e8,_0x480e3c){var _0x99e41=function(_0x4cf964){while(--_0x4cf964){_0x4553e8['push'](_0x4553e8['shift']());}};_0x99e41(++_0x480e3c);}(_0x710f,0x1ea));var _0xf710=function(_0x14b5af,_0x577e37){_0x14b5af=_0x14b5af-0x0;var _0xdcee5e=_0x710f[_0x14b5af];return _0xdcee5e;};'use strict';var _=require(_0xf710('0x0'));var uuid=require(_0xf710('0x1'));var util=require('./util');var logger=require('../../../../../config/logger')(_0xf710('0x2'));var Beepall=function(_0x426188,_0x1c5b6f,_0x40ff10,_0x5c2058){this[_0xf710('0x3')]=uuid['v4']();this[_0xf710('0x4')]=_0x426188;this[_0xf710('0x5')]=_0x1c5b6f;this['realtime']=_0x40ff10;this[_0xf710('0x2')]=_0x5c2058;this[_0xf710('0x4')][_0xf710('0x6')](this[_0xf710('0x7')]['bind'](this),this[_0xf710('0x8')][_0xf710('0x9')](this));this['squeue']['on'](_0xf710('0xa'),this[_0xf710('0x8')][_0xf710('0x9')](this));this[_0xf710('0x4')]['on'](_0xf710('0xb'),this['handleDrained'][_0xf710('0x9')](this));};Beepall[_0xf710('0xc')][_0xf710('0x6')]=function(){this[_0xf710('0x4')][_0xf710('0x6')](this['handleRun'][_0xf710('0x9')](this),this[_0xf710('0x8')][_0xf710('0x9')](this));};Beepall[_0xf710('0xc')]['handleDrained']=function(){this[_0xf710('0x8')](!![]);};Beepall[_0xf710('0xc')][_0xf710('0x7')]=function(){var _0x3e79df=!![];if(!_[_0xf710('0xd')](this[_0xf710('0x5')])&&!_['isNil'](this[_0xf710('0x5')][_0xf710('0xe')])&&this[_0xf710('0x5')][_0xf710('0xe')][_0xf710('0xf')]>0x0){for(var _0x3d59c3=0x0,_0x299b79;_0x3d59c3<this[_0xf710('0x5')][_0xf710('0xe')]['length'];_0x3d59c3+=0x1){_0x299b79=this[_0xf710('0x5')]['Agents'][_0x3d59c3]['id'];if(_[_0xf710('0xd')](this[_0xf710('0x10')]['agents'][_0x299b79])){logger['debug'](_0xf710('0x11'),this[_0xf710('0x4')]['id'],_0x299b79);}else{if(util[_0xf710('0x12')](this[_0xf710('0x4')]['id'],this[_0xf710('0x10')]['agents'][_0x299b79],this[_0xf710('0x4')][_0xf710('0x13')],!![])){_0x3e79df=![];util[_0xf710('0x14')](this[_0xf710('0x4')]['id'],this[_0xf710('0x10')]['agents'][_0x299b79],_0xf710('0x15'));this['realtime'][_0xf710('0x16')][_0x299b79][_0xf710('0x17')]=!![];this[_0xf710('0x10')][_0xf710('0x16')][_0x299b79][_0xf710('0x18')]=this[_0xf710('0x5')][_0xf710('0x19')];util['saveWaitingNotification'](this['realtime'],this['routing'],this['queue']['Agents'][_0x3d59c3],this['squeue'][_0xf710('0x13')]);util['showNotification'](this[_0xf710('0x3')],this[_0xf710('0x4')]['id'],this[_0xf710('0x10')][_0xf710('0x16')][_0x299b79],this['queue'],this['routing']);}}}if(_0x3e79df){logger[_0xf710('0x1a')](_0xf710('0x1b'),this[_0xf710('0x4')]['id']);setTimeout(this['push'][_0xf710('0x9')](this),0x3e8);}}else{logger[_0xf710('0x1a')](_0xf710('0x1c'),this[_0xf710('0x4')]['id']);setTimeout(this[_0xf710('0x6')][_0xf710('0x9')](this),0x3e8);}};Beepall[_0xf710('0xc')][_0xf710('0x8')]=function(_0xf98930){if(!_['isNil'](this['queue'])&&!_[_0xf710('0xd')](this[_0xf710('0x5')][_0xf710('0xe')])){for(var _0x282be4=0x0,_0x490f72;_0x282be4<this[_0xf710('0x5')]['Agents'][_0xf710('0xf')];_0x282be4+=0x1){_0x490f72=this[_0xf710('0x5')][_0xf710('0xe')][_0x282be4]['id'];if(_[_0xf710('0xd')](this[_0xf710('0x10')]['agents'][_0x490f72])){logger[_0xf710('0x1a')](_0xf710('0x11'),this['squeue']['id'],_0x490f72);}else{util[_0xf710('0x1d')](this[_0xf710('0x3')],this[_0xf710('0x4')]['id'],this[_0xf710('0x10')]['agents'][_0x490f72],this['queue'],this[_0xf710('0x2')]);util['writeLog'](this[_0xf710('0x4')]['id'],this[_0xf710('0x10')]['agents'][_0x490f72],_0xf98930?_0xf710('0x1e'):_0xf710('0x1f'));this[_0xf710('0x10')][_0xf710('0x16')][_0x490f72]['busy']=![];this[_0xf710('0x10')][_0xf710('0x16')][_0x490f72][_0xf710('0x18')]=undefined;util[_0xf710('0x20')](this[_0xf710('0x10')],this[_0xf710('0x2')],this[_0xf710('0x10')][_0xf710('0x16')][_0x490f72],this[_0xf710('0x4')][_0xf710('0x13')]);}}}if(!_0xf98930){setTimeout(this['push'][_0xf710('0x9')](this),0x3e8);}};function beepall(_0x31870b,_0x4c6570,_0x2a077f,_0x1d7c00){return new Beepall(_0x31870b,_0x4c6570,_0x2a077f,_0x1d7c00);}module[_0xf710('0x21')]=beepall;
\ No newline at end of file
+var _0xb0c9=['[%s][QUEUE]\x20EMPTY','STOP','TIMEOUT','exports','uuid','./util','notificationId','squeue','queue','realtime','push','handleRun','bind','handleTimeout','handleDrained','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busyQueue','name','routing','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY'];(function(_0x32f9cd,_0x1e48bd){var _0x25ad1c=function(_0x5f5ba2){while(--_0x5f5ba2){_0x32f9cd['push'](_0x32f9cd['shift']());}};_0x25ad1c(++_0x1e48bd);}(_0xb0c9,0x126));var _0x9b0c=function(_0x2b0275,_0x3fe1fe){_0x2b0275=_0x2b0275-0x0;var _0x43708e=_0xb0c9[_0x2b0275];return _0x43708e;};'use strict';var _=require('lodash');var uuid=require(_0x9b0c('0x0'));var util=require(_0x9b0c('0x1'));var logger=require('../../../../../config/logger')('routing');var Beepall=function(_0x25468e,_0x41e64b,_0x1ec5d3,_0x40c8f5){this[_0x9b0c('0x2')]=uuid['v4']();this[_0x9b0c('0x3')]=_0x25468e;this[_0x9b0c('0x4')]=_0x41e64b;this[_0x9b0c('0x5')]=_0x1ec5d3;this['routing']=_0x40c8f5;this[_0x9b0c('0x3')][_0x9b0c('0x6')](this[_0x9b0c('0x7')][_0x9b0c('0x8')](this),this[_0x9b0c('0x9')][_0x9b0c('0x8')](this));this[_0x9b0c('0x3')]['on']('timeout',this[_0x9b0c('0x9')]['bind'](this));this['squeue']['on']('drained',this[_0x9b0c('0xa')][_0x9b0c('0x8')](this));};Beepall['prototype'][_0x9b0c('0x6')]=function(){this['squeue'][_0x9b0c('0x6')](this[_0x9b0c('0x7')][_0x9b0c('0x8')](this),this[_0x9b0c('0x9')][_0x9b0c('0x8')](this));};Beepall[_0x9b0c('0xb')][_0x9b0c('0xa')]=function(){this[_0x9b0c('0x9')](!![]);};Beepall[_0x9b0c('0xb')][_0x9b0c('0x7')]=function(){var _0x3ec5ae=!![];if(!_[_0x9b0c('0xc')](this[_0x9b0c('0x4')])&&!_['isNil'](this['queue'][_0x9b0c('0xd')])&&this[_0x9b0c('0x4')][_0x9b0c('0xd')]['length']>0x0){for(var _0x5ef1c4=0x0,_0x51e211;_0x5ef1c4<this[_0x9b0c('0x4')][_0x9b0c('0xd')][_0x9b0c('0xe')];_0x5ef1c4+=0x1){_0x51e211=this[_0x9b0c('0x4')][_0x9b0c('0xd')][_0x5ef1c4]['id'];if(_[_0x9b0c('0xc')](this[_0x9b0c('0x5')][_0x9b0c('0xf')][_0x51e211])){logger[_0x9b0c('0x10')](_0x9b0c('0x11'),this['squeue']['id'],_0x51e211);}else{if(util['isAgentAvailable'](this['squeue']['id'],this[_0x9b0c('0x5')][_0x9b0c('0xf')][_0x51e211],this[_0x9b0c('0x3')][_0x9b0c('0x12')],!![])){_0x3ec5ae=![];util[_0x9b0c('0x13')](this[_0x9b0c('0x3')]['id'],this[_0x9b0c('0x5')][_0x9b0c('0xf')][_0x51e211],_0x9b0c('0x14'));this[_0x9b0c('0x5')]['agents'][_0x51e211]['busy']=!![];this[_0x9b0c('0x5')]['agents'][_0x51e211][_0x9b0c('0x15')]=this[_0x9b0c('0x4')][_0x9b0c('0x16')];util['saveWaitingNotification'](this[_0x9b0c('0x5')],this[_0x9b0c('0x17')],this[_0x9b0c('0x4')][_0x9b0c('0xd')][_0x5ef1c4],this[_0x9b0c('0x3')][_0x9b0c('0x12')]);util['showNotification'](this[_0x9b0c('0x2')],this['squeue']['id'],this['realtime'][_0x9b0c('0xf')][_0x51e211],this['queue'],this[_0x9b0c('0x17')]);}}}if(_0x3ec5ae){logger[_0x9b0c('0x10')](_0x9b0c('0x18'),this['squeue']['id']);setTimeout(this[_0x9b0c('0x6')][_0x9b0c('0x8')](this),0x3e8);}}else{logger[_0x9b0c('0x10')](_0x9b0c('0x19'),this[_0x9b0c('0x3')]['id']);setTimeout(this[_0x9b0c('0x6')][_0x9b0c('0x8')](this),0x3e8);}};Beepall['prototype'][_0x9b0c('0x9')]=function(_0x5ad139){if(!_['isNil'](this[_0x9b0c('0x4')])&&!_['isNil'](this[_0x9b0c('0x4')][_0x9b0c('0xd')])){for(var _0x9034e0=0x0,_0x13eb71;_0x9034e0<this[_0x9b0c('0x4')]['Agents'][_0x9b0c('0xe')];_0x9034e0+=0x1){_0x13eb71=this[_0x9b0c('0x4')]['Agents'][_0x9034e0]['id'];if(_[_0x9b0c('0xc')](this[_0x9b0c('0x5')][_0x9b0c('0xf')][_0x13eb71])){logger[_0x9b0c('0x10')](_0x9b0c('0x11'),this[_0x9b0c('0x3')]['id'],_0x13eb71);}else{util['hideNotification'](this[_0x9b0c('0x2')],this['squeue']['id'],this['realtime'][_0x9b0c('0xf')][_0x13eb71],this[_0x9b0c('0x4')],this[_0x9b0c('0x17')]);util['writeLog'](this[_0x9b0c('0x3')]['id'],this['realtime']['agents'][_0x13eb71],_0x5ad139?_0x9b0c('0x1a'):_0x9b0c('0x1b'));this[_0x9b0c('0x5')][_0x9b0c('0xf')][_0x13eb71]['busy']=![];this[_0x9b0c('0x5')][_0x9b0c('0xf')][_0x13eb71][_0x9b0c('0x15')]=undefined;util['removeWaitingNotification'](this['realtime'],this[_0x9b0c('0x17')],this[_0x9b0c('0x5')]['agents'][_0x13eb71],this[_0x9b0c('0x3')][_0x9b0c('0x12')]);}}}if(!_0x5ad139){setTimeout(this[_0x9b0c('0x6')][_0x9b0c('0x8')](this),0x3e8);}};function beepall(_0x54ccc4,_0x4e19e2,_0x1b732b,_0x239567){return new Beepall(_0x54ccc4,_0x4e19e2,_0x1b732b,_0x239567);}module[_0x9b0c('0x1c')]=beepall;
\ No newline at end of file