Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / services / routing / model / smsQueue.js
index d7c1dbc..8456b85 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x50a6=['length','smsPause','available','stringify','format','emit','sms_queue:save','exports','lodash','md5','../../../config/environment','defaults','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','prototype','_rr','map','loggedIn','paused'];(function(_0x57d376,_0x16d546){var _0x575f64=function(_0x3e4c38){while(--_0x3e4c38){_0x57d376['push'](_0x57d376['shift']());}};_0x575f64(++_0x16d546);}(_0x50a6,0xa4));var _0x650a=function(_0x7a68b,_0x964789){_0x7a68b=_0x7a68b-0x0;var _0x110d37=_0x50a6[_0x7a68b];return _0x110d37;};'use strict';var _=require(_0x650a('0x0'));var md5=require(_0x650a('0x1'));var util=require('util');var Redis=require('ioredis');var config=require(_0x650a('0x2'));config['redis']=_[_0x650a('0x3')](config[_0x650a('0x4')],{'host':_0x650a('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x650a('0x4')]));function SmsQueue(_0x4c71f3){this['id']=_0x4c71f3['id']||0x0;this['name']=_0x4c71f3[_0x650a('0x6')]||'';this[_0x650a('0x7')]=_0x4c71f3[_0x650a('0x7')]||0xa;this[_0x650a('0x8')]=_0x4c71f3['strategy']||_0x650a('0x9');this['Agents']=_0x4c71f3[_0x650a('0xa')];this[_0x650a('0xb')]={};this['waiting']=0x0;this[_0x650a('0x1')]='';this[_0x650a('0xc')]();this['updateRealtime']();}SmsQueue[_0x650a('0xd')]['updateRouting']=function(){var _0x142cdb=this['mapAgentsId'][_0x650a('0xe')];this['mapAgentsId']=_[_0x650a('0xf')](this['Agents'],'id');this[_0x650a('0xb')][_0x650a('0xe')]=_0x142cdb;};SmsQueue[_0x650a('0xd')]['updateRealtime']=function(){this[_0x650a('0x10')]=0x0;this[_0x650a('0x11')]=0x0;for(var _0x2f727d=0x0;_0x2f727d<this[_0x650a('0xa')][_0x650a('0x12')];_0x2f727d+=0x1){if(this[_0x650a('0xa')][_0x2f727d]['online']){this[_0x650a('0x10')]+=0x1;}if(this['Agents'][_0x2f727d][_0x650a('0x13')]){this[_0x650a('0x11')]+=0x1;}}this[_0x650a('0x14')]=this['loggedIn']-this['paused'];this['available']=this['available']>=0x0?this[_0x650a('0x14')]:0x0;var _0x359314={'id':this['id'],'available':this[_0x650a('0x14')],'loggedIn':this[_0x650a('0x10')],'name':this[_0x650a('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0xf46674=md5(JSON[_0x650a('0x15')](_0x359314));if(this['md5']!==_0xf46674){this[_0x650a('0x1')]=_0xf46674;io['to'](util[_0x650a('0x16')]('sms:queue:%s',_0x359314[_0x650a('0x6')]))[_0x650a('0x17')](_0x650a('0x18'),_0x359314);}};module[_0x650a('0x19')]=SmsQueue;
\ No newline at end of file
+var _0x4f17=['_rr','map','prototype','paused','online','loggedIn','smsPause','available','stringify','md5','format','sms:queue:%s','exports','lodash','util','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','mapAgentsId'];(function(_0x7f943a,_0x44ce53){var _0x5fa814=function(_0x3925dd){while(--_0x3925dd){_0x7f943a['push'](_0x7f943a['shift']());}};_0x5fa814(++_0x44ce53);}(_0x4f17,0x9e));var _0x74f1=function(_0x8e74c4,_0x4c3b72){_0x8e74c4=_0x8e74c4-0x0;var _0x50e53f=_0x4f17[_0x8e74c4];return _0x50e53f;};'use strict';var _=require(_0x74f1('0x0'));var md5=require('md5');var util=require(_0x74f1('0x1'));var Redis=require(_0x74f1('0x2'));var config=require('../../../config/environment');config[_0x74f1('0x3')]=_[_0x74f1('0x4')](config[_0x74f1('0x3')],{'host':_0x74f1('0x5'),'port':0x18eb});var io=require(_0x74f1('0x6'))(new Redis(config['redis']));function SmsQueue(_0x5e67b0){this['id']=_0x5e67b0['id']||0x0;this[_0x74f1('0x7')]=_0x5e67b0['name']||'';this[_0x74f1('0x8')]=_0x5e67b0['timeout']||0xa;this[_0x74f1('0x9')]=_0x5e67b0[_0x74f1('0x9')]||_0x74f1('0xa');this['Agents']=_0x5e67b0[_0x74f1('0xb')];this['mapAgentsId']={};this[_0x74f1('0xc')]=0x0;this['md5']='';this[_0x74f1('0xd')]();this[_0x74f1('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x28307c=this[_0x74f1('0xf')][_0x74f1('0x10')];this[_0x74f1('0xf')]=_[_0x74f1('0x11')](this[_0x74f1('0xb')],'id');this[_0x74f1('0xf')][_0x74f1('0x10')]=_0x28307c;};SmsQueue[_0x74f1('0x12')][_0x74f1('0xe')]=function(){this['loggedIn']=0x0;this[_0x74f1('0x13')]=0x0;for(var _0x4e156f=0x0;_0x4e156f<this[_0x74f1('0xb')]['length'];_0x4e156f+=0x1){if(this[_0x74f1('0xb')][_0x4e156f][_0x74f1('0x14')]){this[_0x74f1('0x15')]+=0x1;}if(this[_0x74f1('0xb')][_0x4e156f][_0x74f1('0x16')]){this['paused']+=0x1;}}this[_0x74f1('0x17')]=this[_0x74f1('0x15')]-this['paused'];this[_0x74f1('0x17')]=this[_0x74f1('0x17')]>=0x0?this['available']:0x0;var _0x1cc44b={'id':this['id'],'available':this[_0x74f1('0x17')],'loggedIn':this[_0x74f1('0x15')],'name':this[_0x74f1('0x7')],'paused':this[_0x74f1('0x13')],'waiting':this['waiting']};var _0x353918=md5(JSON[_0x74f1('0x18')](_0x1cc44b));if(this[_0x74f1('0x19')]!==_0x353918){this[_0x74f1('0x19')]=_0x353918;io['to'](util[_0x74f1('0x1a')](_0x74f1('0x1b'),_0x1cc44b['name']))['emit']('sms_queue:save',_0x1cc44b);}};module[_0x74f1('0x1c')]=SmsQueue;
\ No newline at end of file