Built motion from commit 14588770.|2.5.38
[motion2.git] / server / services / routing / server / applications / strategy / util.js
index fae2520..9a29f64 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x5334=['error','format','message','save','remove','info','isAgentAvailable','busy','OFFLINE','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','util','../utils','mustache','ioredis','../../../../../config/logger','redis','defaults','emit','user:%s','name','user:save','\x20interaction','account','notificationShake','body','queue','getMustacheRender','notificationTemplate','msg'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5334,0x84));var _0x4533=function(_0x3949b0,_0x5ef0f1){_0x3949b0=_0x3949b0-0x0;var _0x4ceff6=_0x5334[_0x3949b0];return _0x4ceff6;};'use strict';var _=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var utils=require(_0x4533('0x2'));var Mustache=require(_0x4533('0x3'));var Redis=require(_0x4533('0x4'));var config=require('../../../../../config/environment');var logger=require(_0x4533('0x5'))('routing');config[_0x4533('0x6')]=_[_0x4533('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x4533('0x6')]));function emit(_0x4dea06,_0x4d89e7,_0x487906){io['to'](_0x4dea06)[_0x4533('0x8')](_0x4d89e7,_0x487906);}function sendNotification(_0x42f94b,_0x300877,_0x2489b6,_0x31018b,_0x21b22f,_0xd417){io['to'](util['format'](_0x4533('0x9'),_0x31018b[_0x4533('0xa')]))[_0x4533('0x8')](_0x4533('0xb'),_0x31018b);var _0x5465bf=_0xd417||{};var _0x7b2420=_0x2489b6['split']('.');var _0xc63e3={'uniqueid':_0x300877,'channel':_0x7b2420[0x0],'id':_0x7b2420[0x1],'title':_0x7b2420[0x0]+_0x4533('0xc'),'interactionId':_0x7b2420[0x2],'queue':_0x21b22f?_0x21b22f[_0x4533('0xa')]:null,'sound':_0x5465bf[_0x4533('0xd')]['notificationSound'],'shake':_0x5465bf[_0x4533('0xd')][_0x4533('0xe')]};try{if(!_0x5465bf[_0x4533('0xf')]){_0x5465bf[_0x4533('0xf')]={};}if(_0x21b22f){_0x5465bf['body'][_0x4533('0x10')]=_0x21b22f;}else if(_0x5465bf['body']['queue']){delete _0x5465bf[_0x4533('0xf')][_0x4533('0x10')];}_0xc63e3['msg']=utils[_0x4533('0x11')](_0x5465bf[_0x4533('0xd')][_0x4533('0x12')],_0x5465bf);}catch(_0x551b0d){_0xc63e3[_0x4533('0x13')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x4533('0x14')](util[_0x4533('0x15')]('[%s][QUEUE]\x20%s',_0x300877,_0x551b0d[_0x4533('0x16')]));}io['to'](util['format']('user:%s',_0x31018b[_0x4533('0xa')]))[_0x4533('0x8')](util['format']('notification:%s',_0x42f94b?_0x4533('0x17'):_0x4533('0x18')),_0xc63e3);}function writeLog(_0x3467ba,_0x1b08fa,_0x6766eb){return logger[_0x4533('0x19')](util[_0x4533('0x15')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x3467ba,_0x1b08fa[_0x4533('0xa')],_0x6766eb));}exports[_0x4533('0x1a')]=function(_0x2901f1,_0x4aa438,_0x513011,_0x138fd9){if(_0x4aa438[_0x4533('0x1b')]){writeLog(_0x2901f1,_0x4aa438,'BUSY');return![];}if(!_0x4aa438['online']){writeLog(_0x2901f1,_0x4aa438,_0x4533('0x1c'));return![];}if(_0x4aa438[_0x513011+_0x4533('0x1d')]){writeLog(_0x2901f1,_0x4aa438,_0x4533('0x1e'));return![];}if(_0x138fd9&&_0x4aa438['hasOwnProperty'](_0x513011+_0x4533('0x1f'))&&_0x4aa438[_0x4533('0x20')](_0x513011+_0x4533('0x21'))){if(_0x4aa438[_0x513011+_0x4533('0x1f')]>0x0&&_0x4aa438[_0x513011+_0x4533('0x21')]>=_0x4aa438[_0x513011+_0x4533('0x1f')]){writeLog(_0x2901f1,_0x4aa438,_0x513011[_0x4533('0x22')]()+_0x4533('0x23'));return![];}}return!![];};exports[_0x4533('0x24')]=function(_0x5f16bb,_0x5c1e24,_0xa2e602,_0x5aaf2d,_0x3fd76a){return sendNotification(!![],_0x5f16bb,_0x5c1e24,_0xa2e602,_0x5aaf2d,_0x3fd76a);};exports['hideNotification']=function(_0x159fea,_0x42ba2d,_0x38706b,_0x4300c1,_0x252a44){return sendNotification(![],_0x159fea,_0x42ba2d,_0x38706b,_0x4300c1,_0x252a44);};exports[_0x4533('0x25')]=writeLog;
\ No newline at end of file
+var _0xeda8=['OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','writeLog','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','emit','format','user:%s','name','user:save','split','\x20interaction','account','notificationSound','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY'];(function(_0x15a2cb,_0x571a10){var _0x26d3f6=function(_0x2e313f){while(--_0x2e313f){_0x15a2cb['push'](_0x15a2cb['shift']());}};_0x26d3f6(++_0x571a10);}(_0xeda8,0x104));var _0x8eda=function(_0x176dfc,_0x3191a4){_0x176dfc=_0x176dfc-0x0;var _0x351cf6=_0xeda8[_0x176dfc];return _0x351cf6;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var utils=require('../utils');var Mustache=require(_0x8eda('0x2'));var Redis=require(_0x8eda('0x3'));var config=require(_0x8eda('0x4'));var logger=require(_0x8eda('0x5'))(_0x8eda('0x6'));config[_0x8eda('0x7')]=_[_0x8eda('0x8')](config[_0x8eda('0x7')],{'host':_0x8eda('0x9'),'port':0x18eb});var io=require(_0x8eda('0xa'))(new Redis(config[_0x8eda('0x7')]));function emit(_0x32abe8,_0x4e2ebb,_0x28b721){io['to'](_0x32abe8)[_0x8eda('0xb')](_0x4e2ebb,_0x28b721);}function sendNotification(_0x5aa93d,_0x6b544f,_0x4be9df,_0x4f7893,_0x488849,_0x4fbf0a){io['to'](util[_0x8eda('0xc')](_0x8eda('0xd'),_0x4f7893[_0x8eda('0xe')]))['emit'](_0x8eda('0xf'),_0x4f7893);var _0x5a80ca=_0x4fbf0a||{};var _0x3f34c=_0x4be9df[_0x8eda('0x10')]('.');var _0x2fdec0={'uniqueid':_0x6b544f,'channel':_0x3f34c[0x0],'id':_0x3f34c[0x1],'title':_0x3f34c[0x0]+_0x8eda('0x11'),'interactionId':_0x3f34c[0x2],'queue':_0x488849?_0x488849[_0x8eda('0xe')]:null,'sound':_0x5a80ca[_0x8eda('0x12')][_0x8eda('0x13')],'shake':_0x5a80ca[_0x8eda('0x12')]['notificationShake']};try{if(!_0x5a80ca['body']){_0x5a80ca[_0x8eda('0x14')]={};}if(_0x488849){_0x5a80ca[_0x8eda('0x14')]['queue']=_0x488849;}else if(_0x5a80ca[_0x8eda('0x14')][_0x8eda('0x15')]){delete _0x5a80ca[_0x8eda('0x14')]['queue'];}_0x2fdec0[_0x8eda('0x16')]=utils['getMustacheRender'](_0x5a80ca[_0x8eda('0x12')]['notificationTemplate'],_0x5a80ca);}catch(_0x24aed4){_0x2fdec0['msg']=_0x8eda('0x17');logger[_0x8eda('0x18')](util['format']('[%s][QUEUE]\x20%s',_0x6b544f,_0x24aed4[_0x8eda('0x19')]));}io['to'](util[_0x8eda('0xc')](_0x8eda('0xd'),_0x4f7893[_0x8eda('0xe')]))[_0x8eda('0xb')](util[_0x8eda('0xc')](_0x8eda('0x1a'),_0x5aa93d?_0x8eda('0x1b'):_0x8eda('0x1c')),_0x2fdec0);}function writeLog(_0x232786,_0x279ade,_0x57f336){return logger[_0x8eda('0x1d')](util['format'](_0x8eda('0x1e'),_0x232786,_0x279ade['name'],_0x57f336));}exports[_0x8eda('0x1f')]=function(_0x2dab25,_0x4f3e0a,_0x58e54b,_0x56dba4){if(_0x4f3e0a[_0x8eda('0x20')]){writeLog(_0x2dab25,_0x4f3e0a,_0x8eda('0x21'));return![];}if(!_0x4f3e0a['online']){writeLog(_0x2dab25,_0x4f3e0a,_0x8eda('0x22'));return![];}if(_0x4f3e0a[_0x58e54b+_0x8eda('0x23')]){writeLog(_0x2dab25,_0x4f3e0a,'PAUSE');return![];}if(_0x56dba4&&_0x4f3e0a[_0x8eda('0x24')](_0x58e54b+_0x8eda('0x25'))&&_0x4f3e0a[_0x8eda('0x24')](_0x58e54b+_0x8eda('0x26'))){if(_0x4f3e0a[_0x58e54b+_0x8eda('0x25')]>0x0&&_0x4f3e0a[_0x58e54b+'CurrentCapacity']>=_0x4f3e0a[_0x58e54b+_0x8eda('0x25')]){writeLog(_0x2dab25,_0x4f3e0a,_0x58e54b['toUpperCase']()+_0x8eda('0x27'));return![];}}return!![];};exports[_0x8eda('0x28')]=function(_0x8337b4,_0x567f69,_0x23e892,_0x244400,_0x1dd12){return sendNotification(!![],_0x8337b4,_0x567f69,_0x23e892,_0x244400,_0x1dd12);};exports['hideNotification']=function(_0x1616ea,_0x11a999,_0x5dd315,_0x27d2ce,_0x29e6f4){return sendNotification(![],_0x1616ea,_0x11a999,_0x5dd315,_0x27d2ce,_0x29e6f4);};exports[_0x8eda('0x29')]=writeLog;
\ No newline at end of file