Built motion from commit efa66e19.|2.6.22
[motion2.git] / server / api / realtime / realtime.controller.js
index 3f81ff7..e0d888e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x6a69=['rawAttributes','fields','name','push','outbound','dialMethod','QueueCampaigns','Queues','filter','UserProfile','findAndCountAll','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/queues','../../components/parsers/qs','../../mysqldb','../../errors/api','offset','limit','undefined','count','status','set','getAgents','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','channel','format','Channel\x20parameter\x20%s\x20is\x20invalid','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','join','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','fieldName','type','key','role','agent','raw','sequelize','literal','FIELD(id,','order','forEach','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','getResources','find','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','isValidChannel','startCase','Queue'];(function(_0x134b36,_0x23a566){var _0x238e7e=function(_0x153484){while(--_0x153484){_0x134b36['push'](_0x134b36['shift']());}};_0x238e7e(++_0x23a566);}(_0x6a69,0x10f));var _0x96a6=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x6a69[_0x455c6c];return _0x488242;};'use strict';var _=require(_0x96a6('0x0'));var util=require(_0x96a6('0x1'));var rta=require('../../components/realtime/agents');var rtq=require(_0x96a6('0x2'));var qs=require(_0x96a6('0x3'));var utils=require('../../config/utils');var db=require(_0x96a6('0x4'))['db'];var APIBadRequestError=require(_0x96a6('0x5'))['APIBadRequestError'];var APIHandleError=require('../../errors/api')['handleError'];function respondWithFilteredResult(_0x3d5906,_0x2094b5){return function(_0x4cd1c2){if(_0x4cd1c2){var _0x5af984=typeof _0x2094b5[_0x96a6('0x6')]==='undefined'&&typeof _0x2094b5[_0x96a6('0x7')]===_0x96a6('0x8');var _0x1d9d3b=_0x4cd1c2[_0x96a6('0x9')];var _0x37a351=_0x5af984?0x0:_0x2094b5[_0x96a6('0x6')];var _0x26c3b5=_0x5af984?_0x4cd1c2[_0x96a6('0x9')]:_0x2094b5[_0x96a6('0x6')]+_0x2094b5['limit'];var _0x5f1f8f;if(_0x26c3b5>=_0x1d9d3b){_0x26c3b5=_0x1d9d3b;_0x5f1f8f=0xc8;}else{_0x5f1f8f=0xce;}_0x3d5906[_0x96a6('0xa')](_0x5f1f8f);return _0x3d5906[_0x96a6('0xb')]('Content-Range',_0x37a351+'-'+_0x26c3b5+'/'+_0x1d9d3b)['json'](_0x4cd1c2);}return null;};}exports[_0x96a6('0xc')]=function(_0xb9a053,_0x1c8f58){var _0x449c9b={'count':0x0,'rows':[]};var _0x5ea9a4={};var _0x42fa0f;var _0x293108=utils['getChannels']();var _0xe03984;var _0x414765;var _0x3da804=_0xb9a053[_0x96a6('0xd')][_0x96a6('0xe')];var _0x3c8478=_0xb9a053['query'][_0x96a6('0xf')];var _0x530d2d=_0xb9a053[_0x96a6('0xd')][_0x96a6('0x10')];var _0x131e42=_0x3c8478===_0x96a6('0x11')||_0x3c8478===_0x96a6('0x12')?!![]:![];var _0xc77662=[];var _0x32d0f0;var _0x584655;Promise[_0x96a6('0x13')]()['then'](function(){if(_0xb9a053[_0x96a6('0xd')]['channel']){if(!utils['isValidChannel'](_0xb9a053[_0x96a6('0xd')][_0x96a6('0x14')])){throw new APIBadRequestError(util[_0x96a6('0x15')](_0x96a6('0x16'),_0xb9a053[_0x96a6('0xd')][_0x96a6('0x14')]));}_0x42fa0f=_0xb9a053['query'][_0x96a6('0x14')]['toLowerCase']();}if(!_0xb9a053[_0x96a6('0xd')][_0x96a6('0x17')]||!_0xb9a053[_0x96a6('0xd')][_0x96a6('0x17')][_0x96a6('0x18')](_0x96a6('0x19'))){_0xb9a053[_0x96a6('0xd')][_0x96a6('0x17')]=rta[_0x96a6('0x1a')](_0xb9a053['query'][_0x96a6('0x17')]);return;}var _0x823fbf=rta[_0x96a6('0x1b')](_0xb9a053['query'][_0x96a6('0x17')]);_0xb9a053[_0x96a6('0xd')]['sort']=_0x823fbf['fields'][_0x96a6('0x1c')](',');_0x32d0f0=_0x823fbf['order'];})[_0x96a6('0x1d')](function(){if(!_0x3da804){return[];}return rta[_0x96a6('0x1e')](_0x3da804,_0x42fa0f);})[_0x96a6('0x1d')](function(_0x45c31d){_0xc77662=_0x45c31d;return rta[_0x96a6('0x1f')]();})['then'](function(_0x3bd311){_0x414765=_0x3bd311[_0x96a6('0x20')];if((!_0x3c8478||_0x131e42)&&!_0x32d0f0){return _0xc77662;}if(_0x32d0f0&&!_0x3c8478){return rta[_0x96a6('0x21')](_0x414765,_0xc77662,_0x32d0f0);}else{return rta[_0x96a6('0x22')](_0x414765,_0xc77662,_0x3c8478);}})[_0x96a6('0x1d')](function(_0x2983de){_0xc77662=_0x2983de;var _0x47433e=![];if(_0xc77662[_0x96a6('0x23')]===0x0){if(_0x3da804||_0x3c8478){_0x47433e=!![];}if(_0x131e42){_0x47433e=![];}}if(_0x47433e){return _0x449c9b;}var _0x2c6df6=_[_0x96a6('0x24')](db[_0x96a6('0x25')]['rawAttributes'],function(_0x503353){return{'name':_0x503353[_0x96a6('0x26')],'type':_0x503353[_0x96a6('0x27')][_0x96a6('0x28')]};});_0xb9a053[_0x96a6('0xd')][_0x96a6('0x29')]=_0x96a6('0x2a');_0x5ea9a4=qs['getOptions'](_0x2c6df6,_0xb9a053);_0x5ea9a4[_0x96a6('0x2b')]=!![];var _0x5bd53b=[];if(_0xc77662['length']>0x0){_0x5bd53b['push']({'id':{'$in':_0xc77662}});if(_0x32d0f0&&!_0x3c8478){_0x584655=[db[_0x96a6('0x2c')][_0x96a6('0x2d')](_0x96a6('0x2e')+_0xc77662+')')];_0x5ea9a4[_0x96a6('0x2f')]=_0x584655;}}if(_0x131e42){_0x293108[_0x96a6('0x30')](function(_0x31f3d7){var _0x2272ee=!![];if(_0x3c8478===_0x96a6('0x12')&&_0x42fa0f!==_0x31f3d7){_0x2272ee=![];}_0x5bd53b['push']({[_0x31f3d7+_0x96a6('0x31')]:_0x2272ee});});if(_0x530d2d){_0x5bd53b['push']({'pauseType':_0x530d2d});}}else if(_0x3c8478){_0x293108[_0x96a6('0x30')](function(_0x3e1be4){_0x5bd53b['push']({[_0x3e1be4+_0x96a6('0x31')]:![]});});}_0x5ea9a4[_0x96a6('0x32')]=_[_0x96a6('0x33')](_0x5ea9a4[_0x96a6('0x32')],{'$and':_0x5bd53b});if(_0xb9a053[_0x96a6('0x34')][_0x96a6('0x29')]===_0x96a6('0x34')){var _0x2ff0b7={'params':{'id':_0xb9a053[_0x96a6('0x34')][_0x96a6('0x35')]},'query':{'section':_0x96a6('0x36'),'role':_0x96a6('0x2a'),'raw':!![],'ids':_0xc77662,'customSorting':_0x584655}};if(_0xb9a053['query'][_0x96a6('0x37')]){_0x2ff0b7[_0x96a6('0xd')][_0x96a6('0x37')]=!![];}if(_0x131e42){_0x2ff0b7[_0x96a6('0xd')][_0x96a6('0x38')]=_0x5bd53b;}_0x2ff0b7[_0x96a6('0xd')]=Object[_0x96a6('0x39')](_0x2ff0b7[_0x96a6('0xd')],_0xb9a053[_0x96a6('0xd')]);return db['UserProfile'][_0x96a6('0x3a')](_0x2ff0b7);}return db[_0x96a6('0x25')]['findAndCountAll'](_0x5ea9a4);})['then'](function(_0x997195){_0x449c9b[_0x96a6('0x9')]=_0x997195[_0x96a6('0x9')];_0xe03984=_0x997195['rows'];return _0xe03984['map'](function(_0x4ec2a6){var _0x45498c=_[_0x96a6('0x3b')](_0x414765,['id',_0x4ec2a6['id']]);if(_0x45498c){var _0x2cca3c=rta['filterAgentAttributes'](_0x45498c);_[_0x96a6('0x33')](_0x4ec2a6,_0x2cca3c);}_0x4ec2a6['globalStatus']=rta[_0x96a6('0x3c')](_0x4ec2a6);if(_0x4ec2a6[_0x96a6('0x19')][_0x96a6('0x18')]('pause')){_0x293108[_0x96a6('0x30')](function(_0x1303dd){if(_0x4ec2a6[_0x1303dd+_0x96a6('0x31')]){if(_0x1303dd===_0x96a6('0x3d')){if(_0x4ec2a6[_0x96a6('0x3e')]!==_0x96a6('0x3f')){_0x4ec2a6['voiceStatus']=_0x96a6('0x11');}}else{_0x4ec2a6[_0x1303dd+_0x96a6('0x40')]=_0x96a6('0x11');}}});}return _0x4ec2a6;});})['then'](function(_0x466496){if(!_0x32d0f0||_0x584655){return _0x466496;}return rta[_0x96a6('0x41')](_0x466496,_0x32d0f0);})[_0x96a6('0x1d')](function(_0x578fd1){var _0x5a0043=rta[_0x96a6('0x42')]();_0x449c9b[_0x96a6('0x20')]=_0x578fd1[_0x96a6('0x24')](function(_0x34eec4){return _[_0x96a6('0x43')](_0x34eec4,_0x5a0043);});return _0x449c9b;})[_0x96a6('0x1d')](respondWithFilteredResult(_0x1c8f58,_0x5ea9a4))[_0x96a6('0x44')](APIHandleError(_0x1c8f58));};exports[_0x96a6('0x45')]=function(_0x2bdfb3,_0x1a6ad1){var _0x485b98={'count':0x0,'rows':[]};var _0x3ff32b={};var _0x10ee2b;var _0x274581;var _0x4c1692;Promise[_0x96a6('0x13')]()['then'](function(){if(_0x2bdfb3['query'][_0x96a6('0x14')]){if(!utils[_0x96a6('0x46')](_0x2bdfb3['query'][_0x96a6('0x14')])){throw new APIBadRequestError(util[_0x96a6('0x15')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2bdfb3[_0x96a6('0xd')][_0x96a6('0x14')]));}_0x10ee2b=_0x2bdfb3[_0x96a6('0xd')][_0x96a6('0x14')]['toLowerCase']();}var _0x2fc8f6=_[_0x96a6('0x47')](_0x10ee2b)+_0x96a6('0x48');var _0x3c9825=_[_0x96a6('0x24')](db[_0x2fc8f6][_0x96a6('0x49')],function(_0x1a51fc){return{'name':_0x1a51fc[_0x96a6('0x26')],'type':_0x1a51fc[_0x96a6('0x27')][_0x96a6('0x28')]};});if(!_0x2bdfb3[_0x96a6('0xd')][_0x96a6('0x4a')]){var _0x3b38f4=['id',_0x96a6('0x4b')];if(_0x10ee2b==='voice'){_0x3b38f4[_0x96a6('0x4c')]('type');if(_0x2bdfb3['query'][_0x96a6('0x27')]===_0x96a6('0x4d')){_0x3b38f4[_0x96a6('0x4c')](['dialActive',_0x96a6('0x4e')]);}}_0x2bdfb3[_0x96a6('0xd')][_0x96a6('0x4a')]=_0x3b38f4[_0x96a6('0x1c')](',');}_0x3ff32b=qs['getOptions'](_0x3c9825,_0x2bdfb3);if(_0x2bdfb3[_0x96a6('0x34')][_0x96a6('0x29')]==='user'){var _0x339b91={'params':{'id':_0x2bdfb3[_0x96a6('0x34')][_0x96a6('0x35')]},'query':{'section':_0x10ee2b===_0x96a6('0x3d')&&_0x2bdfb3['query']['type']==='outbound'?_0x96a6('0x4f'):_[_0x96a6('0x47')](_0x10ee2b)+_0x96a6('0x50'),'type':_0x2bdfb3[_0x96a6('0xd')][_0x96a6('0x27')],'nolimit':!![],'sort':'name','filter':_0x2bdfb3[_0x96a6('0xd')][_0x96a6('0x51')]}};_0x339b91['query']=Object['assign'](_0x339b91[_0x96a6('0xd')],_0x2bdfb3[_0x96a6('0xd')]);delete _0x339b91[_0x96a6('0xd')]['id'];return db[_0x96a6('0x52')][_0x96a6('0x3a')](_0x339b91);}return db[_0x2fc8f6][_0x96a6('0x53')](_0x3ff32b);})['then'](function(_0x45fc08){_0x485b98[_0x96a6('0x9')]=_0x45fc08[_0x96a6('0x9')];_0x274581=_0x45fc08[_0x96a6('0x20')];return rtq[_0x96a6('0x54')](_0x2bdfb3,_0x10ee2b);})[_0x96a6('0x1d')](function(_0x32a948){_0x4c1692=_0x32a948[_0x96a6('0x20')];return rtq[_0x96a6('0x55')](_0x274581,_0x4c1692,_0x10ee2b,_0x2bdfb3[_0x96a6('0xd')][_0x96a6('0x27')]);})[_0x96a6('0x1d')](function(_0x1a14f4){_0x485b98[_0x96a6('0x20')]=_0x1a14f4;return _0x485b98;})[_0x96a6('0x1d')](respondWithFilteredResult(_0x1a6ad1,_0x3ff32b))['catch'](APIHandleError(_0x1a6ad1));};
\ No newline at end of file
+var _0x1885=['dialActive','dialMethod','fields','userProfileId','QueueCampaigns','Queues','name','filter','UserProfile','getResources','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','APIBadRequestError','../../errors/api','handleError','undefined','limit','count','offset','status','Content-Range','json','getChannels','globalQueueFilter','globalStatusFilter','query','pauseTypeFilter','pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','length','map','User','rawAttributes','fieldName','key','agent','getOptions','raw','push','sequelize','literal','*pause','Pause','forEach','where','merge','user','role','Agents','online','extraQueryConditions','assign','findAndCountAll','find','filterAgentAttributes','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','getQueues','startCase','type','outbound'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x1885,0x117));var _0x5188=function(_0x3d30bf,_0x50411f){_0x3d30bf=_0x3d30bf-0x0;var _0x4930ae=_0x1885[_0x3d30bf];return _0x4930ae;};'use strict';var _=require(_0x5188('0x0'));var util=require(_0x5188('0x1'));var rta=require(_0x5188('0x2'));var rtq=require(_0x5188('0x3'));var qs=require(_0x5188('0x4'));var utils=require(_0x5188('0x5'));var db=require(_0x5188('0x6'))['db'];var APIBadRequestError=require('../../errors/api')[_0x5188('0x7')];var APIHandleError=require(_0x5188('0x8'))[_0x5188('0x9')];function respondWithFilteredResult(_0x3f88e8,_0x358256){return function(_0x1eb12f){if(_0x1eb12f){var _0x1e72a2=typeof _0x358256['offset']===_0x5188('0xa')&&typeof _0x358256[_0x5188('0xb')]==='undefined';var _0x2e72e9=_0x1eb12f[_0x5188('0xc')];var _0x1e2f25=_0x1e72a2?0x0:_0x358256[_0x5188('0xd')];var _0x57a694=_0x1e72a2?_0x1eb12f['count']:_0x358256[_0x5188('0xd')]+_0x358256[_0x5188('0xb')];var _0x154962;if(_0x57a694>=_0x2e72e9){_0x57a694=_0x2e72e9;_0x154962=0xc8;}else{_0x154962=0xce;}_0x3f88e8[_0x5188('0xe')](_0x154962);return _0x3f88e8['set'](_0x5188('0xf'),_0x1e2f25+'-'+_0x57a694+'/'+_0x2e72e9)[_0x5188('0x10')](_0x1eb12f);}return null;};}exports['getAgents']=function(_0x3af224,_0xe68c42){var _0x141586={'count':0x0,'rows':[]};var _0x10e1c8={};var _0x15a0c5;var _0xdc75a1=utils[_0x5188('0x11')]();var _0xc63b56;var _0x8edaed;var _0x581d31=_0x3af224['query'][_0x5188('0x12')];var _0x565dca=_0x3af224['query'][_0x5188('0x13')];var _0x1e4787=_0x3af224[_0x5188('0x14')][_0x5188('0x15')];var _0x5dd594=_0x565dca===_0x5188('0x16')||_0x565dca==='*pause'?!![]:![];var _0x2d28b5=[];var _0x108c33;var _0x25266b;Promise[_0x5188('0x17')]()[_0x5188('0x18')](function(){if(_0x3af224[_0x5188('0x14')][_0x5188('0x19')]){if(!utils[_0x5188('0x1a')](_0x3af224[_0x5188('0x14')]['channel'])){throw new APIBadRequestError(util[_0x5188('0x1b')](_0x5188('0x1c'),_0x3af224[_0x5188('0x14')][_0x5188('0x19')]));}_0x15a0c5=_0x3af224[_0x5188('0x14')][_0x5188('0x19')][_0x5188('0x1d')]();}if(!_0x3af224[_0x5188('0x14')][_0x5188('0x1e')]||!_0x3af224[_0x5188('0x14')][_0x5188('0x1e')][_0x5188('0x1f')](_0x5188('0x20'))){_0x3af224['query']['sort']=rta[_0x5188('0x21')](_0x3af224[_0x5188('0x14')][_0x5188('0x1e')]);return;}var _0x24b02d=rta['getUpdatedSortOptions'](_0x3af224[_0x5188('0x14')][_0x5188('0x1e')]);_0x3af224[_0x5188('0x14')][_0x5188('0x1e')]=_0x24b02d['fields'][_0x5188('0x22')](',');_0x108c33=_0x24b02d[_0x5188('0x23')];})['then'](function(){if(!_0x581d31){return[];}return rta[_0x5188('0x24')](_0x581d31,_0x15a0c5);})[_0x5188('0x18')](function(_0x324d23){_0x2d28b5=_0x324d23;return rta[_0x5188('0x25')]();})[_0x5188('0x18')](function(_0x3a2e52){_0x8edaed=_0x3a2e52[_0x5188('0x26')];if((!_0x565dca||_0x5dd594)&&!_0x108c33){return _0x2d28b5;}if(_0x108c33&&!_0x565dca){return rta['getSortedAgentsIdsByStatus'](_0x8edaed,_0x2d28b5,_0x108c33);}else{return rta['getAgentIdsByStatus'](_0x8edaed,_0x2d28b5,_0x565dca);}})[_0x5188('0x18')](function(_0x344614){_0x2d28b5=_0x344614;var _0x5a1811=![];if(_0x2d28b5[_0x5188('0x27')]===0x0){if(_0x581d31||_0x565dca){_0x5a1811=!![];}if(_0x5dd594){_0x5a1811=![];}}if(_0x5a1811){return _0x141586;}var _0x17e6fc=_[_0x5188('0x28')](db[_0x5188('0x29')][_0x5188('0x2a')],function(_0x2b0fc9){return{'name':_0x2b0fc9[_0x5188('0x2b')],'type':_0x2b0fc9['type'][_0x5188('0x2c')]};});_0x3af224[_0x5188('0x14')]['role']=_0x5188('0x2d');_0x10e1c8=qs[_0x5188('0x2e')](_0x17e6fc,_0x3af224);_0x10e1c8[_0x5188('0x2f')]=!![];var _0xfff380=[];if(_0x2d28b5[_0x5188('0x27')]>0x0){_0xfff380[_0x5188('0x30')]({'id':{'$in':_0x2d28b5}});if(_0x108c33&&!_0x565dca){_0x25266b=[db[_0x5188('0x31')][_0x5188('0x32')]('FIELD(id,'+_0x2d28b5+')')];_0x10e1c8[_0x5188('0x23')]=_0x25266b;}}if(_0x5dd594){_0xdc75a1['forEach'](function(_0x339e80){var _0x1d7817=!![];if(_0x565dca===_0x5188('0x33')&&_0x15a0c5!==_0x339e80){_0x1d7817=![];}_0xfff380[_0x5188('0x30')]({[_0x339e80+_0x5188('0x34')]:_0x1d7817});});if(_0x1e4787){_0xfff380[_0x5188('0x30')]({'pauseType':_0x1e4787});}}else if(_0x565dca){_0xdc75a1[_0x5188('0x35')](function(_0xc174f7){_0xfff380[_0x5188('0x30')]({[_0xc174f7+_0x5188('0x34')]:![]});});}_0x10e1c8[_0x5188('0x36')]=_[_0x5188('0x37')](_0x10e1c8[_0x5188('0x36')],{'$and':_0xfff380});if(_0x3af224[_0x5188('0x38')][_0x5188('0x39')]===_0x5188('0x38')){var _0x2b5b24={'params':{'id':_0x3af224[_0x5188('0x38')]['userProfileId']},'query':{'section':_0x5188('0x3a'),'role':'agent','raw':!![],'ids':_0x2d28b5,'customSorting':_0x25266b}};if(_0x3af224[_0x5188('0x14')][_0x5188('0x3b')]){_0x2b5b24[_0x5188('0x14')][_0x5188('0x3b')]=!![];}if(_0x5dd594){_0x2b5b24[_0x5188('0x14')][_0x5188('0x3c')]=_0xfff380;}_0x2b5b24[_0x5188('0x14')]=Object[_0x5188('0x3d')](_0x2b5b24['query'],_0x3af224[_0x5188('0x14')]);return db['UserProfile']['getResources'](_0x2b5b24);}return db[_0x5188('0x29')][_0x5188('0x3e')](_0x10e1c8);})[_0x5188('0x18')](function(_0x5c74f8){_0x141586[_0x5188('0xc')]=_0x5c74f8[_0x5188('0xc')];_0xc63b56=_0x5c74f8[_0x5188('0x26')];return _0xc63b56[_0x5188('0x28')](function(_0x9a8b83){var _0x25bfad=_[_0x5188('0x3f')](_0x8edaed,['id',_0x9a8b83['id']]);if(_0x25bfad){var _0x4a5e8a=rta[_0x5188('0x40')](_0x25bfad);_[_0x5188('0x37')](_0x9a8b83,_0x4a5e8a);}_0x9a8b83[_0x5188('0x20')]=rta[_0x5188('0x41')](_0x9a8b83);if(_0x9a8b83[_0x5188('0x20')]['includes'](_0x5188('0x16'))){_0xdc75a1[_0x5188('0x35')](function(_0x587bc8){if(_0x9a8b83[_0x587bc8+_0x5188('0x34')]){if(_0x587bc8===_0x5188('0x42')){if(_0x9a8b83[_0x5188('0x43')]!==_0x5188('0x44')){_0x9a8b83['voiceStatus']=_0x5188('0x16');}}else{_0x9a8b83[_0x587bc8+_0x5188('0x45')]=_0x5188('0x16');}}});}return _0x9a8b83;});})[_0x5188('0x18')](function(_0x169de3){if(!_0x108c33||_0x25266b){return _0x169de3;}return rta[_0x5188('0x46')](_0x169de3,_0x108c33);})[_0x5188('0x18')](function(_0x19c36a){var _0x485c39=rta[_0x5188('0x47')]();_0x141586[_0x5188('0x26')]=_0x19c36a[_0x5188('0x28')](function(_0x2071ba){return _[_0x5188('0x48')](_0x2071ba,_0x485c39);});return _0x141586;})['then'](respondWithFilteredResult(_0xe68c42,_0x10e1c8))['catch'](APIHandleError(_0xe68c42));};exports[_0x5188('0x49')]=function(_0x9b3769,_0x5015dc){var _0x1eab93={'count':0x0,'rows':[]};var _0x2f7228={};var _0x59d29d;var _0x1ee678;var _0x3ae0b3;Promise['resolve']()[_0x5188('0x18')](function(){if(_0x9b3769['query'][_0x5188('0x19')]){if(!utils[_0x5188('0x1a')](_0x9b3769['query']['channel'])){throw new APIBadRequestError(util[_0x5188('0x1b')](_0x5188('0x1c'),_0x9b3769['query'][_0x5188('0x19')]));}_0x59d29d=_0x9b3769['query'][_0x5188('0x19')][_0x5188('0x1d')]();}var _0x3e143a=_[_0x5188('0x4a')](_0x59d29d)+'Queue';var _0x484d24=_[_0x5188('0x28')](db[_0x3e143a][_0x5188('0x2a')],function(_0x22e803){return{'name':_0x22e803[_0x5188('0x2b')],'type':_0x22e803[_0x5188('0x4b')]['key']};});if(!_0x9b3769[_0x5188('0x14')]['fields']){var _0x80758b=['id','name'];if(_0x59d29d==='voice'){_0x80758b[_0x5188('0x30')](_0x5188('0x4b'));if(_0x9b3769['query'][_0x5188('0x4b')]===_0x5188('0x4c')){_0x80758b[_0x5188('0x30')]([_0x5188('0x4d'),_0x5188('0x4e')]);}}_0x9b3769[_0x5188('0x14')][_0x5188('0x4f')]=_0x80758b[_0x5188('0x22')](',');}_0x2f7228=qs['getOptions'](_0x484d24,_0x9b3769);if(_0x9b3769['user'][_0x5188('0x39')]===_0x5188('0x38')){var _0x305dde={'params':{'id':_0x9b3769[_0x5188('0x38')][_0x5188('0x50')]},'query':{'section':_0x59d29d===_0x5188('0x42')&&_0x9b3769['query'][_0x5188('0x4b')]===_0x5188('0x4c')?_0x5188('0x51'):_[_0x5188('0x4a')](_0x59d29d)+_0x5188('0x52'),'type':_0x9b3769[_0x5188('0x14')][_0x5188('0x4b')],'nolimit':!![],'sort':_0x5188('0x53'),'filter':_0x9b3769['query'][_0x5188('0x54')]}};_0x305dde[_0x5188('0x14')]=Object[_0x5188('0x3d')](_0x305dde[_0x5188('0x14')],_0x9b3769['query']);delete _0x305dde[_0x5188('0x14')]['id'];return db[_0x5188('0x55')][_0x5188('0x56')](_0x305dde);}return db[_0x3e143a][_0x5188('0x3e')](_0x2f7228);})['then'](function(_0x4ce076){_0x1eab93[_0x5188('0xc')]=_0x4ce076['count'];_0x1ee678=_0x4ce076[_0x5188('0x26')];return rtq[_0x5188('0x57')](_0x9b3769,_0x59d29d);})[_0x5188('0x18')](function(_0x1ee42d){_0x3ae0b3=_0x1ee42d[_0x5188('0x26')];return rtq[_0x5188('0x58')](_0x1ee678,_0x3ae0b3,_0x59d29d,_0x9b3769[_0x5188('0x14')][_0x5188('0x4b')]);})['then'](function(_0x40a99e){_0x1eab93['rows']=_0x40a99e;return _0x1eab93;})[_0x5188('0x18')](respondWithFilteredResult(_0x5015dc,_0x2f7228))['catch'](APIHandleError(_0x5015dc));};
\ No newline at end of file