Built motion from commit (unavailable).|2.6.0
[motion2.git] / server / services / routing / server / applications / strategy / util.js
index 563b6f7..c1ab90d 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7a4f=['msg','error','[%s][QUEUE]\x20%s','message','notification:%s','save','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','online','Pause','PAUSE','Capacity','hasOwnProperty','CurrentCapacity','showNotification','writeLog','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','defaults','localhost','socket.io-emitter','emit','format','user:%s','user:save','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','getMustacheRender'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0x7a4f,0x17a));var _0xf7a4=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0x7a4f[_0x3861f7];return _0x50879f;};'use strict';var _=require('lodash');var util=require(_0xf7a4('0x0'));var utils=require(_0xf7a4('0x1'));var Mustache=require('mustache');var Redis=require(_0xf7a4('0x2'));var config=require(_0xf7a4('0x3'));var logger=require(_0xf7a4('0x4'))(_0xf7a4('0x5'));config['redis']=_[_0xf7a4('0x6')](config['redis'],{'host':_0xf7a4('0x7'),'port':0x18eb});var io=require(_0xf7a4('0x8'))(new Redis(config['redis']));function emit(_0x28e789,_0x281e16,_0x1b919c){io['to'](_0x28e789)[_0xf7a4('0x9')](_0x281e16,_0x1b919c);}function sendNotification(_0x166bdd,_0x228dae,_0x1df639,_0x42dfb3,_0x2f6f53,_0x180eb9){io['to'](util[_0xf7a4('0xa')](_0xf7a4('0xb'),_0x42dfb3['name']))[_0xf7a4('0x9')](_0xf7a4('0xc'),_0x42dfb3);var _0x55d31d=_0x180eb9||{};var _0x28294b=_0x1df639[_0xf7a4('0xd')]('.');var _0x5f4dbf={'uniqueid':_0x228dae,'channel':_0x28294b[0x0],'id':_0x28294b[0x1],'title':_0x28294b[0x0]+_0xf7a4('0xe'),'interactionId':_0x28294b[0x2],'queue':_0x2f6f53?_0x2f6f53[_0xf7a4('0xf')]:null,'sound':_0x55d31d[_0xf7a4('0x10')][_0xf7a4('0x11')],'shake':_0x55d31d[_0xf7a4('0x10')][_0xf7a4('0x12')]};try{if(!_0x55d31d[_0xf7a4('0x13')]){_0x55d31d[_0xf7a4('0x13')]={};}if(_0x2f6f53){_0x55d31d[_0xf7a4('0x13')]['queue']=_0x2f6f53;}else if(_0x55d31d[_0xf7a4('0x13')][_0xf7a4('0x14')]){delete _0x55d31d['body'][_0xf7a4('0x14')];}_0x5f4dbf['msg']=utils[_0xf7a4('0x15')](_0x55d31d[_0xf7a4('0x10')]['notificationTemplate'],_0x55d31d);}catch(_0x51a6fd){_0x5f4dbf[_0xf7a4('0x16')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xf7a4('0x17')](util['format'](_0xf7a4('0x18'),_0x228dae,_0x51a6fd[_0xf7a4('0x19')]));}io['to'](util[_0xf7a4('0xa')](_0xf7a4('0xb'),_0x42dfb3[_0xf7a4('0xf')]))[_0xf7a4('0x9')](util['format'](_0xf7a4('0x1a'),_0x166bdd?_0xf7a4('0x1b'):'remove'),_0x5f4dbf);}function writeLog(_0x42e04f,_0x1a1e41,_0x4621b0){return logger[_0xf7a4('0x1c')](util['format'](_0xf7a4('0x1d'),_0x42e04f,_0x1a1e41['name'],_0x4621b0));}exports[_0xf7a4('0x1e')]=function(_0x2a59ae,_0xfdbd60,_0x299eb7,_0x2a36c6){if(_0xfdbd60[_0xf7a4('0x1f')]){writeLog(_0x2a59ae,_0xfdbd60,'BUSY');return![];}if(!_0xfdbd60[_0xf7a4('0x20')]){writeLog(_0x2a59ae,_0xfdbd60,'OFFLINE');return![];}if(_0xfdbd60[_0x299eb7+_0xf7a4('0x21')]){writeLog(_0x2a59ae,_0xfdbd60,_0xf7a4('0x22'));return![];}if(_0x2a36c6&&_0xfdbd60['hasOwnProperty'](_0x299eb7+_0xf7a4('0x23'))&&_0xfdbd60[_0xf7a4('0x24')](_0x299eb7+_0xf7a4('0x25'))){if(_0xfdbd60[_0x299eb7+_0xf7a4('0x23')]>0x0&&_0xfdbd60[_0x299eb7+_0xf7a4('0x25')]>=_0xfdbd60[_0x299eb7+_0xf7a4('0x23')]){writeLog(_0x2a59ae,_0xfdbd60,_0x299eb7['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0xf7a4('0x26')]=function(_0x4984f5,_0x4df6d9,_0x1e242c,_0x5e8409,_0xeef2d5){return sendNotification(!![],_0x4984f5,_0x4df6d9,_0x1e242c,_0x5e8409,_0xeef2d5);};exports['hideNotification']=function(_0x20f533,_0x3b5615,_0x5f1eb3,_0x2dadb0,_0x142835){return sendNotification(![],_0x20f533,_0x3b5615,_0x5f1eb3,_0x2dadb0,_0x142835);};exports[_0xf7a4('0x27')]=writeLog;
\ No newline at end of file
+var _0xa737=['format','user:%s','name','emit','user:save','split','notificationSound','account','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','message','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','BUSY','online','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','lodash','util','../utils','mustache','ioredis','../../../../../config/environment','routing','defaults','redis','localhost','socket.io-emitter'];(function(_0x3c6d44,_0x17b9d4){var _0x4aae83=function(_0x1d9004){while(--_0x1d9004){_0x3c6d44['push'](_0x3c6d44['shift']());}};_0x4aae83(++_0x17b9d4);}(_0xa737,0x154));var _0x7a73=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0xa737[_0x725b8e];return _0x43ac45;};'use strict';var _=require(_0x7a73('0x0'));var util=require(_0x7a73('0x1'));var utils=require(_0x7a73('0x2'));var Mustache=require(_0x7a73('0x3'));var Redis=require(_0x7a73('0x4'));var config=require(_0x7a73('0x5'));var logger=require('../../../../../config/logger')(_0x7a73('0x6'));config['redis']=_[_0x7a73('0x7')](config[_0x7a73('0x8')],{'host':_0x7a73('0x9'),'port':0x18eb});var io=require(_0x7a73('0xa'))(new Redis(config[_0x7a73('0x8')]));function emit(_0xcffeb9,_0x5d66f4,_0x186e8b){io['to'](_0xcffeb9)['emit'](_0x5d66f4,_0x186e8b);}function sendNotification(_0x45afe4,_0x1cac79,_0x184169,_0x3c51de,_0x4f3106,_0xf9a8c){io['to'](util[_0x7a73('0xb')](_0x7a73('0xc'),_0x3c51de[_0x7a73('0xd')]))[_0x7a73('0xe')](_0x7a73('0xf'),_0x3c51de);var _0x7659cb=_0xf9a8c||{};var _0x236f3c=_0x184169[_0x7a73('0x10')]('.');var _0x2fe021={'uniqueid':_0x1cac79,'channel':_0x236f3c[0x0],'id':_0x236f3c[0x1],'title':_0x236f3c[0x0]+'\x20interaction','interactionId':_0x236f3c[0x2],'queue':_0x4f3106?_0x4f3106[_0x7a73('0xd')]:null,'sound':_0x7659cb['account'][_0x7a73('0x11')],'shake':_0x7659cb[_0x7a73('0x12')][_0x7a73('0x13')]};try{if(!_0x7659cb[_0x7a73('0x14')]){_0x7659cb['body']={};}if(_0x4f3106){_0x7659cb[_0x7a73('0x14')][_0x7a73('0x15')]=_0x4f3106;}else if(_0x7659cb[_0x7a73('0x14')][_0x7a73('0x15')]){delete _0x7659cb[_0x7a73('0x14')][_0x7a73('0x15')];}_0x2fe021[_0x7a73('0x16')]=utils['getMustacheRender'](_0x7659cb[_0x7a73('0x12')]['notificationTemplate'],_0x7659cb);}catch(_0x28456d){_0x2fe021['msg']=_0x7a73('0x17');logger[_0x7a73('0x18')](util[_0x7a73('0xb')]('[%s][QUEUE]\x20%s',_0x1cac79,_0x28456d[_0x7a73('0x19')]));}io['to'](util['format']('user:%s',_0x3c51de[_0x7a73('0xd')]))[_0x7a73('0xe')](util[_0x7a73('0xb')]('notification:%s',_0x45afe4?_0x7a73('0x1a'):_0x7a73('0x1b')),_0x2fe021);}function writeLog(_0x3ecb70,_0x4818ed,_0x4741d7){return logger[_0x7a73('0x1c')](util[_0x7a73('0xb')](_0x7a73('0x1d'),_0x3ecb70,_0x4818ed[_0x7a73('0xd')],_0x4741d7));}exports[_0x7a73('0x1e')]=function(_0x16dc41,_0x1db791,_0x27ee73,_0x22576e){if(_0x1db791['busy']){writeLog(_0x16dc41,_0x1db791,_0x7a73('0x1f'));return![];}if(!_0x1db791[_0x7a73('0x20')]){writeLog(_0x16dc41,_0x1db791,'OFFLINE');return![];}if(_0x1db791[_0x27ee73+'Pause']){writeLog(_0x16dc41,_0x1db791,_0x7a73('0x21'));return![];}if(_0x22576e&&_0x1db791[_0x7a73('0x22')](_0x27ee73+_0x7a73('0x23'))&&_0x1db791['hasOwnProperty'](_0x27ee73+_0x7a73('0x24'))){if(_0x1db791[_0x27ee73+_0x7a73('0x23')]>0x0&&_0x1db791[_0x27ee73+_0x7a73('0x24')]>=_0x1db791[_0x27ee73+_0x7a73('0x23')]){writeLog(_0x16dc41,_0x1db791,_0x27ee73[_0x7a73('0x25')]()+_0x7a73('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x17fb84,_0x2c49bf,_0x4d1f94,_0x325d23,_0x2eedd3){return sendNotification(!![],_0x17fb84,_0x2c49bf,_0x4d1f94,_0x325d23,_0x2eedd3);};exports['hideNotification']=function(_0x348c10,_0x2fe28e,_0x10a403,_0x203bd8,_0xdc6a6f){return sendNotification(![],_0x348c10,_0x2fe28e,_0x10a403,_0x203bd8,_0xdc6a6f);};exports['writeLog']=writeLog;
\ No newline at end of file