Built motion from commit 97153652.|2.6.26
[motion2.git] / server / services / routing / server / applications / strategy / beepall.js
index adba40f..93d4acd 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcf38=['notificationId','squeue','queue','routing','push','handleRun','handleTimeout','bind','timeout','drained','handleDrained','prototype','isNil','Agents','length','realtime','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','channel','writeLog','RINGING','busy','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','hideNotification','STOP','TIMEOUT','busyQueue','uuid','../../../../../config/logger'];(function(_0xd95342,_0xb75bf6){var _0x54d694=function(_0x1190c1){while(--_0x1190c1){_0xd95342['push'](_0xd95342['shift']());}};_0x54d694(++_0xb75bf6);}(_0xcf38,0x169));var _0x8cf3=function(_0x17b2ab,_0x43a8dd){_0x17b2ab=_0x17b2ab-0x0;var _0x242a20=_0xcf38[_0x17b2ab];return _0x242a20;};'use strict';var _=require('lodash');var uuid=require(_0x8cf3('0x0'));var util=require('./util');var logger=require(_0x8cf3('0x1'))('routing');var Beepall=function(_0x2f8723,_0x4a4d4b,_0x209ddd,_0x49ae89){this[_0x8cf3('0x2')]=uuid['v4']();this[_0x8cf3('0x3')]=_0x2f8723;this[_0x8cf3('0x4')]=_0x4a4d4b;this['realtime']=_0x209ddd;this[_0x8cf3('0x5')]=_0x49ae89;this[_0x8cf3('0x3')][_0x8cf3('0x6')](this[_0x8cf3('0x7')]['bind'](this),this[_0x8cf3('0x8')][_0x8cf3('0x9')](this));this[_0x8cf3('0x3')]['on'](_0x8cf3('0xa'),this['handleTimeout'][_0x8cf3('0x9')](this));this['squeue']['on'](_0x8cf3('0xb'),this[_0x8cf3('0xc')]['bind'](this));};Beepall['prototype'][_0x8cf3('0x6')]=function(){this[_0x8cf3('0x3')][_0x8cf3('0x6')](this[_0x8cf3('0x7')]['bind'](this),this[_0x8cf3('0x8')]['bind'](this));};Beepall[_0x8cf3('0xd')][_0x8cf3('0xc')]=function(){this[_0x8cf3('0x8')](!![]);};Beepall[_0x8cf3('0xd')][_0x8cf3('0x7')]=function(){var _0x34580a=!![];if(!_[_0x8cf3('0xe')](this[_0x8cf3('0x4')])&&!_[_0x8cf3('0xe')](this['queue'][_0x8cf3('0xf')])&&this[_0x8cf3('0x4')]['Agents'][_0x8cf3('0x10')]>0x0){for(var _0x55333f=0x0,_0x4f7215;_0x55333f<this['queue'][_0x8cf3('0xf')][_0x8cf3('0x10')];_0x55333f+=0x1){_0x4f7215=this[_0x8cf3('0x4')][_0x8cf3('0xf')][_0x55333f]['id'];if(_[_0x8cf3('0xe')](this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x4f7215])){logger[_0x8cf3('0x13')](_0x8cf3('0x14'),this['squeue']['id'],_0x4f7215);}else{if(util['isAgentAvailable'](this[_0x8cf3('0x3')]['id'],this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x4f7215],this[_0x8cf3('0x3')][_0x8cf3('0x15')],!![])){_0x34580a=![];util[_0x8cf3('0x16')](this[_0x8cf3('0x3')]['id'],this['realtime'][_0x8cf3('0x12')][_0x4f7215],_0x8cf3('0x17'));this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x4f7215][_0x8cf3('0x18')]=!![];this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x4f7215]['busyQueue']=this['queue'][_0x8cf3('0x19')];util[_0x8cf3('0x1a')](this[_0x8cf3('0x11')],this[_0x8cf3('0x5')],this[_0x8cf3('0x4')][_0x8cf3('0xf')][_0x55333f],this[_0x8cf3('0x3')][_0x8cf3('0x15')]);util[_0x8cf3('0x1b')](this[_0x8cf3('0x2')],this[_0x8cf3('0x3')]['id'],this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x4f7215],this[_0x8cf3('0x4')],this[_0x8cf3('0x5')]);}}}if(_0x34580a){logger[_0x8cf3('0x13')](_0x8cf3('0x1c'),this['squeue']['id']);setTimeout(this[_0x8cf3('0x6')][_0x8cf3('0x9')](this),0x3e8);}}else{logger[_0x8cf3('0x13')]('[%s][QUEUE]\x20EMPTY',this[_0x8cf3('0x3')]['id']);setTimeout(this[_0x8cf3('0x6')][_0x8cf3('0x9')](this),0x3e8);}};Beepall[_0x8cf3('0xd')][_0x8cf3('0x8')]=function(_0x5aaf0a){if(!_[_0x8cf3('0xe')](this['queue'])&&!_[_0x8cf3('0xe')](this[_0x8cf3('0x4')][_0x8cf3('0xf')])){for(var _0x227901=0x0,_0x17c07e;_0x227901<this['queue'][_0x8cf3('0xf')][_0x8cf3('0x10')];_0x227901+=0x1){_0x17c07e=this[_0x8cf3('0x4')][_0x8cf3('0xf')][_0x227901]['id'];if(_[_0x8cf3('0xe')](this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x17c07e])){logger[_0x8cf3('0x13')](_0x8cf3('0x14'),this[_0x8cf3('0x3')]['id'],_0x17c07e);}else{util[_0x8cf3('0x1d')](this[_0x8cf3('0x2')],this[_0x8cf3('0x3')]['id'],this['realtime']['agents'][_0x17c07e],this[_0x8cf3('0x4')],this[_0x8cf3('0x5')]);util[_0x8cf3('0x16')](this[_0x8cf3('0x3')]['id'],this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x17c07e],_0x5aaf0a?_0x8cf3('0x1e'):_0x8cf3('0x1f'));this['realtime'][_0x8cf3('0x12')][_0x17c07e][_0x8cf3('0x18')]=![];this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x17c07e][_0x8cf3('0x20')]=undefined;util['removeWaitingNotification'](this[_0x8cf3('0x11')],this['routing'],this[_0x8cf3('0x11')][_0x8cf3('0x12')][_0x17c07e],this[_0x8cf3('0x3')][_0x8cf3('0x15')]);}}}if(!_0x5aaf0a){setTimeout(this[_0x8cf3('0x6')][_0x8cf3('0x9')](this),0x3e8);}};function beepall(_0x508814,_0x7ea748,_0x1289ab,_0x3bd2f0){return new Beepall(_0x508814,_0x7ea748,_0x1289ab,_0x3bd2f0);}module['exports']=beepall;
\ No newline at end of file
+var _0xac62=['bind','timeout','drained','prototype','handleDrained','isNil','queue','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busyQueue','name','saveWaitingNotification','showNotification','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','handleTimeout'];(function(_0x4f9b18,_0x2cb5ca){var _0x29f20c=function(_0x268b3d){while(--_0x268b3d){_0x4f9b18['push'](_0x4f9b18['shift']());}};_0x29f20c(++_0x2cb5ca);}(_0xac62,0x65));var _0x2ac6=function(_0x44731a,_0x3417bb){_0x44731a=_0x44731a-0x0;var _0x5541bd=_0xac62[_0x44731a];return _0x5541bd;};'use strict';var _=require(_0x2ac6('0x0'));var uuid=require('uuid');var util=require(_0x2ac6('0x1'));var logger=require(_0x2ac6('0x2'))(_0x2ac6('0x3'));var Beepall=function(_0x22d0f6,_0x57c522,_0x486b32,_0x1e0057){this[_0x2ac6('0x4')]=uuid['v4']();this[_0x2ac6('0x5')]=_0x22d0f6;this['queue']=_0x57c522;this[_0x2ac6('0x6')]=_0x486b32;this['routing']=_0x1e0057;this[_0x2ac6('0x5')][_0x2ac6('0x7')](this[_0x2ac6('0x8')]['bind'](this),this[_0x2ac6('0x9')][_0x2ac6('0xa')](this));this['squeue']['on'](_0x2ac6('0xb'),this[_0x2ac6('0x9')][_0x2ac6('0xa')](this));this['squeue']['on'](_0x2ac6('0xc'),this['handleDrained'][_0x2ac6('0xa')](this));};Beepall[_0x2ac6('0xd')]['push']=function(){this[_0x2ac6('0x5')][_0x2ac6('0x7')](this[_0x2ac6('0x8')][_0x2ac6('0xa')](this),this[_0x2ac6('0x9')]['bind'](this));};Beepall[_0x2ac6('0xd')][_0x2ac6('0xe')]=function(){this[_0x2ac6('0x9')](!![]);};Beepall['prototype'][_0x2ac6('0x8')]=function(){var _0x29f807=!![];if(!_[_0x2ac6('0xf')](this[_0x2ac6('0x10')])&&!_['isNil'](this['queue'][_0x2ac6('0x11')])&&this[_0x2ac6('0x10')][_0x2ac6('0x11')][_0x2ac6('0x12')]>0x0){for(var _0x77683f=0x0,_0x4e7bd0;_0x77683f<this[_0x2ac6('0x10')][_0x2ac6('0x11')][_0x2ac6('0x12')];_0x77683f+=0x1){_0x4e7bd0=this[_0x2ac6('0x10')][_0x2ac6('0x11')][_0x77683f]['id'];if(_[_0x2ac6('0xf')](this[_0x2ac6('0x6')][_0x2ac6('0x13')][_0x4e7bd0])){logger[_0x2ac6('0x14')](_0x2ac6('0x15'),this['squeue']['id'],_0x4e7bd0);}else{if(util[_0x2ac6('0x16')](this[_0x2ac6('0x5')]['id'],this[_0x2ac6('0x6')][_0x2ac6('0x13')][_0x4e7bd0],this[_0x2ac6('0x5')][_0x2ac6('0x17')],!![])){_0x29f807=![];util[_0x2ac6('0x18')](this[_0x2ac6('0x5')]['id'],this[_0x2ac6('0x6')]['agents'][_0x4e7bd0],_0x2ac6('0x19'));this[_0x2ac6('0x6')][_0x2ac6('0x13')][_0x4e7bd0]['busy']=!![];this[_0x2ac6('0x6')][_0x2ac6('0x13')][_0x4e7bd0][_0x2ac6('0x1a')]=this[_0x2ac6('0x10')][_0x2ac6('0x1b')];util[_0x2ac6('0x1c')](this['realtime'],this[_0x2ac6('0x3')],this[_0x2ac6('0x10')][_0x2ac6('0x11')][_0x77683f],this['squeue'][_0x2ac6('0x17')]);util[_0x2ac6('0x1d')](this[_0x2ac6('0x4')],this[_0x2ac6('0x5')]['id'],this[_0x2ac6('0x6')][_0x2ac6('0x13')][_0x4e7bd0],this['queue'],this[_0x2ac6('0x3')]);}}}if(_0x29f807){logger[_0x2ac6('0x14')](_0x2ac6('0x1e'),this[_0x2ac6('0x5')]['id']);setTimeout(this['push'][_0x2ac6('0xa')](this),0x3e8);}}else{logger[_0x2ac6('0x14')](_0x2ac6('0x1f'),this[_0x2ac6('0x5')]['id']);setTimeout(this[_0x2ac6('0x7')][_0x2ac6('0xa')](this),0x3e8);}};Beepall[_0x2ac6('0xd')][_0x2ac6('0x9')]=function(_0x5a3f76){if(!_[_0x2ac6('0xf')](this[_0x2ac6('0x10')])&&!_[_0x2ac6('0xf')](this[_0x2ac6('0x10')][_0x2ac6('0x11')])){for(var _0x52d3d1=0x0,_0x5347fe;_0x52d3d1<this[_0x2ac6('0x10')][_0x2ac6('0x11')][_0x2ac6('0x12')];_0x52d3d1+=0x1){_0x5347fe=this[_0x2ac6('0x10')][_0x2ac6('0x11')][_0x52d3d1]['id'];if(_[_0x2ac6('0xf')](this[_0x2ac6('0x6')]['agents'][_0x5347fe])){logger[_0x2ac6('0x14')](_0x2ac6('0x15'),this['squeue']['id'],_0x5347fe);}else{util[_0x2ac6('0x20')](this[_0x2ac6('0x4')],this['squeue']['id'],this[_0x2ac6('0x6')][_0x2ac6('0x13')][_0x5347fe],this[_0x2ac6('0x10')],this['routing']);util['writeLog'](this[_0x2ac6('0x5')]['id'],this[_0x2ac6('0x6')][_0x2ac6('0x13')][_0x5347fe],_0x5a3f76?_0x2ac6('0x21'):_0x2ac6('0x22'));this[_0x2ac6('0x6')][_0x2ac6('0x13')][_0x5347fe]['busy']=![];this[_0x2ac6('0x6')]['agents'][_0x5347fe][_0x2ac6('0x1a')]=undefined;util[_0x2ac6('0x23')](this['realtime'],this[_0x2ac6('0x3')],this['realtime']['agents'][_0x5347fe],this[_0x2ac6('0x5')][_0x2ac6('0x17')]);}}}if(!_0x5a3f76){setTimeout(this[_0x2ac6('0x7')][_0x2ac6('0xa')](this),0x3e8);}};function beepall(_0x3500c0,_0x4bee7b,_0x14891f,_0x1f687e){return new Beepall(_0x3500c0,_0x4bee7b,_0x14891f,_0x1f687e);}module[_0x2ac6('0x24')]=beepall;
\ No newline at end of file