Built motion from commit b7e79837.|2.6.29
[motion2.git] / server / services / routing / model / smsQueue.js
index 76fd42c..83540f3 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xde50=['name','timeout','strategy','mapAgentsId','waiting','md5','updateRealtime','prototype','_rr','Agents','paused','length','online','loggedIn','smsPause','available','format','sms:queue:%s','sms_queue:save','exports','util','ioredis','../../../config/environment','redis','socket.io-emitter'];(function(_0x1a44fd,_0x7a370){var _0x39b683=function(_0x23763e){while(--_0x23763e){_0x1a44fd['push'](_0x1a44fd['shift']());}};_0x39b683(++_0x7a370);}(_0xde50,0x140));var _0x0de5=function(_0x47693a,_0xbcabe5){_0x47693a=_0x47693a-0x0;var _0xb24d44=_0xde50[_0x47693a];return _0xb24d44;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x0de5('0x0'));var Redis=require(_0x0de5('0x1'));var config=require(_0x0de5('0x2'));config[_0x0de5('0x3')]=_['defaults'](config[_0x0de5('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x0de5('0x4'))(new Redis(config['redis']));function SmsQueue(_0x5c58fb){this['id']=_0x5c58fb['id']||0x0;this['name']=_0x5c58fb[_0x0de5('0x5')]||'';this[_0x0de5('0x6')]=_0x5c58fb[_0x0de5('0x6')]||0xa;this['strategy']=_0x5c58fb[_0x0de5('0x7')]||'beepall';this['Agents']=_0x5c58fb['Agents'];this[_0x0de5('0x8')]={};this[_0x0de5('0x9')]=0x0;this[_0x0de5('0xa')]='';this['updateRouting']();this[_0x0de5('0xb')]();}SmsQueue[_0x0de5('0xc')]['updateRouting']=function(){var _0x132a49=this[_0x0de5('0x8')][_0x0de5('0xd')];this['mapAgentsId']=_['map'](this[_0x0de5('0xe')],'id');this[_0x0de5('0x8')][_0x0de5('0xd')]=_0x132a49;};SmsQueue[_0x0de5('0xc')][_0x0de5('0xb')]=function(){this['loggedIn']=0x0;this[_0x0de5('0xf')]=0x0;for(var _0x5eaad2=0x0;_0x5eaad2<this['Agents'][_0x0de5('0x10')];_0x5eaad2+=0x1){if(this[_0x0de5('0xe')][_0x5eaad2][_0x0de5('0x11')]){this[_0x0de5('0x12')]+=0x1;}if(this[_0x0de5('0xe')][_0x5eaad2][_0x0de5('0x13')]){this['paused']+=0x1;}}this[_0x0de5('0x14')]=this[_0x0de5('0x12')]-this[_0x0de5('0xf')];this[_0x0de5('0x14')]=this[_0x0de5('0x14')]>=0x0?this[_0x0de5('0x14')]:0x0;var _0x58ce66={'id':this['id'],'available':this[_0x0de5('0x14')],'loggedIn':this['loggedIn'],'name':this[_0x0de5('0x5')],'paused':this[_0x0de5('0xf')],'waiting':this[_0x0de5('0x9')]};var _0x325a8=md5(JSON['stringify'](_0x58ce66));if(this[_0x0de5('0xa')]!==_0x325a8){this['md5']=_0x325a8;io['to'](util[_0x0de5('0x15')](_0x0de5('0x16'),_0x58ce66[_0x0de5('0x5')]))['emit'](_0x0de5('0x17'),_0x58ce66);}};module[_0x0de5('0x18')]=SmsQueue;
\ No newline at end of file
+var _0x402f=['mapAgentsId','waiting','md5','updateRouting','updateRealtime','paused','length','online','loggedIn','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','redis','defaults','socket.io-emitter','name','timeout','beepall','Agents'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x402f,0x6f));var _0xf402=function(_0xe70d09,_0x418aba){_0xe70d09=_0xe70d09-0x0;var _0x215e35=_0x402f[_0xe70d09];return _0x215e35;};'use strict';var _=require(_0xf402('0x0'));var md5=require('md5');var util=require(_0xf402('0x1'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0xf402('0x2')]=_[_0xf402('0x3')](config[_0xf402('0x2')],{'host':'localhost','port':0x18eb});var io=require(_0xf402('0x4'))(new Redis(config['redis']));function SmsQueue(_0x20c2cc){this['id']=_0x20c2cc['id']||0x0;this[_0xf402('0x5')]=_0x20c2cc[_0xf402('0x5')]||'';this[_0xf402('0x6')]=_0x20c2cc[_0xf402('0x6')]||0xa;this['strategy']=_0x20c2cc['strategy']||_0xf402('0x7');this[_0xf402('0x8')]=_0x20c2cc[_0xf402('0x8')];this[_0xf402('0x9')]={};this[_0xf402('0xa')]=0x0;this[_0xf402('0xb')]='';this[_0xf402('0xc')]();this[_0xf402('0xd')]();}SmsQueue['prototype'][_0xf402('0xc')]=function(){var _0x496916=this['mapAgentsId']['_rr'];this['mapAgentsId']=_['map'](this[_0xf402('0x8')],'id');this['mapAgentsId']['_rr']=_0x496916;};SmsQueue['prototype'][_0xf402('0xd')]=function(){this['loggedIn']=0x0;this[_0xf402('0xe')]=0x0;for(var _0xb3deb6=0x0;_0xb3deb6<this[_0xf402('0x8')][_0xf402('0xf')];_0xb3deb6+=0x1){if(this['Agents'][_0xb3deb6][_0xf402('0x10')]){this['loggedIn']+=0x1;}if(this[_0xf402('0x8')][_0xb3deb6]['smsPause']){this['paused']+=0x1;}}this['available']=this[_0xf402('0x11')]-this[_0xf402('0xe')];this[_0xf402('0x12')]=this[_0xf402('0x12')]>=0x0?this[_0xf402('0x12')]:0x0;var _0x5d7236={'id':this['id'],'available':this[_0xf402('0x12')],'loggedIn':this[_0xf402('0x11')],'name':this[_0xf402('0x5')],'paused':this[_0xf402('0xe')],'waiting':this['waiting']};var _0x14fdcc=md5(JSON[_0xf402('0x13')](_0x5d7236));if(this[_0xf402('0xb')]!==_0x14fdcc){this[_0xf402('0xb')]=_0x14fdcc;io['to'](util[_0xf402('0x14')](_0xf402('0x15'),_0x5d7236[_0xf402('0x5')]))[_0xf402('0x16')](_0xf402('0x17'),_0x5d7236);}};module['exports']=SmsQueue;
\ No newline at end of file