Built motion from commit 55091a5c.|2.6.30
[motion2.git] / server / services / routing / model / agent.js
index 3e95ced..354eb04 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xffd6=['idle','mail','openchannel','fax','length','StatusTime','format','Status','chatStatusTime','chatCurrentCapacity','faxStatus','faxStatusTime','smsStatus','whatsappCurrentCapacity','openchannelStatus','busy','busyQueue','faxWaitingInteractions','whatsappWaitingInteractions','stringify','user:routing:update','omit','exports','lodash','md5','moment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','chatWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','maxcapacity'];(function(_0x42c0aa,_0x52a8ad){var _0x13e9f8=function(_0x1b2cb5){while(--_0x1b2cb5){_0x42c0aa['push'](_0x42c0aa['shift']());}};_0x13e9f8(++_0x52a8ad);}(_0xffd6,0x97));var _0x6ffd=function(_0x46f1a6,_0xc7a582){_0x46f1a6=_0x46f1a6-0x0;var _0x38429a=_0xffd6[_0x46f1a6];return _0x38429a;};'use strict';var _=require(_0x6ffd('0x0'));var md5=require(_0x6ffd('0x1'));var moment=require(_0x6ffd('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x6ffd('0x3')]=_[_0x6ffd('0x4')](config[_0x6ffd('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x6ffd('0x5'))(new Redis(config[_0x6ffd('0x3')]));function Agent(_0x3b8a46){this['id']=_0x3b8a46['id']||0x0;this[_0x6ffd('0x6')]=_0x3b8a46['name']||'';this[_0x6ffd('0x7')]=_0x3b8a46[_0x6ffd('0x7')]||!![];this[_0x6ffd('0x8')]=_0x3b8a46[_0x6ffd('0x8')]||![];this[_0x6ffd('0x9')]=_0x3b8a46['chatPause']||![];this[_0x6ffd('0xa')]=_0x3b8a46[_0x6ffd('0xa')]||![];this['faxPause']=_0x3b8a46[_0x6ffd('0xb')]||![];this[_0x6ffd('0xc')]=_0x3b8a46[_0x6ffd('0xc')]||![];this[_0x6ffd('0xd')]=_0x3b8a46[_0x6ffd('0xd')]||![];this[_0x6ffd('0xe')]=_0x6ffd('0xf');this['chatStatusTime']=0x0;this[_0x6ffd('0x10')]=_0x3b8a46[_0x6ffd('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0x6ffd('0x11')]=_0x6ffd('0xf');this[_0x6ffd('0x12')]=0x0;this[_0x6ffd('0x13')]=_0x3b8a46['mailCapacity']||0x0;this[_0x6ffd('0x14')]=0x0;this['faxStatus']=_0x6ffd('0xf');this['faxStatusTime']=0x0;this[_0x6ffd('0x15')]=_0x3b8a46[_0x6ffd('0x15')]||0x0;this[_0x6ffd('0x16')]=0x0;this['smsStatus']=_0x6ffd('0xf');this[_0x6ffd('0x17')]=0x0;this[_0x6ffd('0x18')]=_0x3b8a46[_0x6ffd('0x18')]||0x0;this[_0x6ffd('0x19')]=0x0;this[_0x6ffd('0x1a')]=_0x6ffd('0xf');this[_0x6ffd('0x1b')]=0x0;this['whatsappCapacity']=_0x3b8a46[_0x6ffd('0x1c')]||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x6ffd('0xf');this[_0x6ffd('0x1d')]=0x0;this['openchannelCapacity']=_0x3b8a46[_0x6ffd('0x1e')]||0x0;this[_0x6ffd('0x1f')]=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x6ffd('0x1')]='';this[_0x6ffd('0x20')]={};this['faxWaitingInteractions']={};this[_0x6ffd('0x21')]={};this[_0x6ffd('0x22')]={};this[_0x6ffd('0x23')]={};this['whatsappWaitingInteractions']={};this[_0x6ffd('0x24')]();}Agent[_0x6ffd('0x25')]['getChannelStatus']=function(_0x356c9c){if(this[_0x356c9c+_0x6ffd('0x26')]>0x0){if(this[_0x356c9c+'Capacity']>0x0&&this[_0x356c9c+_0x6ffd('0x26')]>=this[_0x356c9c+_0x6ffd('0x27')]){return _0x6ffd('0x28');}else{return'working';}}else{return _0x6ffd('0x29');}};Agent[_0x6ffd('0x25')][_0x6ffd('0x24')]=function(){var _0x4ae7ac=[_0x6ffd('0x2a'),'chat',_0x6ffd('0x2b'),_0x6ffd('0x2c'),'sms','whatsapp'];for(var _0x252201=0x0;_0x252201<_0x4ae7ac[_0x6ffd('0x2d')];_0x252201+=0x1){var _0x1934d4=this['getChannelStatus'](_0x4ae7ac[_0x252201]);if(this[_0x4ae7ac[_0x252201]+'Status']!==_0x1934d4){this[_0x4ae7ac[_0x252201]+_0x6ffd('0x2e')]=_['toNumber'](moment()[_0x6ffd('0x2f')]('x'));}this[_0x4ae7ac[_0x252201]+_0x6ffd('0x30')]=_0x1934d4;}var _0x51fdb6={'id':this['id'],'name':this[_0x6ffd('0x6')],'online':this[_0x6ffd('0x7')],'voicePause':this[_0x6ffd('0x8')],'chatPause':this[_0x6ffd('0x9')],'mailPause':this[_0x6ffd('0xa')],'smsPause':this[_0x6ffd('0xc')],'faxPause':this[_0x6ffd('0xb')],'openchannelPause':this[_0x6ffd('0xd')],'chatStatus':this[_0x6ffd('0xe')],'chatStatusTime':this[_0x6ffd('0x31')],'chatCapacity':this[_0x6ffd('0x10')],'chatCurrentCapacity':this[_0x6ffd('0x32')],'mailStatus':this[_0x6ffd('0x11')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x6ffd('0x33')],'faxStatusTime':this[_0x6ffd('0x34')],'faxCapacity':this[_0x6ffd('0x15')],'faxCurrentCapacity':this[_0x6ffd('0x16')],'smsStatus':this[_0x6ffd('0x35')],'smsStatusTime':this[_0x6ffd('0x17')],'smsCapacity':this[_0x6ffd('0x18')],'smsCurrentCapacity':this[_0x6ffd('0x19')],'whatsappStatus':this[_0x6ffd('0x1a')],'whatsappStatusTime':this[_0x6ffd('0x1b')],'whatsappCapacity':this[_0x6ffd('0x1c')],'whatsappCurrentCapacity':this[_0x6ffd('0x36')],'openchannelStatus':this[_0x6ffd('0x37')],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this[_0x6ffd('0x1e')],'openchannelCurrentCapacity':this[_0x6ffd('0x1f')],'busy':this[_0x6ffd('0x38')],'busyQueue':this[_0x6ffd('0x39')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x6ffd('0x3a')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x6ffd('0x23')],'whatsappWaitingInteractions':this[_0x6ffd('0x3b')]};var _0x25bc7c=md5(JSON[_0x6ffd('0x3c')](_0x51fdb6));if(this['md5']!==_0x25bc7c){this[_0x6ffd('0x1')]=_0x25bc7c;io['emit'](_0x6ffd('0x3d'),_[_0x6ffd('0x3e')](_0x51fdb6,[_0x6ffd('0x7')]));}};module[_0x6ffd('0x3f')]=Agent;
\ No newline at end of file
+var _0x8ace=['unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','whatsapp','toNumber','format','Status','mailStatus','faxCurrentCapacity','openchannelStatusTime','busyQueue','openchannelWaitingInteractions','whatsappWaitingInteractions','stringify','emit','user:routing:update','omit','lodash','md5','moment','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus'];(function(_0x300b0c,_0x595823){var _0x698d8c=function(_0x44f160){while(--_0x44f160){_0x300b0c['push'](_0x300b0c['shift']());}};_0x698d8c(++_0x595823);}(_0x8ace,0x1bc));var _0xe8ac=function(_0xdfcf22,_0x322509){_0xdfcf22=_0xdfcf22-0x0;var _0x59b62f=_0x8ace[_0xdfcf22];return _0x59b62f;};'use strict';var _=require(_0xe8ac('0x0'));var md5=require(_0xe8ac('0x1'));var moment=require(_0xe8ac('0x2'));var Redis=require(_0xe8ac('0x3'));var config=require(_0xe8ac('0x4'));config[_0xe8ac('0x5')]=_[_0xe8ac('0x6')](config[_0xe8ac('0x5')],{'host':_0xe8ac('0x7'),'port':0x18eb});var io=require(_0xe8ac('0x8'))(new Redis(config[_0xe8ac('0x5')]));function Agent(_0x224fc8){this['id']=_0x224fc8['id']||0x0;this[_0xe8ac('0x9')]=_0x224fc8[_0xe8ac('0x9')]||'';this['online']=_0x224fc8[_0xe8ac('0xa')]||!![];this[_0xe8ac('0xb')]=_0x224fc8['voicePause']||![];this['chatPause']=_0x224fc8[_0xe8ac('0xc')]||![];this['mailPause']=_0x224fc8[_0xe8ac('0xd')]||![];this[_0xe8ac('0xe')]=_0x224fc8[_0xe8ac('0xe')]||![];this[_0xe8ac('0xf')]=_0x224fc8[_0xe8ac('0xf')]||![];this[_0xe8ac('0x10')]=_0x224fc8['openchannelPause']||![];this[_0xe8ac('0x11')]=_0xe8ac('0x12');this[_0xe8ac('0x13')]=0x0;this['chatCapacity']=_0x224fc8[_0xe8ac('0x14')]||0x0;this[_0xe8ac('0x15')]=0x0;this['mailStatus']=_0xe8ac('0x12');this[_0xe8ac('0x16')]=0x0;this[_0xe8ac('0x17')]=_0x224fc8[_0xe8ac('0x17')]||0x0;this[_0xe8ac('0x18')]=0x0;this[_0xe8ac('0x19')]=_0xe8ac('0x12');this[_0xe8ac('0x1a')]=0x0;this[_0xe8ac('0x1b')]=_0x224fc8[_0xe8ac('0x1b')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xe8ac('0x1c')]=_0xe8ac('0x12');this['smsStatusTime']=0x0;this[_0xe8ac('0x1d')]=_0x224fc8[_0xe8ac('0x1d')]||0x0;this[_0xe8ac('0x1e')]=0x0;this[_0xe8ac('0x1f')]=_0xe8ac('0x12');this[_0xe8ac('0x20')]=0x0;this['whatsappCapacity']=_0x224fc8['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this[_0xe8ac('0x21')]=_0xe8ac('0x12');this['openchannelStatusTime']=0x0;this[_0xe8ac('0x22')]=_0x224fc8['openchannelCapacity']||0x0;this[_0xe8ac('0x23')]=0x0;this[_0xe8ac('0x24')]=![];this['busyQueue']=undefined;this[_0xe8ac('0x1')]='';this[_0xe8ac('0x25')]={};this[_0xe8ac('0x26')]={};this[_0xe8ac('0x27')]={};this['openchannelWaitingInteractions']={};this[_0xe8ac('0x28')]={};this['whatsappWaitingInteractions']={};this[_0xe8ac('0x29')]();}Agent[_0xe8ac('0x2a')][_0xe8ac('0x2b')]=function(_0x252440){if(this[_0x252440+_0xe8ac('0x2c')]>0x0){if(this[_0x252440+_0xe8ac('0x2d')]>0x0&&this[_0x252440+_0xe8ac('0x2c')]>=this[_0x252440+'Capacity']){return _0xe8ac('0x2e');}else{return _0xe8ac('0x2f');}}else{return _0xe8ac('0x30');}};Agent[_0xe8ac('0x2a')][_0xe8ac('0x29')]=function(){var _0x3a92e1=[_0xe8ac('0x31'),_0xe8ac('0x32'),_0xe8ac('0x33'),'fax','sms',_0xe8ac('0x34')];for(var _0xbef18f=0x0;_0xbef18f<_0x3a92e1['length'];_0xbef18f+=0x1){var _0x2a78c6=this[_0xe8ac('0x2b')](_0x3a92e1[_0xbef18f]);if(this[_0x3a92e1[_0xbef18f]+'Status']!==_0x2a78c6){this[_0x3a92e1[_0xbef18f]+'StatusTime']=_[_0xe8ac('0x35')](moment()[_0xe8ac('0x36')]('x'));}this[_0x3a92e1[_0xbef18f]+_0xe8ac('0x37')]=_0x2a78c6;}var _0x5d7562={'id':this['id'],'name':this[_0xe8ac('0x9')],'online':this[_0xe8ac('0xa')],'voicePause':this[_0xe8ac('0xb')],'chatPause':this['chatPause'],'mailPause':this[_0xe8ac('0xd')],'smsPause':this['smsPause'],'faxPause':this[_0xe8ac('0xe')],'openchannelPause':this['openchannelPause'],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xe8ac('0x15')],'mailStatus':this[_0xe8ac('0x38')],'mailStatusTime':this[_0xe8ac('0x16')],'mailCapacity':this[_0xe8ac('0x17')],'mailCurrentCapacity':this[_0xe8ac('0x18')],'faxStatus':this[_0xe8ac('0x19')],'faxStatusTime':this[_0xe8ac('0x1a')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xe8ac('0x39')],'smsStatus':this['smsStatus'],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0xe8ac('0x1e')],'whatsappStatus':this[_0xe8ac('0x1f')],'whatsappStatusTime':this[_0xe8ac('0x20')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0xe8ac('0x21')],'openchannelStatusTime':this[_0xe8ac('0x3a')],'openchannelCapacity':this[_0xe8ac('0x22')],'openchannelCurrentCapacity':this[_0xe8ac('0x23')],'busy':this['busy'],'busyQueue':this[_0xe8ac('0x3b')],'chatWaitingInteractions':this[_0xe8ac('0x25')],'faxWaitingInteractions':this[_0xe8ac('0x26')],'mailWaitingInteractions':this[_0xe8ac('0x27')],'openchannelWaitingInteractions':this[_0xe8ac('0x3c')],'smsWaitingInteractions':this[_0xe8ac('0x28')],'whatsappWaitingInteractions':this[_0xe8ac('0x3d')]};var _0x55a3a4=md5(JSON[_0xe8ac('0x3e')](_0x5d7562));if(this[_0xe8ac('0x1')]!==_0x55a3a4){this['md5']=_0x55a3a4;io[_0xe8ac('0x3f')](_0xe8ac('0x40'),_[_0xe8ac('0x41')](_0x5d7562,[_0xe8ac('0xa')]));}};module['exports']=Agent;
\ No newline at end of file