Built motion from commit cb845558.|2.6.34
[motion2.git] / server / services / routing / model / whatsappQueue.js
index adbd522..f5ec91e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xcfc4=['updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','exports','lodash','md5','ioredis','redis','name','timeout','strategy','Agents','waiting'];(function(_0x819ce,_0xf25f51){var _0x1edcf0=function(_0x192389){while(--_0x192389){_0x819ce['push'](_0x819ce['shift']());}};_0x1edcf0(++_0xf25f51);}(_0xcfc4,0x187));var _0x4cfc=function(_0x139ac3,_0x1470e8){_0x139ac3=_0x139ac3-0x0;var _0x33e0a7=_0xcfc4[_0x139ac3];return _0x33e0a7;};'use strict';var _=require(_0x4cfc('0x0'));var md5=require(_0x4cfc('0x1'));var util=require('util');var Redis=require(_0x4cfc('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4cfc('0x3')]));function WhatsappQueue(_0x97a8b7){this['id']=_0x97a8b7['id']||0x0;this[_0x4cfc('0x4')]=_0x97a8b7[_0x4cfc('0x4')]||'';this[_0x4cfc('0x5')]=_0x97a8b7[_0x4cfc('0x5')]||0xa;this[_0x4cfc('0x6')]=_0x97a8b7[_0x4cfc('0x6')]||'beepall';this[_0x4cfc('0x7')]=_0x97a8b7['Agents'];this['mapAgentsId']={};this[_0x4cfc('0x8')]=0x0;this[_0x4cfc('0x1')]='';this[_0x4cfc('0x9')]();this[_0x4cfc('0xa')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x5ba6f5=this[_0x4cfc('0xb')][_0x4cfc('0xc')];this[_0x4cfc('0xb')]=_[_0x4cfc('0xd')](this['Agents'],'id');this['mapAgentsId'][_0x4cfc('0xc')]=_0x5ba6f5;};WhatsappQueue[_0x4cfc('0xe')][_0x4cfc('0xa')]=function(){this[_0x4cfc('0xf')]=0x0;this[_0x4cfc('0x10')]=0x0;for(var _0x35e79b=0x0;_0x35e79b<this[_0x4cfc('0x7')][_0x4cfc('0x11')];_0x35e79b+=0x1){if(this['Agents'][_0x35e79b][_0x4cfc('0x12')]){this[_0x4cfc('0xf')]+=0x1;}if(this[_0x4cfc('0x7')][_0x35e79b][_0x4cfc('0x13')]){this[_0x4cfc('0x10')]+=0x1;}}this[_0x4cfc('0x14')]=this['loggedIn']-this['paused'];this['available']=this[_0x4cfc('0x14')]>=0x0?this['available']:0x0;var _0x55e383={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0x4cfc('0x8')]};var _0x188874=md5(JSON['stringify'](_0x55e383));if(this[_0x4cfc('0x1')]!==_0x188874){this[_0x4cfc('0x1')]=_0x188874;io['to'](util[_0x4cfc('0x15')](_0x4cfc('0x16'),_0x55e383[_0x4cfc('0x4')]))[_0x4cfc('0x17')]('whatsapp_queue:save',_0x55e383);}};module[_0x4cfc('0x18')]=WhatsappQueue;
\ No newline at end of file
+var _0xf669=['beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','length','online','whatsappPause','available','stringify','format','emit','exports','lodash','md5','util','../../../config/environment','defaults','redis','socket.io-emitter','name','timeout','strategy'];(function(_0x58e2a5,_0x4e822c){var _0x440ba0=function(_0x375d68){while(--_0x375d68){_0x58e2a5['push'](_0x58e2a5['shift']());}};_0x440ba0(++_0x4e822c);}(_0xf669,0xd6));var _0x9f66=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xf669[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x9f66('0x0'));var md5=require(_0x9f66('0x1'));var util=require(_0x9f66('0x2'));var Redis=require('ioredis');var config=require(_0x9f66('0x3'));config['redis']=_[_0x9f66('0x4')](config[_0x9f66('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9f66('0x6'))(new Redis(config[_0x9f66('0x5')]));function WhatsappQueue(_0x158375){this['id']=_0x158375['id']||0x0;this[_0x9f66('0x7')]=_0x158375[_0x9f66('0x7')]||'';this[_0x9f66('0x8')]=_0x158375[_0x9f66('0x8')]||0xa;this['strategy']=_0x158375[_0x9f66('0x9')]||_0x9f66('0xa');this[_0x9f66('0xb')]=_0x158375['Agents'];this[_0x9f66('0xc')]={};this[_0x9f66('0xd')]=0x0;this['md5']='';this[_0x9f66('0xe')]();this[_0x9f66('0xf')]();}WhatsappQueue[_0x9f66('0x10')]['updateRouting']=function(){var _0x9477d9=this[_0x9f66('0xc')][_0x9f66('0x11')];this[_0x9f66('0xc')]=_[_0x9f66('0x12')](this['Agents'],'id');this[_0x9f66('0xc')][_0x9f66('0x11')]=_0x9477d9;};WhatsappQueue[_0x9f66('0x10')][_0x9f66('0xf')]=function(){this[_0x9f66('0x13')]=0x0;this['paused']=0x0;for(var _0x5342c5=0x0;_0x5342c5<this[_0x9f66('0xb')][_0x9f66('0x14')];_0x5342c5+=0x1){if(this['Agents'][_0x5342c5][_0x9f66('0x15')]){this[_0x9f66('0x13')]+=0x1;}if(this[_0x9f66('0xb')][_0x5342c5][_0x9f66('0x16')]){this['paused']+=0x1;}}this['available']=this['loggedIn']-this['paused'];this[_0x9f66('0x17')]=this[_0x9f66('0x17')]>=0x0?this[_0x9f66('0x17')]:0x0;var _0x56f3df={'id':this['id'],'available':this[_0x9f66('0x17')],'loggedIn':this[_0x9f66('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x3165ad=md5(JSON[_0x9f66('0x18')](_0x56f3df));if(this[_0x9f66('0x1')]!==_0x3165ad){this[_0x9f66('0x1')]=_0x3165ad;io['to'](util[_0x9f66('0x19')]('whatsapp:queue:%s',_0x56f3df[_0x9f66('0x7')]))[_0x9f66('0x1a')]('whatsapp_queue:save',_0x56f3df);}};module[_0x9f66('0x1b')]=WhatsappQueue;
\ No newline at end of file