Built motion from commit f0a64034.|2.6.11
[motion2.git] / server / services / routing / model / agent.js
index 376bb83..799a16f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xc727=['smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','getChannelStatus','CurrentCapacity','Capacity','prototype','openchannel','fax','sms','whatsapp','length','Status','StatusTime','format','chatStatusTime','chatCurrentCapacity','mailCurrentCapacity','smsStatus','smsStatusTime','whatsappCurrentCapacity','openchannelStatusTime','emit','user:save','lodash','md5','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions'];(function(_0xa65ffb,_0x53dd5b){var _0x491769=function(_0x237134){while(--_0x237134){_0xa65ffb['push'](_0xa65ffb['shift']());}};_0x491769(++_0x53dd5b);}(_0xc727,0x94));var _0x7c72=function(_0x25e1fd,_0x28cff0){_0x25e1fd=_0x25e1fd-0x0;var _0x3e9e8b=_0xc727[_0x25e1fd];return _0x3e9e8b;};'use strict';var _=require(_0x7c72('0x0'));var moment=require('moment');var md5=require(_0x7c72('0x1'));var Redis=require(_0x7c72('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0x7c72('0x3')],{'host':_0x7c72('0x4'),'port':0x18eb});var io=require(_0x7c72('0x5'))(new Redis(config['redis']));function Agent(_0xf7b22d){this['id']=_0xf7b22d['id']||0x0;this['name']=_0xf7b22d[_0x7c72('0x6')]||'';this['online']=_0xf7b22d[_0x7c72('0x7')]||!![];this[_0x7c72('0x8')]=_0xf7b22d[_0x7c72('0x8')]||![];this[_0x7c72('0x9')]=_0xf7b22d['chatPause']||![];this[_0x7c72('0xa')]=_0xf7b22d['mailPause']||![];this[_0x7c72('0xb')]=_0xf7b22d[_0x7c72('0xb')]||![];this[_0x7c72('0xc')]=_0xf7b22d[_0x7c72('0xc')]||![];this[_0x7c72('0xd')]=_0xf7b22d['openchannelPause']||![];this[_0x7c72('0xe')]=_0x7c72('0xf');this['chatStatusTime']=0x0;this[_0x7c72('0x10')]=_0xf7b22d[_0x7c72('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x7c72('0x11')]=_0x7c72('0xf');this[_0x7c72('0x12')]=0x0;this[_0x7c72('0x13')]=_0xf7b22d[_0x7c72('0x13')]||0x0;this['mailCurrentCapacity']=0x0;this[_0x7c72('0x14')]=_0x7c72('0xf');this[_0x7c72('0x15')]=0x0;this[_0x7c72('0x16')]=_0xf7b22d[_0x7c72('0x16')]||0x0;this[_0x7c72('0x17')]=0x0;this['smsStatus']=_0x7c72('0xf');this['smsStatusTime']=0x0;this[_0x7c72('0x18')]=_0xf7b22d['smsCapacity']||0x0;this[_0x7c72('0x19')]=0x0;this[_0x7c72('0x1a')]='unknown';this[_0x7c72('0x1b')]=0x0;this[_0x7c72('0x1c')]=_0xf7b22d['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0x7c72('0x1d')]=_0x7c72('0xf');this['openchannelStatusTime']=0x0;this[_0x7c72('0x1e')]=_0xf7b22d[_0x7c72('0x1e')]||0x0;this[_0x7c72('0x1f')]=0x0;this[_0x7c72('0x20')]=![];this[_0x7c72('0x21')]=undefined;this[_0x7c72('0x1')]='';this[_0x7c72('0x22')]={};this[_0x7c72('0x23')]={};this[_0x7c72('0x24')]={};this[_0x7c72('0x25')]={};this[_0x7c72('0x26')]={};this[_0x7c72('0x27')]={};this[_0x7c72('0x28')]();}Agent['prototype'][_0x7c72('0x29')]=function(_0x125dc5){if(this[_0x125dc5+_0x7c72('0x2a')]>0x0){if(this[_0x125dc5+_0x7c72('0x2b')]>0x0&&this[_0x125dc5+'CurrentCapacity']>=this[_0x125dc5+_0x7c72('0x2b')]){return'maxcapacity';}else{return'working';}}else{return'idle';}};Agent[_0x7c72('0x2c')]['updateRealtime']=function(){var _0x1ccb96=['mail','chat',_0x7c72('0x2d'),_0x7c72('0x2e'),_0x7c72('0x2f'),_0x7c72('0x30')];for(var _0x21d81e=0x0;_0x21d81e<_0x1ccb96[_0x7c72('0x31')];_0x21d81e+=0x1){var _0x13ce0a=this[_0x7c72('0x29')](_0x1ccb96[_0x21d81e]);if(this[_0x1ccb96[_0x21d81e]+_0x7c72('0x32')]!==_0x13ce0a){this[_0x1ccb96[_0x21d81e]+_0x7c72('0x33')]=_['toNumber'](moment()[_0x7c72('0x34')]('x'));}this[_0x1ccb96[_0x21d81e]+'Status']=_0x13ce0a;}var _0x5ad289={'id':this['id'],'name':this[_0x7c72('0x6')],'online':this[_0x7c72('0x7')],'voicePause':this[_0x7c72('0x8')],'chatPause':this[_0x7c72('0x9')],'mailPause':this[_0x7c72('0xa')],'smsPause':this[_0x7c72('0xc')],'faxPause':this[_0x7c72('0xb')],'openchannelPause':this[_0x7c72('0xd')],'chatStatus':this[_0x7c72('0xe')],'chatStatusTime':this[_0x7c72('0x35')],'chatCapacity':this[_0x7c72('0x10')],'chatCurrentCapacity':this[_0x7c72('0x36')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x7c72('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x7c72('0x37')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0x7c72('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x7c72('0x38')],'smsStatusTime':this[_0x7c72('0x39')],'smsCapacity':this[_0x7c72('0x18')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x7c72('0x1b')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x7c72('0x3a')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x7c72('0x3b')],'openchannelCapacity':this[_0x7c72('0x1e')],'openchannelCurrentCapacity':this[_0x7c72('0x1f')],'busy':this[_0x7c72('0x20')],'busyQueue':this[_0x7c72('0x21')],'chatWaitingInteractions':this[_0x7c72('0x22')],'faxWaitingInteractions':this[_0x7c72('0x23')],'mailWaitingInteractions':this[_0x7c72('0x24')],'openchannelWaitingInteractions':this[_0x7c72('0x25')],'smsWaitingInteractions':this[_0x7c72('0x26')],'whatsappWaitingInteractions':this[_0x7c72('0x27')]};var _0x41f374=md5(JSON['stringify'](_0x5ad289));if(this[_0x7c72('0x1')]!==_0x41f374){this[_0x7c72('0x1')]=_0x41f374;io[_0x7c72('0x3c')](_0x7c72('0x3d'),_0x5ad289);}};module['exports']=Agent;
\ No newline at end of file
+var _0x0ed8=['sms','whatsapp','length','StatusTime','format','Status','chatCapacity','whatsappCurrentCapacity','busyQueue','stringify','emit','user:save','exports','lodash','moment','md5','ioredis','redis','defaults','localhost','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','mail','openchannel','fax'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0x0ed8,0x111));var _0x80ed=function(_0x2f5012,_0x3eee4b){_0x2f5012=_0x2f5012-0x0;var _0x4b0c3a=_0x0ed8[_0x2f5012];return _0x4b0c3a;};'use strict';var _=require(_0x80ed('0x0'));var moment=require(_0x80ed('0x1'));var md5=require(_0x80ed('0x2'));var Redis=require(_0x80ed('0x3'));var config=require('../../../config/environment');config[_0x80ed('0x4')]=_[_0x80ed('0x5')](config['redis'],{'host':_0x80ed('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x80ed('0x4')]));function Agent(_0x16da4a){this['id']=_0x16da4a['id']||0x0;this[_0x80ed('0x7')]=_0x16da4a[_0x80ed('0x7')]||'';this[_0x80ed('0x8')]=_0x16da4a[_0x80ed('0x8')]||!![];this['voicePause']=_0x16da4a[_0x80ed('0x9')]||![];this[_0x80ed('0xa')]=_0x16da4a[_0x80ed('0xa')]||![];this[_0x80ed('0xb')]=_0x16da4a[_0x80ed('0xb')]||![];this['faxPause']=_0x16da4a[_0x80ed('0xc')]||![];this['smsPause']=_0x16da4a[_0x80ed('0xd')]||![];this[_0x80ed('0xe')]=_0x16da4a['openchannelPause']||![];this[_0x80ed('0xf')]=_0x80ed('0x10');this[_0x80ed('0x11')]=0x0;this['chatCapacity']=_0x16da4a['chatCapacity']||0x0;this[_0x80ed('0x12')]=0x0;this[_0x80ed('0x13')]=_0x80ed('0x10');this[_0x80ed('0x14')]=0x0;this['mailCapacity']=_0x16da4a[_0x80ed('0x15')]||0x0;this[_0x80ed('0x16')]=0x0;this[_0x80ed('0x17')]=_0x80ed('0x10');this[_0x80ed('0x18')]=0x0;this[_0x80ed('0x19')]=_0x16da4a[_0x80ed('0x19')]||0x0;this[_0x80ed('0x1a')]=0x0;this[_0x80ed('0x1b')]=_0x80ed('0x10');this['smsStatusTime']=0x0;this[_0x80ed('0x1c')]=_0x16da4a[_0x80ed('0x1c')]||0x0;this[_0x80ed('0x1d')]=0x0;this[_0x80ed('0x1e')]='unknown';this[_0x80ed('0x1f')]=0x0;this[_0x80ed('0x20')]=_0x16da4a[_0x80ed('0x20')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x80ed('0x10');this[_0x80ed('0x21')]=0x0;this[_0x80ed('0x22')]=_0x16da4a['openchannelCapacity']||0x0;this[_0x80ed('0x23')]=0x0;this[_0x80ed('0x24')]=![];this['busyQueue']=undefined;this[_0x80ed('0x2')]='';this[_0x80ed('0x25')]={};this[_0x80ed('0x26')]={};this[_0x80ed('0x27')]={};this[_0x80ed('0x28')]={};this[_0x80ed('0x29')]={};this[_0x80ed('0x2a')]={};this[_0x80ed('0x2b')]();}Agent[_0x80ed('0x2c')][_0x80ed('0x2d')]=function(_0x1e6de9){if(this[_0x1e6de9+_0x80ed('0x2e')]>0x0){if(this[_0x1e6de9+_0x80ed('0x2f')]>0x0&&this[_0x1e6de9+_0x80ed('0x2e')]>=this[_0x1e6de9+_0x80ed('0x2f')]){return _0x80ed('0x30');}else{return'working';}}else{return'idle';}};Agent['prototype']['updateRealtime']=function(){var _0x35b61c=[_0x80ed('0x31'),'chat',_0x80ed('0x32'),_0x80ed('0x33'),_0x80ed('0x34'),_0x80ed('0x35')];for(var _0xbf45bc=0x0;_0xbf45bc<_0x35b61c[_0x80ed('0x36')];_0xbf45bc+=0x1){var _0x125c49=this['getChannelStatus'](_0x35b61c[_0xbf45bc]);if(this[_0x35b61c[_0xbf45bc]+'Status']!==_0x125c49){this[_0x35b61c[_0xbf45bc]+_0x80ed('0x37')]=_['toNumber'](moment()[_0x80ed('0x38')]('x'));}this[_0x35b61c[_0xbf45bc]+_0x80ed('0x39')]=_0x125c49;}var _0x321f58={'id':this['id'],'name':this['name'],'online':this[_0x80ed('0x8')],'voicePause':this[_0x80ed('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x80ed('0xb')],'smsPause':this[_0x80ed('0xd')],'faxPause':this[_0x80ed('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x80ed('0xf')],'chatStatusTime':this[_0x80ed('0x11')],'chatCapacity':this[_0x80ed('0x3a')],'chatCurrentCapacity':this[_0x80ed('0x12')],'mailStatus':this[_0x80ed('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x80ed('0x15')],'mailCurrentCapacity':this[_0x80ed('0x16')],'faxStatus':this[_0x80ed('0x17')],'faxStatusTime':this[_0x80ed('0x18')],'faxCapacity':this[_0x80ed('0x19')],'faxCurrentCapacity':this[_0x80ed('0x1a')],'smsStatus':this[_0x80ed('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0x80ed('0x1c')],'smsCurrentCapacity':this[_0x80ed('0x1d')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0x80ed('0x1f')],'whatsappCapacity':this[_0x80ed('0x20')],'whatsappCurrentCapacity':this[_0x80ed('0x3b')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x80ed('0x21')],'openchannelCapacity':this[_0x80ed('0x22')],'openchannelCurrentCapacity':this[_0x80ed('0x23')],'busy':this[_0x80ed('0x24')],'busyQueue':this[_0x80ed('0x3c')],'chatWaitingInteractions':this[_0x80ed('0x25')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x80ed('0x27')],'openchannelWaitingInteractions':this[_0x80ed('0x28')],'smsWaitingInteractions':this[_0x80ed('0x29')],'whatsappWaitingInteractions':this[_0x80ed('0x2a')]};var _0x3ffc0c=md5(JSON[_0x80ed('0x3d')](_0x321f58));if(this[_0x80ed('0x2')]!==_0x3ffc0c){this['md5']=_0x3ffc0c;io[_0x80ed('0x3e')](_0x80ed('0x3f'),_0x321f58);}};module[_0x80ed('0x40')]=Agent;
\ No newline at end of file