Built motion from commit (unavailable).|2.5.28
[motion2.git] / server / services / routing / realtime / index.js
index cbd7771..6310f33 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf3cd=['../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/whatsappQueue','agents','intervals','openchannelQueues','chatQueues','smsQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','length','isUndefined','initIntervals','initOpenchannelQueues','updateRouting','updateRealtime','initChatQueues','initSmsQueues','mailQueues','initFaxQueues','initWhatsappQueues','whatsappQueues','bluebird','util','lodash','moment','../model/agent'];(function(_0x396e74,_0x27fdca){var _0x50a5a9=function(_0x599485){while(--_0x599485){_0x396e74['push'](_0x396e74['shift']());}};_0x50a5a9(++_0x27fdca);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x68359d,_0x51477f){_0x68359d=_0x68359d-0x0;var _0x15d875=_0xf3cd[_0x68359d];return _0x15d875;};'use strict';var BPromise=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var _=require(_0xdf3c('0x2'));var moment=require(_0xdf3c('0x3'));var Agent=require(_0xdf3c('0x4'));var Interval=require(_0xdf3c('0x5'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0xdf3c('0x6'));var SmsQueue=require(_0xdf3c('0x7'));var MailQueue=require(_0xdf3c('0x8'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require(_0xdf3c('0x9'));var Realtime=function(){this[_0xdf3c('0xa')]={};this[_0xdf3c('0xb')]={};this[_0xdf3c('0xc')]={};this[_0xdf3c('0xd')]={};this[_0xdf3c('0xe')]={};this['mailQueues']={};this[_0xdf3c('0xf')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0xdf3c('0x10')]={};this[_0xdf3c('0x11')]={};this['smsQueuesWaitingInteractions']={};this[_0xdf3c('0x12')]={};this[_0xdf3c('0x13')]={};};function freeIsNotKey(_0x2d420c,_0x21a6e5,_0x3a3154){var _0x1c456b=_[_0xdf3c('0x14')](_0x2d420c,function(_0x32d2db,_0x5e8925){return _0x32d2db[_0x3a3154];});for(var _0x1d483c in _0x21a6e5){if(_0x21a6e5[_0xdf3c('0x15')](_0x1d483c)){if(!_0x1c456b[_0x1d483c]){delete _0x21a6e5[_0x1d483c];}}}}Realtime[_0xdf3c('0x16')][_0xdf3c('0x17')]=function(_0x59e431,_0x2ae4ad){for(var _0x461079 in _0x2ae4ad){if(_0x59e431[_0xdf3c('0x15')](_0x461079)){_0x59e431[_0x461079]=_0x2ae4ad[_0x461079];}}};Realtime['prototype'][_0xdf3c('0x18')]=function(){var _0x38b01d=this;return function(_0x173041){if(_0x173041){freeIsNotKey(_0x173041,_0x38b01d[_0xdf3c('0xa')],'id');for(var _0x21e587=0x0,_0x1a7a5a={},_0x305ea5={};_0x21e587<_0x173041[_0xdf3c('0x19')];_0x21e587+=0x1){_0x1a7a5a=_0x173041[_0x21e587];if(_[_0xdf3c('0x1a')](_0x38b01d[_0xdf3c('0xa')][_0x1a7a5a['id']])){_0x38b01d['agents'][_0x1a7a5a['id']]=new Agent(_0x1a7a5a);}else{_0x38b01d[_0xdf3c('0x17')](_0x38b01d[_0xdf3c('0xa')][_0x1a7a5a['id']],_0x1a7a5a);}}}return _0x38b01d[_0xdf3c('0xa')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x1b')]=function(){var _0x113b56=this;return function(_0x16b02b){if(_0x16b02b){freeIsNotKey(_0x16b02b,_0x113b56[_0xdf3c('0xb')],'id');for(var _0x426f3a=0x0,_0x18fb5f={},_0x267488={};_0x426f3a<_0x16b02b[_0xdf3c('0x19')];_0x426f3a+=0x1){_0x18fb5f=_0x16b02b[_0x426f3a];if(_[_0xdf3c('0x1a')](_0x113b56['intervals'][_0x18fb5f['id']])){_0x113b56['intervals'][_0x18fb5f['id']]=new Interval(_0x18fb5f);}else{_0x113b56[_0xdf3c('0x17')](_0x113b56['intervals'][_0x18fb5f['id']],_0x18fb5f);}}}return _0x113b56[_0xdf3c('0xb')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x1c')]=function(){var _0x38b319=this;return function(_0x33652f){if(_0x33652f){freeIsNotKey(_0x33652f,_0x38b319[_0xdf3c('0xc')],'id');for(var _0x50d8ca=0x0,_0x22a164={},_0x213d75={};_0x50d8ca<_0x33652f[_0xdf3c('0x19')];_0x50d8ca+=0x1){_0x22a164=_0x33652f[_0x50d8ca];if(_[_0xdf3c('0x1a')](_0x38b319[_0xdf3c('0xc')][_0x22a164['id']])){_0x38b319[_0xdf3c('0xc')][_0x22a164['id']]=new OpenchannelQueue(_0x22a164);}else{_0x38b319[_0xdf3c('0x17')](_0x38b319[_0xdf3c('0xc')][_0x22a164['id']],_0x22a164);}_0x38b319[_0xdf3c('0xc')][_0x22a164['id']][_0xdf3c('0x1d')]();_0x38b319['openchannelQueues'][_0x22a164['id']][_0xdf3c('0x1e')]();}}return _0x38b319[_0xdf3c('0xc')];};};Realtime['prototype'][_0xdf3c('0x1f')]=function(){var _0x59659e=this;return function(_0x4eaced){if(_0x4eaced){freeIsNotKey(_0x4eaced,_0x59659e['chatQueues'],'id');for(var _0x14aac9=0x0,_0x186bba={},_0x52b8f6={};_0x14aac9<_0x4eaced['length'];_0x14aac9+=0x1){_0x186bba=_0x4eaced[_0x14aac9];if(_[_0xdf3c('0x1a')](_0x59659e[_0xdf3c('0xd')][_0x186bba['id']])){_0x59659e[_0xdf3c('0xd')][_0x186bba['id']]=new ChatQueue(_0x186bba);}else{_0x59659e[_0xdf3c('0x17')](_0x59659e['chatQueues'][_0x186bba['id']],_0x186bba);}_0x59659e[_0xdf3c('0xd')][_0x186bba['id']][_0xdf3c('0x1d')]();_0x59659e['chatQueues'][_0x186bba['id']]['updateRealtime']();}}return _0x59659e[_0xdf3c('0xd')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x20')]=function(){var _0x540f3a=this;return function(_0x2355f6){if(_0x2355f6){freeIsNotKey(_0x2355f6,_0x540f3a[_0xdf3c('0xe')],'id');for(var _0x21e7b8=0x0,_0x10099e={},_0x575ae1={};_0x21e7b8<_0x2355f6[_0xdf3c('0x19')];_0x21e7b8+=0x1){_0x10099e=_0x2355f6[_0x21e7b8];if(_[_0xdf3c('0x1a')](_0x540f3a['smsQueues'][_0x10099e['id']])){_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']]=new SmsQueue(_0x10099e);}else{_0x540f3a[_0xdf3c('0x17')](_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']],_0x10099e);}_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']]['updateRouting']();_0x540f3a[_0xdf3c('0xe')][_0x10099e['id']][_0xdf3c('0x1e')]();}}return _0x540f3a[_0xdf3c('0xe')];};};Realtime[_0xdf3c('0x16')]['initMailQueues']=function(){var _0x474564=this;return function(_0x3e7a4b){if(_0x3e7a4b){freeIsNotKey(_0x3e7a4b,_0x474564['mailQueues'],'id');for(var _0x4f68f9=0x0,_0x12cc19={},_0x588d02={};_0x4f68f9<_0x3e7a4b[_0xdf3c('0x19')];_0x4f68f9+=0x1){_0x12cc19=_0x3e7a4b[_0x4f68f9];if(_['isUndefined'](_0x474564['mailQueues'][_0x12cc19['id']])){_0x474564['mailQueues'][_0x12cc19['id']]=new MailQueue(_0x12cc19);}else{_0x474564[_0xdf3c('0x17')](_0x474564[_0xdf3c('0x21')][_0x12cc19['id']],_0x12cc19);}_0x474564[_0xdf3c('0x21')][_0x12cc19['id']][_0xdf3c('0x1d')]();_0x474564['mailQueues'][_0x12cc19['id']]['updateRealtime']();}}return _0x474564[_0xdf3c('0x21')];};};Realtime['prototype'][_0xdf3c('0x22')]=function(){var _0x17b502=this;return function(_0x3628ae){if(_0x3628ae){freeIsNotKey(_0x3628ae,_0x17b502[_0xdf3c('0xf')],'id');for(var _0x1004e9=0x0,_0x1e0cf2={},_0x1c7335={};_0x1004e9<_0x3628ae[_0xdf3c('0x19')];_0x1004e9+=0x1){_0x1e0cf2=_0x3628ae[_0x1004e9];if(_[_0xdf3c('0x1a')](_0x17b502['faxQueues'][_0x1e0cf2['id']])){_0x17b502[_0xdf3c('0xf')][_0x1e0cf2['id']]=new FaxQueue(_0x1e0cf2);}else{_0x17b502['mergeFromDatabase'](_0x17b502['faxQueues'][_0x1e0cf2['id']],_0x1e0cf2);}_0x17b502[_0xdf3c('0xf')][_0x1e0cf2['id']]['updateRouting']();_0x17b502[_0xdf3c('0xf')][_0x1e0cf2['id']]['updateRealtime']();}}return _0x17b502[_0xdf3c('0xf')];};};Realtime[_0xdf3c('0x16')][_0xdf3c('0x23')]=function(){var _0x1349a4=this;return function(_0x3098cb){if(_0x3098cb){freeIsNotKey(_0x3098cb,_0x1349a4[_0xdf3c('0x24')],'id');for(var _0x736ef5=0x0,_0x3d47fb={},_0x3cf131={};_0x736ef5<_0x3098cb[_0xdf3c('0x19')];_0x736ef5+=0x1){_0x3d47fb=_0x3098cb[_0x736ef5];if(_[_0xdf3c('0x1a')](_0x1349a4[_0xdf3c('0x24')][_0x3d47fb['id']])){_0x1349a4['whatsappQueues'][_0x3d47fb['id']]=new WhatsappQueue(_0x3d47fb);}else{_0x1349a4['mergeFromDatabase'](_0x1349a4[_0xdf3c('0x24')][_0x3d47fb['id']],_0x3d47fb);}_0x1349a4['whatsappQueues'][_0x3d47fb['id']][_0xdf3c('0x1d')]();_0x1349a4[_0xdf3c('0x24')][_0x3d47fb['id']][_0xdf3c('0x1e')]();}}return _0x1349a4[_0xdf3c('0x24')];};};module['exports']=Realtime;
\ No newline at end of file
+var _0x6aa7=['agents','openchannelQueues','chatQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','mapKeys','prototype','mergeFromDatabase','initAgents','length','intervals','isUndefined','updateRealtime','initChatQueues','updateRouting','initMailQueues','mailQueues','initWhatsappQueues','bluebird','lodash','moment','../model/agent','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x6aa7,0x178));var _0x76aa=function(_0x5ca285,_0x5dbceb){_0x5ca285=_0x5ca285-0x0;var _0x5c9fb6=_0x6aa7[_0x5ca285];return _0x5c9fb6;};'use strict';var BPromise=require(_0x76aa('0x0'));var util=require('util');var _=require(_0x76aa('0x1'));var moment=require(_0x76aa('0x2'));var Agent=require(_0x76aa('0x3'));var Interval=require(_0x76aa('0x4'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x76aa('0x5'));var SmsQueue=require(_0x76aa('0x6'));var MailQueue=require(_0x76aa('0x7'));var FaxQueue=require('../model/faxQueue');var WhatsappQueue=require('../model/whatsappQueue');var Realtime=function(){this[_0x76aa('0x8')]={};this['intervals']={};this[_0x76aa('0x9')]={};this[_0x76aa('0xa')]={};this[_0x76aa('0xb')]={};this['mailQueues']={};this[_0x76aa('0xc')]={};this[_0x76aa('0xd')]={};this[_0x76aa('0xe')]={};this['mailQueuesWaitingInteractions']={};this[_0x76aa('0xf')]={};this[_0x76aa('0x10')]={};this[_0x76aa('0x11')]={};this[_0x76aa('0x12')]={};};function freeIsNotKey(_0x37f1ab,_0x128435,_0x2c5075){var _0x8dc35c=_[_0x76aa('0x13')](_0x37f1ab,function(_0x17a417,_0x5e5f47){return _0x17a417[_0x2c5075];});for(var _0x112c39 in _0x128435){if(_0x128435['hasOwnProperty'](_0x112c39)){if(!_0x8dc35c[_0x112c39]){delete _0x128435[_0x112c39];}}}}Realtime[_0x76aa('0x14')][_0x76aa('0x15')]=function(_0x3f8f6b,_0x8e44ed){for(var _0x10432c in _0x8e44ed){if(_0x3f8f6b['hasOwnProperty'](_0x10432c)){_0x3f8f6b[_0x10432c]=_0x8e44ed[_0x10432c];}}};Realtime['prototype'][_0x76aa('0x16')]=function(){var _0x4cfc34=this;return function(_0x180d92){if(_0x180d92){freeIsNotKey(_0x180d92,_0x4cfc34[_0x76aa('0x8')],'id');for(var _0x5cf594=0x0,_0x2111c7={},_0x550d9a={};_0x5cf594<_0x180d92[_0x76aa('0x17')];_0x5cf594+=0x1){_0x2111c7=_0x180d92[_0x5cf594];if(_['isUndefined'](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']])){_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']]=new Agent(_0x2111c7);}else{_0x4cfc34[_0x76aa('0x15')](_0x4cfc34[_0x76aa('0x8')][_0x2111c7['id']],_0x2111c7);}}}return _0x4cfc34[_0x76aa('0x8')];};};Realtime[_0x76aa('0x14')]['initIntervals']=function(){var _0x5d6202=this;return function(_0x256636){if(_0x256636){freeIsNotKey(_0x256636,_0x5d6202[_0x76aa('0x18')],'id');for(var _0xf0711=0x0,_0x15b931={},_0x15109b={};_0xf0711<_0x256636[_0x76aa('0x17')];_0xf0711+=0x1){_0x15b931=_0x256636[_0xf0711];if(_[_0x76aa('0x19')](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']])){_0x5d6202[_0x76aa('0x18')][_0x15b931['id']]=new Interval(_0x15b931);}else{_0x5d6202['mergeFromDatabase'](_0x5d6202[_0x76aa('0x18')][_0x15b931['id']],_0x15b931);}}}return _0x5d6202[_0x76aa('0x18')];};};Realtime[_0x76aa('0x14')]['initOpenchannelQueues']=function(){var _0x41463a=this;return function(_0x189cb6){if(_0x189cb6){freeIsNotKey(_0x189cb6,_0x41463a[_0x76aa('0x9')],'id');for(var _0x2bd2c6=0x0,_0x29c50c={},_0xc1044c={};_0x2bd2c6<_0x189cb6[_0x76aa('0x17')];_0x2bd2c6+=0x1){_0x29c50c=_0x189cb6[_0x2bd2c6];if(_[_0x76aa('0x19')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']])){_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]=new OpenchannelQueue(_0x29c50c);}else{_0x41463a[_0x76aa('0x15')](_0x41463a[_0x76aa('0x9')][_0x29c50c['id']],_0x29c50c);}_0x41463a[_0x76aa('0x9')][_0x29c50c['id']]['updateRouting']();_0x41463a[_0x76aa('0x9')][_0x29c50c['id']][_0x76aa('0x1a')]();}}return _0x41463a[_0x76aa('0x9')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1b')]=function(){var _0x2f9316=this;return function(_0x25a803){if(_0x25a803){freeIsNotKey(_0x25a803,_0x2f9316[_0x76aa('0xa')],'id');for(var _0xd12a99=0x0,_0x1bdc3d={},_0x545b06={};_0xd12a99<_0x25a803[_0x76aa('0x17')];_0xd12a99+=0x1){_0x1bdc3d=_0x25a803[_0xd12a99];if(_['isUndefined'](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']])){_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']]=new ChatQueue(_0x1bdc3d);}else{_0x2f9316[_0x76aa('0x15')](_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']],_0x1bdc3d);}_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1c')]();_0x2f9316[_0x76aa('0xa')][_0x1bdc3d['id']][_0x76aa('0x1a')]();}}return _0x2f9316[_0x76aa('0xa')];};};Realtime[_0x76aa('0x14')]['initSmsQueues']=function(){var _0x430ad6=this;return function(_0x5532c7){if(_0x5532c7){freeIsNotKey(_0x5532c7,_0x430ad6[_0x76aa('0xb')],'id');for(var _0x928ccf=0x0,_0x458ac3={},_0x38ecd1={};_0x928ccf<_0x5532c7[_0x76aa('0x17')];_0x928ccf+=0x1){_0x458ac3=_0x5532c7[_0x928ccf];if(_['isUndefined'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']])){_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']]=new SmsQueue(_0x458ac3);}else{_0x430ad6['mergeFromDatabase'](_0x430ad6[_0x76aa('0xb')][_0x458ac3['id']],_0x458ac3);}_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1c')]();_0x430ad6['smsQueues'][_0x458ac3['id']][_0x76aa('0x1a')]();}}return _0x430ad6['smsQueues'];};};Realtime['prototype'][_0x76aa('0x1d')]=function(){var _0x282c56=this;return function(_0x198fcb){if(_0x198fcb){freeIsNotKey(_0x198fcb,_0x282c56[_0x76aa('0x1e')],'id');for(var _0x595a0f=0x0,_0x592596={},_0xdb18d3={};_0x595a0f<_0x198fcb[_0x76aa('0x17')];_0x595a0f+=0x1){_0x592596=_0x198fcb[_0x595a0f];if(_[_0x76aa('0x19')](_0x282c56[_0x76aa('0x1e')][_0x592596['id']])){_0x282c56[_0x76aa('0x1e')][_0x592596['id']]=new MailQueue(_0x592596);}else{_0x282c56['mergeFromDatabase'](_0x282c56[_0x76aa('0x1e')][_0x592596['id']],_0x592596);}_0x282c56['mailQueues'][_0x592596['id']]['updateRouting']();_0x282c56[_0x76aa('0x1e')][_0x592596['id']][_0x76aa('0x1a')]();}}return _0x282c56[_0x76aa('0x1e')];};};Realtime[_0x76aa('0x14')]['initFaxQueues']=function(){var _0x401c07=this;return function(_0x1c22f7){if(_0x1c22f7){freeIsNotKey(_0x1c22f7,_0x401c07[_0x76aa('0xc')],'id');for(var _0x4e131a=0x0,_0x113770={},_0x1638db={};_0x4e131a<_0x1c22f7[_0x76aa('0x17')];_0x4e131a+=0x1){_0x113770=_0x1c22f7[_0x4e131a];if(_[_0x76aa('0x19')](_0x401c07[_0x76aa('0xc')][_0x113770['id']])){_0x401c07[_0x76aa('0xc')][_0x113770['id']]=new FaxQueue(_0x113770);}else{_0x401c07[_0x76aa('0x15')](_0x401c07[_0x76aa('0xc')][_0x113770['id']],_0x113770);}_0x401c07[_0x76aa('0xc')][_0x113770['id']]['updateRouting']();_0x401c07[_0x76aa('0xc')][_0x113770['id']][_0x76aa('0x1a')]();}}return _0x401c07[_0x76aa('0xc')];};};Realtime[_0x76aa('0x14')][_0x76aa('0x1f')]=function(){var _0x2957aa=this;return function(_0x572fdb){if(_0x572fdb){freeIsNotKey(_0x572fdb,_0x2957aa['whatsappQueues'],'id');for(var _0x153a47=0x0,_0x262906={},_0x426454={};_0x153a47<_0x572fdb[_0x76aa('0x17')];_0x153a47+=0x1){_0x262906=_0x572fdb[_0x153a47];if(_['isUndefined'](_0x2957aa[_0x76aa('0xd')][_0x262906['id']])){_0x2957aa[_0x76aa('0xd')][_0x262906['id']]=new WhatsappQueue(_0x262906);}else{_0x2957aa[_0x76aa('0x15')](_0x2957aa[_0x76aa('0xd')][_0x262906['id']],_0x262906);}_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRouting']();_0x2957aa[_0x76aa('0xd')][_0x262906['id']]['updateRealtime']();}}return _0x2957aa[_0x76aa('0xd')];};};module['exports']=Realtime;
\ No newline at end of file