Built motion from commit fade34fd.|2.5.41
[motion2.git] / server / services / routing / model / agent.js
index 9534ead..dbb958d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8bf1=['chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','working','updateRealtime','mail','chat','openchannel','fax','whatsapp','length','Status','StatusTime','toNumber','format','mailStatus','faxCurrentCapacity','user:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity'];(function(_0x32a032,_0x1b373b){var _0x24a388=function(_0x51daca){while(--_0x51daca){_0x32a032['push'](_0x32a032['shift']());}};_0x24a388(++_0x1b373b);}(_0x8bf1,0x65));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x18bf('0x0'));var moment=require('moment');var md5=require(_0x18bf('0x1'));var Redis=require(_0x18bf('0x2'));var config=require(_0x18bf('0x3'));config[_0x18bf('0x4')]=_[_0x18bf('0x5')](config[_0x18bf('0x4')],{'host':_0x18bf('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x18bf('0x4')]));function Agent(_0x415665){this['id']=_0x415665['id']||0x0;this[_0x18bf('0x7')]=_0x415665[_0x18bf('0x7')]||'';this['online']=_0x415665[_0x18bf('0x8')]||!![];this[_0x18bf('0x9')]=_0x415665[_0x18bf('0x9')]||![];this[_0x18bf('0xa')]=_0x415665[_0x18bf('0xa')]||![];this[_0x18bf('0xb')]=_0x415665[_0x18bf('0xb')]||![];this[_0x18bf('0xc')]=_0x415665[_0x18bf('0xc')]||![];this['smsPause']=_0x415665[_0x18bf('0xd')]||![];this[_0x18bf('0xe')]=_0x415665[_0x18bf('0xe')]||![];this[_0x18bf('0xf')]=_0x18bf('0x10');this[_0x18bf('0x11')]=0x0;this[_0x18bf('0x12')]=_0x415665[_0x18bf('0x12')]||0x0;this[_0x18bf('0x13')]=0x0;this['mailStatus']=_0x18bf('0x10');this[_0x18bf('0x14')]=0x0;this['mailCapacity']=_0x415665[_0x18bf('0x15')]||0x0;this[_0x18bf('0x16')]=0x0;this[_0x18bf('0x17')]='unknown';this[_0x18bf('0x18')]=0x0;this['faxCapacity']=_0x415665[_0x18bf('0x19')]||0x0;this['faxCurrentCapacity']=0x0;this[_0x18bf('0x1a')]=_0x18bf('0x10');this[_0x18bf('0x1b')]=0x0;this[_0x18bf('0x1c')]=_0x415665['smsCapacity']||0x0;this[_0x18bf('0x1d')]=0x0;this[_0x18bf('0x1e')]=_0x18bf('0x10');this[_0x18bf('0x1f')]=0x0;this[_0x18bf('0x20')]=_0x415665[_0x18bf('0x20')]||0x0;this[_0x18bf('0x21')]=0x0;this[_0x18bf('0x22')]=_0x18bf('0x10');this[_0x18bf('0x23')]=0x0;this[_0x18bf('0x24')]=_0x415665[_0x18bf('0x24')]||0x0;this[_0x18bf('0x25')]=0x0;this[_0x18bf('0x26')]=![];this[_0x18bf('0x27')]=undefined;this[_0x18bf('0x1')]='';this['updateRealtime']();}Agent[_0x18bf('0x28')][_0x18bf('0x29')]=function(_0x1b491b){if(this[_0x1b491b+_0x18bf('0x2a')]>0x0){if(this[_0x1b491b+_0x18bf('0x2b')]>0x0&&this[_0x1b491b+_0x18bf('0x2a')]>=this[_0x1b491b+_0x18bf('0x2b')]){return'maxcapacity';}else{return _0x18bf('0x2c');}}else{return'idle';}};Agent[_0x18bf('0x28')][_0x18bf('0x2d')]=function(){var _0x2a011e=[_0x18bf('0x2e'),_0x18bf('0x2f'),_0x18bf('0x30'),_0x18bf('0x31'),'sms',_0x18bf('0x32')];for(var _0x1591c5=0x0;_0x1591c5<_0x2a011e[_0x18bf('0x33')];_0x1591c5+=0x1){var _0x52f802=this[_0x18bf('0x29')](_0x2a011e[_0x1591c5]);if(this[_0x2a011e[_0x1591c5]+_0x18bf('0x34')]!==_0x52f802){this[_0x2a011e[_0x1591c5]+_0x18bf('0x35')]=_[_0x18bf('0x36')](moment()[_0x18bf('0x37')]('x'));}this[_0x2a011e[_0x1591c5]+_0x18bf('0x34')]=_0x52f802;}var _0x3e4fa5={'id':this['id'],'name':this[_0x18bf('0x7')],'online':this[_0x18bf('0x8')],'voicePause':this[_0x18bf('0x9')],'chatPause':this[_0x18bf('0xa')],'mailPause':this[_0x18bf('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x18bf('0xc')],'openchannelPause':this[_0x18bf('0xe')],'chatStatus':this[_0x18bf('0xf')],'chatStatusTime':this[_0x18bf('0x11')],'chatCapacity':this[_0x18bf('0x12')],'chatCurrentCapacity':this[_0x18bf('0x13')],'mailStatus':this[_0x18bf('0x38')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x18bf('0x16')],'faxStatus':this[_0x18bf('0x17')],'faxStatusTime':this[_0x18bf('0x18')],'faxCapacity':this[_0x18bf('0x19')],'faxCurrentCapacity':this[_0x18bf('0x39')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x18bf('0x1b')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x18bf('0x1e')],'whatsappStatusTime':this[_0x18bf('0x1f')],'whatsappCapacity':this[_0x18bf('0x20')],'whatsappCurrentCapacity':this[_0x18bf('0x21')],'openchannelStatus':this[_0x18bf('0x22')],'openchannelStatusTime':this[_0x18bf('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x18bf('0x25')],'busy':this[_0x18bf('0x26')],'busyQueue':this[_0x18bf('0x27')]};var _0x207110=md5(JSON['stringify'](_0x3e4fa5));if(this[_0x18bf('0x1')]!==_0x207110){this[_0x18bf('0x1')]=_0x207110;io['emit'](_0x18bf('0x3a'),_0x3e4fa5);}};module[_0x18bf('0x3b')]=Agent;
\ No newline at end of file
+var _0xcf9d=['faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','mail','chat','fax','sms','length','StatusTime','toNumber','Status','chatStatus','mailStatusTime','mailCurrentCapacity','faxStatusTime','smsStatusTime','whatsappStatus','openchannelStatus','openchannelStatusTime','stringify','emit','moment','md5','ioredis','../../../config/environment','redis','defaults','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatCapacity','mailStatus','mailCapacity'];(function(_0x1a8e6e,_0x427f3f){var _0x2c0fd5=function(_0x48c2e1){while(--_0x48c2e1){_0x1a8e6e['push'](_0x1a8e6e['shift']());}};_0x2c0fd5(++_0x427f3f);}(_0xcf9d,0x1ae));var _0xdcf9=function(_0x33dc9e,_0x13d609){_0x33dc9e=_0x33dc9e-0x0;var _0x52269f=_0xcf9d[_0x33dc9e];return _0x52269f;};'use strict';var _=require('lodash');var moment=require(_0xdcf9('0x0'));var md5=require(_0xdcf9('0x1'));var Redis=require(_0xdcf9('0x2'));var config=require(_0xdcf9('0x3'));config[_0xdcf9('0x4')]=_[_0xdcf9('0x5')](config[_0xdcf9('0x4')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdcf9('0x4')]));function Agent(_0x14dfe6){this['id']=_0x14dfe6['id']||0x0;this['name']=_0x14dfe6[_0xdcf9('0x6')]||'';this['online']=_0x14dfe6[_0xdcf9('0x7')]||!![];this[_0xdcf9('0x8')]=_0x14dfe6['voicePause']||![];this['chatPause']=_0x14dfe6[_0xdcf9('0x9')]||![];this[_0xdcf9('0xa')]=_0x14dfe6['mailPause']||![];this[_0xdcf9('0xb')]=_0x14dfe6['faxPause']||![];this[_0xdcf9('0xc')]=_0x14dfe6[_0xdcf9('0xc')]||![];this[_0xdcf9('0xd')]=_0x14dfe6[_0xdcf9('0xd')]||![];this['chatStatus']=_0xdcf9('0xe');this['chatStatusTime']=0x0;this[_0xdcf9('0xf')]=_0x14dfe6[_0xdcf9('0xf')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xdcf9('0x10')]=_0xdcf9('0xe');this['mailStatusTime']=0x0;this[_0xdcf9('0x11')]=_0x14dfe6['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this[_0xdcf9('0x12')]='unknown';this['faxStatusTime']=0x0;this[_0xdcf9('0x13')]=_0x14dfe6[_0xdcf9('0x13')]||0x0;this[_0xdcf9('0x14')]=0x0;this[_0xdcf9('0x15')]=_0xdcf9('0xe');this['smsStatusTime']=0x0;this[_0xdcf9('0x16')]=_0x14dfe6['smsCapacity']||0x0;this[_0xdcf9('0x17')]=0x0;this['whatsappStatus']=_0xdcf9('0xe');this[_0xdcf9('0x18')]=0x0;this[_0xdcf9('0x19')]=_0x14dfe6['whatsappCapacity']||0x0;this[_0xdcf9('0x1a')]=0x0;this['openchannelStatus']=_0xdcf9('0xe');this['openchannelStatusTime']=0x0;this[_0xdcf9('0x1b')]=_0x14dfe6[_0xdcf9('0x1b')]||0x0;this[_0xdcf9('0x1c')]=0x0;this[_0xdcf9('0x1d')]=![];this[_0xdcf9('0x1e')]=undefined;this[_0xdcf9('0x1')]='';this[_0xdcf9('0x1f')]();}Agent[_0xdcf9('0x20')][_0xdcf9('0x21')]=function(_0x5d6e36){if(this[_0x5d6e36+_0xdcf9('0x22')]>0x0){if(this[_0x5d6e36+_0xdcf9('0x23')]>0x0&&this[_0x5d6e36+'CurrentCapacity']>=this[_0x5d6e36+_0xdcf9('0x23')]){return _0xdcf9('0x24');}else{return _0xdcf9('0x25');}}else{return'idle';}};Agent[_0xdcf9('0x20')][_0xdcf9('0x1f')]=function(){var _0x281dc2=[_0xdcf9('0x26'),_0xdcf9('0x27'),'openchannel',_0xdcf9('0x28'),_0xdcf9('0x29'),'whatsapp'];for(var _0x2d5aec=0x0;_0x2d5aec<_0x281dc2[_0xdcf9('0x2a')];_0x2d5aec+=0x1){var _0x3dfbf7=this['getChannelStatus'](_0x281dc2[_0x2d5aec]);if(this[_0x281dc2[_0x2d5aec]+'Status']!==_0x3dfbf7){this[_0x281dc2[_0x2d5aec]+_0xdcf9('0x2b')]=_[_0xdcf9('0x2c')](moment()['format']('x'));}this[_0x281dc2[_0x2d5aec]+_0xdcf9('0x2d')]=_0x3dfbf7;}var _0x45ce59={'id':this['id'],'name':this[_0xdcf9('0x6')],'online':this['online'],'voicePause':this[_0xdcf9('0x8')],'chatPause':this[_0xdcf9('0x9')],'mailPause':this[_0xdcf9('0xa')],'smsPause':this['smsPause'],'faxPause':this[_0xdcf9('0xb')],'openchannelPause':this[_0xdcf9('0xd')],'chatStatus':this[_0xdcf9('0x2e')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xdcf9('0xf')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xdcf9('0x10')],'mailStatusTime':this[_0xdcf9('0x2f')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xdcf9('0x30')],'faxStatus':this[_0xdcf9('0x12')],'faxStatusTime':this[_0xdcf9('0x31')],'faxCapacity':this[_0xdcf9('0x13')],'faxCurrentCapacity':this[_0xdcf9('0x14')],'smsStatus':this[_0xdcf9('0x15')],'smsStatusTime':this[_0xdcf9('0x32')],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xdcf9('0x33')],'whatsappStatusTime':this[_0xdcf9('0x18')],'whatsappCapacity':this[_0xdcf9('0x19')],'whatsappCurrentCapacity':this[_0xdcf9('0x1a')],'openchannelStatus':this[_0xdcf9('0x34')],'openchannelStatusTime':this[_0xdcf9('0x35')],'openchannelCapacity':this[_0xdcf9('0x1b')],'openchannelCurrentCapacity':this[_0xdcf9('0x1c')],'busy':this[_0xdcf9('0x1d')],'busyQueue':this['busyQueue']};var _0x3beb8b=md5(JSON[_0xdcf9('0x36')](_0x45ce59));if(this[_0xdcf9('0x1')]!==_0x3beb8b){this[_0xdcf9('0x1')]=_0x3beb8b;io[_0xdcf9('0x37')]('user:save',_0x45ce59);}};module['exports']=Agent;
\ No newline at end of file