Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / services / routing / server / applications / strategy / beepall.js
index 0448d93..95de519 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa120=['agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','writeLog','RINGING','busyQueue','name','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','length','hideNotification','STOP','TIMEOUT','busy','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','bind','handleTimeout','timeout','handleDrained','prototype','handleRun','isNil','Agents'];(function(_0x97f6db,_0x3c1b27){var _0x396fda=function(_0x4066bc){while(--_0x4066bc){_0x97f6db['push'](_0x97f6db['shift']());}};_0x396fda(++_0x3c1b27);}(_0xa120,0xf6));var _0x0a12=function(_0x52982f,_0x36c33e){_0x52982f=_0x52982f-0x0;var _0x3ac186=_0xa120[_0x52982f];return _0x3ac186;};'use strict';var _=require(_0x0a12('0x0'));var uuid=require(_0x0a12('0x1'));var util=require(_0x0a12('0x2'));var logger=require(_0x0a12('0x3'))(_0x0a12('0x4'));var Beepall=function(_0x8ed316,_0x610e1,_0x3743b8,_0x463a02){this[_0x0a12('0x5')]=uuid['v4']();this[_0x0a12('0x6')]=_0x8ed316;this[_0x0a12('0x7')]=_0x610e1;this[_0x0a12('0x8')]=_0x3743b8;this['routing']=_0x463a02;this[_0x0a12('0x6')][_0x0a12('0x9')](this['handleRun'][_0x0a12('0xa')](this),this[_0x0a12('0xb')][_0x0a12('0xa')](this));this[_0x0a12('0x6')]['on'](_0x0a12('0xc'),this[_0x0a12('0xb')][_0x0a12('0xa')](this));this[_0x0a12('0x6')]['on']('drained',this[_0x0a12('0xd')]['bind'](this));};Beepall[_0x0a12('0xe')][_0x0a12('0x9')]=function(){this[_0x0a12('0x6')][_0x0a12('0x9')](this[_0x0a12('0xf')][_0x0a12('0xa')](this),this[_0x0a12('0xb')][_0x0a12('0xa')](this));};Beepall[_0x0a12('0xe')][_0x0a12('0xd')]=function(_0x8680e){this[_0x0a12('0xb')](!![]);};Beepall['prototype'][_0x0a12('0xf')]=function(_0x52a0b7){var _0x75e4a7=!![];if(!_[_0x0a12('0x10')](this[_0x0a12('0x7')])&&!_[_0x0a12('0x10')](this[_0x0a12('0x7')][_0x0a12('0x11')])&&this['queue'][_0x0a12('0x11')]['length']>0x0){for(var _0x5b30c8=0x0,_0x37e891;_0x5b30c8<this[_0x0a12('0x7')]['Agents']['length'];_0x5b30c8+=0x1){_0x37e891=this['queue'][_0x0a12('0x11')][_0x5b30c8]['id'];if(_[_0x0a12('0x10')](this[_0x0a12('0x8')][_0x0a12('0x12')][_0x37e891])){logger[_0x0a12('0x13')](_0x0a12('0x14'),this[_0x0a12('0x6')]['id'],_0x37e891);}else{if(util['isAgentAvailable'](this[_0x0a12('0x6')]['id'],this[_0x0a12('0x8')][_0x0a12('0x12')][_0x37e891],this['squeue']['channel'],!![])){_0x75e4a7=![];util[_0x0a12('0x15')](this[_0x0a12('0x6')]['id'],this['realtime'][_0x0a12('0x12')][_0x37e891],_0x0a12('0x16'));this[_0x0a12('0x8')][_0x0a12('0x12')][_0x37e891]['busy']=!![];this[_0x0a12('0x8')][_0x0a12('0x12')][_0x37e891][_0x0a12('0x17')]=this[_0x0a12('0x7')][_0x0a12('0x18')];util['showNotification'](this[_0x0a12('0x5')],this[_0x0a12('0x6')]['id'],this[_0x0a12('0x8')]['agents'][_0x37e891],this[_0x0a12('0x7')],this[_0x0a12('0x4')]);}}}if(_0x75e4a7){logger['info'](_0x0a12('0x19'),this[_0x0a12('0x6')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}else{logger['info'](_0x0a12('0x1a'),this['squeue']['id']);setTimeout(this[_0x0a12('0x9')]['bind'](this),0x3e8);}};Beepall[_0x0a12('0xe')]['handleTimeout']=function(_0x8377dc){if(!_[_0x0a12('0x10')](this['queue'])&&!_[_0x0a12('0x10')](this['queue'][_0x0a12('0x11')])){for(var _0x49fe3e=0x0,_0x1d4d0d;_0x49fe3e<this[_0x0a12('0x7')][_0x0a12('0x11')][_0x0a12('0x1b')];_0x49fe3e+=0x1){_0x1d4d0d=this[_0x0a12('0x7')]['Agents'][_0x49fe3e]['id'];if(_[_0x0a12('0x10')](this[_0x0a12('0x8')][_0x0a12('0x12')][_0x1d4d0d])){logger[_0x0a12('0x13')](_0x0a12('0x14'),this[_0x0a12('0x6')]['id'],_0x1d4d0d);}else{util[_0x0a12('0x1c')](this['notificationId'],this[_0x0a12('0x6')]['id'],this[_0x0a12('0x8')][_0x0a12('0x12')][_0x1d4d0d],this[_0x0a12('0x7')],this['routing']);util['writeLog'](this['squeue']['id'],this[_0x0a12('0x8')][_0x0a12('0x12')][_0x1d4d0d],_0x8377dc?_0x0a12('0x1d'):_0x0a12('0x1e'));this[_0x0a12('0x8')][_0x0a12('0x12')][_0x1d4d0d][_0x0a12('0x1f')]=![];this['realtime'][_0x0a12('0x12')][_0x1d4d0d][_0x0a12('0x17')]=undefined;}}}if(!_0x8377dc){setTimeout(this[_0x0a12('0x9')][_0x0a12('0xa')](this),0x3e8);}};function beepall(_0x35847a,_0x470d6c,_0x33bb83,_0x24d602){return new Beepall(_0x35847a,_0x470d6c,_0x33bb83,_0x24d602);}module[_0x0a12('0x20')]=beepall;
\ No newline at end of file
+var _0xe7f2=['[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','STOP','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','queue','realtime','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','writeLog','RINGING','name','showNotification'];(function(_0x5c0759,_0x5a9700){var _0x45b4a9=function(_0x3a7801){while(--_0x3a7801){_0x5c0759['push'](_0x5c0759['shift']());}};_0x45b4a9(++_0x5a9700);}(_0xe7f2,0x196));var _0x2e7f=function(_0x6ccc6a,_0x32b025){_0x6ccc6a=_0x6ccc6a-0x0;var _0x43aa73=_0xe7f2[_0x6ccc6a];return _0x43aa73;};'use strict';var _=require(_0x2e7f('0x0'));var uuid=require(_0x2e7f('0x1'));var util=require(_0x2e7f('0x2'));var logger=require(_0x2e7f('0x3'))(_0x2e7f('0x4'));var Beepall=function(_0x1733ca,_0x4d6bac,_0x2b7271,_0x4a231c){this[_0x2e7f('0x5')]=uuid['v4']();this[_0x2e7f('0x6')]=_0x1733ca;this[_0x2e7f('0x7')]=_0x4d6bac;this[_0x2e7f('0x8')]=_0x2b7271;this[_0x2e7f('0x4')]=_0x4a231c;this['squeue'][_0x2e7f('0x9')](this[_0x2e7f('0xa')]['bind'](this),this[_0x2e7f('0xb')][_0x2e7f('0xc')](this));this[_0x2e7f('0x6')]['on'](_0x2e7f('0xd'),this['handleTimeout']['bind'](this));this[_0x2e7f('0x6')]['on'](_0x2e7f('0xe'),this[_0x2e7f('0xf')][_0x2e7f('0xc')](this));};Beepall[_0x2e7f('0x10')][_0x2e7f('0x9')]=function(){this[_0x2e7f('0x6')][_0x2e7f('0x9')](this['handleRun']['bind'](this),this[_0x2e7f('0xb')]['bind'](this));};Beepall[_0x2e7f('0x10')][_0x2e7f('0xf')]=function(_0x302159){this['handleTimeout'](!![]);};Beepall[_0x2e7f('0x10')]['handleRun']=function(_0x45ba4a){var _0x5f1ab1=!![];if(!_[_0x2e7f('0x11')](this[_0x2e7f('0x7')])&&!_[_0x2e7f('0x11')](this[_0x2e7f('0x7')]['Agents'])&&this[_0x2e7f('0x7')][_0x2e7f('0x12')]['length']>0x0){for(var _0x4c3f1e=0x0,_0x1923c7;_0x4c3f1e<this[_0x2e7f('0x7')][_0x2e7f('0x12')][_0x2e7f('0x13')];_0x4c3f1e+=0x1){_0x1923c7=this[_0x2e7f('0x7')][_0x2e7f('0x12')][_0x4c3f1e]['id'];if(_['isNil'](this[_0x2e7f('0x8')][_0x2e7f('0x14')][_0x1923c7])){logger[_0x2e7f('0x15')](_0x2e7f('0x16'),this['squeue']['id'],_0x1923c7);}else{if(util[_0x2e7f('0x17')](this['squeue']['id'],this[_0x2e7f('0x8')][_0x2e7f('0x14')][_0x1923c7],this[_0x2e7f('0x6')]['channel'],!![])){_0x5f1ab1=![];util[_0x2e7f('0x18')](this[_0x2e7f('0x6')]['id'],this['realtime'][_0x2e7f('0x14')][_0x1923c7],_0x2e7f('0x19'));this[_0x2e7f('0x8')]['agents'][_0x1923c7]['busy']=!![];this[_0x2e7f('0x8')][_0x2e7f('0x14')][_0x1923c7]['busyQueue']=this[_0x2e7f('0x7')][_0x2e7f('0x1a')];util[_0x2e7f('0x1b')](this[_0x2e7f('0x5')],this[_0x2e7f('0x6')]['id'],this[_0x2e7f('0x8')][_0x2e7f('0x14')][_0x1923c7],this[_0x2e7f('0x7')],this[_0x2e7f('0x4')]);}}}if(_0x5f1ab1){logger[_0x2e7f('0x15')](_0x2e7f('0x1c'),this[_0x2e7f('0x6')]['id']);setTimeout(this[_0x2e7f('0x9')][_0x2e7f('0xc')](this),0x3e8);}}else{logger[_0x2e7f('0x15')](_0x2e7f('0x1d'),this[_0x2e7f('0x6')]['id']);setTimeout(this[_0x2e7f('0x9')]['bind'](this),0x3e8);}};Beepall[_0x2e7f('0x10')][_0x2e7f('0xb')]=function(_0x349582){if(!_[_0x2e7f('0x11')](this[_0x2e7f('0x7')])&&!_[_0x2e7f('0x11')](this['queue'][_0x2e7f('0x12')])){for(var _0x5b326d=0x0,_0x5d4001;_0x5b326d<this['queue']['Agents'][_0x2e7f('0x13')];_0x5b326d+=0x1){_0x5d4001=this[_0x2e7f('0x7')][_0x2e7f('0x12')][_0x5b326d]['id'];if(_[_0x2e7f('0x11')](this[_0x2e7f('0x8')][_0x2e7f('0x14')][_0x5d4001])){logger[_0x2e7f('0x15')]('[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x2e7f('0x6')]['id'],_0x5d4001);}else{util['hideNotification'](this[_0x2e7f('0x5')],this[_0x2e7f('0x6')]['id'],this[_0x2e7f('0x8')]['agents'][_0x5d4001],this[_0x2e7f('0x7')],this[_0x2e7f('0x4')]);util[_0x2e7f('0x18')](this[_0x2e7f('0x6')]['id'],this['realtime']['agents'][_0x5d4001],_0x349582?_0x2e7f('0x1e'):'TIMEOUT');this[_0x2e7f('0x8')][_0x2e7f('0x14')][_0x5d4001]['busy']=![];this['realtime'][_0x2e7f('0x14')][_0x5d4001]['busyQueue']=undefined;}}}if(!_0x349582){setTimeout(this['push'][_0x2e7f('0xc')](this),0x3e8);}};function beepall(_0x2d3494,_0x14bac6,_0xcada2d,_0x4ed98a){return new Beepall(_0x2d3494,_0x14bac6,_0xcada2d,_0x4ed98a);}module['exports']=beepall;
\ No newline at end of file