Built motion from commit 85328c08.|2.5.50
[motion2.git] / server / api / realtime / realtime.controller.js
index e8c40e5..278003a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x76e3=['Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','startCase','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','loggedIn','available','paused','outbound','originated','message','dialActive','dialMethod','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','map','get','agents','loggedInDb','voice','busy','pTalking','find','pick','queue','some','internal','toString','talking','getMembers','length','UserId','accountcode','online','push','Queue','Pause','QueueId','idle','unknown','ringing','isNil','chatPause','mailPause','openchannelPause','voicePause','filter','voiceStatus','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','*pause','getAgents','lastLoginAt','lastPauseAt','pauseType','whatsappPause','faxPause','chatCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatus','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','smsPause','resolve','User','fieldName','type','key','agent','query','getOptions','raw','user','nolimit','UserProfile','getResources','findAndCountAll','count','rows','omit','globalStatus','globalStatusFilter','pauseTypeFilter','getQueues','mail','chat','openchannel','fax','whatsapp','toLowerCase','Invalid\x20channel','channel','rawAttributes','userProfileId','QueueCampaigns','util','lodash','jayson/promise','../../components/parsers/qs','../../config/logger','client','offset','undefined','limit','status','Content-Range','json','stack','name','send','request','Agents'];(function(_0x28874f,_0x61a6a2){var _0x3ffc2f=function(_0x209b07){while(--_0x209b07){_0x28874f['push'](_0x28874f['shift']());}};_0x3ffc2f(++_0x61a6a2);}(_0x76e3,0x115));var _0x376e=function(_0xfdba05,_0x4448b6){_0xfdba05=_0xfdba05-0x0;var _0x2c7dcd=_0x76e3[_0xfdba05];return _0x2c7dcd;};'use strict';var util=require(_0x376e('0x0'));var _=require(_0x376e('0x1'));var jayson=require(_0x376e('0x2'));var qs=require(_0x376e('0x3'));var logger=require(_0x376e('0x4'))('api');var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x376e('0x5')]['http']({'port':0x232a});var routingClient=jayson[_0x376e('0x5')]['http']({'port':0x232c});function respondWithFilteredResult(_0x415187,_0x5e6c24){return function(_0x5ed198){if(_0x5ed198){var _0x6632e9=typeof _0x5e6c24[_0x376e('0x6')]===_0x376e('0x7')&&typeof _0x5e6c24[_0x376e('0x8')]==='undefined';var _0x523287=_0x5ed198['count'];var _0x333458=_0x6632e9?0x0:_0x5e6c24[_0x376e('0x6')];var _0xe4da37=_0x6632e9?_0x5ed198['count']:_0x5e6c24[_0x376e('0x6')]+_0x5e6c24[_0x376e('0x8')];var _0x372631;if(_0xe4da37>=_0x523287){_0xe4da37=_0x523287;_0x372631=0xc8;}else{_0x372631=0xce;}_0x415187[_0x376e('0x9')](_0x372631);return _0x415187['set'](_0x376e('0xa'),_0x333458+'-'+_0xe4da37+'/'+_0x523287)[_0x376e('0xb')](_0x5ed198);}return null;};}function handleError(_0x596f23,_0x555e54){_0x555e54=_0x555e54||0x1f4;return function(_0x43a180){logger['error'](_0x43a180[_0x376e('0xc')]);if(_0x43a180[_0x376e('0xd')]){delete _0x43a180[_0x376e('0xd')];}_0x596f23[_0x376e('0x9')](_0x555e54)[_0x376e('0xe')](_0x43a180);};}function getRealtimeAgents(){return new Promise(function(_0x5637a9,_0x440950){return amiClient[_0x376e('0xf')](_0x376e('0x10'),{})['then'](function(_0x7e8d44){if(_0x7e8d44['error'])throw new Error(_0x376e('0x11'));var _0xdd6f82=_0x7e8d44[_0x376e('0x12')];return routingClient[_0x376e('0xf')](_0x376e('0x10'),{})['then'](function(_0x3822be){if(_0x3822be[_0x376e('0x13')])throw new Error(_0x376e('0x14'));var _0x548cd1=_0x3822be[_0x376e('0x12')];return _0x5637a9(_[_0x376e('0x15')]({},_0xdd6f82,_0x548cd1));});})[_0x376e('0x16')](function(_0x3946fc){_0x440950(_0x3946fc);});});}function getRealtimeQueues(_0x2c863d,_0x496c0c){return new Promise(function(_0x2fea7e,_0x2bbb37){var _0x13cf6f=_0x496c0c==='voice'?amiClient:routingClient;return _0x13cf6f[_0x376e('0xf')](_[_0x376e('0x17')](_0x496c0c)+'Queues',_0x2c863d)[_0x376e('0x18')](function(_0x2b598f){if(_0x2b598f['error'])throw new Error(util[_0x376e('0x19')](_0x376e('0x1a'),_0x496c0c));return _0x2fea7e(_0x2b598f[_0x376e('0x12')]);})[_0x376e('0x16')](function(_0x31d27d){_0x2bbb37(_0x31d27d);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x34685b,_0x2a6299){return amiClient[_0x376e('0xf')](_0x376e('0x1b'),{})[_0x376e('0x18')](function(_0x44fab1){if(_0x44fab1['error'])throw new Error('Unable\x20to\x20retrieve\x20voice\x20queues\x20channels');return _0x34685b(_0x44fab1[_0x376e('0x12')]);})[_0x376e('0x16')](function(_0x30d195){_0x2a6299(_0x30d195);});});}function initializeQueues(_0x4c91b2,_0x153006,_0x54820d,_0x246f7d){var _0x24c556=[_0x376e('0x1c'),_0x376e('0x1d'),'waiting','talking',_0x376e('0x1e')];if(_0x54820d==='voice'&&_0x246f7d===_0x376e('0x1f')){_0x24c556['push']('pTalking',_0x376e('0x20'),_0x376e('0x21'),_0x376e('0x22'),_0x376e('0x23'),'Trunk','startPredictive',_0x376e('0x24'),_0x376e('0x25'),_0x376e('0x26'),_0x376e('0x27'),_0x376e('0x28'),_0x376e('0x29'),_0x376e('0x2a'),_0x376e('0x2b'),_0x376e('0x2c'),_0x376e('0x2d'),_0x376e('0x2e'),_0x376e('0x2f'),_0x376e('0x30'),_0x376e('0x31'),'predictiveIntervalAvgTalktime');}return _0x4c91b2[_0x376e('0x32')](function(_0x29e48e){var _0x3f33ab=_0x29e48e[_0x376e('0x33')]({'plain':!![]});_0x3f33ab[_0x376e('0x34')]=[];_0x3f33ab['paused']=0x0;_0x3f33ab[_0x376e('0x35')]=0x0;_0x3f33ab[_0x376e('0x1c')]=0x0;_0x3f33ab[_0x376e('0x1d')]=0x0;_0x3f33ab['waiting']=0x0;if(_0x54820d===_0x376e('0x36')){_0x3f33ab['talking']=0x0;_0x3f33ab[_0x376e('0x37')]=0x0;if(_0x246f7d===_0x376e('0x1f')){_0x3f33ab[_0x376e('0x38')]=0x0;_0x3f33ab[_0x376e('0x20')]=0x0;}}var _0x139754=_[_0x376e('0x39')](_0x153006,['id',_0x3f33ab['id']]);if(_0x139754)_[_0x376e('0x15')](_0x3f33ab,_[_0x376e('0x3a')](_0x139754,_0x24c556));return _0x3f33ab;});}function updateAgentVoiceStatus(_0x4adab2,_0x508b0f,_0x2213fa){var _0x333663=_['filter'](_0x2213fa,[_0x376e('0x3b'),_0x508b0f[_0x376e('0xd')]]);if(_0x333663['length']===0x0)return _0x4adab2[_0x376e('0x37')]=!![];if(_[_0x376e('0x3c')](_0x333663,['connectedlinenum',_0x4adab2[_0x376e('0x3d')][_0x376e('0x3e')]()]))return _0x4adab2[_0x376e('0x3f')]=!![];if(!_0x4adab2[_0x376e('0x3f')])return _0x4adab2[_0x376e('0x37')]=!![];}function getVoiceQueueAgents(_0x291110,_0x3feabe,_0x151776,_0x4046f9){var _0x2c4b9b=_['find'](_0x3feabe,['id',_0x291110['id']]);if(!_0x2c4b9b)return _0x291110;return _0x2c4b9b[_0x376e('0x40')]({'raw':!![]})[_0x376e('0x18')](function(_0x1a8c70){for(var _0x3cd93c=0x0;_0x3cd93c<_0x1a8c70[_0x376e('0x41')];_0x3cd93c++){var _0x22b763=_[_0x376e('0x39')](_0x151776,['id',_0x1a8c70[_0x3cd93c][_0x376e('0x42')]]);if(!_0x22b763){_0x22b763={'id':_0x1a8c70[_0x3cd93c][_0x376e('0x42')],'name':_0x1a8c70[_0x3cd93c]['UserId'],'accountcode':'','online':![]};}var _0xc25d5={'id':_0x22b763['id'],'name':_0x22b763[_0x376e('0xd')],'internal':_0x22b763[_0x376e('0x43')],'online':Boolean(_0x22b763['online']),'paused':Boolean(_0x1a8c70[_0x3cd93c]['paused'])};if(_0x22b763['voiceStatus']===_0x376e('0x3f'))updateAgentVoiceStatus(_0xc25d5,_0x291110,_0x4046f9);if(_0xc25d5[_0x376e('0x44')])_0x291110[_0x376e('0x35')]++;if(_0xc25d5[_0x376e('0x37')])_0x291110[_0x376e('0x37')]++;if(_0xc25d5[_0x376e('0x1e')]&&!_0xc25d5[_0x376e('0x37')]&&!_0xc25d5['talking'])_0x291110['paused']++;_0x291110[_0x376e('0x34')][_0x376e('0x45')](_0xc25d5);}return _0x291110;});}function getQueueAgents(_0x17932f,_0xf93e0c,_0x2a3789){var _0x25131a='User'+_['startCase'](_0x2a3789)+_0x376e('0x46');var _0x43d0ec=_0x2a3789+_0x376e('0x47');return db[_0x25131a]['findAll']({'where':{[_['startCase'](_0x2a3789)+_0x376e('0x48')]:_0x17932f['id']},'raw':!![]})['then'](function(_0x2771e1){for(var _0x20f69b=0x0;_0x20f69b<_0x2771e1['length'];_0x20f69b++){var _0x3403e8=_[_0x376e('0x39')](_0xf93e0c,['id',_0x2771e1[_0x20f69b][_0x376e('0x42')]]);if(!_0x3403e8){_0x3403e8={'id':_0x2771e1[_0x20f69b]['UserId'],'name':_0x2771e1[_0x20f69b][_0x376e('0x42')],'online':![],['pauseField']:![]};}var _0x262409={'id':_0x3403e8['id'],'name':_0x3403e8[_0x376e('0xd')],'online':Boolean(_0x3403e8['online']),'paused':Boolean(_0x3403e8[_0x43d0ec])};if(_0x262409[_0x376e('0x44')])_0x17932f[_0x376e('0x35')]++;_0x17932f[_0x376e('0x34')][_0x376e('0x45')](_0x262409);}return _0x17932f;});}function isIdle(_0x41d860){return _0x41d860===_0x376e('0x49')||_0x41d860===_0x376e('0x4a')||_0x41d860==='unavailable'||_0x41d860===_0x376e('0x4b')||_[_0x376e('0x4c')](_0x41d860);}function isAgentPaused(_0x50fd0d,_0x24b854){var _0x2dd2a9=[_0x50fd0d[_0x376e('0x4d')],_0x50fd0d['faxPause'],_0x50fd0d[_0x376e('0x4e')],_0x50fd0d[_0x376e('0x4f')],_0x50fd0d['smsPause'],_0x50fd0d[_0x376e('0x50')],_0x50fd0d['whatsappPause']];if(!_0x24b854)return _['every'](_0x2dd2a9);var _0x3694c6=_[_0x376e('0x51')](_0x2dd2a9);return _0x3694c6[_0x376e('0x41')]>0x0&&_0x3694c6[_0x376e('0x41')]<_0x2dd2a9[_0x376e('0x41')]?!![]:![];}function isAgentIdle(_0x22e2b3){if(_0x22e2b3[_0x376e('0x52')]!==_0x376e('0x49')&&_0x22e2b3['voicePause']){_0x22e2b3[_0x376e('0x52')]=_0x376e('0x53');return![];}return _['every']([_0x22e2b3['chatStatus'],_0x22e2b3[_0x376e('0x54')],_0x22e2b3[_0x376e('0x55')],_0x22e2b3[_0x376e('0x56')],_0x22e2b3[_0x376e('0x57')],_0x22e2b3['voiceStatus'],_0x22e2b3['whatsappStatus']],isIdle);}function getAgentStatus(_0x3dcb13){var _0x4bc211=_0x376e('0x4a');if(isAgentPaused(_0x3dcb13))_0x4bc211='pause';else if(isAgentPaused(_0x3dcb13,!![]))_0x4bc211=_0x376e('0x58');else if(isAgentIdle(_0x3dcb13))_0x4bc211=_0x376e('0x49');else _0x4bc211='busy';return _0x4bc211;}exports[_0x376e('0x59')]=function(_0x25dde6,_0x416d18){var _0x41a6e9={'count':0x0,'rows':[]},_0x35c89a={},_0x32b607,_0x19e063,_0x1e0157=['userpic',_0x376e('0x44'),_0x376e('0x5a'),_0x376e('0x5b'),_0x376e('0x5c'),'lastPauseAt',_0x376e('0x3d'),'address',_0x376e('0x4d'),_0x376e('0x4f'),_0x376e('0x4e'),'smsPause',_0x376e('0x5d'),_0x376e('0x5e'),'voicePause',_0x376e('0x5f'),'openchannelCapacity','mailCapacity','smsCapacity',_0x376e('0x60'),_0x376e('0x61'),_0x376e('0x62'),'openchannelCurrentCapacity',_0x376e('0x63'),_0x376e('0x64'),'whatsappCurrentCapacity',_0x376e('0x65'),_0x376e('0x66'),_0x376e('0x56'),'mailStatus',_0x376e('0x57'),_0x376e('0x67'),_0x376e('0x54'),_0x376e('0x52'),_0x376e('0x68'),_0x376e('0x69'),_0x376e('0x6a'),'smsStatusTime',_0x376e('0x6b'),_0x376e('0x6c'),_0x376e('0x6d'),'queue','destconnectedlinenum',_0x376e('0x6e'),_0x376e('0x6f'),_0x376e('0x70'),_0x376e('0x71')],_0x493c21=['chatPause',_0x376e('0x4f'),_0x376e('0x4e'),_0x376e('0x72'),_0x376e('0x5d'),_0x376e('0x5e'),_0x376e('0x50'),_0x376e('0x44')];Promise[_0x376e('0x73')]()[_0x376e('0x18')](function(){var _0x4b03db=_[_0x376e('0x32')](db[_0x376e('0x74')]['rawAttributes'],function(_0x589fed){return{'name':_0x589fed[_0x376e('0x75')],'type':_0x589fed[_0x376e('0x76')][_0x376e('0x77')]};});_0x25dde6['query']['role']=_0x376e('0x78');_0x25dde6[_0x376e('0x79')]['online']=!![];_0x35c89a=qs[_0x376e('0x7a')](_0x4b03db,_0x25dde6);_0x35c89a[_0x376e('0x7b')]=!![];if(_0x25dde6[_0x376e('0x7c')]['role']===_0x376e('0x7c')){var _0x180b0f={'params':{'id':_0x25dde6[_0x376e('0x7c')]['userProfileId']},'query':{'section':'Agents','role':_0x376e('0x78'),'online':!![],'nolimit':_0x25dde6[_0x376e('0x79')][_0x376e('0x7d')],'sort':_0x25dde6[_0x376e('0x79')]['sort'],'filter':_0x25dde6['query']['filter']},'raw':!![]};return db[_0x376e('0x7e')][_0x376e('0x7f')](_0x180b0f);}return db['User'][_0x376e('0x80')](_0x35c89a);})[_0x376e('0x18')](function(_0x43494f){_0x41a6e9[_0x376e('0x81')]=_0x43494f[_0x376e('0x81')];_0x32b607=_0x43494f[_0x376e('0x82')];return getRealtimeAgents();})[_0x376e('0x18')](function(_0xff5ab2){_0x19e063=_0xff5ab2[_0x376e('0x82')];return _0x32b607[_0x376e('0x32')](function(_0x4d7890){var _0x31462e=_[_0x376e('0x39')](_0x19e063,['id',_0x4d7890['id']]);if(_0x31462e)_['merge'](_0x4d7890,_['pick'](_[_0x376e('0x83')](_0x31462e,_0x493c21),_0x1e0157));_0x4d7890[_0x376e('0x84')]=getAgentStatus(_0x4d7890);return _0x4d7890;});})[_0x376e('0x18')](function(_0x58f083){if(_0x25dde6['query'][_0x376e('0x85')]){var _0x3c2d8f=_[_0x376e('0x51')](_0x58f083,[_0x376e('0x84'),_0x25dde6[_0x376e('0x79')][_0x376e('0x85')]]);if(_0x25dde6[_0x376e('0x79')][_0x376e('0x86')]){_0x3c2d8f=_[_0x376e('0x51')](_0x3c2d8f,[_0x376e('0x5c'),_0x25dde6[_0x376e('0x79')][_0x376e('0x86')]]);}}_0x41a6e9[_0x376e('0x82')]=_0x3c2d8f||_0x58f083;return _0x41a6e9;})[_0x376e('0x18')](respondWithFilteredResult(_0x416d18,_0x35c89a))[_0x376e('0x16')](handleError(_0x416d18,null));};exports[_0x376e('0x87')]=function(_0x5c02f3,_0x168a6c){var _0x2818dd=[_0x376e('0x88'),_0x376e('0x89'),'sms',_0x376e('0x8a'),_0x376e('0x8b'),_0x376e('0x8c'),'voice'];var _0x1ac6bd={'count':0x0,'rows':[]},_0x53e598={},_0x28779b,_0x156a77,_0x51af5f,_0x35537a,_0x2e2a70;Promise[_0x376e('0x73')]()[_0x376e('0x18')](function(){if(_0x5c02f3[_0x376e('0x79')]['channel']){if(!_['includes'](_0x2818dd,_0x5c02f3['query']['channel'][_0x376e('0x8d')]()))throw new Error(_0x376e('0x8e'));_0x28779b=_0x5c02f3[_0x376e('0x79')][_0x376e('0x8f')][_0x376e('0x8d')]();}var _0x45ba99=_['startCase'](_0x28779b)+'Queue';var _0x333486=_[_0x376e('0x32')](db[_0x45ba99][_0x376e('0x90')],function(_0x352e79){return{'name':_0x352e79[_0x376e('0x75')],'type':_0x352e79[_0x376e('0x76')][_0x376e('0x77')]};});_0x53e598=qs[_0x376e('0x7a')](_0x333486,_0x5c02f3);if(_0x5c02f3['user']['role']===_0x376e('0x7c')){var _0x5840cf={'params':{'id':_0x5c02f3[_0x376e('0x7c')][_0x376e('0x91')]},'query':{'section':_0x28779b===_0x376e('0x36')&&_0x5c02f3[_0x376e('0x79')][_0x376e('0x76')]===_0x376e('0x1f')?_0x376e('0x92'):_['startCase'](_0x28779b)+'Queues','type':_0x5c02f3[_0x376e('0x79')][_0x376e('0x76')],'nolimit':!![],'sort':_0x376e('0xd'),'filter':_0x5c02f3[_0x376e('0x79')][_0x376e('0x51')]}};return db[_0x376e('0x7e')][_0x376e('0x7f')](_0x5840cf);}return db[_0x45ba99]['findAndCountAll'](_0x53e598);})['then'](function(_0x41a9f3){_0x1ac6bd['count']=_0x41a9f3[_0x376e('0x81')];_0x156a77=_0x41a9f3[_0x376e('0x82')];return getRealtimeQueues(_0x5c02f3,_0x28779b);})[_0x376e('0x18')](function(_0x49e56f){_0x35537a=_0x49e56f[_0x376e('0x82')];return getRealtimeAgents();})[_0x376e('0x18')](function(_0x51a5cc){_0x51af5f=_0x51a5cc[_0x376e('0x82')];if(_0x28779b!=_0x376e('0x36'))return;return getRealtimeVoiceQueueChannels();})[_0x376e('0x18')](function(_0x1ceede){_0x2e2a70=_0x1ceede?_0x1ceede[_0x376e('0x82')]:[];return initializeQueues(_0x156a77,_0x35537a,_0x28779b,_0x5c02f3[_0x376e('0x79')]['type']);})['then'](function(_0x4910d){var _0x59af61=_0x4910d[_0x376e('0x32')](function(_0x20e47d){if(_0x28779b==='voice')return getVoiceQueueAgents(_0x20e47d,_0x156a77,_0x51af5f,_0x2e2a70);else return getQueueAgents(_0x20e47d,_0x51af5f,_0x28779b);});return Promise['all'](_0x59af61);})[_0x376e('0x18')](function(_0x45b391){_0x1ac6bd[_0x376e('0x82')]=_0x45b391;return _0x1ac6bd;})[_0x376e('0x18')](respondWithFilteredResult(_0x168a6c,_0x53e598))[_0x376e('0x16')](handleError(_0x168a6c,null));};
\ No newline at end of file
+var _0x0f76=['merge','catch','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','VoiceQueuesChannels','Unable\x20to\x20retrieve\x20voice\x20queues\x20channels','loggedIn','available','waiting','talking','paused','voice','outbound','push','pTalking','originated','message','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','map','get','agents','busy','find','filter','queue','length','some','connectedlinenum','internal','getMembers','UserId','accountcode','online','loggedInDb','User','startCase','Queue','findAll','QueueId','idle','unknown','unavailable','ringing','isNil','faxPause','openchannelPause','smsPause','voicePause','every','voiceStatus','pause','faxStatus','mailStatus','openchannelStatus','smsStatus','whatsappStatus','*pause','mail','chat','fax','whatsapp','toLowerCase','isArray','findOne','getAgents','flatten','uniq','value','globalStatus','order','startsWith','ASC','sort','DESC','pauseType','userpic','lastLoginAt','lastPauseAt','address','mailPause','whatsappPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','destconnectedlinenum','screenrecording','phoneBarEnableAutomaticScreenRecording','query','channel','fields','join','globalQueueFilter','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','isEmpty','where','user','userProfileId','nolimit','getResources','findAndCountAll','rows','pick','omit','globalStatusFilter','pauseTypeFilter','getQueues','resolve','QueueCampaigns','Queues','all','lodash','jayson/promise','../../config/logger','api','../../mysqldb','http','offset','limit','count','status','stack','name','send','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)'];(function(_0x276469,_0x3bb9f6){var _0x3a013e=function(_0x2e1f0a){while(--_0x2e1f0a){_0x276469['push'](_0x276469['shift']());}};_0x3a013e(++_0x3bb9f6);}(_0x0f76,0x136));var _0x60f7=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x0f76[_0xb24a3e];return _0x4038d7;};'use strict';var util=require('util');var _=require(_0x60f7('0x0'));var jayson=require(_0x60f7('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x60f7('0x2'))(_0x60f7('0x3'));var db=require(_0x60f7('0x4'))['db'];var amiClient=jayson['client'][_0x60f7('0x5')]({'port':0x232a});var routingClient=jayson['client'][_0x60f7('0x5')]({'port':0x232c});function respondWithFilteredResult(_0x23ee24,_0x14e1cb){return function(_0x298f9d){if(_0x298f9d){var _0x213725=typeof _0x14e1cb[_0x60f7('0x6')]==='undefined'&&typeof _0x14e1cb[_0x60f7('0x7')]==='undefined';var _0x5328d6=_0x298f9d[_0x60f7('0x8')];var _0x213c42=_0x213725?0x0:_0x14e1cb['offset'];var _0x16507c=_0x213725?_0x298f9d[_0x60f7('0x8')]:_0x14e1cb['offset']+_0x14e1cb[_0x60f7('0x7')];var _0x1b8aee;if(_0x16507c>=_0x5328d6){_0x16507c=_0x5328d6;_0x1b8aee=0xc8;}else{_0x1b8aee=0xce;}_0x23ee24[_0x60f7('0x9')](_0x1b8aee);return _0x23ee24['set']('Content-Range',_0x213c42+'-'+_0x16507c+'/'+_0x5328d6)['json'](_0x298f9d);}return null;};}function handleError(_0x41167a,_0x5971ab){_0x5971ab=_0x5971ab||0x1f4;return function(_0x482ba9){logger['error'](_0x482ba9[_0x60f7('0xa')]);if(_0x482ba9[_0x60f7('0xb')]){delete _0x482ba9[_0x60f7('0xb')];}_0x41167a[_0x60f7('0x9')](_0x5971ab)[_0x60f7('0xc')](_0x482ba9);};}function getRealtimeAgents(){return new Promise(function(_0xba5c14,_0xbc8d55){return amiClient[_0x60f7('0xd')](_0x60f7('0xe'),{})[_0x60f7('0xf')](function(_0x3ae37f){if(_0x3ae37f[_0x60f7('0x10')])throw new Error(_0x60f7('0x11'));var _0x75d117=_0x3ae37f[_0x60f7('0x12')];return routingClient[_0x60f7('0xd')](_0x60f7('0xe'),{})['then'](function(_0x3f9505){if(_0x3f9505['error'])throw new Error(_0x60f7('0x13'));var _0x53df52=_0x3f9505[_0x60f7('0x12')];return _0xba5c14(_[_0x60f7('0x14')]({},_0x75d117,_0x53df52));});})[_0x60f7('0x15')](function(_0x2c6377){_0xbc8d55(_0x2c6377);});});}function getRealtimeQueues(_0x3466e5,_0x5ca1f7){return new Promise(function(_0x33cc98,_0x24b9f2){var _0x58e658=_0x5ca1f7==='voice'?amiClient:routingClient;return _0x58e658[_0x60f7('0xd')](_['startCase'](_0x5ca1f7)+'Queues',_0x3466e5)['then'](function(_0x347f18){if(_0x347f18['error'])throw new Error(util[_0x60f7('0x16')](_0x60f7('0x17'),_0x5ca1f7));return _0x33cc98(_0x347f18[_0x60f7('0x12')]);})[_0x60f7('0x15')](function(_0xd4f8ec){_0x24b9f2(_0xd4f8ec);});});}function getRealtimeVoiceQueueChannels(){return new Promise(function(_0x22aa18,_0x153895){return amiClient['request'](_0x60f7('0x18'),{})[_0x60f7('0xf')](function(_0x397d8f){if(_0x397d8f[_0x60f7('0x10')])throw new Error(_0x60f7('0x19'));return _0x22aa18(_0x397d8f['result']);})[_0x60f7('0x15')](function(_0x58239a){_0x153895(_0x58239a);});});}function initializeQueues(_0x46f474,_0x3b0f7a,_0x1916e6,_0x15dfee){var _0x2a989b=[_0x60f7('0x1a'),_0x60f7('0x1b'),_0x60f7('0x1c'),_0x60f7('0x1d'),_0x60f7('0x1e')];if(_0x1916e6===_0x60f7('0x1f')&&_0x15dfee===_0x60f7('0x20')){_0x2a989b[_0x60f7('0x21')](_0x60f7('0x22'),_0x60f7('0x23'),_0x60f7('0x24'),_0x60f7('0x25'),_0x60f7('0x26'),_0x60f7('0x27'),_0x60f7('0x28'),'startProgressive',_0x60f7('0x29'),_0x60f7('0x2a'),_0x60f7('0x2b'),'erlangBusyFactor',_0x60f7('0x2c'),_0x60f7('0x2d'),'dialPredictiveIntervalMinThreshold',_0x60f7('0x2e'),_0x60f7('0x2f'),_0x60f7('0x30'),_0x60f7('0x31'),_0x60f7('0x32'),_0x60f7('0x33'),_0x60f7('0x34'));}return _0x46f474[_0x60f7('0x35')](function(_0x3f881d){var _0x4050ea=_0x3f881d[_0x60f7('0x36')]({'plain':!![]});_0x4050ea[_0x60f7('0x37')]=[];_0x4050ea['paused']=0x0;_0x4050ea['loggedInDb']=0x0;_0x4050ea[_0x60f7('0x1a')]=0x0;_0x4050ea[_0x60f7('0x1b')]=0x0;_0x4050ea[_0x60f7('0x1c')]=0x0;if(_0x1916e6===_0x60f7('0x1f')){_0x4050ea[_0x60f7('0x1d')]=0x0;_0x4050ea[_0x60f7('0x38')]=0x0;if(_0x15dfee==='outbound'){_0x4050ea[_0x60f7('0x22')]=0x0;_0x4050ea[_0x60f7('0x23')]=0x0;}}var _0xf3208f=_[_0x60f7('0x39')](_0x3b0f7a,['id',_0x4050ea['id']]);if(_0xf3208f)_[_0x60f7('0x14')](_0x4050ea,_['pick'](_0xf3208f,_0x2a989b));return _0x4050ea;});}function updateAgentVoiceStatus(_0x4cf707,_0x3d562d,_0x50365d){var _0x3b8f70=_[_0x60f7('0x3a')](_0x50365d,[_0x60f7('0x3b'),_0x3d562d['name']]);if(_0x3b8f70[_0x60f7('0x3c')]===0x0)return _0x4cf707[_0x60f7('0x38')]=!![];if(_[_0x60f7('0x3d')](_0x3b8f70,[_0x60f7('0x3e'),_0x4cf707[_0x60f7('0x3f')]['toString']()]))return _0x4cf707[_0x60f7('0x1d')]=!![];if(!_0x4cf707[_0x60f7('0x1d')])return _0x4cf707['busy']=!![];}function getVoiceQueueAgents(_0x5a0aff,_0x4c627d,_0x52f4e2,_0x2bf90e){var _0x4f2d0a=_['find'](_0x4c627d,['id',_0x5a0aff['id']]);if(!_0x4f2d0a)return _0x5a0aff;return _0x4f2d0a[_0x60f7('0x40')]({'raw':!![]})[_0x60f7('0xf')](function(_0x3dfa7c){for(var _0xe2b921=0x0;_0xe2b921<_0x3dfa7c['length'];_0xe2b921++){var _0x1bde84=_[_0x60f7('0x39')](_0x52f4e2,['id',_0x3dfa7c[_0xe2b921][_0x60f7('0x41')]]);if(!_0x1bde84){_0x1bde84={'id':_0x3dfa7c[_0xe2b921]['UserId'],'name':_0x3dfa7c[_0xe2b921][_0x60f7('0x41')],'accountcode':'','online':![]};}var _0x2ac1af={'id':_0x1bde84['id'],'name':_0x1bde84['name'],'internal':_0x1bde84[_0x60f7('0x42')],'online':Boolean(_0x1bde84[_0x60f7('0x43')]),'paused':Boolean(_0x3dfa7c[_0xe2b921][_0x60f7('0x1e')])};if(_0x1bde84['voiceStatus']===_0x60f7('0x1d'))updateAgentVoiceStatus(_0x2ac1af,_0x5a0aff,_0x2bf90e);if(_0x2ac1af[_0x60f7('0x43')])_0x5a0aff[_0x60f7('0x44')]++;if(_0x2ac1af[_0x60f7('0x38')])_0x5a0aff['busy']++;if(_0x2ac1af[_0x60f7('0x1e')]&&!_0x2ac1af[_0x60f7('0x38')]&&!_0x2ac1af[_0x60f7('0x1d')])_0x5a0aff[_0x60f7('0x1e')]++;_0x5a0aff[_0x60f7('0x37')]['push'](_0x2ac1af);}return _0x5a0aff;});}function getQueueAgents(_0x3b9a0f,_0x32900e,_0x526729){var _0x3d7b78=_0x60f7('0x45')+_[_0x60f7('0x46')](_0x526729)+_0x60f7('0x47');var _0xce6bc7=_0x526729+'Pause';return db[_0x3d7b78][_0x60f7('0x48')]({'where':{[_[_0x60f7('0x46')](_0x526729)+_0x60f7('0x49')]:_0x3b9a0f['id']},'raw':!![]})['then'](function(_0xbdd9b5){for(var _0x59c739=0x0;_0x59c739<_0xbdd9b5['length'];_0x59c739++){var _0x2efbf8=_[_0x60f7('0x39')](_0x32900e,['id',_0xbdd9b5[_0x59c739][_0x60f7('0x41')]]);if(!_0x2efbf8){_0x2efbf8={'id':_0xbdd9b5[_0x59c739][_0x60f7('0x41')],'name':_0xbdd9b5[_0x59c739][_0x60f7('0x41')],'online':![],['pauseField']:![]};}var _0x2910ae={'id':_0x2efbf8['id'],'name':_0x2efbf8[_0x60f7('0xb')],'online':Boolean(_0x2efbf8[_0x60f7('0x43')]),'paused':Boolean(_0x2efbf8[_0xce6bc7])};if(_0x2910ae['online'])_0x3b9a0f[_0x60f7('0x44')]++;_0x3b9a0f[_0x60f7('0x37')][_0x60f7('0x21')](_0x2910ae);}return _0x3b9a0f;});}function isIdle(_0x485430){return _0x485430===_0x60f7('0x4a')||_0x485430===_0x60f7('0x4b')||_0x485430===_0x60f7('0x4c')||_0x485430===_0x60f7('0x4d')||_[_0x60f7('0x4e')](_0x485430);}function isAgentPaused(_0x3485da,_0x476ec3){var _0x2a740b=[_0x3485da['chatPause'],_0x3485da[_0x60f7('0x4f')],_0x3485da['mailPause'],_0x3485da[_0x60f7('0x50')],_0x3485da[_0x60f7('0x51')],_0x3485da[_0x60f7('0x52')],_0x3485da['whatsappPause']];if(!_0x476ec3)return _[_0x60f7('0x53')](_0x2a740b);var _0x2c105=_['filter'](_0x2a740b);return _0x2c105['length']>0x0&&_0x2c105['length']<_0x2a740b[_0x60f7('0x3c')]?!![]:![];}function isAgentIdle(_0x437273){if(_0x437273[_0x60f7('0x54')]!==_0x60f7('0x4a')&&_0x437273[_0x60f7('0x52')]){_0x437273[_0x60f7('0x54')]=_0x60f7('0x55');return![];}return _['every']([_0x437273['chatStatus'],_0x437273[_0x60f7('0x56')],_0x437273[_0x60f7('0x57')],_0x437273[_0x60f7('0x58')],_0x437273[_0x60f7('0x59')],_0x437273[_0x60f7('0x54')],_0x437273[_0x60f7('0x5a')]],isIdle);}function getAgentStatus(_0x28ac95){var _0x5a639c=_0x60f7('0x4b');if(isAgentPaused(_0x28ac95))_0x5a639c='pause';else if(isAgentPaused(_0x28ac95,!![]))_0x5a639c=_0x60f7('0x5b');else if(isAgentIdle(_0x28ac95))_0x5a639c=_0x60f7('0x4a');else _0x5a639c=_0x60f7('0x38');return _0x5a639c;}function validateChannel(_0x49bf9e){var _0x49558e=[_0x60f7('0x5c'),_0x60f7('0x5d'),'sms','openchannel',_0x60f7('0x5e'),_0x60f7('0x5f'),_0x60f7('0x1f')];if(!_['includes'](_0x49558e,_0x49bf9e[_0x60f7('0x60')]()))throw new Error('Invalid\x20channel');return _0x49bf9e[_0x60f7('0x60')]();}function getFilteredAgentIds(_0x582727,_0x17f5d1){var _0x35157c=_[_0x60f7('0x61')](_0x582727)?_0x582727:[_0x582727];var _0x3fae30=_[_0x60f7('0x35')](_0x35157c,function(_0x4b435e){return db[_0x17f5d1][_0x60f7('0x62')]({'where':{'name':_0x4b435e}})[_0x60f7('0xf')](function(_0x2f08df){if(!_0x2f08df)return[];return _0x2f08df[_0x60f7('0x63')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x3fae30)[_0x60f7('0xf')](function(_0x2270be){var _0x4d7ae4=_(_0x2270be)[_0x60f7('0x64')]()[_0x60f7('0x35')]('id')[_0x60f7('0x65')]()[_0x60f7('0x66')]();return _0x4d7ae4;});}function getUpdatedSortOptions(_0x3e50c8){var _0x145701={'fields':[],'order':null};var _0x1467e6=_0x3e50c8['split'](',');_0x145701['fields']=_[_0x60f7('0x3a')](_0x1467e6,function(_0x200fe2){if(!_0x200fe2['includes'](_0x60f7('0x67')))return!![];_0x145701[_0x60f7('0x68')]=_[_0x60f7('0x69')](_0x200fe2,'-')?'DESC':_0x60f7('0x6a');return![];});return _0x145701;}function orderAgentsByStatus(_0x3ac4d9,_0xddb7ba){return _0x3ac4d9[_0x60f7('0x6b')](function(_0x43d2ba,_0x1a5251){if(_0x43d2ba[_0x60f7('0x67')]===_0x1a5251[_0x60f7('0x67')]&&_0x43d2ba['globalStatus']==='pause'){if(_0xddb7ba===_0x60f7('0x6c'))return(_0x43d2ba[_0x60f7('0x6d')]||'')<(_0x1a5251[_0x60f7('0x6d')]||'')?0x1:-0x1;return _0x43d2ba[_0x60f7('0x6d')]<_0x1a5251[_0x60f7('0x6d')]?-0x1:0x1;}else{if(_0xddb7ba==='DESC')return _0x43d2ba[_0x60f7('0x67')]<_0x1a5251[_0x60f7('0x67')]?0x1:-0x1;return _0x43d2ba['globalStatus']<_0x1a5251[_0x60f7('0x67')]?-0x1:0x1;}});}exports[_0x60f7('0x63')]=function(_0x1c72d2,_0xe2c6c0){var _0x1dc371={'count':0x0,'rows':[]},_0x1ef22f={},_0x170d9c,_0x4b1189,_0xabf102,_0x599a47,_0x41bead=[_0x60f7('0x6e'),_0x60f7('0x43'),_0x60f7('0x6f'),_0x60f7('0x70'),_0x60f7('0x6d'),'lastPauseAt',_0x60f7('0x3f'),_0x60f7('0x71'),'chatPause',_0x60f7('0x50'),_0x60f7('0x72'),_0x60f7('0x51'),_0x60f7('0x73'),_0x60f7('0x4f'),_0x60f7('0x52'),_0x60f7('0x74'),_0x60f7('0x75'),_0x60f7('0x76'),_0x60f7('0x77'),_0x60f7('0x78'),_0x60f7('0x79'),_0x60f7('0x7a'),_0x60f7('0x7b'),'mailCurrentCapacity',_0x60f7('0x7c'),'whatsappCurrentCapacity',_0x60f7('0x7d'),'chatStatus',_0x60f7('0x58'),_0x60f7('0x57'),_0x60f7('0x59'),_0x60f7('0x5a'),_0x60f7('0x56'),_0x60f7('0x54'),_0x60f7('0x7e'),_0x60f7('0x7f'),_0x60f7('0x80'),'smsStatusTime',_0x60f7('0x81'),_0x60f7('0x82'),_0x60f7('0x83'),_0x60f7('0x3b'),_0x60f7('0x84'),_0x60f7('0x85'),'phoneBarEnableScreenRecordingByAgent',_0x60f7('0x86'),'routealias'],_0x33c925=['chatPause',_0x60f7('0x50'),_0x60f7('0x72'),_0x60f7('0x51'),_0x60f7('0x73'),_0x60f7('0x4f'),'voicePause',_0x60f7('0x43')];Promise['resolve']()['then'](function(){if(_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x88')])_0x170d9c=validateChannel(_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x88')]);if(!_0x1c72d2['query']['sort']||!_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x6b')]['includes'](_0x60f7('0x67')))return;var _0x663b68=getUpdatedSortOptions(_0x1c72d2['query']['sort']);_0x1c72d2['query'][_0x60f7('0x6b')]=_0x663b68[_0x60f7('0x89')][_0x60f7('0x8a')](',');_0x4b1189=_0x663b68['order'];})[_0x60f7('0xf')](function(){if(!_0x1c72d2[_0x60f7('0x87')]['globalQueueFilter'])return[];var _0x557d07=_[_0x60f7('0x46')](_0x170d9c)+_0x60f7('0x47');return getFilteredAgentIds(_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x8b')],_0x557d07);})[_0x60f7('0xf')](function(_0x3ae4f6){var _0x40e52d=_[_0x60f7('0x35')](db[_0x60f7('0x45')][_0x60f7('0x8c')],function(_0x47e70b){return{'name':_0x47e70b[_0x60f7('0x8d')],'type':_0x47e70b[_0x60f7('0x8e')][_0x60f7('0x8f')]};});_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x90')]=_0x60f7('0x91');_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x43')]=!![];_0x1ef22f=qs[_0x60f7('0x92')](_0x40e52d,_0x1c72d2);_0x1ef22f[_0x60f7('0x93')]=!![];if(!_[_0x60f7('0x94')](_0x3ae4f6)){_0x1ef22f[_0x60f7('0x95')]=_['merge'](_0x1ef22f[_0x60f7('0x95')],{'$and':[{'id':{'$in':_0x3ae4f6}}]});}else if(!_['isEmpty'](_0x1c72d2['query'][_0x60f7('0x8b')])){return _0x1dc371;}if(_0x1c72d2[_0x60f7('0x96')][_0x60f7('0x90')]===_0x60f7('0x96')){var _0x412ced={'params':{'id':_0x1c72d2[_0x60f7('0x96')][_0x60f7('0x97')]},'query':{'section':_0x60f7('0xe'),'role':_0x60f7('0x91'),'online':!![],'nolimit':_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x98')],'sort':_0x1c72d2[_0x60f7('0x87')]['sort'],'filter':_0x1c72d2[_0x60f7('0x87')]['filter'],'raw':!![],'ids':_0x3ae4f6}};return db['UserProfile'][_0x60f7('0x99')](_0x412ced);}return db[_0x60f7('0x45')][_0x60f7('0x9a')](_0x1ef22f);})[_0x60f7('0xf')](function(_0x414b5b){_0x1dc371['count']=_0x414b5b[_0x60f7('0x8')];_0xabf102=_0x414b5b[_0x60f7('0x9b')];return getRealtimeAgents();})[_0x60f7('0xf')](function(_0x4fa6f9){_0x599a47=_0x4fa6f9['rows'];return _0xabf102[_0x60f7('0x35')](function(_0x3f6433){var _0x25f597=_[_0x60f7('0x39')](_0x599a47,['id',_0x3f6433['id']]);if(_0x25f597)_[_0x60f7('0x14')](_0x3f6433,_[_0x60f7('0x9c')](_[_0x60f7('0x9d')](_0x25f597,_0x33c925),_0x41bead));_0x3f6433['globalStatus']=getAgentStatus(_0x3f6433);return _0x3f6433;});})[_0x60f7('0xf')](function(_0x1362c1){var _0x15e5ee;if(_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x9e')]){_0x15e5ee=_[_0x60f7('0x3a')](_0x1362c1,[_0x60f7('0x67'),_0x1c72d2['query'][_0x60f7('0x9e')]]);if(_0x1c72d2[_0x60f7('0x87')][_0x60f7('0x9f')]){_0x15e5ee=_[_0x60f7('0x3a')](_0x15e5ee,[_0x60f7('0x6d'),_0x1c72d2['query'][_0x60f7('0x9f')]]);}}if(_0x15e5ee)_0x1362c1=_0x15e5ee;if(!_0x4b1189)return _0x1362c1;return orderAgentsByStatus(_0x1362c1,_0x4b1189);})[_0x60f7('0xf')](function(_0x435111){_0x1dc371[_0x60f7('0x9b')]=_0x435111;return _0x1dc371;})[_0x60f7('0xf')](respondWithFilteredResult(_0xe2c6c0,_0x1ef22f))[_0x60f7('0x15')](handleError(_0xe2c6c0,null));};exports[_0x60f7('0xa0')]=function(_0xd39a03,_0x426af7){var _0x2bd7d8={'count':0x0,'rows':[]},_0x841ab={},_0x3f6504,_0x20d957,_0x35609b,_0x205ebc,_0x29df78;Promise[_0x60f7('0xa1')]()[_0x60f7('0xf')](function(){if(_0xd39a03['query'][_0x60f7('0x88')])_0x3f6504=validateChannel(_0xd39a03[_0x60f7('0x87')][_0x60f7('0x88')]);var _0x17cfce=_['startCase'](_0x3f6504)+_0x60f7('0x47');var _0x145ebf=_[_0x60f7('0x35')](db[_0x17cfce]['rawAttributes'],function(_0x515388){return{'name':_0x515388['fieldName'],'type':_0x515388['type'][_0x60f7('0x8f')]};});_0x841ab=qs[_0x60f7('0x92')](_0x145ebf,_0xd39a03);if(_0xd39a03['user']['role']===_0x60f7('0x96')){var _0x1c207e={'params':{'id':_0xd39a03[_0x60f7('0x96')][_0x60f7('0x97')]},'query':{'section':_0x3f6504===_0x60f7('0x1f')&&_0xd39a03[_0x60f7('0x87')][_0x60f7('0x8e')]===_0x60f7('0x20')?_0x60f7('0xa2'):_['startCase'](_0x3f6504)+_0x60f7('0xa3'),'type':_0xd39a03[_0x60f7('0x87')][_0x60f7('0x8e')],'nolimit':!![],'sort':_0x60f7('0xb'),'filter':_0xd39a03['query']['filter']}};return db['UserProfile'][_0x60f7('0x99')](_0x1c207e);}return db[_0x17cfce][_0x60f7('0x9a')](_0x841ab);})[_0x60f7('0xf')](function(_0x2d5179){_0x2bd7d8[_0x60f7('0x8')]=_0x2d5179['count'];_0x20d957=_0x2d5179[_0x60f7('0x9b')];return getRealtimeQueues(_0xd39a03,_0x3f6504);})[_0x60f7('0xf')](function(_0x538613){_0x205ebc=_0x538613[_0x60f7('0x9b')];return getRealtimeAgents();})['then'](function(_0xd3aa25){_0x35609b=_0xd3aa25[_0x60f7('0x9b')];if(_0x3f6504!=_0x60f7('0x1f'))return;return getRealtimeVoiceQueueChannels();})['then'](function(_0x28488a){_0x29df78=_0x28488a?_0x28488a[_0x60f7('0x9b')]:[];return initializeQueues(_0x20d957,_0x205ebc,_0x3f6504,_0xd39a03[_0x60f7('0x87')][_0x60f7('0x8e')]);})[_0x60f7('0xf')](function(_0xc24484){var _0x1123c8=_0xc24484['map'](function(_0xdb9045){if(_0x3f6504==='voice')return getVoiceQueueAgents(_0xdb9045,_0x20d957,_0x35609b,_0x29df78);else return getQueueAgents(_0xdb9045,_0x35609b,_0x3f6504);});return Promise[_0x60f7('0xa4')](_0x1123c8);})['then'](function(_0xde20a8){_0x2bd7d8[_0x60f7('0x9b')]=_0xde20a8;return _0x2bd7d8;})['then'](respondWithFilteredResult(_0x426af7,_0x841ab))[_0x60f7('0x15')](handleError(_0x426af7,null));};
\ No newline at end of file