Built motion from commit 639a1a7f.|2.6.19
[motion2.git] / server / services / routing / server / applications / strategy / util.js
index b1de0db..2c0deb2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8d0e=['localhost','format','user:%s','emit','user:save','\x20interaction','name','account','notificationSound','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','notification:%s','save','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','../../../../../config/logger','routing','redis','defaults'];(function(_0x36905c,_0xb31581){var _0x5712fb=function(_0x29e126){while(--_0x29e126){_0x36905c['push'](_0x36905c['shift']());}};_0x5712fb(++_0xb31581);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x1aa42d,_0xa00e80){_0x1aa42d=_0x1aa42d-0x0;var _0x48b4eb=_0x8d0e[_0x1aa42d];return _0x48b4eb;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var utils=require(_0xe8d0('0x2'));var Redis=require(_0xe8d0('0x3'));var config=require(_0xe8d0('0x4'));var logger=require(_0xe8d0('0x5'))(_0xe8d0('0x6'));config[_0xe8d0('0x7')]=_[_0xe8d0('0x8')](config['redis'],{'host':_0xe8d0('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function sendNotification(_0x2e2985,_0x92483d,_0x469d37,_0xcc03d0,_0x2b6dce,_0x13aa63){io['to'](util[_0xe8d0('0xa')](_0xe8d0('0xb'),_0xcc03d0['name']))[_0xe8d0('0xc')](_0xe8d0('0xd'),_0xcc03d0);var _0x463159=_0x13aa63||{};var _0x599bc3=_0x469d37['split']('.');var _0x42e0c2={'uniqueid':_0x92483d,'channel':_0x599bc3[0x0],'id':_0x599bc3[0x1],'title':_0x599bc3[0x0]+_0xe8d0('0xe'),'interactionId':_0x599bc3[0x2],'queue':_0x2b6dce?_0x2b6dce[_0xe8d0('0xf')]:null,'sound':_0x463159[_0xe8d0('0x10')][_0xe8d0('0x11')],'shake':_0x463159[_0xe8d0('0x10')]['notificationShake']};try{if(!_0x463159[_0xe8d0('0x12')]){_0x463159[_0xe8d0('0x12')]={};}if(_0x2b6dce){_0x463159['body'][_0xe8d0('0x13')]=_0x2b6dce;}else if(_0x463159['body']['queue']){delete _0x463159[_0xe8d0('0x12')][_0xe8d0('0x13')];}_0x42e0c2[_0xe8d0('0x14')]=utils[_0xe8d0('0x15')](_0x463159[_0xe8d0('0x10')][_0xe8d0('0x16')],_0x463159);}catch(_0x52818a){_0x42e0c2[_0xe8d0('0x14')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0xe8d0('0x17')](util[_0xe8d0('0xa')](_0xe8d0('0x18'),_0x92483d,_0x52818a['message']));}io['to'](util['format']('user:%s',_0xcc03d0[_0xe8d0('0xf')]))[_0xe8d0('0xc')](util[_0xe8d0('0xa')](_0xe8d0('0x19'),_0x2e2985?_0xe8d0('0x1a'):'remove'),_0x42e0c2);}function writeLog(_0x105861,_0x12ebf4,_0x524b00){return logger['debug'](util['format'](_0xe8d0('0x1b'),_0x105861,_0x12ebf4[_0xe8d0('0xf')],_0x524b00));}exports[_0xe8d0('0x1c')]=function(_0x1fbfe8,_0x25f764,_0x23a945,_0x1bd25c){if(_0x25f764[_0xe8d0('0x1d')]){writeLog(_0x1fbfe8,_0x25f764,_0xe8d0('0x1e'));return![];}if(!_0x25f764['online']){writeLog(_0x1fbfe8,_0x25f764,_0xe8d0('0x1f'));return![];}if(_0x25f764[_0x23a945+_0xe8d0('0x20')]){writeLog(_0x1fbfe8,_0x25f764,'PAUSE');return![];}if(_0x1bd25c&&_0x25f764[_0xe8d0('0x21')](_0x23a945+_0xe8d0('0x22'))&&_0x25f764[_0xe8d0('0x21')](_0x23a945+_0xe8d0('0x23'))){if(_0x25f764[_0x23a945+_0xe8d0('0x22')]>0x0&&_0x25f764[_0x23a945+_0xe8d0('0x23')]>=_0x25f764[_0x23a945+_0xe8d0('0x22')]){writeLog(_0x1fbfe8,_0x25f764,_0x23a945[_0xe8d0('0x24')]()+_0xe8d0('0x25'));return![];}}return!![];};exports[_0xe8d0('0x26')]=function(_0x264de4,_0x539548,_0x24982c,_0x26dd52,_0x10dec2){return sendNotification(!![],_0x264de4,_0x539548,_0x24982c,_0x26dd52,_0x10dec2);};exports['hideNotification']=function(_0x10a30b,_0x343b08,_0x526240,_0x1519e2,_0x3ffcb7){return sendNotification(![],_0x10a30b,_0x343b08,_0x526240,_0x1519e2,_0x3ffcb7);};exports[_0xe8d0('0x27')]=writeLog;
\ No newline at end of file
+var _0xdcc4=['PAUSE','Capacity','hasOwnProperty','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','checkWaitingNotifications','UserId','channel','capitalize','InteractionId','interaction','agents','some','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','user:%s','name','emit','user:save','split','account','notificationShake','body','queue','msg','notificationTemplate','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','format','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','online','OFFLINE','Pause'];(function(_0x3d1895,_0x1c207b){var _0x5b6663=function(_0x50ca20){while(--_0x50ca20){_0x3d1895['push'](_0x3d1895['shift']());}};_0x5b6663(++_0x1c207b);}(_0xdcc4,0xea));var _0x4dcc=function(_0x13f741,_0x113a37){_0x13f741=_0x13f741-0x0;var _0x1be8f5=_0xdcc4[_0x13f741];return _0x1be8f5;};'use strict';var _=require(_0x4dcc('0x0'));var util=require(_0x4dcc('0x1'));var utils=require(_0x4dcc('0x2'));var Redis=require(_0x4dcc('0x3'));var config=require(_0x4dcc('0x4'));var logger=require('../../../../../config/logger')(_0x4dcc('0x5'));config[_0x4dcc('0x6')]=_[_0x4dcc('0x7')](config[_0x4dcc('0x6')],{'host':_0x4dcc('0x8'),'port':0x18eb});var io=require(_0x4dcc('0x9'))(new Redis(config['redis']));function sendNotification(_0x1f8ef7,_0x5561be,_0x3392ef,_0x1634f2,_0x461e9c,_0x165bf5){io['to'](util['format'](_0x4dcc('0xa'),_0x1634f2[_0x4dcc('0xb')]))[_0x4dcc('0xc')](_0x4dcc('0xd'),_0x1634f2);var _0x7ad844=_0x165bf5||{};var _0x227f00=_0x3392ef[_0x4dcc('0xe')]('.');var _0x43e361={'uniqueid':_0x5561be,'channel':_0x227f00[0x0],'id':_0x227f00[0x1],'title':_0x227f00[0x0]+'\x20interaction','interactionId':_0x227f00[0x2],'queue':_0x461e9c?_0x461e9c[_0x4dcc('0xb')]:null,'sound':_0x7ad844[_0x4dcc('0xf')]['notificationSound'],'shake':_0x7ad844[_0x4dcc('0xf')][_0x4dcc('0x10')]};try{if(!_0x7ad844['body']){_0x7ad844[_0x4dcc('0x11')]={};}if(_0x461e9c){_0x7ad844[_0x4dcc('0x11')][_0x4dcc('0x12')]=_0x461e9c;}else if(_0x7ad844[_0x4dcc('0x11')][_0x4dcc('0x12')]){delete _0x7ad844[_0x4dcc('0x11')][_0x4dcc('0x12')];}_0x43e361[_0x4dcc('0x13')]=utils['getMustacheRender'](_0x7ad844['account'][_0x4dcc('0x14')],_0x7ad844);}catch(_0x407072){_0x43e361[_0x4dcc('0x13')]=_0x4dcc('0x15');logger[_0x4dcc('0x16')](util['format'](_0x4dcc('0x17'),_0x5561be,_0x407072[_0x4dcc('0x18')]));}io['to'](util['format']('user:%s',_0x1634f2['name']))[_0x4dcc('0xc')](util[_0x4dcc('0x19')]('notification:%s',_0x1f8ef7?_0x4dcc('0x1a'):_0x4dcc('0x1b')),_0x43e361);}function writeLog(_0x25157f,_0x548f24,_0x27cb11){return logger[_0x4dcc('0x1c')](util[_0x4dcc('0x19')](_0x4dcc('0x1d'),_0x25157f,_0x548f24[_0x4dcc('0xb')],_0x27cb11));}exports[_0x4dcc('0x1e')]=function(_0x44ae9e,_0x3c6d3b,_0x1b2834,_0x1ed6d0){if(_0x3c6d3b[_0x4dcc('0x1f')]){writeLog(_0x44ae9e,_0x3c6d3b,_0x4dcc('0x20'));return![];}if(!_0x3c6d3b[_0x4dcc('0x21')]){writeLog(_0x44ae9e,_0x3c6d3b,_0x4dcc('0x22'));return![];}if(_0x3c6d3b[_0x1b2834+_0x4dcc('0x23')]){writeLog(_0x44ae9e,_0x3c6d3b,_0x4dcc('0x24'));return![];}if(_0x1ed6d0&&_0x3c6d3b['hasOwnProperty'](_0x1b2834+_0x4dcc('0x25'))&&_0x3c6d3b[_0x4dcc('0x26')](_0x1b2834+_0x4dcc('0x27'))){if(_0x3c6d3b[_0x1b2834+'Capacity']>0x0&&_0x3c6d3b[_0x1b2834+_0x4dcc('0x27')]>=_0x3c6d3b[_0x1b2834+'Capacity']){writeLog(_0x44ae9e,_0x3c6d3b,_0x1b2834[_0x4dcc('0x28')]()+_0x4dcc('0x29'));return![];}}return!![];};exports['showNotification']=function(_0x3853ae,_0x2afff8,_0x4fb23c,_0x388cc2,_0x288514){return sendNotification(!![],_0x3853ae,_0x2afff8,_0x4fb23c,_0x388cc2,_0x288514);};exports['hideNotification']=function(_0x488bf3,_0x110911,_0x1aac81,_0x160805,_0x562d1f){return sendNotification(![],_0x488bf3,_0x110911,_0x1aac81,_0x160805,_0x562d1f);};exports[_0x4dcc('0x2a')]=function(_0x5c2464,_0x2ffac7,_0x279524){var _0x45b0d5=_0x2ffac7['interaction'][_0x4dcc('0x2b')];if(!_0x45b0d5&&_0x279524){_0x45b0d5=_0x279524['id'];}var _0x4dd2e6=_['some'](_0x5c2464[_0x2ffac7[_0x4dcc('0x2c')]+'QueuesWaitingInteractions'],function(_0x39ce82){var _0x213c95=_[_0x4dcc('0x2d')](_0x2ffac7[_0x4dcc('0x2c')])+_0x4dcc('0x2e');return _0x39ce82[_0x213c95]===_0x2ffac7[_0x4dcc('0x2f')]['id'];});if(!_0x4dd2e6&&_0x45b0d5&&_0x5c2464[_0x4dcc('0x30')][_0x45b0d5]){_0x4dd2e6=_[_0x4dcc('0x31')](_0x5c2464[_0x4dcc('0x30')][_0x45b0d5][_0x2ffac7[_0x4dcc('0x2c')]+_0x4dcc('0x32')],function(_0x5686a9){return _0x5686a9['id']===_0x2ffac7['interaction']['id'];});}return _0x4dd2e6;};exports[_0x4dcc('0x33')]=function(_0x53e80a,_0x3a88ac,_0x445087,_0x3656fe){if(_0x445087&&_0x445087['id']&&_0x53e80a[_0x4dcc('0x30')]&&_0x53e80a[_0x4dcc('0x30')][_0x445087['id']]){_0x53e80a[_0x4dcc('0x30')][_0x445087['id']][_0x3656fe+_0x4dcc('0x32')][_0x3a88ac[_0x4dcc('0x18')]['id']]={'id':_0x3a88ac['interaction']['id']};}};exports[_0x4dcc('0x34')]=function(_0x5698b8,_0x6722ca,_0x53b522,_0x333fb8){if(_0x53b522&&_0x53b522['id']&&_0x5698b8['agents']&&_0x5698b8[_0x4dcc('0x30')][_0x53b522['id']]){delete _0x5698b8[_0x4dcc('0x30')][_0x53b522['id']][_0x333fb8+_0x4dcc('0x32')][_0x6722ca[_0x4dcc('0x18')]['id']];}};exports[_0x4dcc('0x35')]=writeLog;
\ No newline at end of file