Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / realtime / realtime.controller.js
index 0ad31a3..c23b60e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6f47=['address','faxPause','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','openchannelStatus','chatStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','mailPause','resolve','fieldName','type','query','agent','getOptions','raw','user','role','userProfileId','sort','UserProfile','getResources','findAndCountAll','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','chat','openchannel','fax','channel','includes','toLowerCase','Invalid\x20channel','rawAttributes','key','lodash','jayson/promise','../../config/logger','../../mysqldb','http','client','offset','limit','undefined','count','status','set','Content-Range','json','error','stack','name','request','Agents','then','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','startCase','Queues','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','available','voice','outbound','push','pTalking','message','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','paused','loggedInDb','loggedIn','waiting','talking','busy','originated','find','pick','filter','queue','length','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','voiceStatus','agents','User','Queue','findAll','QueueId','idle','unknown','ringing','isNil','chatPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','*pause','userpic','lastPauseAt','pauseType'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0x6f47,0xc7));var _0x76f4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x6f47[_0x502c7d];return _0x30b7ed;};'use strict';var util=require('util');var _=require(_0x76f4('0x0'));var jayson=require(_0x76f4('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x76f4('0x2'))('api');var db=require(_0x76f4('0x3'))['db'];var amiClient=jayson['client'][_0x76f4('0x4')]({'port':0x232a});var routingClient=jayson[_0x76f4('0x5')][_0x76f4('0x4')]({'port':0x232c});function respondWithFilteredResult(_0x2523ba,_0x5754ca){return function(_0x35602f){if(_0x35602f){var _0xfc2405=typeof _0x5754ca[_0x76f4('0x6')]==='undefined'&&typeof _0x5754ca[_0x76f4('0x7')]===_0x76f4('0x8');var _0x65d2c7=_0x35602f[_0x76f4('0x9')];var _0x101f55=_0xfc2405?0x0:_0x5754ca['offset'];var _0x5367d6=_0xfc2405?_0x35602f[_0x76f4('0x9')]:_0x5754ca[_0x76f4('0x6')]+_0x5754ca['limit'];var _0x51d500;if(_0x5367d6>=_0x65d2c7){_0x5367d6=_0x65d2c7;_0x51d500=0xc8;}else{_0x51d500=0xce;}_0x2523ba[_0x76f4('0xa')](_0x51d500);return _0x2523ba[_0x76f4('0xb')](_0x76f4('0xc'),_0x101f55+'-'+_0x5367d6+'/'+_0x65d2c7)[_0x76f4('0xd')](_0x35602f);}return null;};}function handleError(_0x1aee7f,_0xafd21e){_0xafd21e=_0xafd21e||0x1f4;return function(_0xf7e347){logger[_0x76f4('0xe')](_0xf7e347[_0x76f4('0xf')]);if(_0xf7e347['name']){delete _0xf7e347[_0x76f4('0x10')];}_0x1aee7f[_0x76f4('0xa')](_0xafd21e)['send'](_0xf7e347);};}function getRealtimeAgents(){return new Promise(function(_0x4b6021,_0x5d6f8e){return amiClient[_0x76f4('0x11')](_0x76f4('0x12'),{})[_0x76f4('0x13')](function(_0x40252d){if(_0x40252d[_0x76f4('0xe')])throw new Error(_0x76f4('0x14'));var _0x46ba51=_0x40252d[_0x76f4('0x15')];return routingClient[_0x76f4('0x11')](_0x76f4('0x12'),{})[_0x76f4('0x13')](function(_0x2d4bd1){if(_0x2d4bd1[_0x76f4('0xe')])throw new Error(_0x76f4('0x16'));var _0x17625e=_0x2d4bd1[_0x76f4('0x15')];return _0x4b6021(_[_0x76f4('0x17')]({},_0x46ba51,_0x17625e));});})[_0x76f4('0x18')](function(_0x435534){_0x5d6f8e(_0x435534);});});}function getRealtimeQueues(_0x35b406,_0x46f057){return new Promise(function(_0x285232,_0x5bf3d5){var _0x262937=_0x46f057==='voice'?amiClient:routingClient;return _0x262937[_0x76f4('0x11')](_[_0x76f4('0x19')](_0x46f057)+_0x76f4('0x1a'),_0x35b406)['then'](function(_0x567f2a){if(_0x567f2a['error'])throw new Error(util[_0x76f4('0x1b')](_0x76f4('0x1c'),_0x46f057));return _0x285232(_0x567f2a[_0x76f4('0x15')]);})[_0x76f4('0x18')](function(_0x42ef70){_0x5bf3d5(_0x42ef70);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x4786c9,_0x3f4d11){return amiClient['request']('VoiceQueuesChannels',{})[_0x76f4('0x13')](function(_0x497913){if(_0x497913[_0x76f4('0xe')])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x4786c9(_0x497913['result']);})['catch'](function(_0x470242){_0x3f4d11(_0x470242);});});}function initializeQueues(_0x38300d,_0xd368a2,_0x1d1fe6,_0x13d219){var _0x447dbc=['loggedIn',_0x76f4('0x1d'),'waiting','talking','paused'];if(_0x1d1fe6===_0x76f4('0x1e')&&_0x13d219===_0x76f4('0x1f')){_0x447dbc[_0x76f4('0x20')](_0x76f4('0x21'),'originated',_0x76f4('0x22'),'dialActive',_0x76f4('0x23'),_0x76f4('0x24'),_0x76f4('0x25'),_0x76f4('0x26'),_0x76f4('0x27'),'erlangCallToSecond','erlangAbandonmentRate',_0x76f4('0x28'),_0x76f4('0x29'),_0x76f4('0x2a'),_0x76f4('0x2b'),_0x76f4('0x2c'),_0x76f4('0x2d'),_0x76f4('0x2e'),_0x76f4('0x2f'),_0x76f4('0x30'),_0x76f4('0x31'),_0x76f4('0x32'));}return _0x38300d[_0x76f4('0x33')](function(_0x5326b2){var _0x58d4b7=_0x5326b2['get']({'plain':!![]});_0x58d4b7['agents']=[];_0x58d4b7[_0x76f4('0x34')]=0x0;_0x58d4b7[_0x76f4('0x35')]=0x0;_0x58d4b7[_0x76f4('0x36')]=0x0;_0x58d4b7[_0x76f4('0x1d')]=0x0;_0x58d4b7[_0x76f4('0x37')]=0x0;if(_0x1d1fe6==='voice'){_0x58d4b7[_0x76f4('0x38')]=0x0;_0x58d4b7[_0x76f4('0x39')]=0x0;if(_0x13d219===_0x76f4('0x1f')){_0x58d4b7[_0x76f4('0x21')]=0x0;_0x58d4b7[_0x76f4('0x3a')]=0x0;}}var _0x23278f=_[_0x76f4('0x3b')](_0xd368a2,['id',_0x58d4b7['id']]);if(_0x23278f)_[_0x76f4('0x17')](_0x58d4b7,_[_0x76f4('0x3c')](_0x23278f,_0x447dbc));return _0x58d4b7;});}function updateAgentVoiceStatus(_0xdce828,_0x6953ca,_0x244607){var _0x2d744e=_[_0x76f4('0x3d')](_0x244607,[_0x76f4('0x3e'),_0x6953ca[_0x76f4('0x10')]]);if(_0x2d744e[_0x76f4('0x3f')]===0x0)return _0xdce828[_0x76f4('0x39')]=!![];if(_['some'](_0x2d744e,[_0x76f4('0x40'),_0xdce828[_0x76f4('0x41')][_0x76f4('0x42')]()]))return _0xdce828['talking']=!![];if(!_0xdce828['talking'])return _0xdce828[_0x76f4('0x39')]=!![];}function getVoiceQueueAgents(_0x487926,_0x229d1e,_0x5ac18f,_0x152af8){var _0x16f36d=_[_0x76f4('0x3b')](_0x229d1e,['id',_0x487926['id']]);if(!_0x16f36d)return _0x487926;return _0x16f36d[_0x76f4('0x43')]({'raw':!![]})[_0x76f4('0x13')](function(_0x2d99e3){for(var _0x21ae82=0x0;_0x21ae82<_0x2d99e3[_0x76f4('0x3f')];_0x21ae82++){var _0x16779e=_[_0x76f4('0x3b')](_0x5ac18f,['id',_0x2d99e3[_0x21ae82]['UserId']]);if(!_0x16779e){_0x16779e={'id':_0x2d99e3[_0x21ae82]['UserId'],'name':_0x2d99e3[_0x21ae82][_0x76f4('0x44')],'accountcode':'','online':![]};}var _0x13a5a7={'id':_0x16779e['id'],'name':_0x16779e[_0x76f4('0x10')],'internal':_0x16779e[_0x76f4('0x45')],'online':Boolean(_0x16779e[_0x76f4('0x46')]),'paused':Boolean(_0x2d99e3[_0x21ae82][_0x76f4('0x34')])};if(_0x16779e[_0x76f4('0x47')]===_0x76f4('0x38'))updateAgentVoiceStatus(_0x13a5a7,_0x487926,_0x152af8);if(_0x13a5a7[_0x76f4('0x46')])_0x487926['loggedInDb']++;if(_0x13a5a7[_0x76f4('0x39')])_0x487926[_0x76f4('0x39')]++;if(_0x13a5a7['paused']&&!_0x13a5a7['busy']&&!_0x13a5a7[_0x76f4('0x38')])_0x487926[_0x76f4('0x34')]++;_0x487926[_0x76f4('0x48')][_0x76f4('0x20')](_0x13a5a7);}return _0x487926;});}function getQueueAgents(_0x212f50,_0x597734,_0x1b6183){var _0x4126aa=_0x76f4('0x49')+_[_0x76f4('0x19')](_0x1b6183)+_0x76f4('0x4a');var _0x673267=_0x1b6183+'Pause';return db[_0x4126aa][_0x76f4('0x4b')]({'where':{[_[_0x76f4('0x19')](_0x1b6183)+_0x76f4('0x4c')]:_0x212f50['id']},'raw':!![]})['then'](function(_0x571261){for(var _0x11ea58=0x0;_0x11ea58<_0x571261[_0x76f4('0x3f')];_0x11ea58++){var _0x306cc2=_[_0x76f4('0x3b')](_0x597734,['id',_0x571261[_0x11ea58][_0x76f4('0x44')]]);if(!_0x306cc2){_0x306cc2={'id':_0x571261[_0x11ea58]['UserId'],'name':_0x571261[_0x11ea58]['UserId'],'online':![],['pauseField']:![]};}var _0x8e5b60={'id':_0x306cc2['id'],'name':_0x306cc2['name'],'online':Boolean(_0x306cc2[_0x76f4('0x46')]),'paused':Boolean(_0x306cc2[_0x673267])};if(_0x8e5b60[_0x76f4('0x46')])_0x212f50['loggedInDb']++;_0x212f50['agents'][_0x76f4('0x20')](_0x8e5b60);}return _0x212f50;});}function isIdle(_0x40833d){return _0x40833d===_0x76f4('0x4d')||_0x40833d===_0x76f4('0x4e')||_0x40833d==='unavailable'||_0x40833d===_0x76f4('0x4f')||_[_0x76f4('0x50')](_0x40833d);}function isAgentPaused(_0x28922a,_0x533dca){var _0x23afe4=[_0x28922a[_0x76f4('0x51')],_0x28922a['faxPause'],_0x28922a['mailPause'],_0x28922a[_0x76f4('0x52')],_0x28922a[_0x76f4('0x53')],_0x28922a[_0x76f4('0x54')],_0x28922a[_0x76f4('0x55')]];if(!_0x533dca)return _[_0x76f4('0x56')](_0x23afe4);var _0x524503=_[_0x76f4('0x3d')](_0x23afe4);return _0x524503['length']>0x0&&_0x524503[_0x76f4('0x3f')]<_0x23afe4[_0x76f4('0x3f')]?!![]:![];}function isAgentIdle(_0x270baf){if(_0x270baf['voiceStatus']!==_0x76f4('0x4d')&&_0x270baf[_0x76f4('0x54')]){_0x270baf['voiceStatus']=_0x76f4('0x57');return![];}return _[_0x76f4('0x56')]([_0x270baf[_0x76f4('0x58')],_0x270baf[_0x76f4('0x59')],_0x270baf[_0x76f4('0x5a')],_0x270baf['openchannelStatus'],_0x270baf[_0x76f4('0x5b')],_0x270baf['voiceStatus'],_0x270baf[_0x76f4('0x5c')]],isIdle);}function getAgentStatus(_0x38dc69){var _0x154ba='unknown';if(isAgentPaused(_0x38dc69))_0x154ba=_0x76f4('0x57');else if(isAgentPaused(_0x38dc69,!![]))_0x154ba=_0x76f4('0x5d');else if(isAgentIdle(_0x38dc69))_0x154ba=_0x76f4('0x4d');else _0x154ba=_0x76f4('0x39');return _0x154ba;}exports['getAgents']=function(_0x2028e9,_0xf11e07){var _0xaad66b={'count':0x0,'rows':[]},_0xff4b9b={},_0x4dab07,_0x1d1117,_0x5b492c=[_0x76f4('0x5e'),'online','lastLoginAt',_0x76f4('0x5f'),_0x76f4('0x60'),_0x76f4('0x5f'),'internal',_0x76f4('0x61'),_0x76f4('0x51'),_0x76f4('0x52'),'mailPause','smsPause',_0x76f4('0x55'),_0x76f4('0x62'),'voicePause','chatCapacity',_0x76f4('0x63'),_0x76f4('0x64'),_0x76f4('0x65'),_0x76f4('0x66'),_0x76f4('0x67'),_0x76f4('0x68'),_0x76f4('0x69'),_0x76f4('0x6a'),_0x76f4('0x6b'),'whatsappCurrentCapacity','faxCurrentCapacity','chatStatus',_0x76f4('0x6c'),_0x76f4('0x5a'),_0x76f4('0x5b'),_0x76f4('0x5c'),'faxStatus','voiceStatus',_0x76f4('0x6d'),'openchannelStatusTime',_0x76f4('0x6e'),'smsStatusTime',_0x76f4('0x6f'),_0x76f4('0x70'),_0x76f4('0x71'),_0x76f4('0x3e'),'destconnectedlinenum',_0x76f4('0x72'),_0x76f4('0x73'),_0x76f4('0x74'),_0x76f4('0x75')],_0x129048=[_0x76f4('0x51'),_0x76f4('0x52'),_0x76f4('0x76'),'smsPause',_0x76f4('0x55'),_0x76f4('0x62'),_0x76f4('0x54'),_0x76f4('0x46')];Promise[_0x76f4('0x77')]()[_0x76f4('0x13')](function(){var _0x2e3653=_[_0x76f4('0x33')](db['User']['rawAttributes'],function(_0xa3091a){return{'name':_0xa3091a[_0x76f4('0x78')],'type':_0xa3091a[_0x76f4('0x79')]['key']};});_0x2028e9[_0x76f4('0x7a')]['role']=_0x76f4('0x7b');_0x2028e9[_0x76f4('0x7a')]['online']=!![];_0xff4b9b=qs[_0x76f4('0x7c')](_0x2e3653,_0x2028e9);_0xff4b9b[_0x76f4('0x7d')]=!![];if(_0x2028e9[_0x76f4('0x7e')][_0x76f4('0x7f')]===_0x76f4('0x7e')){var _0x351fde={'params':{'id':_0x2028e9[_0x76f4('0x7e')][_0x76f4('0x80')]},'query':{'section':_0x76f4('0x12'),'role':'agent','online':!![],'nolimit':_0x2028e9[_0x76f4('0x7a')]['nolimit'],'sort':_0x2028e9[_0x76f4('0x7a')][_0x76f4('0x81')],'filter':_0x2028e9[_0x76f4('0x7a')][_0x76f4('0x3d')],'raw':!![]}};return db[_0x76f4('0x82')][_0x76f4('0x83')](_0x351fde);}return db[_0x76f4('0x49')][_0x76f4('0x84')](_0xff4b9b);})[_0x76f4('0x13')](function(_0x373848){_0xaad66b['count']=_0x373848[_0x76f4('0x9')];_0x4dab07=_0x373848[_0x76f4('0x85')];return getRealtimeAgents();})['then'](function(_0x30b1f7){_0x1d1117=_0x30b1f7[_0x76f4('0x85')];return _0x4dab07[_0x76f4('0x33')](function(_0x53974b){var _0x318f78=_[_0x76f4('0x3b')](_0x1d1117,['id',_0x53974b['id']]);if(_0x318f78)_[_0x76f4('0x17')](_0x53974b,_['pick'](_[_0x76f4('0x86')](_0x318f78,_0x129048),_0x5b492c));_0x53974b[_0x76f4('0x87')]=getAgentStatus(_0x53974b);return _0x53974b;});})[_0x76f4('0x13')](function(_0x1ed3b0){if(_0x2028e9[_0x76f4('0x7a')][_0x76f4('0x88')]){var _0x19b99c=_[_0x76f4('0x3d')](_0x1ed3b0,[_0x76f4('0x87'),_0x2028e9['query'][_0x76f4('0x88')]]);if(_0x2028e9[_0x76f4('0x7a')][_0x76f4('0x89')]){_0x19b99c=_[_0x76f4('0x3d')](_0x19b99c,['pauseType',_0x2028e9[_0x76f4('0x7a')][_0x76f4('0x89')]]);}}_0xaad66b[_0x76f4('0x85')]=_0x19b99c||_0x1ed3b0;return _0xaad66b;})['then'](respondWithFilteredResult(_0xf11e07,_0xff4b9b))[_0x76f4('0x18')](handleError(_0xf11e07,null));};exports[_0x76f4('0x8a')]=function(_0x31249b,_0x99fbd6){var _0x400050=['mail',_0x76f4('0x8b'),'sms',_0x76f4('0x8c'),_0x76f4('0x8d'),'whatsapp','voice'];var _0x58251e={'count':0x0,'rows':[]},_0x3aa958={},_0x462f3e,_0x1e7b6,_0x3e2a07,_0x32fe75,_0x2a677d;Promise['resolve']()[_0x76f4('0x13')](function(){if(_0x31249b[_0x76f4('0x7a')][_0x76f4('0x8e')]){if(!_[_0x76f4('0x8f')](_0x400050,_0x31249b[_0x76f4('0x7a')][_0x76f4('0x8e')][_0x76f4('0x90')]()))throw new Error(_0x76f4('0x91'));_0x462f3e=_0x31249b['query'][_0x76f4('0x8e')]['toLowerCase']();}var _0x4b5532=_[_0x76f4('0x19')](_0x462f3e)+_0x76f4('0x4a');var _0x220a42=_[_0x76f4('0x33')](db[_0x4b5532][_0x76f4('0x92')],function(_0x36b601){return{'name':_0x36b601[_0x76f4('0x78')],'type':_0x36b601['type'][_0x76f4('0x93')]};});_0x3aa958=qs['getOptions'](_0x220a42,_0x31249b);if(_0x31249b['user']['role']===_0x76f4('0x7e')){var _0x402209={'params':{'id':_0x31249b[_0x76f4('0x7e')][_0x76f4('0x80')]},'query':{'section':_0x462f3e==='voice'&&_0x31249b[_0x76f4('0x7a')][_0x76f4('0x79')]===_0x76f4('0x1f')?'QueueCampaigns':_[_0x76f4('0x19')](_0x462f3e)+_0x76f4('0x1a'),'type':_0x31249b[_0x76f4('0x7a')][_0x76f4('0x79')],'nolimit':!![],'sort':_0x76f4('0x10'),'filter':_0x31249b[_0x76f4('0x7a')][_0x76f4('0x3d')]}};return db['UserProfile'][_0x76f4('0x83')](_0x402209);}return db[_0x4b5532][_0x76f4('0x84')](_0x3aa958);})['then'](function(_0x3bc914){_0x58251e[_0x76f4('0x9')]=_0x3bc914[_0x76f4('0x9')];_0x1e7b6=_0x3bc914[_0x76f4('0x85')];return getRealtimeQueues(_0x31249b,_0x462f3e);})[_0x76f4('0x13')](function(_0x1f62a9){_0x32fe75=_0x1f62a9[_0x76f4('0x85')];return getRealtimeAgents();})[_0x76f4('0x13')](function(_0x330d61){_0x3e2a07=_0x330d61['rows'];if(_0x462f3e!=_0x76f4('0x1e'))return;return getRealtimeVoiceQueueChannels();})[_0x76f4('0x13')](function(_0x1f5f0d){_0x2a677d=_0x1f5f0d?_0x1f5f0d[_0x76f4('0x85')]:[];return initializeQueues(_0x1e7b6,_0x32fe75,_0x462f3e,_0x31249b['query'][_0x76f4('0x79')]);})['then'](function(_0x420281){var _0x4a7a98=_0x420281[_0x76f4('0x33')](function(_0x7380f){if(_0x462f3e==='voice')return getVoiceQueueAgents(_0x7380f,_0x1e7b6,_0x3e2a07,_0x2a677d);else return getQueueAgents(_0x7380f,_0x3e2a07,_0x462f3e);});return Promise['all'](_0x4a7a98);})[_0x76f4('0x13')](function(_0xc709fd){_0x58251e[_0x76f4('0x85')]=_0xc709fd;return _0x58251e;})['then'](respondWithFilteredResult(_0x99fbd6,_0x3aa958))['catch'](handleError(_0x99fbd6,null));};
\ No newline at end of file
+var _0x44ee=['Queue','globalQueueFilter','fieldName','key','agent','getOptions','isEmpty','where','role','user','userProfileId','nolimit','UserProfile','omit','globalStatusFilter','pauseTypeFilter','rawAttributes','QueueCampaigns','getResources','findAndCountAll','rows','type','util','lodash','jayson/promise','../../config/logger','api','client','http','offset','undefined','count','limit','status','set','Content-Range','stack','name','send','error','result','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','catch','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','waiting','talking','outbound','push','originated','Trunk','startProgressive','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','loggedInDb','available','voice','pTalking','find','pick','filter','queue','length','busy','connectedlinenum','internal','toString','getMembers','UserId','accountcode','online','paused','voiceStatus','agents','User','Pause','findAll','idle','unknown','unavailable','ringing','isNil','faxPause','mailPause','openchannelPause','smsPause','voicePause','whatsappPause','every','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','*pause','mail','sms','toLowerCase','Invalid\x20channel','isArray','getAgents','all','flatten','value','split','fields','includes','globalStatus','order','startsWith','DESC','pauseType','lastPauseAt','chatPause','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','smsStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','voiceStatusTime','destconnectedlinenum','routealias','resolve','channel','query','sort','join'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x44ee,0x1e7));var _0xe44e=function(_0x561d9b,_0x1a7508){_0x561d9b=_0x561d9b-0x0;var _0xf0b943=_0x44ee[_0x561d9b];return _0xf0b943;};'use strict';var util=require(_0xe44e('0x0'));var _=require(_0xe44e('0x1'));var jayson=require(_0xe44e('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xe44e('0x3'))(_0xe44e('0x4'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0xe44e('0x5')][_0xe44e('0x6')]({'port':0x232a});var routingClient=jayson['client'][_0xe44e('0x6')]({'port':0x232c});function respondWithFilteredResult(_0x2ef89f,_0x17a048){return function(_0x2668e0){if(_0x2668e0){var _0x3b56a9=typeof _0x17a048[_0xe44e('0x7')]===_0xe44e('0x8')&&typeof _0x17a048['limit']===_0xe44e('0x8');var _0x2fb2ec=_0x2668e0[_0xe44e('0x9')];var _0xd777d9=_0x3b56a9?0x0:_0x17a048[_0xe44e('0x7')];var _0x44612c=_0x3b56a9?_0x2668e0[_0xe44e('0x9')]:_0x17a048[_0xe44e('0x7')]+_0x17a048[_0xe44e('0xa')];var _0x527196;if(_0x44612c>=_0x2fb2ec){_0x44612c=_0x2fb2ec;_0x527196=0xc8;}else{_0x527196=0xce;}_0x2ef89f[_0xe44e('0xb')](_0x527196);return _0x2ef89f[_0xe44e('0xc')](_0xe44e('0xd'),_0xd777d9+'-'+_0x44612c+'/'+_0x2fb2ec)['json'](_0x2668e0);}return null;};}function handleError(_0xf9f195,_0x3fd0e6){_0x3fd0e6=_0x3fd0e6||0x1f4;return function(_0x537d55){logger['error'](_0x537d55[_0xe44e('0xe')]);if(_0x537d55[_0xe44e('0xf')]){delete _0x537d55['name'];}_0xf9f195[_0xe44e('0xb')](_0x3fd0e6)[_0xe44e('0x10')](_0x537d55);};}function getRealtimeAgents(){return new Promise(function(_0x2eaf54,_0x2a8a1b){return amiClient['request']('Agents',{})['then'](function(_0x4de300){if(_0x4de300[_0xe44e('0x11')])throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');var _0x15224d=_0x4de300[_0xe44e('0x12')];return routingClient[_0xe44e('0x13')](_0xe44e('0x14'),{})['then'](function(_0x15c5b3){if(_0x15c5b3[_0xe44e('0x11')])throw new Error(_0xe44e('0x15'));var _0xf7ee03=_0x15c5b3['result'];return _0x2eaf54(_[_0xe44e('0x16')]({},_0x15224d,_0xf7ee03));});})['catch'](function(_0x16f4b0){_0x2a8a1b(_0x16f4b0);});});}function getRealtimeQueues(_0x4b8401,_0x13e488){return new Promise(function(_0x470bcd,_0x136d4a){var _0x52febd=_0x13e488==='voice'?amiClient:routingClient;return _0x52febd[_0xe44e('0x13')](_[_0xe44e('0x17')](_0x13e488)+_0xe44e('0x18'),_0x4b8401)[_0xe44e('0x19')](function(_0x54da33){if(_0x54da33[_0xe44e('0x11')])throw new Error(util[_0xe44e('0x1a')](_0xe44e('0x1b'),_0x13e488));return _0x470bcd(_0x54da33[_0xe44e('0x12')]);})[_0xe44e('0x1c')](function(_0x23fc47){_0x136d4a(_0x23fc47);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x13e84f,_0x19e5d1){return amiClient[_0xe44e('0x13')](_0xe44e('0x1d'),{})[_0xe44e('0x19')](function(_0x296cef){if(_0x296cef[_0xe44e('0x11')])throw new Error(_0xe44e('0x1e'));return _0x13e84f(_0x296cef[_0xe44e('0x12')]);})[_0xe44e('0x1c')](function(_0x50b4b2){_0x19e5d1(_0x50b4b2);});});}function initializeQueues(_0x5b3b3a,_0x4769f8,_0x5b7f8d,_0x3f545f){var _0x5c2d83=[_0xe44e('0x1f'),'available',_0xe44e('0x20'),_0xe44e('0x21'),'paused'];if(_0x5b7f8d==='voice'&&_0x3f545f===_0xe44e('0x22')){_0x5c2d83[_0xe44e('0x23')]('pTalking',_0xe44e('0x24'),'message','dialActive','dialMethod',_0xe44e('0x25'),'startPredictive',_0xe44e('0x26'),'erlangCalls',_0xe44e('0x27'),_0xe44e('0x28'),_0xe44e('0x29'),_0xe44e('0x2a'),'dialPredictiveIntervalMaxThreshold',_0xe44e('0x2b'),_0xe44e('0x2c'),'predictiveIntervalTotalCalls',_0xe44e('0x2d'),_0xe44e('0x2e'),_0xe44e('0x2f'),_0xe44e('0x30'),'predictiveIntervalAvgTalktime');}return _0x5b3b3a[_0xe44e('0x31')](function(_0x3b3a27){var _0xef6488=_0x3b3a27['get']({'plain':!![]});_0xef6488['agents']=[];_0xef6488['paused']=0x0;_0xef6488[_0xe44e('0x32')]=0x0;_0xef6488['loggedIn']=0x0;_0xef6488[_0xe44e('0x33')]=0x0;_0xef6488['waiting']=0x0;if(_0x5b7f8d===_0xe44e('0x34')){_0xef6488[_0xe44e('0x21')]=0x0;_0xef6488['busy']=0x0;if(_0x3f545f===_0xe44e('0x22')){_0xef6488[_0xe44e('0x35')]=0x0;_0xef6488[_0xe44e('0x24')]=0x0;}}var _0x5a07c8=_[_0xe44e('0x36')](_0x4769f8,['id',_0xef6488['id']]);if(_0x5a07c8)_[_0xe44e('0x16')](_0xef6488,_[_0xe44e('0x37')](_0x5a07c8,_0x5c2d83));return _0xef6488;});}function updateAgentVoiceStatus(_0x14fbc3,_0x2331be,_0x1373a9){var _0x4bcb2b=_[_0xe44e('0x38')](_0x1373a9,[_0xe44e('0x39'),_0x2331be[_0xe44e('0xf')]]);if(_0x4bcb2b[_0xe44e('0x3a')]===0x0)return _0x14fbc3[_0xe44e('0x3b')]=!![];if(_['some'](_0x4bcb2b,[_0xe44e('0x3c'),_0x14fbc3[_0xe44e('0x3d')][_0xe44e('0x3e')]()]))return _0x14fbc3[_0xe44e('0x21')]=!![];if(!_0x14fbc3['talking'])return _0x14fbc3[_0xe44e('0x3b')]=!![];}function getVoiceQueueAgents(_0x43b8bc,_0x8a151a,_0x4eb566,_0x33242d){var _0xb5ca79=_[_0xe44e('0x36')](_0x8a151a,['id',_0x43b8bc['id']]);if(!_0xb5ca79)return _0x43b8bc;return _0xb5ca79[_0xe44e('0x3f')]({'raw':!![]})['then'](function(_0xaaec59){for(var _0xe2caa6=0x0;_0xe2caa6<_0xaaec59[_0xe44e('0x3a')];_0xe2caa6++){var _0x3bf4d2=_[_0xe44e('0x36')](_0x4eb566,['id',_0xaaec59[_0xe2caa6]['UserId']]);if(!_0x3bf4d2){_0x3bf4d2={'id':_0xaaec59[_0xe2caa6][_0xe44e('0x40')],'name':_0xaaec59[_0xe2caa6][_0xe44e('0x40')],'accountcode':'','online':![]};}var _0x1c1b8f={'id':_0x3bf4d2['id'],'name':_0x3bf4d2[_0xe44e('0xf')],'internal':_0x3bf4d2[_0xe44e('0x41')],'online':Boolean(_0x3bf4d2[_0xe44e('0x42')]),'paused':Boolean(_0xaaec59[_0xe2caa6][_0xe44e('0x43')])};if(_0x3bf4d2[_0xe44e('0x44')]===_0xe44e('0x21'))updateAgentVoiceStatus(_0x1c1b8f,_0x43b8bc,_0x33242d);if(_0x1c1b8f['online'])_0x43b8bc['loggedInDb']++;if(_0x1c1b8f['busy'])_0x43b8bc[_0xe44e('0x3b')]++;if(_0x1c1b8f[_0xe44e('0x43')]&&!_0x1c1b8f[_0xe44e('0x3b')]&&!_0x1c1b8f[_0xe44e('0x21')])_0x43b8bc[_0xe44e('0x43')]++;_0x43b8bc[_0xe44e('0x45')][_0xe44e('0x23')](_0x1c1b8f);}return _0x43b8bc;});}function getQueueAgents(_0x58eabb,_0x452e2d,_0x4e8c52){var _0x1065fb=_0xe44e('0x46')+_[_0xe44e('0x17')](_0x4e8c52)+'Queue';var _0x331364=_0x4e8c52+_0xe44e('0x47');return db[_0x1065fb][_0xe44e('0x48')]({'where':{[_[_0xe44e('0x17')](_0x4e8c52)+'QueueId']:_0x58eabb['id']},'raw':!![]})[_0xe44e('0x19')](function(_0x547758){for(var _0xc417e5=0x0;_0xc417e5<_0x547758[_0xe44e('0x3a')];_0xc417e5++){var _0x31ea27=_[_0xe44e('0x36')](_0x452e2d,['id',_0x547758[_0xc417e5][_0xe44e('0x40')]]);if(!_0x31ea27){_0x31ea27={'id':_0x547758[_0xc417e5][_0xe44e('0x40')],'name':_0x547758[_0xc417e5][_0xe44e('0x40')],'online':![],['pauseField']:![]};}var _0x50f930={'id':_0x31ea27['id'],'name':_0x31ea27['name'],'online':Boolean(_0x31ea27['online']),'paused':Boolean(_0x31ea27[_0x331364])};if(_0x50f930['online'])_0x58eabb[_0xe44e('0x32')]++;_0x58eabb[_0xe44e('0x45')]['push'](_0x50f930);}return _0x58eabb;});}function isIdle(_0x2e10cd){return _0x2e10cd===_0xe44e('0x49')||_0x2e10cd===_0xe44e('0x4a')||_0x2e10cd===_0xe44e('0x4b')||_0x2e10cd===_0xe44e('0x4c')||_[_0xe44e('0x4d')](_0x2e10cd);}function isAgentPaused(_0x10e765,_0x4c8451){var _0x2e8ea7=[_0x10e765['chatPause'],_0x10e765[_0xe44e('0x4e')],_0x10e765[_0xe44e('0x4f')],_0x10e765[_0xe44e('0x50')],_0x10e765[_0xe44e('0x51')],_0x10e765[_0xe44e('0x52')],_0x10e765[_0xe44e('0x53')]];if(!_0x4c8451)return _[_0xe44e('0x54')](_0x2e8ea7);var _0x5f4d49=_[_0xe44e('0x38')](_0x2e8ea7);return _0x5f4d49[_0xe44e('0x3a')]>0x0&&_0x5f4d49[_0xe44e('0x3a')]<_0x2e8ea7[_0xe44e('0x3a')]?!![]:![];}function isAgentIdle(_0x32d1dc){if(_0x32d1dc[_0xe44e('0x44')]!==_0xe44e('0x49')&&_0x32d1dc['voicePause']){_0x32d1dc['voiceStatus']=_0xe44e('0x55');return![];}return _[_0xe44e('0x54')]([_0x32d1dc[_0xe44e('0x56')],_0x32d1dc[_0xe44e('0x57')],_0x32d1dc[_0xe44e('0x58')],_0x32d1dc[_0xe44e('0x59')],_0x32d1dc['smsStatus'],_0x32d1dc[_0xe44e('0x44')],_0x32d1dc['whatsappStatus']],isIdle);}function getAgentStatus(_0x4b081a){var _0x1a342f=_0xe44e('0x4a');if(isAgentPaused(_0x4b081a))_0x1a342f=_0xe44e('0x55');else if(isAgentPaused(_0x4b081a,!![]))_0x1a342f=_0xe44e('0x5a');else if(isAgentIdle(_0x4b081a))_0x1a342f=_0xe44e('0x49');else _0x1a342f='busy';return _0x1a342f;}function validateChannel(_0x55cb0c){var _0x2dc163=[_0xe44e('0x5b'),'chat',_0xe44e('0x5c'),'openchannel','fax','whatsapp',_0xe44e('0x34')];if(!_['includes'](_0x2dc163,_0x55cb0c[_0xe44e('0x5d')]()))throw new Error(_0xe44e('0x5e'));return _0x55cb0c['toLowerCase']();}function getFilteredAgentIds(_0x14c262,_0x31364c){var _0x344788=_[_0xe44e('0x5f')](_0x14c262)?_0x14c262:[_0x14c262];var _0x258137=_[_0xe44e('0x31')](_0x344788,function(_0x131dff){return db[_0x31364c]['findOne']({'where':{'name':_0x131dff}})['then'](function(_0x5739aa){if(!_0x5739aa)return[];return _0x5739aa[_0xe44e('0x60')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xe44e('0x61')](_0x258137)[_0xe44e('0x19')](function(_0x2346cb){var _0x1dd9a8=_(_0x2346cb)[_0xe44e('0x62')]()[_0xe44e('0x31')]('id')['uniq']()[_0xe44e('0x63')]();return _0x1dd9a8;});}function getUpdatedSortOptions(_0x3801b8){var _0x332cdf={'fields':[],'order':null};var _0x46082e=_0x3801b8[_0xe44e('0x64')](',');_0x332cdf[_0xe44e('0x65')]=_[_0xe44e('0x38')](_0x46082e,function(_0x5dfbe1){if(!_0x5dfbe1[_0xe44e('0x66')](_0xe44e('0x67')))return!![];_0x332cdf[_0xe44e('0x68')]=_[_0xe44e('0x69')](_0x5dfbe1,'-')?_0xe44e('0x6a'):'ASC';return![];});return _0x332cdf;}function orderAgentsByStatus(_0x5531dc,_0x5a039b){return _0x5531dc['sort'](function(_0x1ab6ae,_0x11ee7b){if(_0x1ab6ae[_0xe44e('0x67')]===_0x11ee7b[_0xe44e('0x67')]&&_0x1ab6ae[_0xe44e('0x67')]===_0xe44e('0x55')){if(_0x5a039b===_0xe44e('0x6a'))return(_0x1ab6ae['pauseType']||'')<(_0x11ee7b[_0xe44e('0x6b')]||'')?0x1:-0x1;return _0x1ab6ae['pauseType']<_0x11ee7b['pauseType']?-0x1:0x1;}else{if(_0x5a039b===_0xe44e('0x6a'))return _0x1ab6ae['globalStatus']<_0x11ee7b[_0xe44e('0x67')]?0x1:-0x1;return _0x1ab6ae[_0xe44e('0x67')]<_0x11ee7b[_0xe44e('0x67')]?-0x1:0x1;}});}exports[_0xe44e('0x60')]=function(_0x14dbdc,_0x5463fe){var _0x88ea1b={'count':0x0,'rows':[]},_0x5c080c={},_0xd11c1f,_0x1e815e,_0x4ab16b,_0x1a03f0,_0x2dae0f=['userpic',_0xe44e('0x42'),'lastLoginAt','lastPauseAt',_0xe44e('0x6b'),_0xe44e('0x6c'),_0xe44e('0x3d'),'address',_0xe44e('0x6d'),_0xe44e('0x50'),_0xe44e('0x4f'),_0xe44e('0x51'),'whatsappPause',_0xe44e('0x4e'),'voicePause',_0xe44e('0x6e'),_0xe44e('0x6f'),'mailCapacity',_0xe44e('0x70'),_0xe44e('0x71'),_0xe44e('0x72'),'chatCurrentCapacity',_0xe44e('0x73'),_0xe44e('0x74'),_0xe44e('0x75'),_0xe44e('0x76'),'faxCurrentCapacity',_0xe44e('0x56'),_0xe44e('0x59'),'mailStatus',_0xe44e('0x77'),_0xe44e('0x78'),'faxStatus','voiceStatus',_0xe44e('0x79'),_0xe44e('0x7a'),_0xe44e('0x7b'),'smsStatusTime',_0xe44e('0x7c'),'faxStatusTime',_0xe44e('0x7d'),_0xe44e('0x39'),_0xe44e('0x7e'),'screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording',_0xe44e('0x7f')],_0x71d430=[_0xe44e('0x6d'),_0xe44e('0x50'),'mailPause',_0xe44e('0x51'),_0xe44e('0x53'),_0xe44e('0x4e'),_0xe44e('0x52'),'online'];Promise[_0xe44e('0x80')]()[_0xe44e('0x19')](function(){if(_0x14dbdc['query']['channel'])_0xd11c1f=validateChannel(_0x14dbdc['query'][_0xe44e('0x81')]);if(!_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')]||!_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')][_0xe44e('0x66')](_0xe44e('0x67')))return;var _0x26eea4=getUpdatedSortOptions(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')]);_0x14dbdc['query'][_0xe44e('0x83')]=_0x26eea4[_0xe44e('0x65')][_0xe44e('0x84')](',');_0x1e815e=_0x26eea4[_0xe44e('0x68')];})[_0xe44e('0x19')](function(){if(!_0x14dbdc[_0xe44e('0x82')]['globalQueueFilter'])return[];var _0x2e68f9=_[_0xe44e('0x17')](_0xd11c1f)+_0xe44e('0x85');return getFilteredAgentIds(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x86')],_0x2e68f9);})[_0xe44e('0x19')](function(_0x256849){var _0x4bd192=_[_0xe44e('0x31')](db[_0xe44e('0x46')]['rawAttributes'],function(_0x396157){return{'name':_0x396157[_0xe44e('0x87')],'type':_0x396157['type'][_0xe44e('0x88')]};});_0x14dbdc[_0xe44e('0x82')]['role']=_0xe44e('0x89');_0x14dbdc['query'][_0xe44e('0x42')]=!![];_0x5c080c=qs[_0xe44e('0x8a')](_0x4bd192,_0x14dbdc);_0x5c080c['raw']=!![];if(!_[_0xe44e('0x8b')](_0x256849)){_0x5c080c['where']=_[_0xe44e('0x16')](_0x5c080c[_0xe44e('0x8c')],{'$and':[{'id':{'$in':_0x256849}}]});}else if(!_[_0xe44e('0x8b')](_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x86')])){return _0x88ea1b;}if(_0x14dbdc['user'][_0xe44e('0x8d')]===_0xe44e('0x8e')){var _0x2bc678={'params':{'id':_0x14dbdc['user'][_0xe44e('0x8f')]},'query':{'section':'Agents','role':_0xe44e('0x89'),'online':!![],'nolimit':_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x90')],'sort':_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x83')],'filter':_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x38')],'raw':!![],'ids':_0x256849}};return db[_0xe44e('0x91')]['getResources'](_0x2bc678);}return db[_0xe44e('0x46')]['findAndCountAll'](_0x5c080c);})[_0xe44e('0x19')](function(_0x3f0d22){_0x88ea1b[_0xe44e('0x9')]=_0x3f0d22[_0xe44e('0x9')];_0x4ab16b=_0x3f0d22['rows'];return getRealtimeAgents();})[_0xe44e('0x19')](function(_0xc22968){_0x1a03f0=_0xc22968['rows'];return _0x4ab16b[_0xe44e('0x31')](function(_0x40f2b8){var _0x4ceed1=_[_0xe44e('0x36')](_0x1a03f0,['id',_0x40f2b8['id']]);if(_0x4ceed1)_['merge'](_0x40f2b8,_['pick'](_[_0xe44e('0x92')](_0x4ceed1,_0x71d430),_0x2dae0f));_0x40f2b8[_0xe44e('0x67')]=getAgentStatus(_0x40f2b8);return _0x40f2b8;});})[_0xe44e('0x19')](function(_0x154fa3){var _0x58b5e7;if(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x93')]){_0x58b5e7=_[_0xe44e('0x38')](_0x154fa3,[_0xe44e('0x67'),_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x93')]]);if(_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x94')]){_0x58b5e7=_['filter'](_0x58b5e7,[_0xe44e('0x6b'),_0x14dbdc[_0xe44e('0x82')][_0xe44e('0x94')]]);}}if(_0x58b5e7)_0x154fa3=_0x58b5e7;if(!_0x1e815e)return _0x154fa3;return orderAgentsByStatus(_0x154fa3,_0x1e815e);})[_0xe44e('0x19')](function(_0x9a7f69){_0x88ea1b['rows']=_0x9a7f69;return _0x88ea1b;})['then'](respondWithFilteredResult(_0x5463fe,_0x5c080c))['catch'](handleError(_0x5463fe,null));};exports['getQueues']=function(_0x2b22a6,_0x452e0c){var _0x468ee2={'count':0x0,'rows':[]},_0x322d64={},_0x231030,_0x41865e,_0x148e40,_0x44ed9a,_0x251a92;Promise[_0xe44e('0x80')]()[_0xe44e('0x19')](function(){if(_0x2b22a6[_0xe44e('0x82')][_0xe44e('0x81')])_0x231030=validateChannel(_0x2b22a6['query'][_0xe44e('0x81')]);var _0x4f126c=_[_0xe44e('0x17')](_0x231030)+_0xe44e('0x85');var _0xf89534=_[_0xe44e('0x31')](db[_0x4f126c][_0xe44e('0x95')],function(_0x20655b){return{'name':_0x20655b[_0xe44e('0x87')],'type':_0x20655b['type'][_0xe44e('0x88')]};});_0x322d64=qs[_0xe44e('0x8a')](_0xf89534,_0x2b22a6);if(_0x2b22a6[_0xe44e('0x8e')][_0xe44e('0x8d')]===_0xe44e('0x8e')){var _0x4d8417={'params':{'id':_0x2b22a6[_0xe44e('0x8e')]['userProfileId']},'query':{'section':_0x231030==='voice'&&_0x2b22a6[_0xe44e('0x82')]['type']===_0xe44e('0x22')?_0xe44e('0x96'):_[_0xe44e('0x17')](_0x231030)+'Queues','type':_0x2b22a6[_0xe44e('0x82')]['type'],'nolimit':!![],'sort':'name','filter':_0x2b22a6[_0xe44e('0x82')]['filter']}};return db['UserProfile'][_0xe44e('0x97')](_0x4d8417);}return db[_0x4f126c][_0xe44e('0x98')](_0x322d64);})[_0xe44e('0x19')](function(_0x447214){_0x468ee2[_0xe44e('0x9')]=_0x447214[_0xe44e('0x9')];_0x41865e=_0x447214[_0xe44e('0x99')];return getRealtimeQueues(_0x2b22a6,_0x231030);})[_0xe44e('0x19')](function(_0x56ce4e){_0x44ed9a=_0x56ce4e[_0xe44e('0x99')];return getRealtimeAgents();})[_0xe44e('0x19')](function(_0x2dfd4c){_0x148e40=_0x2dfd4c[_0xe44e('0x99')];if(_0x231030!=_0xe44e('0x34'))return;return getRealtimeVoiceQueueChannels();})[_0xe44e('0x19')](function(_0x4f22f8){_0x251a92=_0x4f22f8?_0x4f22f8['rows']:[];return initializeQueues(_0x41865e,_0x44ed9a,_0x231030,_0x2b22a6[_0xe44e('0x82')][_0xe44e('0x9a')]);})[_0xe44e('0x19')](function(_0x4bae17){var _0x3ece2d=_0x4bae17['map'](function(_0x343963){if(_0x231030===_0xe44e('0x34'))return getVoiceQueueAgents(_0x343963,_0x41865e,_0x148e40,_0x251a92);else return getQueueAgents(_0x343963,_0x148e40,_0x231030);});return Promise[_0xe44e('0x61')](_0x3ece2d);})['then'](function(_0x261860){_0x468ee2[_0xe44e('0x99')]=_0x261860;return _0x468ee2;})[_0xe44e('0x19')](respondWithFilteredResult(_0x452e0c,_0x322d64))[_0xe44e('0x1c')](handleError(_0x452e0c,null));};
\ No newline at end of file