Built motion from commit 97153652.|2.6.26
[motion2.git] / server / services / routing / model / smsQueue.js
index 91d8464..20a57e4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa3e6=['name','timeout','strategy','Agents','md5','updateRealtime','updateRouting','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','smsPause','available','waiting','format','emit','sms_queue:save','exports','lodash','util','../../../config/environment','redis','defaults','localhost'];(function(_0x33b065,_0x2bb180){var _0x16bc95=function(_0x18cd93){while(--_0x18cd93){_0x33b065['push'](_0x33b065['shift']());}};_0x16bc95(++_0x2bb180);}(_0xa3e6,0xbe));var _0x6a3e=function(_0x3bfd98,_0xc13ab4){_0x3bfd98=_0x3bfd98-0x0;var _0x1f64d7=_0xa3e6[_0x3bfd98];return _0x1f64d7;};'use strict';var _=require(_0x6a3e('0x0'));var md5=require('md5');var util=require(_0x6a3e('0x1'));var Redis=require('ioredis');var config=require(_0x6a3e('0x2'));config[_0x6a3e('0x3')]=_[_0x6a3e('0x4')](config['redis'],{'host':_0x6a3e('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6a3e('0x3')]));function SmsQueue(_0x23599b){this['id']=_0x23599b['id']||0x0;this[_0x6a3e('0x6')]=_0x23599b[_0x6a3e('0x6')]||'';this[_0x6a3e('0x7')]=_0x23599b['timeout']||0xa;this[_0x6a3e('0x8')]=_0x23599b[_0x6a3e('0x8')]||'beepall';this['Agents']=_0x23599b[_0x6a3e('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x6a3e('0xa')]='';this['updateRouting']();this[_0x6a3e('0xb')]();}SmsQueue['prototype'][_0x6a3e('0xc')]=function(){var _0x3159db=this[_0x6a3e('0xd')][_0x6a3e('0xe')];this[_0x6a3e('0xd')]=_[_0x6a3e('0xf')](this['Agents'],'id');this[_0x6a3e('0xd')][_0x6a3e('0xe')]=_0x3159db;};SmsQueue[_0x6a3e('0x10')][_0x6a3e('0xb')]=function(){this[_0x6a3e('0x11')]=0x0;this[_0x6a3e('0x12')]=0x0;for(var _0x222f7c=0x0;_0x222f7c<this['Agents'][_0x6a3e('0x13')];_0x222f7c+=0x1){if(this[_0x6a3e('0x9')][_0x222f7c][_0x6a3e('0x14')]){this[_0x6a3e('0x11')]+=0x1;}if(this['Agents'][_0x222f7c][_0x6a3e('0x15')]){this[_0x6a3e('0x12')]+=0x1;}}this['available']=this['loggedIn']-this['paused'];this['available']=this['available']>=0x0?this[_0x6a3e('0x16')]:0x0;var _0x467e2c={'id':this['id'],'available':this[_0x6a3e('0x16')],'loggedIn':this[_0x6a3e('0x11')],'name':this[_0x6a3e('0x6')],'paused':this[_0x6a3e('0x12')],'waiting':this[_0x6a3e('0x17')]};var _0x2f2150=md5(JSON['stringify'](_0x467e2c));if(this[_0x6a3e('0xa')]!==_0x2f2150){this['md5']=_0x2f2150;io['to'](util[_0x6a3e('0x18')]('sms:queue:%s',_0x467e2c[_0x6a3e('0x6')]))[_0x6a3e('0x19')](_0x6a3e('0x1a'),_0x467e2c);}};module[_0x6a3e('0x1b')]=SmsQueue;
\ No newline at end of file
+var _0xfa2f=['loggedIn','smsPause','paused','available','stringify','format','sms:queue:%s','sms_queue:save','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRealtime','_rr','map','prototype','length','online'];(function(_0x50c211,_0x50933a){var _0x5408a3=function(_0x10e425){while(--_0x10e425){_0x50c211['push'](_0x50c211['shift']());}};_0x5408a3(++_0x50933a);}(_0xfa2f,0xe8));var _0xffa2=function(_0x348db8,_0x2a84a6){_0x348db8=_0x348db8-0x0;var _0x14bec4=_0xfa2f[_0x348db8];return _0x14bec4;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0xffa2('0x0'));var Redis=require('ioredis');var config=require(_0xffa2('0x1'));config[_0xffa2('0x2')]=_[_0xffa2('0x3')](config['redis'],{'host':_0xffa2('0x4'),'port':0x18eb});var io=require(_0xffa2('0x5'))(new Redis(config[_0xffa2('0x2')]));function SmsQueue(_0x14787c){this['id']=_0x14787c['id']||0x0;this[_0xffa2('0x6')]=_0x14787c[_0xffa2('0x6')]||'';this[_0xffa2('0x7')]=_0x14787c['timeout']||0xa;this['strategy']=_0x14787c[_0xffa2('0x8')]||_0xffa2('0x9');this[_0xffa2('0xa')]=_0x14787c[_0xffa2('0xa')];this[_0xffa2('0xb')]={};this[_0xffa2('0xc')]=0x0;this[_0xffa2('0xd')]='';this['updateRouting']();this[_0xffa2('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x2eb5bb=this[_0xffa2('0xb')][_0xffa2('0xf')];this[_0xffa2('0xb')]=_[_0xffa2('0x10')](this['Agents'],'id');this[_0xffa2('0xb')][_0xffa2('0xf')]=_0x2eb5bb;};SmsQueue[_0xffa2('0x11')][_0xffa2('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x32e54e=0x0;_0x32e54e<this[_0xffa2('0xa')][_0xffa2('0x12')];_0x32e54e+=0x1){if(this['Agents'][_0x32e54e][_0xffa2('0x13')]){this[_0xffa2('0x14')]+=0x1;}if(this[_0xffa2('0xa')][_0x32e54e][_0xffa2('0x15')]){this[_0xffa2('0x16')]+=0x1;}}this[_0xffa2('0x17')]=this[_0xffa2('0x14')]-this['paused'];this[_0xffa2('0x17')]=this[_0xffa2('0x17')]>=0x0?this[_0xffa2('0x17')]:0x0;var _0x2ae03f={'id':this['id'],'available':this[_0xffa2('0x17')],'loggedIn':this[_0xffa2('0x14')],'name':this[_0xffa2('0x6')],'paused':this[_0xffa2('0x16')],'waiting':this[_0xffa2('0xc')]};var _0xc10cfb=md5(JSON[_0xffa2('0x18')](_0x2ae03f));if(this[_0xffa2('0xd')]!==_0xc10cfb){this['md5']=_0xc10cfb;io['to'](util[_0xffa2('0x19')](_0xffa2('0x1a'),_0x2ae03f[_0xffa2('0x6')]))['emit'](_0xffa2('0x1b'),_0x2ae03f);}};module['exports']=SmsQueue;
\ No newline at end of file