Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / services / routing / model / smsQueue.js
index e7b62d0..1150cd5 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xd6ce=['redis','defaults','name','strategy','Agents','mapAgentsId','waiting','map','prototype','updateRealtime','paused','length','loggedIn','smsPause','available','stringify','sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x232905,_0x4a465a){var _0x17844e=function(_0x12bce2){while(--_0x12bce2){_0x232905['push'](_0x232905['shift']());}};_0x17844e(++_0x4a465a);}(_0xd6ce,0x127));var _0xed6c=function(_0x1cbf17,_0x5ccc55){_0x1cbf17=_0x1cbf17-0x0;var _0x2b23ee=_0xd6ce[_0x1cbf17];return _0x2b23ee;};'use strict';var _=require(_0xed6c('0x0'));var md5=require(_0xed6c('0x1'));var util=require(_0xed6c('0x2'));var Redis=require(_0xed6c('0x3'));var config=require(_0xed6c('0x4'));config[_0xed6c('0x5')]=_[_0xed6c('0x6')](config[_0xed6c('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xed6c('0x5')]));function SmsQueue(_0x160735){this['id']=_0x160735['id']||0x0;this[_0xed6c('0x7')]=_0x160735[_0xed6c('0x7')]||'';this['timeout']=_0x160735['timeout']||0xa;this[_0xed6c('0x8')]=_0x160735[_0xed6c('0x8')]||'beepall';this['Agents']=_0x160735[_0xed6c('0x9')];this[_0xed6c('0xa')]={};this[_0xed6c('0xb')]=0x0;this[_0xed6c('0x1')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue['prototype']['updateRouting']=function(){var _0x978b9f=this['mapAgentsId']['_rr'];this[_0xed6c('0xa')]=_[_0xed6c('0xc')](this['Agents'],'id');this[_0xed6c('0xa')]['_rr']=_0x978b9f;};SmsQueue[_0xed6c('0xd')][_0xed6c('0xe')]=function(){this['loggedIn']=0x0;this[_0xed6c('0xf')]=0x0;for(var _0x32a8c9=0x0;_0x32a8c9<this[_0xed6c('0x9')][_0xed6c('0x10')];_0x32a8c9+=0x1){if(this['Agents'][_0x32a8c9]['online']){this[_0xed6c('0x11')]+=0x1;}if(this[_0xed6c('0x9')][_0x32a8c9][_0xed6c('0x12')]){this['paused']+=0x1;}}this[_0xed6c('0x13')]=this['loggedIn']-this[_0xed6c('0xf')];this[_0xed6c('0x13')]=this[_0xed6c('0x13')]>=0x0?this[_0xed6c('0x13')]:0x0;var _0x4a920e={'id':this['id'],'available':this[_0xed6c('0x13')],'loggedIn':this[_0xed6c('0x11')],'name':this[_0xed6c('0x7')],'paused':this['paused'],'waiting':this[_0xed6c('0xb')]};var _0x2d34d5=md5(JSON[_0xed6c('0x14')](_0x4a920e));if(this[_0xed6c('0x1')]!==_0x2d34d5){this[_0xed6c('0x1')]=_0x2d34d5;io['to'](util['format'](_0xed6c('0x15'),_0x4a920e['name']))[_0xed6c('0x16')](_0xed6c('0x17'),_0x4a920e);}};module[_0xed6c('0x18')]=SmsQueue;
\ No newline at end of file
+var _0xd52d=['localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','sms:queue:%s','sms_queue:save','md5','util','../../../config/environment','redis'];(function(_0xd9a3f2,_0x1e6574){var _0x182fb7=function(_0x1912fa){while(--_0x1912fa){_0xd9a3f2['push'](_0xd9a3f2['shift']());}};_0x182fb7(++_0x1e6574);}(_0xd52d,0x1c7));var _0xdd52=function(_0x5930cb,_0x4f0423){_0x5930cb=_0x5930cb-0x0;var _0x56444c=_0xd52d[_0x5930cb];return _0x56444c;};'use strict';var _=require('lodash');var md5=require(_0xdd52('0x0'));var util=require(_0xdd52('0x1'));var Redis=require('ioredis');var config=require(_0xdd52('0x2'));config['redis']=_['defaults'](config[_0xdd52('0x3')],{'host':_0xdd52('0x4'),'port':0x18eb});var io=require(_0xdd52('0x5'))(new Redis(config[_0xdd52('0x3')]));function SmsQueue(_0x3b9337){this['id']=_0x3b9337['id']||0x0;this[_0xdd52('0x6')]=_0x3b9337[_0xdd52('0x6')]||'';this[_0xdd52('0x7')]=_0x3b9337['timeout']||0xa;this[_0xdd52('0x8')]=_0x3b9337[_0xdd52('0x8')]||_0xdd52('0x9');this[_0xdd52('0xa')]=_0x3b9337[_0xdd52('0xa')];this[_0xdd52('0xb')]={};this[_0xdd52('0xc')]=0x0;this[_0xdd52('0x0')]='';this[_0xdd52('0xd')]();this[_0xdd52('0xe')]();}SmsQueue[_0xdd52('0xf')][_0xdd52('0xd')]=function(){var _0x1cfc7f=this['mapAgentsId'][_0xdd52('0x10')];this[_0xdd52('0xb')]=_[_0xdd52('0x11')](this[_0xdd52('0xa')],'id');this[_0xdd52('0xb')][_0xdd52('0x10')]=_0x1cfc7f;};SmsQueue['prototype'][_0xdd52('0xe')]=function(){this[_0xdd52('0x12')]=0x0;this[_0xdd52('0x13')]=0x0;for(var _0x55b823=0x0;_0x55b823<this[_0xdd52('0xa')][_0xdd52('0x14')];_0x55b823+=0x1){if(this[_0xdd52('0xa')][_0x55b823][_0xdd52('0x15')]){this[_0xdd52('0x12')]+=0x1;}if(this[_0xdd52('0xa')][_0x55b823][_0xdd52('0x16')]){this[_0xdd52('0x13')]+=0x1;}}this['available']=this[_0xdd52('0x12')]-this['paused'];this[_0xdd52('0x17')]=this[_0xdd52('0x17')]>=0x0?this[_0xdd52('0x17')]:0x0;var _0x45062e={'id':this['id'],'available':this['available'],'loggedIn':this[_0xdd52('0x12')],'name':this[_0xdd52('0x6')],'paused':this[_0xdd52('0x13')],'waiting':this[_0xdd52('0xc')]};var _0x5de47a=md5(JSON[_0xdd52('0x18')](_0x45062e));if(this['md5']!==_0x5de47a){this[_0xdd52('0x0')]=_0x5de47a;io['to'](util['format'](_0xdd52('0x19'),_0x45062e[_0xdd52('0x6')]))['emit'](_0xdd52('0x1a'),_0x45062e);}};module['exports']=SmsQueue;
\ No newline at end of file