Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / services / routing / server / applications / strategy / util.js
index 2cb754c..be8e2b4 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x25a8=['hasOwnProperty','CurrentCapacity','Capacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','util','../utils','mustache','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','user:%s','name','emit','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','format','message','notification:%s','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause'];(function(_0x33466d,_0x4d7e8c){var _0x401b25=function(_0x13a18d){while(--_0x13a18d){_0x33466d['push'](_0x33466d['shift']());}};_0x401b25(++_0x4d7e8c);}(_0x25a8,0x126));var _0x825a=function(_0x5a4cea,_0x2fc40f){_0x5a4cea=_0x5a4cea-0x0;var _0x239ff0=_0x25a8[_0x5a4cea];return _0x239ff0;};'use strict';var _=require('lodash');var util=require(_0x825a('0x0'));var utils=require(_0x825a('0x1'));var Mustache=require(_0x825a('0x2'));var Redis=require('ioredis');var config=require(_0x825a('0x3'));var logger=require('../../../../../config/logger')(_0x825a('0x4'));config[_0x825a('0x5')]=_[_0x825a('0x6')](config[_0x825a('0x5')],{'host':_0x825a('0x7'),'port':0x18eb});var io=require(_0x825a('0x8'))(new Redis(config[_0x825a('0x5')]));function emit(_0x29a13c,_0x31be45,_0x215c51){io['to'](_0x29a13c)['emit'](_0x31be45,_0x215c51);}function sendNotification(_0x13b61d,_0x55c1d0,_0x579b53,_0x48696e,_0x1d1d7a,_0x460611){io['to'](util['format'](_0x825a('0x9'),_0x48696e[_0x825a('0xa')]))[_0x825a('0xb')]('user:save',_0x48696e);var _0x8add5d=_0x460611||{};var _0x1eec2d=_0x579b53['split']('.');var _0x558567={'uniqueid':_0x55c1d0,'channel':_0x1eec2d[0x0],'id':_0x1eec2d[0x1],'title':_0x1eec2d[0x0]+'\x20interaction','interactionId':_0x1eec2d[0x2],'queue':_0x1d1d7a?_0x1d1d7a[_0x825a('0xa')]:null,'sound':_0x8add5d[_0x825a('0xc')][_0x825a('0xd')],'shake':_0x8add5d[_0x825a('0xc')][_0x825a('0xe')]};try{if(!_0x8add5d['body']){_0x8add5d[_0x825a('0xf')]={};}if(_0x1d1d7a){_0x8add5d[_0x825a('0xf')][_0x825a('0x10')]=_0x1d1d7a;}else if(_0x8add5d[_0x825a('0xf')][_0x825a('0x10')]){delete _0x8add5d[_0x825a('0xf')][_0x825a('0x10')];}_0x558567[_0x825a('0x11')]=utils[_0x825a('0x12')](_0x8add5d['account'][_0x825a('0x13')],_0x8add5d);}catch(_0x58e23d){_0x558567[_0x825a('0x11')]=_0x825a('0x14');logger['error'](util[_0x825a('0x15')]('[%s][QUEUE]\x20%s',_0x55c1d0,_0x58e23d[_0x825a('0x16')]));}io['to'](util['format'](_0x825a('0x9'),_0x48696e[_0x825a('0xa')]))[_0x825a('0xb')](util[_0x825a('0x15')](_0x825a('0x17'),_0x13b61d?_0x825a('0x18'):_0x825a('0x19')),_0x558567);}function writeLog(_0x59946d,_0x513511,_0x1ff559){return logger[_0x825a('0x1a')](util['format'](_0x825a('0x1b'),_0x59946d,_0x513511[_0x825a('0xa')],_0x1ff559));}exports[_0x825a('0x1c')]=function(_0x3466f8,_0x105cd7,_0x3eace3,_0x312342){if(_0x105cd7[_0x825a('0x1d')]){writeLog(_0x3466f8,_0x105cd7,_0x825a('0x1e'));return![];}if(!_0x105cd7[_0x825a('0x1f')]){writeLog(_0x3466f8,_0x105cd7,_0x825a('0x20'));return![];}if(_0x105cd7[_0x3eace3+_0x825a('0x21')]){writeLog(_0x3466f8,_0x105cd7,'PAUSE');return![];}if(_0x312342&&_0x105cd7[_0x825a('0x22')](_0x3eace3+'Capacity')&&_0x105cd7['hasOwnProperty'](_0x3eace3+_0x825a('0x23'))){if(_0x105cd7[_0x3eace3+_0x825a('0x24')]>0x0&&_0x105cd7[_0x3eace3+'CurrentCapacity']>=_0x105cd7[_0x3eace3+_0x825a('0x24')]){writeLog(_0x3466f8,_0x105cd7,_0x3eace3['toUpperCase']()+_0x825a('0x25'));return![];}}return!![];};exports[_0x825a('0x26')]=function(_0x23beed,_0x3e6bf7,_0x46a28d,_0x16a359,_0x5494a0){return sendNotification(!![],_0x23beed,_0x3e6bf7,_0x46a28d,_0x16a359,_0x5494a0);};exports[_0x825a('0x27')]=function(_0x490532,_0x1327cc,_0xa52de7,_0x56e614,_0xd0e237){return sendNotification(![],_0x490532,_0x1327cc,_0xa52de7,_0x56e614,_0xd0e237);};exports[_0x825a('0x28')]=writeLog;
\ No newline at end of file
+var _0xe605=['notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','[%s][QUEUE]\x20%s','notification:%s','save','remove','isAgentAvailable','busy','online','OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','writeLog','lodash','util','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','format','user:%s','emit','split','\x20interaction','name','account'];(function(_0xea9d95,_0x1a1003){var _0x12aa1f=function(_0x19abd0){while(--_0x19abd0){_0xea9d95['push'](_0xea9d95['shift']());}};_0x12aa1f(++_0x1a1003);}(_0xe605,0x92));var _0x5e60=function(_0x32bdca,_0x300d5b){_0x32bdca=_0x32bdca-0x0;var _0x4830d0=_0xe605[_0x32bdca];return _0x4830d0;};'use strict';var _=require(_0x5e60('0x0'));var util=require(_0x5e60('0x1'));var utils=require('../utils');var Mustache=require(_0x5e60('0x2'));var Redis=require(_0x5e60('0x3'));var config=require(_0x5e60('0x4'));var logger=require(_0x5e60('0x5'))(_0x5e60('0x6'));config[_0x5e60('0x7')]=_[_0x5e60('0x8')](config[_0x5e60('0x7')],{'host':_0x5e60('0x9'),'port':0x18eb});var io=require(_0x5e60('0xa'))(new Redis(config[_0x5e60('0x7')]));function emit(_0x168a14,_0x4e3501,_0x1c5a6f){io['to'](_0x168a14)['emit'](_0x4e3501,_0x1c5a6f);}function sendNotification(_0x593118,_0x53dccb,_0x43f7eb,_0xe93f9c,_0x150a51,_0x2c5425){io['to'](util[_0x5e60('0xb')](_0x5e60('0xc'),_0xe93f9c['name']))[_0x5e60('0xd')]('user:save',_0xe93f9c);var _0x1d2558=_0x2c5425||{};var _0x15035f=_0x43f7eb[_0x5e60('0xe')]('.');var _0x51e7f6={'uniqueid':_0x53dccb,'channel':_0x15035f[0x0],'id':_0x15035f[0x1],'title':_0x15035f[0x0]+_0x5e60('0xf'),'interactionId':_0x15035f[0x2],'queue':_0x150a51?_0x150a51[_0x5e60('0x10')]:null,'sound':_0x1d2558[_0x5e60('0x11')][_0x5e60('0x12')],'shake':_0x1d2558[_0x5e60('0x11')][_0x5e60('0x13')]};try{if(!_0x1d2558['body']){_0x1d2558[_0x5e60('0x14')]={};}if(_0x150a51){_0x1d2558[_0x5e60('0x14')][_0x5e60('0x15')]=_0x150a51;}else if(_0x1d2558[_0x5e60('0x14')]['queue']){delete _0x1d2558[_0x5e60('0x14')]['queue'];}_0x51e7f6[_0x5e60('0x16')]=utils[_0x5e60('0x17')](_0x1d2558['account'][_0x5e60('0x18')],_0x1d2558);}catch(_0x3e1a44){_0x51e7f6[_0x5e60('0x16')]=_0x5e60('0x19');logger['error'](util[_0x5e60('0xb')](_0x5e60('0x1a'),_0x53dccb,_0x3e1a44['message']));}io['to'](util[_0x5e60('0xb')](_0x5e60('0xc'),_0xe93f9c[_0x5e60('0x10')]))[_0x5e60('0xd')](util[_0x5e60('0xb')](_0x5e60('0x1b'),_0x593118?_0x5e60('0x1c'):_0x5e60('0x1d')),_0x51e7f6);}function writeLog(_0x3282e4,_0x45f1a6,_0x228f13){return logger['info'](util[_0x5e60('0xb')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x3282e4,_0x45f1a6[_0x5e60('0x10')],_0x228f13));}exports[_0x5e60('0x1e')]=function(_0x2b0bae,_0x144808,_0x34e98d,_0x2a499e){if(_0x144808[_0x5e60('0x1f')]){writeLog(_0x2b0bae,_0x144808,'BUSY');return![];}if(!_0x144808[_0x5e60('0x20')]){writeLog(_0x2b0bae,_0x144808,_0x5e60('0x21'));return![];}if(_0x144808[_0x34e98d+_0x5e60('0x22')]){writeLog(_0x2b0bae,_0x144808,'PAUSE');return![];}if(_0x2a499e&&_0x144808[_0x5e60('0x23')](_0x34e98d+_0x5e60('0x24'))&&_0x144808[_0x5e60('0x23')](_0x34e98d+_0x5e60('0x25'))){if(_0x144808[_0x34e98d+'Capacity']>0x0&&_0x144808[_0x34e98d+_0x5e60('0x25')]>=_0x144808[_0x34e98d+'Capacity']){writeLog(_0x2b0bae,_0x144808,_0x34e98d[_0x5e60('0x26')]()+_0x5e60('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x46691f,_0x19e5ab,_0x5b1b46,_0x1ee931,_0xac9c7a){return sendNotification(!![],_0x46691f,_0x19e5ab,_0x5b1b46,_0x1ee931,_0xac9c7a);};exports['hideNotification']=function(_0x5431a8,_0x52f668,_0xf25956,_0x235cc7,_0x2e8e9e){return sendNotification(![],_0x5431a8,_0x52f668,_0xf25956,_0x235cc7,_0x2e8e9e);};exports[_0x5e60('0x28')]=writeLog;
\ No newline at end of file