Built motion from commit (unavailable).|2.4.15
[motion2.git] / server / services / routing / server / index.js
index 2aaed5b..1b17384 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x3f41=['../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','push','slice','dialogflow','split','tag','TagId','./interval','condition','intervals','./applications/','consequence','priority','Push\x20new\x20rule','on\x20interval','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','execute','info','stringify','matchPath','end','No\x20applications\x20to\x20execute','error','routing\x20is\x20empty','emit','QueueReport','UserId','catch','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','available','loggedIn','waiting','mailQueues','name','openchannelQueues','paused','smsQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport'];(function(_0x44ccbb,_0x16afb7){var _0x2d649f=function(_0x20fa05){while(--_0x20fa05){_0x44ccbb['push'](_0x44ccbb['shift']());}};_0x2d649f(++_0x16afb7);}(_0x3f41,0x1ce));var _0x13f4=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x3f41[_0x39e283];return _0x7de89f;};'use strict';var _=require(_0x13f4('0x0'));var util=require(_0x13f4('0x1'));var path=require(_0x13f4('0x2'));var fs=require('fs');var jayson=require(_0x13f4('0x3'));var BPromise=require(_0x13f4('0x4'));var uuid=require(_0x13f4('0x5'));var config=require('../../../config/environment');var logger=require(_0x13f4('0x6'))(_0x13f4('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport')};var rpc={'openchannelQueueReport':require(_0x13f4('0x8')),'mailQueueReport':require(_0x13f4('0x9')),'chatQueueReport':require(_0x13f4('0xa')),'smsQueueReport':require(_0x13f4('0xb')),'faxQueueReport':require(_0x13f4('0xc'))};var RuleEngine=require(_0x13f4('0xd'));function getId(_0x106901,_0xe641f5,_0x406276){return util[_0x13f4('0xe')](_0x13f4('0xf'),_0x106901,_0xe641f5||0x0,_0x406276||0x0);}function getIntervals(_0x51114f,_0x3c2eb0){var _0x40e1a3=[];if(!_[_0x13f4('0x10')](_0x3c2eb0[_0x13f4('0x11')])&&!_[_0x13f4('0x10')](_0x51114f[_0x3c2eb0[_0x13f4('0x11')]])&&!_[_0x13f4('0x10')](_0x51114f[_0x3c2eb0[_0x13f4('0x11')]][_0x13f4('0x12')])){_0x40e1a3=_[_0x13f4('0x13')](_0x51114f[_0x3c2eb0[_0x13f4('0x11')]][_0x13f4('0x12')],_0x13f4('0x14'));}else if(!_['isNil'](_0x3c2eb0[_0x13f4('0x14')])){_0x40e1a3=[_0x3c2eb0[_0x13f4('0x14')]];}return _0x40e1a3;}exports[_0x13f4('0x15')]=function(_0x43a112){_0x43a112[_0x13f4('0x16')]={};return new BPromise(function(_0x2a654d,_0x11f4c7){var _0x1ac17e={'Start':function(_0x229e91){var _0x12336e=this;return new Promise(function(_0x5f33d1,_0x1d6ac3){if(_0x229e91){try{var _0x3a7038=[];var _0x39b332=getId(_0x229e91[_0x13f4('0x17')],_0x229e91[_0x13f4('0x18')]?_0x229e91[_0x13f4('0x18')]['id']:0x0,_0x229e91['interaction']?_0x229e91[_0x13f4('0x19')]['id']:0x0);if(_0x229e91[_0x13f4('0x1a')]&&_[_0x13f4('0x1b')](_0x229e91['applications'])&&_0x229e91[_0x13f4('0x1a')][_0x13f4('0x1c')]){for(var _0x4621f3=0x0;_0x4621f3<_0x229e91[_0x13f4('0x1a')][_0x13f4('0x1c')];_0x4621f3+=0x1){var _0x3f15d1=_0x229e91[_0x13f4('0x1a')][_0x4621f3];if(fs[_0x13f4('0x1d')](path[_0x13f4('0x1e')](__dirname,_0x13f4('0x1a'),_0x3f15d1[_0x13f4('0x1f')]+_0x13f4('0x20')))){var _0x2e10b0=[];switch(_0x3f15d1[_0x13f4('0x1f')][_0x13f4('0x21')]()){case _0x13f4('0x22'):var _0x3bb0c2=_0x3f15d1[_0x13f4('0x23')]['split'](',');_0x2e10b0[_0x13f4('0x24')](_0x3bb0c2[0x0]);_0x2e10b0[_0x13f4('0x24')](_0x3bb0c2[_0x13f4('0x25')](0x1,_0x3bb0c2[_0x13f4('0x1c')])['join'](','));break;case _0x13f4('0x26'):var _0x3bb0c2=_0x3f15d1[_0x13f4('0x23')]['split'](',');_0x2e10b0[_0x13f4('0x24')](_0x3bb0c2[0x0]);_0x2e10b0[_0x13f4('0x24')](_0x3bb0c2[0x1]);_0x2e10b0['push'](_0x3bb0c2[_0x13f4('0x25')](0x2,_0x3bb0c2[_0x13f4('0x1c')])[_0x13f4('0x1e')](','));break;case'amazonlex':var _0x3bb0c2=_0x3f15d1['appdata'][_0x13f4('0x27')](',');_0x2e10b0['push'](_0x3bb0c2[0x0]);_0x2e10b0[_0x13f4('0x24')](_0x3bb0c2[0x1]);_0x2e10b0[_0x13f4('0x24')](_0x3bb0c2[0x2]);_0x2e10b0[_0x13f4('0x24')](_0x3bb0c2[0x3]);_0x2e10b0[_0x13f4('0x24')](_0x3bb0c2[_0x13f4('0x25')](0x4,_0x3bb0c2[_0x13f4('0x1c')])[_0x13f4('0x1e')](','));break;case _0x13f4('0x18'):_0x2e10b0[_0x13f4('0x24')](_0x3f15d1[_0x13f4('0x23')]);break;case _0x13f4('0x28'):_0x2e10b0[_0x13f4('0x24')](_0x3f15d1[_0x13f4('0x29')]);_0x2e10b0['push'](_0x3f15d1[_0x13f4('0x23')]);break;default:_0x2e10b0=_[_0x13f4('0x10')](_0x3f15d1[_0x13f4('0x23')])?[]:_0x3f15d1[_0x13f4('0x23')]['split'](',');}var _0x597435={'id':util[_0x13f4('0xe')]('%s:%s:%s',_0x39b332,_0x3f15d1['id'],_0x3f15d1[_0x13f4('0x1f')]),'condition':require(_0x13f4('0x2a'))[_0x13f4('0x2b')](_0x39b332,getIntervals(_0x43a112[_0x13f4('0x2c')],_0x3f15d1),_0x43a112),'consequence':require(_0x13f4('0x2d')+_0x3f15d1[_0x13f4('0x1f')])[_0x13f4('0x2e')](_0x39b332,_0x2e10b0,_0x43a112,_0x229e91),'p':_0x3f15d1[_0x13f4('0x2f')]||0x0};logger['info'](_0x13f4('0x30'),_0x597435['id'],_0x13f4('0x31'),getIntervals(_0x43a112[_0x13f4('0x2c')],_0x3f15d1)[_0x13f4('0x1e')](_0x13f4('0x32')));_0x3a7038[_0x13f4('0x24')](_0x597435);}else{logger['error'](_0x13f4('0x33'),path[_0x13f4('0x1e')](__dirname,_0x13f4('0x1a'),_0x3f15d1[_0x13f4('0x1f')]+_0x13f4('0x20')));}}_0x43a112[_0x13f4('0x16')][_0x39b332]=new RuleEngine(_0x3a7038);_0x43a112[_0x13f4('0x16')][_0x39b332][_0x13f4('0x34')](_0x229e91,function(_0x1f7c75){logger[_0x13f4('0x35')]('Applications\x20executed',JSON[_0x13f4('0x36')](_0x1f7c75[_0x13f4('0x37')]));if(_0x43a112[_0x13f4('0x16')][_0x39b332]){_0x43a112[_0x13f4('0x16')][_0x39b332]['emit'](_0x13f4('0x38'));}});return _0x5f33d1({'code':0xc8,'message':_0x229e91});}else{logger[_0x13f4('0x35')](_0x13f4('0x39'));return _0x5f33d1({'code':0xc8,'message':_0x229e91});}}catch(_0x1da229){logger['error'](_0x1da229['stack']);return _0x1d6ac3(_0x12336e[_0x13f4('0x3a')](0x1f4,_0x1da229));}}return _0x1d6ac3(_0x13f4('0x3b'));});},'AcceptMessage':function(_0x7a3db6){var _0x6b1752=this;return new Promise(function(_0x4a8576,_0x3ec5c0){if(_0x7a3db6[_0x13f4('0x18')]&&_0x7a3db6[_0x13f4('0x18')]['id']){try{var _0x353d51=getId(_0x7a3db6[_0x13f4('0x17')],_0x7a3db6[_0x13f4('0x18')]?_0x7a3db6[_0x13f4('0x18')]['id']:0x0,_0x7a3db6[_0x13f4('0x19')]?_0x7a3db6['interaction']['id']:0x0);if(_0x43a112['rules'][_0x353d51]){_0x43a112[_0x13f4('0x16')][_0x353d51][_0x13f4('0x3c')](_0x13f4('0x38'));if(rpc[_0x7a3db6[_0x13f4('0x17')]+'QueueReport']){rpc[_0x7a3db6[_0x13f4('0x17')]+_0x13f4('0x3d')]['update'](_0x353d51,{'UserId':_0x7a3db6['message'][_0x13f4('0x3e')]})[_0x13f4('0x3f')](function(_0x3b2207){logger[_0x13f4('0x3a')]('error\x20update\x20queue\x20report');});}}return _0x4a8576({'code':0xc8,'message':_0x7a3db6});}catch(_0x43906d){logger[_0x13f4('0x3a')](_0x43906d[_0x13f4('0x40')]);return _0x3ec5c0(_0x6b1752[_0x13f4('0x3a')](0x1f4,_0x43906d));}}logger[_0x13f4('0x3a')](_0x13f4('0x41'));return _0x3ec5c0(_0x6b1752[_0x13f4('0x3a')](0x1f4,_0x13f4('0x41')));});},'RejectMessage':function(_0x645e91){var _0x218bb6=this;return new Promise(function(_0x3f5d63,_0x290c12){if(_0x645e91['agent']&&_0x645e91[_0x13f4('0x42')]['id']){try{if(_0x43a112[_0x13f4('0x43')][_0x645e91['agent']['id']]){_0x43a112['agents'][_0x645e91[_0x13f4('0x42')]['id']][_0x13f4('0x44')]=![];_0x43a112['agents'][_0x645e91[_0x13f4('0x42')]['id']][_0x13f4('0x45')]=undefined;}return _0x3f5d63({'code':0xc8,'message':_0x645e91});}catch(_0x897ef4){logger['error'](_0x897ef4[_0x13f4('0x40')]);return _0x290c12(_0x218bb6['error'](0x1f4,_0x897ef4));}}logger['error'](_0x13f4('0x41'));return _0x290c12(_0x218bb6[_0x13f4('0x3a')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x1e6309){var _0x5e51b8=this;return new Promise(function(_0x58ac5e,_0x2309ca){if(_0x1e6309[_0x13f4('0x17')]&&_0x1e6309['interaction']&&_0x1e6309[_0x13f4('0x19')]['id']){try{var _0x4ad4e4=getId(_0x1e6309['channel'],_0x1e6309[_0x13f4('0x18')]?_0x1e6309['message']['id']:0x0,_0x1e6309[_0x13f4('0x19')]?_0x1e6309[_0x13f4('0x19')]['id']:0x0);if(_0x43a112[_0x13f4('0x16')][_0x4ad4e4]){_0x43a112[_0x13f4('0x16')][_0x4ad4e4][_0x13f4('0x3c')](_0x13f4('0x38'));}return _0x58ac5e({'code':0xc8,'message':_0x1e6309});}catch(_0x4db853){logger['error'](_0x4db853[_0x13f4('0x40')]);return _0x2309ca(_0x5e51b8['error'](0x1f4,_0x4db853));}}logger[_0x13f4('0x3a')](_0x13f4('0x41'));return _0x2309ca(_0x5e51b8['error'](0x1f4,_0x13f4('0x41')));});},'AgentCapacity':function(_0x55eb28){var _0x2dc579=this;return new Promise(function(_0x189c08,_0x23c173){if(_0x43a112[_0x13f4('0x43')][_0x13f4('0x46')](_0x55eb28['id'])){for(var _0x4387a1 in _0x55eb28[_0x13f4('0x47')]){if(_0x55eb28[_0x13f4('0x47')][_0x13f4('0x46')](_0x4387a1)){if(_0x43a112[_0x13f4('0x43')][_0x55eb28['id']][_0x13f4('0x46')](_0x4387a1+_0x13f4('0x48'))){_0x43a112['agents'][_0x55eb28['id']][_0x4387a1+_0x13f4('0x48')]=parseInt(_0x55eb28['capacity'][_0x4387a1],0xa);}}}_0x43a112[_0x13f4('0x43')][_0x55eb28['id']][_0x13f4('0x49')]();return _0x189c08({'code':0xc8,'message':_0x43a112[_0x13f4('0x43')][_0x55eb28['id']]});}else{return _0x23c173(_0x2dc579['error'](0x1f4,_0x13f4('0x4a')));}});},'Agents':function(_0x1952e5){return new Promise(function(_0x5153fb,_0x89753f){var _0x488871=_[_0x13f4('0x4b')](_0x43a112[_0x13f4('0x43')]);_0x5153fb({'count':_0x488871['length'],'rows':_0x488871});});},'ChatQueues':function(_0x1e0b35){return new Promise(function(_0x8f826d,_0x33b56b){var _0x2b09af=[];for(var _0x5e5f44 in _0x43a112[_0x13f4('0x4c')]){if(_0x43a112[_0x13f4('0x4c')]['hasOwnProperty'](_0x5e5f44)){var _0x4868e9=_0x43a112[_0x13f4('0x4c')][_0x5e5f44];var _0x22f7b4={'id':_0x4868e9['id'],'available':_0x4868e9[_0x13f4('0x4d')],'loggedIn':_0x4868e9[_0x13f4('0x4e')],'name':_0x4868e9['name'],'paused':_0x4868e9['paused'],'waiting':_0x4868e9[_0x13f4('0x4f')]};_0x2b09af[_0x13f4('0x24')](_0x22f7b4);}}_0x8f826d({'count':_0x2b09af['length'],'rows':_0x2b09af});});},'MailQueues':function(_0x291260){return new Promise(function(_0x33ad66,_0x3383c5){var _0x39e65f=[];for(var _0x3a17f9 in _0x43a112['mailQueues']){if(_0x43a112[_0x13f4('0x50')][_0x13f4('0x46')](_0x3a17f9)){var _0x4ad418=_0x43a112['mailQueues'][_0x3a17f9];var _0x4831da={'id':_0x4ad418['id'],'available':_0x4ad418[_0x13f4('0x4d')],'loggedIn':_0x4ad418[_0x13f4('0x4e')],'name':_0x4ad418[_0x13f4('0x51')],'paused':_0x4ad418['paused'],'waiting':_0x4ad418['waiting']};_0x39e65f['push'](_0x4831da);}}_0x33ad66({'count':_0x39e65f['length'],'rows':_0x39e65f});});},'OpenchannelQueues':function(_0x485196){return new Promise(function(_0x44ea55,_0x35ff5f){var _0xbb7688=[];for(var _0x16c88a in _0x43a112[_0x13f4('0x52')]){if(_0x43a112[_0x13f4('0x52')][_0x13f4('0x46')](_0x16c88a)){var _0xc4a9e0=_0x43a112[_0x13f4('0x52')][_0x16c88a];var _0x144713={'id':_0xc4a9e0['id'],'available':_0xc4a9e0['available'],'loggedIn':_0xc4a9e0[_0x13f4('0x4e')],'name':_0xc4a9e0[_0x13f4('0x51')],'paused':_0xc4a9e0[_0x13f4('0x53')],'waiting':_0xc4a9e0['waiting']};_0xbb7688['push'](_0x144713);}}_0x44ea55({'count':_0xbb7688[_0x13f4('0x1c')],'rows':_0xbb7688});});},'SmsQueues':function(_0x4e8cd9){return new Promise(function(_0x48ed88,_0x504952){var _0x27972f=[];for(var _0xe70e0e in _0x43a112[_0x13f4('0x54')]){if(_0x43a112[_0x13f4('0x54')]['hasOwnProperty'](_0xe70e0e)){var _0x59cac5=_0x43a112['smsQueues'][_0xe70e0e];var _0x306648={'id':_0x59cac5['id'],'available':_0x59cac5[_0x13f4('0x4d')],'loggedIn':_0x59cac5[_0x13f4('0x4e')],'name':_0x59cac5[_0x13f4('0x51')],'paused':_0x59cac5[_0x13f4('0x53')],'waiting':_0x59cac5[_0x13f4('0x4f')]};_0x27972f[_0x13f4('0x24')](_0x306648);}}_0x48ed88({'count':_0x27972f[_0x13f4('0x1c')],'rows':_0x27972f});});},'FaxQueues':function(_0x515c76){return new Promise(function(_0x5c240c,_0x50fd6f){var _0x31276d=[];for(var _0x3c09a3 in _0x43a112['faxQueues']){if(_0x43a112['faxQueues'][_0x13f4('0x46')](_0x3c09a3)){var _0x6b19e3=_0x43a112['faxQueues'][_0x3c09a3];var _0x3fc00e={'id':_0x6b19e3['id'],'available':_0x6b19e3['available'],'loggedIn':_0x6b19e3['loggedIn'],'name':_0x6b19e3['name'],'paused':_0x6b19e3['paused'],'waiting':_0x6b19e3[_0x13f4('0x4f')]};_0x31276d[_0x13f4('0x24')](_0x3fc00e);}}_0x5c240c({'count':_0x31276d[_0x13f4('0x1c')],'rows':_0x31276d});});},'ChatQueuesWaitingInteractions':function(_0x3be516){return new Promise(function(_0x444808,_0x3c127a){var _0x28a5d6=_[_0x13f4('0x4b')](_0x43a112[_0x13f4('0x55')]);_0x444808({'count':_0x28a5d6[_0x13f4('0x1c')],'rows':_0x28a5d6});});},'MailQueuesWaitingInteractions':function(_0x5d3467){return new Promise(function(_0x3a3c11,_0x14b47b){var _0x5b4447=_[_0x13f4('0x4b')](_0x43a112[_0x13f4('0x56')]);_0x3a3c11({'count':_0x5b4447[_0x13f4('0x1c')],'rows':_0x5b4447});});},'OpenchannelQueuesWaitingInteractions':function(_0x3e1146){return new Promise(function(_0x5b0c27,_0x2ce0a4){var _0xf067be=_['values'](_0x43a112[_0x13f4('0x57')]);_0x5b0c27({'count':_0xf067be[_0x13f4('0x1c')],'rows':_0xf067be});});},'SmsQueuesWaitingInteractions':function(_0x4470aa){return new Promise(function(_0x8b2c40,_0x12f51c){var _0xff21bf=_[_0x13f4('0x4b')](_0x43a112[_0x13f4('0x58')]);_0x8b2c40({'count':_0xff21bf['length'],'rows':_0xff21bf});});},'FaxQueuesWaitingInteractions':function(_0x36f761){return new Promise(function(_0x1f06f0,_0x53a44f){var _0x45503a=_[_0x13f4('0x4b')](_0x43a112[_0x13f4('0x59')]);_0x1f06f0({'count':_0x45503a['length'],'rows':_0x45503a});});}};var _0x314632=jayson[_0x13f4('0x5a')](_0x1ac17e)[_0x13f4('0x5b')]();_0x314632['on'](_0x13f4('0x3a'),function(_0xe57785){logger[_0x13f4('0x3a')](JSON['stringify'](_0xe57785));return _0x11f4c7(_0xe57785);});_0x314632[_0x13f4('0x15')](0x232c,_0x13f4('0x5c'),function(){console[_0x13f4('0x5d')](_0x13f4('0x5e'),0x232c);return _0x2a654d('RPC\x20listening\x20on\x20port:'+0x232c);});});};
\ No newline at end of file
+var _0xabbe=['error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','chatQueues','available','loggedIn','name','mailQueues','paused','waiting','smsQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','lodash','util','path','jayson/promise','bluebird','../../../config/environment','../../../config/logger','../rpc/openchannelQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','autoreply','split','push','slice','dialogflow','appdata','TagId','./interval','condition','intervals','consequence','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','end','stack','channel','emit','QueueReport','update','UserId','catch'];(function(_0x40197b,_0x4e763f){var _0x3b9c2f=function(_0x41c34f){while(--_0x41c34f){_0x40197b['push'](_0x40197b['shift']());}};_0x3b9c2f(++_0x4e763f);}(_0xabbe,0xbf));var _0xeabb=function(_0x51f545,_0x4582d5){_0x51f545=_0x51f545-0x0;var _0x15c765=_0xabbe[_0x51f545];return _0x15c765;};'use strict';var _=require(_0xeabb('0x0'));var util=require(_0xeabb('0x1'));var path=require(_0xeabb('0x2'));var fs=require('fs');var jayson=require(_0xeabb('0x3'));var BPromise=require(_0xeabb('0x4'));var uuid=require('uuid');var config=require(_0xeabb('0x5'));var logger=require(_0xeabb('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0xeabb('0x7'))};var rpc={'openchannelQueueReport':require(_0xeabb('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xeabb('0x8'))};var RuleEngine=require(_0xeabb('0x9'));function getId(_0x284ce1,_0xc08382,_0x322285){return util[_0xeabb('0xa')](_0xeabb('0xb'),_0x284ce1,_0xc08382||0x0,_0x322285||0x0);}function getIntervals(_0x3ce2ab,_0x5ea67e){var _0x453fad=[];if(!_[_0xeabb('0xc')](_0x5ea67e[_0xeabb('0xd')])&&!_[_0xeabb('0xc')](_0x3ce2ab[_0x5ea67e[_0xeabb('0xd')]])&&!_[_0xeabb('0xc')](_0x3ce2ab[_0x5ea67e[_0xeabb('0xd')]][_0xeabb('0xe')])){_0x453fad=_[_0xeabb('0xf')](_0x3ce2ab[_0x5ea67e[_0xeabb('0xd')]]['Intervals'],_0xeabb('0x10'));}else if(!_[_0xeabb('0xc')](_0x5ea67e[_0xeabb('0x10')])){_0x453fad=[_0x5ea67e[_0xeabb('0x10')]];}return _0x453fad;}exports[_0xeabb('0x11')]=function(_0x3378f7){_0x3378f7[_0xeabb('0x12')]={};return new BPromise(function(_0x5f432b,_0x5d0e14){var _0x43c211={'Start':function(_0x209430){var _0x3860c0=this;return new Promise(function(_0x202ee1,_0x12ede6){if(_0x209430){try{var _0x5983f8=[];var _0x2abac8=getId(_0x209430['channel'],_0x209430[_0xeabb('0x13')]?_0x209430[_0xeabb('0x13')]['id']:0x0,_0x209430['interaction']?_0x209430[_0xeabb('0x14')]['id']:0x0);if(_0x209430[_0xeabb('0x15')]&&_[_0xeabb('0x16')](_0x209430[_0xeabb('0x15')])&&_0x209430[_0xeabb('0x15')][_0xeabb('0x17')]){for(var _0x5d3c26=0x0;_0x5d3c26<_0x209430[_0xeabb('0x15')]['length'];_0x5d3c26+=0x1){var _0x37f7a4=_0x209430[_0xeabb('0x15')][_0x5d3c26];if(fs[_0xeabb('0x18')](path[_0xeabb('0x19')](__dirname,_0xeabb('0x15'),_0x37f7a4[_0xeabb('0x1a')]+_0xeabb('0x1b')))){var _0x5ea26f=[];switch(_0x37f7a4['app']['toLowerCase']()){case _0xeabb('0x1c'):var _0x1e7e06=_0x37f7a4['appdata'][_0xeabb('0x1d')](',');_0x5ea26f[_0xeabb('0x1e')](_0x1e7e06[0x0]);_0x5ea26f[_0xeabb('0x1e')](_0x1e7e06[_0xeabb('0x1f')](0x1,_0x1e7e06['length'])[_0xeabb('0x19')](','));break;case _0xeabb('0x20'):var _0x1e7e06=_0x37f7a4[_0xeabb('0x21')]['split'](',');_0x5ea26f[_0xeabb('0x1e')](_0x1e7e06[0x0]);_0x5ea26f['push'](_0x1e7e06[0x1]);_0x5ea26f['push'](_0x1e7e06['slice'](0x2,_0x1e7e06['length'])[_0xeabb('0x19')](','));break;case'amazonlex':var _0x1e7e06=_0x37f7a4[_0xeabb('0x21')][_0xeabb('0x1d')](',');_0x5ea26f[_0xeabb('0x1e')](_0x1e7e06[0x0]);_0x5ea26f[_0xeabb('0x1e')](_0x1e7e06[0x1]);_0x5ea26f['push'](_0x1e7e06[0x2]);_0x5ea26f['push'](_0x1e7e06[0x3]);_0x5ea26f['push'](_0x1e7e06[_0xeabb('0x1f')](0x4,_0x1e7e06['length'])['join'](','));break;case _0xeabb('0x13'):_0x5ea26f[_0xeabb('0x1e')](_0x37f7a4[_0xeabb('0x21')]);break;case'tag':_0x5ea26f['push'](_0x37f7a4[_0xeabb('0x22')]);_0x5ea26f[_0xeabb('0x1e')](_0x37f7a4[_0xeabb('0x21')]);break;default:_0x5ea26f=_[_0xeabb('0xc')](_0x37f7a4[_0xeabb('0x21')])?[]:_0x37f7a4['appdata'][_0xeabb('0x1d')](',');}var _0xfa8c47={'id':util[_0xeabb('0xa')]('%s:%s:%s',_0x2abac8,_0x37f7a4['id'],_0x37f7a4[_0xeabb('0x1a')]),'condition':require(_0xeabb('0x23'))[_0xeabb('0x24')](_0x2abac8,getIntervals(_0x3378f7[_0xeabb('0x25')],_0x37f7a4),_0x3378f7),'consequence':require('./applications/'+_0x37f7a4[_0xeabb('0x1a')])[_0xeabb('0x26')](_0x2abac8,_0x5ea26f,_0x3378f7,_0x209430),'p':_0x37f7a4['priority']||0x0};logger[_0xeabb('0x27')](_0xeabb('0x28'),_0xfa8c47['id'],_0xeabb('0x29'),getIntervals(_0x3378f7[_0xeabb('0x25')],_0x37f7a4)['join'](_0xeabb('0x2a')));_0x5983f8[_0xeabb('0x1e')](_0xfa8c47);}else{logger[_0xeabb('0x2b')](_0xeabb('0x2c'),path[_0xeabb('0x19')](__dirname,'applications',_0x37f7a4[_0xeabb('0x1a')]+_0xeabb('0x1b')));}}_0x3378f7[_0xeabb('0x12')][_0x2abac8]=new RuleEngine(_0x5983f8);_0x3378f7[_0xeabb('0x12')][_0x2abac8][_0xeabb('0x2d')](_0x209430,function(_0xc76a5e){logger[_0xeabb('0x27')]('Applications\x20executed',JSON[_0xeabb('0x2e')](_0xc76a5e['matchPath']));if(_0x3378f7[_0xeabb('0x12')][_0x2abac8]){_0x3378f7[_0xeabb('0x12')][_0x2abac8]['emit'](_0xeabb('0x2f'));}});return _0x202ee1({'code':0xc8,'message':_0x209430});}else{logger[_0xeabb('0x27')]('No\x20applications\x20to\x20execute');return _0x202ee1({'code':0xc8,'message':_0x209430});}}catch(_0x5c6cd5){logger['error'](_0x5c6cd5[_0xeabb('0x30')]);return _0x12ede6(_0x3860c0[_0xeabb('0x2b')](0x1f4,_0x5c6cd5));}}return _0x12ede6('routing\x20is\x20empty');});},'AcceptMessage':function(_0xc90b7b){var _0x46bbf2=this;return new Promise(function(_0x2addf7,_0x3fc922){if(_0xc90b7b[_0xeabb('0x13')]&&_0xc90b7b[_0xeabb('0x13')]['id']){try{var _0x466020=getId(_0xc90b7b[_0xeabb('0x31')],_0xc90b7b['message']?_0xc90b7b[_0xeabb('0x13')]['id']:0x0,_0xc90b7b[_0xeabb('0x14')]?_0xc90b7b[_0xeabb('0x14')]['id']:0x0);if(_0x3378f7[_0xeabb('0x12')][_0x466020]){_0x3378f7[_0xeabb('0x12')][_0x466020][_0xeabb('0x32')](_0xeabb('0x2f'));if(rpc[_0xc90b7b[_0xeabb('0x31')]+_0xeabb('0x33')]){rpc[_0xc90b7b['channel']+_0xeabb('0x33')][_0xeabb('0x34')](_0x466020,{'UserId':_0xc90b7b['message'][_0xeabb('0x35')]})[_0xeabb('0x36')](function(_0x15ac5e){logger[_0xeabb('0x2b')](_0xeabb('0x37'));});}}return _0x2addf7({'code':0xc8,'message':_0xc90b7b});}catch(_0x156cb5){logger[_0xeabb('0x2b')](_0x156cb5[_0xeabb('0x30')]);return _0x3fc922(_0x46bbf2['error'](0x1f4,_0x156cb5));}}logger[_0xeabb('0x2b')](_0xeabb('0x38'));return _0x3fc922(_0x46bbf2['error'](0x1f4,_0xeabb('0x38')));});},'RejectMessage':function(_0x1cbe09){var _0x2c5b5e=this;return new Promise(function(_0x2b3a72,_0x5b2023){if(_0x1cbe09['agent']&&_0x1cbe09[_0xeabb('0x39')]['id']){try{if(_0x3378f7[_0xeabb('0x3a')][_0x1cbe09[_0xeabb('0x39')]['id']]){_0x3378f7['agents'][_0x1cbe09[_0xeabb('0x39')]['id']][_0xeabb('0x3b')]=![];_0x3378f7[_0xeabb('0x3a')][_0x1cbe09['agent']['id']][_0xeabb('0x3c')]=undefined;}return _0x2b3a72({'code':0xc8,'message':_0x1cbe09});}catch(_0x20a290){logger[_0xeabb('0x2b')](_0x20a290['stack']);return _0x5b2023(_0x2c5b5e[_0xeabb('0x2b')](0x1f4,_0x20a290));}}logger['error']('message\x20is\x20empty');return _0x5b2023(_0x2c5b5e[_0xeabb('0x2b')](0x1f4,_0xeabb('0x38')));});},'AbandonInteraction':function(_0xb4dbc8){var _0x507bc1=this;return new Promise(function(_0x1f5093,_0x4f41f5){if(_0xb4dbc8[_0xeabb('0x31')]&&_0xb4dbc8[_0xeabb('0x14')]&&_0xb4dbc8[_0xeabb('0x14')]['id']){try{var _0x5009df=getId(_0xb4dbc8[_0xeabb('0x31')],_0xb4dbc8[_0xeabb('0x13')]?_0xb4dbc8[_0xeabb('0x13')]['id']:0x0,_0xb4dbc8[_0xeabb('0x14')]?_0xb4dbc8[_0xeabb('0x14')]['id']:0x0);if(_0x3378f7[_0xeabb('0x12')][_0x5009df]){_0x3378f7['rules'][_0x5009df][_0xeabb('0x32')](_0xeabb('0x2f'));}return _0x1f5093({'code':0xc8,'message':_0xb4dbc8});}catch(_0x2b7362){logger[_0xeabb('0x2b')](_0x2b7362[_0xeabb('0x30')]);return _0x4f41f5(_0x507bc1['error'](0x1f4,_0x2b7362));}}logger['error'](_0xeabb('0x38'));return _0x4f41f5(_0x507bc1[_0xeabb('0x2b')](0x1f4,_0xeabb('0x38')));});},'AgentCapacity':function(_0x1b8de0){var _0x49705b=this;return new Promise(function(_0x1ef67c,_0x3444df){if(_0x3378f7['agents'][_0xeabb('0x3d')](_0x1b8de0['id'])){for(var _0x364060 in _0x1b8de0['capacity']){if(_0x1b8de0[_0xeabb('0x3e')][_0xeabb('0x3d')](_0x364060)){if(_0x3378f7[_0xeabb('0x3a')][_0x1b8de0['id']][_0xeabb('0x3d')](_0x364060+_0xeabb('0x3f'))){_0x3378f7[_0xeabb('0x3a')][_0x1b8de0['id']][_0x364060+_0xeabb('0x3f')]=parseInt(_0x1b8de0['capacity'][_0x364060],0xa);}}}_0x3378f7[_0xeabb('0x3a')][_0x1b8de0['id']]['updateRealtime']();return _0x1ef67c({'code':0xc8,'message':_0x3378f7[_0xeabb('0x3a')][_0x1b8de0['id']]});}else{return _0x3444df(_0x49705b[_0xeabb('0x2b')](0x1f4,_0xeabb('0x40')));}});},'Agents':function(_0x26ff2e){return new Promise(function(_0x2dd90f,_0x27d528){var _0x3babb4=_[_0xeabb('0x41')](_0x3378f7['agents']);_0x2dd90f({'count':_0x3babb4[_0xeabb('0x17')],'rows':_0x3babb4});});},'ChatQueues':function(_0x53f5ea){return new Promise(function(_0x52e6a3,_0x5ff302){var _0x20b695=[];for(var _0x24641b in _0x3378f7[_0xeabb('0x42')]){if(_0x3378f7[_0xeabb('0x42')][_0xeabb('0x3d')](_0x24641b)){var _0x5551b7=_0x3378f7[_0xeabb('0x42')][_0x24641b];var _0x4b5335={'id':_0x5551b7['id'],'available':_0x5551b7[_0xeabb('0x43')],'loggedIn':_0x5551b7[_0xeabb('0x44')],'name':_0x5551b7[_0xeabb('0x45')],'paused':_0x5551b7['paused'],'waiting':_0x5551b7['waiting']};_0x20b695[_0xeabb('0x1e')](_0x4b5335);}}_0x52e6a3({'count':_0x20b695[_0xeabb('0x17')],'rows':_0x20b695});});},'MailQueues':function(_0x437289){return new Promise(function(_0x4ace11,_0x150728){var _0x556db5=[];for(var _0x3d432a in _0x3378f7[_0xeabb('0x46')]){if(_0x3378f7[_0xeabb('0x46')][_0xeabb('0x3d')](_0x3d432a)){var _0x3466b0=_0x3378f7['mailQueues'][_0x3d432a];var _0x20f69c={'id':_0x3466b0['id'],'available':_0x3466b0[_0xeabb('0x43')],'loggedIn':_0x3466b0['loggedIn'],'name':_0x3466b0['name'],'paused':_0x3466b0['paused'],'waiting':_0x3466b0['waiting']};_0x556db5[_0xeabb('0x1e')](_0x20f69c);}}_0x4ace11({'count':_0x556db5[_0xeabb('0x17')],'rows':_0x556db5});});},'OpenchannelQueues':function(_0xf45512){return new Promise(function(_0x3f9f16,_0x38adeb){var _0x392790=[];for(var _0x302a45 in _0x3378f7['openchannelQueues']){if(_0x3378f7['openchannelQueues'][_0xeabb('0x3d')](_0x302a45)){var _0x271f0a=_0x3378f7['openchannelQueues'][_0x302a45];var _0x3d8b7c={'id':_0x271f0a['id'],'available':_0x271f0a[_0xeabb('0x43')],'loggedIn':_0x271f0a[_0xeabb('0x44')],'name':_0x271f0a[_0xeabb('0x45')],'paused':_0x271f0a[_0xeabb('0x47')],'waiting':_0x271f0a[_0xeabb('0x48')]};_0x392790[_0xeabb('0x1e')](_0x3d8b7c);}}_0x3f9f16({'count':_0x392790[_0xeabb('0x17')],'rows':_0x392790});});},'SmsQueues':function(_0x35db36){return new Promise(function(_0x591e9e,_0x808ac2){var _0x4621af=[];for(var _0x155322 in _0x3378f7[_0xeabb('0x49')]){if(_0x3378f7['smsQueues'][_0xeabb('0x3d')](_0x155322)){var _0x103535=_0x3378f7[_0xeabb('0x49')][_0x155322];var _0x2c7cca={'id':_0x103535['id'],'available':_0x103535['available'],'loggedIn':_0x103535[_0xeabb('0x44')],'name':_0x103535[_0xeabb('0x45')],'paused':_0x103535[_0xeabb('0x47')],'waiting':_0x103535[_0xeabb('0x48')]};_0x4621af[_0xeabb('0x1e')](_0x2c7cca);}}_0x591e9e({'count':_0x4621af['length'],'rows':_0x4621af});});},'FaxQueues':function(_0x1b653e){return new Promise(function(_0x2b40a2,_0x4cdfc6){var _0x276975=[];for(var _0x4210ee in _0x3378f7[_0xeabb('0x4a')]){if(_0x3378f7[_0xeabb('0x4a')][_0xeabb('0x3d')](_0x4210ee)){var _0x56bf69=_0x3378f7[_0xeabb('0x4a')][_0x4210ee];var _0x100aa8={'id':_0x56bf69['id'],'available':_0x56bf69[_0xeabb('0x43')],'loggedIn':_0x56bf69[_0xeabb('0x44')],'name':_0x56bf69[_0xeabb('0x45')],'paused':_0x56bf69['paused'],'waiting':_0x56bf69[_0xeabb('0x48')]};_0x276975[_0xeabb('0x1e')](_0x100aa8);}}_0x2b40a2({'count':_0x276975[_0xeabb('0x17')],'rows':_0x276975});});},'ChatQueuesWaitingInteractions':function(_0x5b651c){return new Promise(function(_0x3890c6,_0x3b856e){var _0x489508=_['values'](_0x3378f7[_0xeabb('0x4b')]);_0x3890c6({'count':_0x489508['length'],'rows':_0x489508});});},'MailQueuesWaitingInteractions':function(_0x4eaaff){return new Promise(function(_0x3d21a9,_0x310899){var _0x2ac059=_[_0xeabb('0x41')](_0x3378f7[_0xeabb('0x4c')]);_0x3d21a9({'count':_0x2ac059[_0xeabb('0x17')],'rows':_0x2ac059});});},'OpenchannelQueuesWaitingInteractions':function(_0x25ea82){return new Promise(function(_0x27a8f5,_0x1c5421){var _0x2c4e85=_['values'](_0x3378f7[_0xeabb('0x4d')]);_0x27a8f5({'count':_0x2c4e85[_0xeabb('0x17')],'rows':_0x2c4e85});});},'SmsQueuesWaitingInteractions':function(_0x1938e4){return new Promise(function(_0x55fb9f,_0x329d95){var _0xdf07d3=_[_0xeabb('0x41')](_0x3378f7[_0xeabb('0x4e')]);_0x55fb9f({'count':_0xdf07d3[_0xeabb('0x17')],'rows':_0xdf07d3});});},'FaxQueuesWaitingInteractions':function(_0x5901d5){return new Promise(function(_0x63fd0b,_0x5c4d20){var _0x224005=_[_0xeabb('0x41')](_0x3378f7[_0xeabb('0x4f')]);_0x63fd0b({'count':_0x224005['length'],'rows':_0x224005});});}};var _0x2f085a=jayson['server'](_0x43c211)['http']();_0x2f085a['on'](_0xeabb('0x2b'),function(_0xd078e2){logger[_0xeabb('0x2b')](JSON[_0xeabb('0x2e')](_0xd078e2));return _0x5d0e14(_0xd078e2);});_0x2f085a[_0xeabb('0x11')](0x232c,'127.0.0.1',function(){console[_0xeabb('0x50')](_0xeabb('0x51'),0x232c);return _0x5f432b('RPC\x20listening\x20on\x20port:'+0x232c);});});};
\ No newline at end of file