Built motion from commit b0a9a629.|2.6.33
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index 329845c..21708a1 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb3f9=['VIRTUAL','merge','options','includeAll','include','catch','show','create','body','user','role','inbound','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','createdAt','updatedAt','QueueCampaigns','UserProfileSection','update','getHoppers','findOne','CmHopper','nolimit','pick','findAll','getHopperHistories','CmHopperHistory','VoiceQueueId','rows','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','TeamVoiceQueue','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','User','select','field','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','all','union','compact','transaction','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','interface','isArray','getAgents','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','ListId','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','NOW()','ListId\x20=\x20?','removeBlackLists','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','VoiceQueues','outbound','filter','map','value','includes','type','find','name','UserProfileResource','end','error','stack','send','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where'];(function(_0xcc956e,_0x5b8076){var _0x352d62=function(_0x5e7a59){while(--_0x5e7a59){_0xcc956e['push'](_0xcc956e['shift']());}};_0x352d62(++_0x5b8076);}(_0xb3f9,0x7a));var _0x9b3f=function(_0xb1b3a6,_0x38623f){_0xb1b3a6=_0xb1b3a6-0x0;var _0x4e074e=_0xb3f9[_0xb1b3a6];return _0x4e074e;};'use strict';var emlformat=require(_0x9b3f('0x0'));var rimraf=require(_0x9b3f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9b3f('0x2'));var moment=require('moment');var BPromise=require(_0x9b3f('0x3'));var Mustache=require(_0x9b3f('0x4'));var util=require(_0x9b3f('0x5'));var path=require(_0x9b3f('0x6'));var sox=require(_0x9b3f('0x7'));var csv=require(_0x9b3f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9b3f('0x9'));var squel=require(_0x9b3f('0xa'));var crypto=require('crypto');var jsforce=require(_0x9b3f('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9b3f('0xc'));var Redis=require('ioredis');var authService=require(_0x9b3f('0xd'));var qs=require(_0x9b3f('0xe'));var as=require(_0x9b3f('0xf'));var hardwareService=require(_0x9b3f('0x10'));var logger=require(_0x9b3f('0x11'))('api');var utils=require(_0x9b3f('0x12'));var config=require(_0x9b3f('0x13'));var licenseUtil=require(_0x9b3f('0x14'));var db=require(_0x9b3f('0x15'))['db'];config[_0x9b3f('0x16')]=_[_0x9b3f('0x17')](config[_0x9b3f('0x16')],{'host':_0x9b3f('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9b3f('0x19'))[_0x9b3f('0x1a')](socket);function respondWithStatusCode(_0x27dab5,_0x377bfa){_0x377bfa=_0x377bfa||0xcc;return function(_0x76978e){if(_0x76978e){return _0x27dab5['sendStatus'](_0x377bfa);}return _0x27dab5['status'](_0x377bfa)['end']();};}function respondWithResult(_0x34fb19,_0x427992){_0x427992=_0x427992||0xc8;return function(_0x484323){if(_0x484323){return _0x34fb19[_0x9b3f('0x1b')](_0x427992)[_0x9b3f('0x1c')](_0x484323);}};}function respondWithFilteredResult(_0x2cdc7c,_0x5f5c1c){return function(_0x579c32){if(_0x579c32){var _0x2f2a53=typeof _0x5f5c1c[_0x9b3f('0x1d')]===_0x9b3f('0x1e')&&typeof _0x5f5c1c[_0x9b3f('0x1f')]===_0x9b3f('0x1e');var _0x297fa8=_0x579c32[_0x9b3f('0x20')];var _0x17f2d3=_0x2f2a53?0x0:_0x5f5c1c[_0x9b3f('0x1d')];var _0x13e65b=_0x2f2a53?_0x579c32[_0x9b3f('0x20')]:_0x5f5c1c[_0x9b3f('0x1d')]+_0x5f5c1c[_0x9b3f('0x1f')];var _0x1218c0;if(_0x13e65b>=_0x297fa8){_0x13e65b=_0x297fa8;_0x1218c0=0xc8;}else{_0x1218c0=0xce;}_0x2cdc7c[_0x9b3f('0x1b')](_0x1218c0);return _0x2cdc7c[_0x9b3f('0x21')](_0x9b3f('0x22'),_0x17f2d3+'-'+_0x13e65b+'/'+_0x297fa8)[_0x9b3f('0x1c')](_0x579c32);}return null;};}function patchUpdates(_0x3360d6){return function(_0x5b4f21){try{jsonpatch[_0x9b3f('0x23')](_0x5b4f21,_0x3360d6,!![]);}catch(_0x4db496){return BPromise[_0x9b3f('0x24')](_0x4db496);}return _0x5b4f21['save']();};}function saveUpdates(_0x3c9d8d,_0x28dd96){return function(_0x16452e){if(_0x16452e){return _0x16452e['update'](_0x3c9d8d)[_0x9b3f('0x25')](function(_0x483eb3){return _0x483eb3;});}return null;};}function removeEntity(_0x325c74,_0x526355){return function(_0x1b3ba8){if(_0x1b3ba8){return _0x1b3ba8[_0x9b3f('0x26')]()['then'](function(){var _0x248c9d=_0x1b3ba8[_0x9b3f('0x27')]({'plain':!![]});var _0x2dfef4=[{'name':_0x9b3f('0x28'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x9b3f('0x29'),'ignore':![]}];var _0x555bf4=_(_0x2dfef4)[_0x9b3f('0x2a')]('ignore')[_0x9b3f('0x2b')](_0x9b3f('0x2c'))[_0x9b3f('0x2c')]();if(_[_0x9b3f('0x2d')](_0x555bf4,_0x248c9d[_0x9b3f('0x2e')])){return;}var _0x590e9c=_[_0x9b3f('0x2f')](_0x2dfef4,[_0x9b3f('0x2c'),_0x248c9d[_0x9b3f('0x2e')]])[_0x9b3f('0x30')];return db[_0x9b3f('0x31')][_0x9b3f('0x26')]({'where':{'type':_0x590e9c,'resourceId':_0x248c9d['id']}})[_0x9b3f('0x25')](function(){return _0x1b3ba8;});})['then'](function(){_0x325c74['status'](0xcc)[_0x9b3f('0x32')]();});}};}function handleEntityNotFound(_0x4ddecb,_0x53bf78){return function(_0x20b019){if(!_0x20b019){_0x4ddecb['sendStatus'](0x194);}return _0x20b019;};}function handleError(_0x44dab3,_0x1a123a){_0x1a123a=_0x1a123a||0x1f4;return function(_0x294506){logger[_0x9b3f('0x33')](_0x294506[_0x9b3f('0x34')]);if(_0x294506['name']){delete _0x294506[_0x9b3f('0x30')];}_0x44dab3[_0x9b3f('0x1b')](_0x1a123a)[_0x9b3f('0x35')](_0x294506);};}exports[_0x9b3f('0x36')]=function(_0x378e87,_0x365df5){var _0x5c7a9d={},_0x1ae307={},_0x4082cb={'count':0x0,'rows':[]};var _0x222118=_['map'](db[_0x9b3f('0x37')][_0x9b3f('0x38')],function(_0x23d4d6){return{'name':_0x23d4d6[_0x9b3f('0x39')],'type':_0x23d4d6[_0x9b3f('0x2e')][_0x9b3f('0x3a')]};});_0x1ae307[_0x9b3f('0x3b')]=_[_0x9b3f('0x2b')](_0x222118,_0x9b3f('0x30'));_0x1ae307[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x378e87[_0x9b3f('0x3c')]);_0x1ae307[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x1ae307[_0x9b3f('0x3b')],_0x1ae307['query']);_0x5c7a9d[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x1ae307[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x378e87[_0x9b3f('0x3c')][_0x9b3f('0x41')]));_0x5c7a9d[_0x9b3f('0x40')]=_0x5c7a9d['attributes'][_0x9b3f('0x42')]?_0x5c7a9d[_0x9b3f('0x40')]:_0x1ae307['model'];if(!_0x378e87[_0x9b3f('0x3c')][_0x9b3f('0x43')]('nolimit')){_0x5c7a9d[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x378e87[_0x9b3f('0x3c')]['limit']);_0x5c7a9d[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x378e87[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}_0x5c7a9d[_0x9b3f('0x44')]=qs['sort'](_0x378e87['query'][_0x9b3f('0x45')]);_0x5c7a9d[_0x9b3f('0x46')]=qs['filters'](_['pick'](_0x378e87[_0x9b3f('0x3c')],_0x1ae307['filters']),_0x222118);if(_0x378e87[_0x9b3f('0x3c')]['filter']){_0x5c7a9d[_0x9b3f('0x46')]=_['merge'](_0x5c7a9d['where'],{'$or':_[_0x9b3f('0x2b')](_0x222118,function(_0x3ff5f5){if(_0x3ff5f5[_0x9b3f('0x2e')]!==_0x9b3f('0x47')){var _0x588e84={};_0x588e84[_0x3ff5f5['name']]={'$like':'%'+_0x378e87[_0x9b3f('0x3c')]['filter']+'%'};return _0x588e84;}})});}_0x5c7a9d=_[_0x9b3f('0x48')]({},_0x5c7a9d,_0x378e87[_0x9b3f('0x49')]);var _0x503210={'where':_0x5c7a9d[_0x9b3f('0x46')]};return db[_0x9b3f('0x37')][_0x9b3f('0x20')](_0x503210)[_0x9b3f('0x25')](function(_0x5bb2a7){_0x4082cb[_0x9b3f('0x20')]=_0x5bb2a7;if(_0x378e87[_0x9b3f('0x3c')][_0x9b3f('0x4a')]){_0x5c7a9d[_0x9b3f('0x4b')]=[{'all':!![]}];}return db[_0x9b3f('0x37')]['findAll'](_0x5c7a9d);})[_0x9b3f('0x25')](function(_0x2cb8e0){_0x4082cb['rows']=_0x2cb8e0;return _0x4082cb;})[_0x9b3f('0x25')](respondWithFilteredResult(_0x365df5,_0x5c7a9d))[_0x9b3f('0x4c')](handleError(_0x365df5,null));};exports[_0x9b3f('0x4d')]=function(_0x735da1,_0x2efc70){var _0xdf1738={'raw':![],'where':{'id':_0x735da1['params']['id']}},_0x24d87c={};_0x24d87c[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db[_0x9b3f('0x37')][_0x9b3f('0x38')]);_0x24d87c[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x735da1[_0x9b3f('0x3c')]);_0x24d87c[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x24d87c['model'],_0x24d87c[_0x9b3f('0x3c')]);_0xdf1738['attributes']=_[_0x9b3f('0x3f')](_0x24d87c[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x735da1[_0x9b3f('0x3c')]['fields']));_0xdf1738[_0x9b3f('0x40')]=_0xdf1738[_0x9b3f('0x40')][_0x9b3f('0x42')]?_0xdf1738[_0x9b3f('0x40')]:_0x24d87c['model'];if(_0x735da1['query']['includeAll']){_0xdf1738['include']=[{'all':!![]}];}_0xdf1738=_[_0x9b3f('0x48')]({},_0xdf1738,_0x735da1[_0x9b3f('0x49')]);return db[_0x9b3f('0x37')][_0x9b3f('0x2f')](_0xdf1738)[_0x9b3f('0x25')](handleEntityNotFound(_0x2efc70,null))['then'](respondWithResult(_0x2efc70,null))[_0x9b3f('0x4c')](handleError(_0x2efc70,null));};exports['create']=function(_0x330975,_0x3c6950){return db['VoiceQueue'][_0x9b3f('0x4e')](_0x330975[_0x9b3f('0x4f')],{})[_0x9b3f('0x25')](function(_0x42b751){var _0x36320e=_0x330975[_0x9b3f('0x50')][_0x9b3f('0x27')]({'plain':!![]});if(!_0x36320e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36320e[_0x9b3f('0x51')]==='user'){var _0x9503f0=_0x42b751[_0x9b3f('0x27')]({'plain':!![]});var _0x7839f9=[{'name':_0x9b3f('0x28'),'value':_0x9b3f('0x52')},{'name':'QueueCampaigns','value':_0x9b3f('0x29')}];var _0xbea8cb=_['find'](_0x7839f9,[_0x9b3f('0x2c'),_0x9503f0[_0x9b3f('0x2e')]])[_0x9b3f('0x30')];return db['UserProfileSection'][_0x9b3f('0x2f')]({'where':{'name':_0xbea8cb,'userProfileId':_0x36320e[_0x9b3f('0x53')]},'raw':!![]})['then'](function(_0x4652c4){if(_0x4652c4&&_0x4652c4[_0x9b3f('0x54')]===0x0){return db[_0x9b3f('0x31')][_0x9b3f('0x4e')]({'name':_0x9503f0[_0x9b3f('0x30')],'resourceId':_0x9503f0['id'],'type':_0x4652c4['name'],'sectionId':_0x4652c4['id']},{})[_0x9b3f('0x25')](function(){return _0x42b751;});}else{return _0x42b751;}})[_0x9b3f('0x4c')](function(_0x36eb9c){logger[_0x9b3f('0x33')](_0x9b3f('0x55'),_0x36eb9c);throw _0x36eb9c;});}return _0x42b751;})[_0x9b3f('0x25')](respondWithResult(_0x3c6950,0xc9))[_0x9b3f('0x4c')](handleError(_0x3c6950,null));};exports[_0x9b3f('0x56')]=function(_0x323c6d,_0x3dd4fc){var _0x2dc3b2={'where':{'id':_0x323c6d[_0x9b3f('0x57')]['id']}},_0x11011e={};_0x11011e[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db['VoiceQueue'][_0x9b3f('0x38')]);_0x2dc3b2[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x11011e[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x323c6d[_0x9b3f('0x3c')][_0x9b3f('0x41')]));_0x2dc3b2[_0x9b3f('0x40')]=_0x2dc3b2['attributes'][_0x9b3f('0x42')]?_0x2dc3b2['attributes']:_0x11011e[_0x9b3f('0x3b')];if(_0x323c6d[_0x9b3f('0x3c')][_0x9b3f('0x4a')]){_0x2dc3b2[_0x9b3f('0x4b')]=[{'all':!![]}];}_0x2dc3b2=_[_0x9b3f('0x48')]({},_0x2dc3b2,_0x323c6d[_0x9b3f('0x49')]);return db[_0x9b3f('0x37')][_0x9b3f('0x2f')](_0x2dc3b2)[_0x9b3f('0x25')](handleEntityNotFound(_0x3dd4fc,null))[_0x9b3f('0x25')](function(_0x51adab){if(_0x51adab){var _0x461999=_0x51adab[_0x9b3f('0x27')]({'plain':!![]});_0x461999=qs[_0x9b3f('0x58')](_0x461999,['id',_0x9b3f('0x59'),_0x9b3f('0x5a')]);_0x323c6d['body']=_[_0x9b3f('0x58')](_0x323c6d[_0x9b3f('0x4f')],['id','createdAt',_0x9b3f('0x5a')]);return db['VoiceQueue']['create'](_['merge'](_0x461999,_0x323c6d['body']),{'include':_0x323c6d[_0x9b3f('0x3c')][_0x9b3f('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x514aac){var _0x24a45a=_0x323c6d[_0x9b3f('0x50')][_0x9b3f('0x27')]({'plain':!![]});if(!_0x24a45a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24a45a[_0x9b3f('0x51')]==='user'){var _0x4b0575=_0x514aac['get']({'plain':!![]});var _0x56631b=[{'name':'VoiceQueues','value':_0x9b3f('0x52')},{'name':_0x9b3f('0x5b'),'value':_0x9b3f('0x29')}];var _0x1bfaad=_[_0x9b3f('0x2f')](_0x56631b,[_0x9b3f('0x2c'),_0x4b0575[_0x9b3f('0x2e')]])['name'];return db[_0x9b3f('0x5c')][_0x9b3f('0x2f')]({'where':{'name':_0x1bfaad,'userProfileId':_0x24a45a[_0x9b3f('0x53')]},'raw':!![]})[_0x9b3f('0x25')](function(_0x44ec13){if(_0x44ec13&&_0x44ec13['autoAssociation']===0x0){return db['UserProfileResource'][_0x9b3f('0x4e')]({'name':_0x4b0575[_0x9b3f('0x30')],'resourceId':_0x4b0575['id'],'type':_0x44ec13['name'],'sectionId':_0x44ec13['id']},{})[_0x9b3f('0x25')](function(){return _0x514aac;});}else{return _0x514aac;}})[_0x9b3f('0x4c')](function(_0x3fdfe9){logger[_0x9b3f('0x33')](_0x9b3f('0x55'),_0x3fdfe9);throw _0x3fdfe9;});}return _0x514aac;});}})['then'](respondWithResult(_0x3dd4fc,0xc9))[_0x9b3f('0x4c')](handleError(_0x3dd4fc,null));};exports[_0x9b3f('0x5d')]=function(_0x41fff0,_0x430570){if(_0x41fff0['body']['id']){delete _0x41fff0[_0x9b3f('0x4f')]['id'];}return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x41fff0['params']['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x430570,null))['then'](saveUpdates(_0x41fff0[_0x9b3f('0x4f')],null))[_0x9b3f('0x25')](respondWithResult(_0x430570,null))[_0x9b3f('0x4c')](handleError(_0x430570,null));};exports[_0x9b3f('0x26')]=function(_0x39fdb1,_0x25b2a5){return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x39fdb1[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x25b2a5,null))[_0x9b3f('0x25')](removeEntity(_0x25b2a5,null))[_0x9b3f('0x4c')](handleError(_0x25b2a5,null));};exports[_0x9b3f('0x5e')]=function(_0x37d719,_0x2896de,_0x43751c){var _0x479657={'raw':![],'where':{}};var _0x5ab9f4={};var _0xca9f52={'count':0x0,'rows':[]};return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0x37d719[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x2896de,null))[_0x9b3f('0x25')](function(_0x3b2b87){if(_0x3b2b87){_0x5ab9f4[_0x9b3f('0x3b')]=_['keys'](db[_0x9b3f('0x60')][_0x9b3f('0x38')]);_0x5ab9f4[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x37d719[_0x9b3f('0x3c')]);_0x5ab9f4[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x5ab9f4[_0x9b3f('0x3b')],_0x5ab9f4[_0x9b3f('0x3c')]);_0x479657['attributes']=_[_0x9b3f('0x3f')](_0x5ab9f4['model'],qs[_0x9b3f('0x41')](_0x37d719[_0x9b3f('0x3c')]['fields']));_0x479657[_0x9b3f('0x40')]=_0x479657[_0x9b3f('0x40')][_0x9b3f('0x42')]?_0x479657[_0x9b3f('0x40')]:_0x5ab9f4[_0x9b3f('0x3b')];if(!_0x37d719['query'][_0x9b3f('0x43')](_0x9b3f('0x61'))){_0x479657[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x37d719[_0x9b3f('0x3c')][_0x9b3f('0x1f')]);_0x479657[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x37d719[_0x9b3f('0x3c')]['offset']);}_0x479657[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0x37d719[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x479657[_0x9b3f('0x46')]=qs[_0x9b3f('0x3e')](_[_0x9b3f('0x62')](_0x37d719[_0x9b3f('0x3c')],_0x5ab9f4['filters']));_0x479657[_0x9b3f('0x46')]['VoiceQueueId']=_0x3b2b87['id'];if(_0x37d719[_0x9b3f('0x3c')][_0x9b3f('0x2a')]){_0x479657[_0x9b3f('0x46')]=_[_0x9b3f('0x48')](_0x479657['where'],{'$or':_[_0x9b3f('0x2b')](_0x479657[_0x9b3f('0x40')],function(_0xf7412c){var _0x4b94f3={};_0x4b94f3[_0xf7412c]={'$like':'%'+_0x37d719['query'][_0x9b3f('0x2a')]+'%'};return _0x4b94f3;})});}_0x479657=_[_0x9b3f('0x48')]({},_0x479657,_0x37d719[_0x9b3f('0x49')]);return db['CmHopper']['count']({'where':_0x479657[_0x9b3f('0x46')]})['then'](function(_0x48a45c){_0xca9f52[_0x9b3f('0x20')]=_0x48a45c;if(_0x37d719[_0x9b3f('0x3c')][_0x9b3f('0x4a')]){_0x479657['include']=[{'all':!![]}];}return db['CmHopper'][_0x9b3f('0x63')](_0x479657);})[_0x9b3f('0x25')](function(_0x5d7cf7){_0xca9f52['rows']=_0x5d7cf7;return _0xca9f52;});}})[_0x9b3f('0x25')](respondWithFilteredResult(_0x2896de,_0x479657))[_0x9b3f('0x4c')](handleError(_0x2896de,null));};exports[_0x9b3f('0x64')]=function(_0x22d633,_0x37bcc2,_0x81d2a0){var _0x8cdf78={'raw':!![],'where':{}};var _0x57d301={};var _0xbb6d44={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x22d633[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x37bcc2,null))[_0x9b3f('0x25')](function(_0x21ab78){if(_0x21ab78){_0x57d301[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db[_0x9b3f('0x65')]['rawAttributes']);_0x57d301[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x22d633[_0x9b3f('0x3c')]);_0x57d301[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x57d301[_0x9b3f('0x3b')],_0x57d301['query']);_0x8cdf78[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x57d301['model'],qs['fields'](_0x22d633[_0x9b3f('0x3c')][_0x9b3f('0x41')]));_0x8cdf78[_0x9b3f('0x40')]=_0x8cdf78['attributes']['length']?_0x8cdf78[_0x9b3f('0x40')]:_0x57d301[_0x9b3f('0x3b')];if(!_0x22d633['query'][_0x9b3f('0x43')](_0x9b3f('0x61'))){_0x8cdf78[_0x9b3f('0x1f')]=qs['limit'](_0x22d633[_0x9b3f('0x3c')][_0x9b3f('0x1f')]);_0x8cdf78[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x22d633[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}_0x8cdf78[_0x9b3f('0x44')]=qs['sort'](_0x22d633[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x8cdf78[_0x9b3f('0x46')]=qs[_0x9b3f('0x3e')](_[_0x9b3f('0x62')](_0x22d633[_0x9b3f('0x3c')],_0x57d301[_0x9b3f('0x3e')]));_0x8cdf78[_0x9b3f('0x46')][_0x9b3f('0x66')]=_0x21ab78['id'];if(_0x22d633[_0x9b3f('0x3c')]['filter']){_0x8cdf78['where']=_[_0x9b3f('0x48')](_0x8cdf78[_0x9b3f('0x46')],{'$or':_[_0x9b3f('0x2b')](_0x8cdf78[_0x9b3f('0x40')],function(_0x7e5dce){var _0x19c42b={};_0x19c42b[_0x7e5dce]={'$like':'%'+_0x22d633['query']['filter']+'%'};return _0x19c42b;})});}_0x8cdf78=_[_0x9b3f('0x48')]({},_0x8cdf78,_0x22d633[_0x9b3f('0x49')]);return db[_0x9b3f('0x65')]['count']({'where':_0x8cdf78['where']})[_0x9b3f('0x25')](function(_0x573abe){_0xbb6d44[_0x9b3f('0x20')]=_0x573abe;if(_0x22d633[_0x9b3f('0x3c')][_0x9b3f('0x4a')]){_0x8cdf78['include']=[{'all':!![]}];}return db[_0x9b3f('0x65')][_0x9b3f('0x63')](_0x8cdf78);})['then'](function(_0xd911b7){_0xbb6d44[_0x9b3f('0x67')]=_0xd911b7;return _0xbb6d44;});}})['then'](respondWithFilteredResult(_0x37bcc2,_0x8cdf78))['catch'](handleError(_0x37bcc2,null));};exports['getHopperFinals']=function(_0x13d7f5,_0x27584f,_0x296989){var _0x1b4a44={'raw':!![],'where':{}};var _0x468cb2={};var _0x53d7ef={'count':0x0,'rows':[]};return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0x13d7f5['params']['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x27584f,null))[_0x9b3f('0x25')](function(_0x4174cb){if(_0x4174cb){_0x468cb2['model']=_[_0x9b3f('0x3d')](db[_0x9b3f('0x68')][_0x9b3f('0x38')]);_0x468cb2[_0x9b3f('0x3c')]=_['keys'](_0x13d7f5[_0x9b3f('0x3c')]);_0x468cb2[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x468cb2[_0x9b3f('0x3b')],_0x468cb2[_0x9b3f('0x3c')]);_0x1b4a44[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x468cb2[_0x9b3f('0x3b')],qs['fields'](_0x13d7f5['query']['fields']));_0x1b4a44['attributes']=_0x1b4a44[_0x9b3f('0x40')]['length']?_0x1b4a44[_0x9b3f('0x40')]:_0x468cb2['model'];if(!_0x13d7f5['query'][_0x9b3f('0x43')]('nolimit')){_0x1b4a44[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x13d7f5['query']['limit']);_0x1b4a44[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x13d7f5[_0x9b3f('0x3c')]['offset']);}_0x1b4a44[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0x13d7f5['query'][_0x9b3f('0x45')]);_0x1b4a44[_0x9b3f('0x46')]=qs['filters'](_[_0x9b3f('0x62')](_0x13d7f5[_0x9b3f('0x3c')],_0x468cb2[_0x9b3f('0x3e')]));_0x1b4a44[_0x9b3f('0x46')]['VoiceQueueId']=_0x4174cb['id'];if(_0x13d7f5['query'][_0x9b3f('0x2a')]){_0x1b4a44['where']=_['merge'](_0x1b4a44[_0x9b3f('0x46')],{'$or':_['map'](_0x1b4a44[_0x9b3f('0x40')],function(_0x3476d7){var _0x1891fa={};_0x1891fa[_0x3476d7]={'$like':'%'+_0x13d7f5[_0x9b3f('0x3c')]['filter']+'%'};return _0x1891fa;})});}_0x1b4a44=_[_0x9b3f('0x48')]({},_0x1b4a44,_0x13d7f5[_0x9b3f('0x49')]);return db['CmHopperFinal'][_0x9b3f('0x20')]({'where':_0x1b4a44['where']})[_0x9b3f('0x25')](function(_0x3b9018){_0x53d7ef[_0x9b3f('0x20')]=_0x3b9018;if(_0x13d7f5['query'][_0x9b3f('0x4a')]){_0x1b4a44[_0x9b3f('0x4b')]=[{'all':!![]}];}return db[_0x9b3f('0x68')][_0x9b3f('0x63')](_0x1b4a44);})[_0x9b3f('0x25')](function(_0x357cc1){_0x53d7ef[_0x9b3f('0x67')]=_0x357cc1;return _0x53d7ef;});}})[_0x9b3f('0x25')](respondWithFilteredResult(_0x27584f,_0x1b4a44))[_0x9b3f('0x4c')](handleError(_0x27584f,null));};exports[_0x9b3f('0x69')]=function(_0x279406,_0x136498,_0xf47c7){var _0x38a399={'raw':!![],'where':{}};var _0x3625ec={};var _0x2d9f95={'count':0x0,'rows':[]};return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0x279406[_0x9b3f('0x57')]['id']}})['then'](handleEntityNotFound(_0x136498,null))['then'](function(_0x5a4418){if(_0x5a4418){_0x3625ec[_0x9b3f('0x3b')]=_['keys'](db[_0x9b3f('0x6a')][_0x9b3f('0x38')]);_0x3625ec['query']=_[_0x9b3f('0x3d')](_0x279406[_0x9b3f('0x3c')]);_0x3625ec[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x3625ec[_0x9b3f('0x3b')],_0x3625ec[_0x9b3f('0x3c')]);_0x38a399[_0x9b3f('0x40')]=_['intersection'](_0x3625ec[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x279406[_0x9b3f('0x3c')][_0x9b3f('0x41')]));_0x38a399['attributes']=_0x38a399[_0x9b3f('0x40')][_0x9b3f('0x42')]?_0x38a399[_0x9b3f('0x40')]:_0x3625ec['model'];if(!_0x279406[_0x9b3f('0x3c')]['hasOwnProperty']('nolimit')){_0x38a399['limit']=qs['limit'](_0x279406['query']['limit']);_0x38a399['offset']=qs[_0x9b3f('0x1d')](_0x279406[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}_0x38a399[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0x279406[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x38a399[_0x9b3f('0x46')]=qs[_0x9b3f('0x3e')](_[_0x9b3f('0x62')](_0x279406[_0x9b3f('0x3c')],_0x3625ec['filters']));_0x38a399[_0x9b3f('0x46')][_0x9b3f('0x66')]=_0x5a4418['id'];if(_0x279406[_0x9b3f('0x3c')][_0x9b3f('0x2a')]){_0x38a399['where']=_[_0x9b3f('0x48')](_0x38a399[_0x9b3f('0x46')],{'$or':_[_0x9b3f('0x2b')](_0x38a399['attributes'],function(_0x164294){var _0x509551={};_0x509551[_0x164294]={'$like':'%'+_0x279406[_0x9b3f('0x3c')]['filter']+'%'};return _0x509551;})});}_0x38a399=_[_0x9b3f('0x48')]({},_0x38a399,_0x279406['options']);return db[_0x9b3f('0x6a')]['count']({'where':_0x38a399['where']})[_0x9b3f('0x25')](function(_0xc4af69){_0x2d9f95[_0x9b3f('0x20')]=_0xc4af69;if(_0x279406[_0x9b3f('0x3c')][_0x9b3f('0x4a')]){_0x38a399[_0x9b3f('0x4b')]=[{'all':!![]}];}return db[_0x9b3f('0x6a')][_0x9b3f('0x63')](_0x38a399);})[_0x9b3f('0x25')](function(_0x5cc7bf){_0x2d9f95[_0x9b3f('0x67')]=_0x5cc7bf;return _0x2d9f95;});}})[_0x9b3f('0x25')](respondWithFilteredResult(_0x136498,_0x38a399))[_0x9b3f('0x4c')](handleError(_0x136498,null));};exports['getTeams']=function(_0x91daa8,_0x23e6db,_0x3fdd88){var _0x179905={};var _0x1e53c0={};var _0x27b517;var _0x3b2150;return db['VoiceQueue'][_0x9b3f('0x5f')]({'where':{'id':_0x91daa8['params']['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x23e6db,null))[_0x9b3f('0x25')](function(_0x38b675){if(_0x38b675){_0x27b517=_0x38b675;_0x1e53c0['model']=_[_0x9b3f('0x3d')](db[_0x9b3f('0x6b')][_0x9b3f('0x38')]);_0x1e53c0[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x91daa8['query']);_0x1e53c0[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x1e53c0[_0x9b3f('0x3b')],_0x1e53c0['query']);_0x179905[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x1e53c0['model'],qs[_0x9b3f('0x41')](_0x91daa8[_0x9b3f('0x3c')]['fields']));_0x179905[_0x9b3f('0x40')]=_0x179905[_0x9b3f('0x40')]['length']?_0x179905[_0x9b3f('0x40')]:_0x1e53c0[_0x9b3f('0x3b')];_0x179905[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0x91daa8[_0x9b3f('0x3c')]['sort']);_0x179905[_0x9b3f('0x46')]=qs['filters'](_[_0x9b3f('0x62')](_0x91daa8[_0x9b3f('0x3c')],_0x1e53c0[_0x9b3f('0x3e')]));if(_0x91daa8[_0x9b3f('0x3c')][_0x9b3f('0x2a')]){_0x179905[_0x9b3f('0x46')]=_['merge'](_0x179905[_0x9b3f('0x46')],{'$or':_[_0x9b3f('0x2b')](_0x179905[_0x9b3f('0x40')],function(_0x59e63b){var _0x27f5cf={};_0x27f5cf[_0x59e63b]={'$like':'%'+_0x91daa8[_0x9b3f('0x3c')][_0x9b3f('0x2a')]+'%'};return _0x27f5cf;})});}_0x179905=_[_0x9b3f('0x48')]({},_0x179905,_0x91daa8[_0x9b3f('0x49')]);return _0x27b517[_0x9b3f('0x6c')](_0x179905);}})[_0x9b3f('0x25')](function(_0x11d867){if(_0x11d867){_0x3b2150=_0x11d867[_0x9b3f('0x42')];if(!_0x91daa8[_0x9b3f('0x3c')][_0x9b3f('0x43')](_0x9b3f('0x61'))){_0x179905[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x91daa8['query'][_0x9b3f('0x1f')]);_0x179905[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x91daa8[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}return _0x27b517[_0x9b3f('0x6c')](_0x179905);}})[_0x9b3f('0x25')](function(_0xb45da2){if(_0xb45da2){return _0xb45da2?{'count':_0x3b2150,'rows':_0xb45da2}:null;}})[_0x9b3f('0x25')](respondWithResult(_0x23e6db,null))['catch'](handleError(_0x23e6db,null));};exports[_0x9b3f('0x6d')]=function(_0x16bf29,_0x221c2a,_0x45bd1f){var _0x152e4a=_0x16bf29[_0x9b3f('0x4f')]['teams'];var _0x5ef2f1=_['map'](_0x152e4a,'id');return db[_0x9b3f('0x6b')]['findAll']({'where':{'id':_0x5ef2f1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9b3f('0x6e'),'attributes':['id','name',_0x9b3f('0x6f'),_0x9b3f('0x70'),'interface'],'raw':!![]}]})[_0x9b3f('0x25')](function(_0x55b3e5){if(_0x55b3e5){var _0x297172=_[_0x9b3f('0x71')](_0x55b3e5,function(_0x4f03b1){var _0x4657eb=_0x4f03b1['get']({'plain':!![]});_0x4657eb[_0x9b3f('0x6e')][_0x9b3f('0x72')](function(_0x33baf9){_0x33baf9[_0x9b3f('0x73')]=_[_0x9b3f('0x2f')](_0x152e4a,{'id':_0x4657eb['id']})[_0x9b3f('0x73')];});return _0x4657eb[_0x9b3f('0x6e')];});return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x16bf29[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](function(_0x5cd274){return db[_0x9b3f('0x74')]['transaction'](function(_0x467b2a){return _0x5cd274[_0x9b3f('0x6d')](_0x5ef2f1,{'transaction':_0x467b2a})[_0x9b3f('0x25')](function(){return BPromise['each'](_0x152e4a,function(_0x235d18){return db[_0x9b3f('0x75')]['upsert']({'TeamId':_0x235d18['id'],'VoiceQueueId':_0x16bf29[_0x9b3f('0x57')]['id'],'penalty':_0x235d18[_0x9b3f('0x73')]},{'transaction':_0x467b2a});});})['then'](function(){return BPromise[_0x9b3f('0x76')](_0x297172,function(_0x2e589a){return db[_0x9b3f('0x77')][_0x9b3f('0x78')]({'where':{'UserId':_0x2e589a['id'],'VoiceQueueId':_0x16bf29[_0x9b3f('0x57')]['id']},'defaults':{'penalty':_0x2e589a[_0x9b3f('0x73')]},'transaction':_0x467b2a});});})[_0x9b3f('0x25')](function(){return BPromise[_0x9b3f('0x76')](_[_0x9b3f('0x2a')](_0x297172,{'online':!![]}),function(_0x5e78d8){return db[_0x9b3f('0x79')][_0x9b3f('0x7a')]({'membername':_0x5e78d8['name'],'UserId':_0x5e78d8['id'],'queue_name':_0x5cd274['name'],'VoiceQueueId':_0x5cd274['id'],'interface':_[_0x9b3f('0x7b')](_0x5e78d8['interface'])?util[_0x9b3f('0x7c')](_0x9b3f('0x7d'),_0x5e78d8[_0x9b3f('0x30')]):_0x5e78d8['interface'],'paused':_0x5e78d8['voicePause']||![],'penalty':_0x5e78d8[_0x9b3f('0x73')]},{'transaction':_0x467b2a});});})[_0x9b3f('0x25')](function(){_0x297172[_0x9b3f('0x72')](function(_0x58b594){socket[_0x9b3f('0x7e')](_0x9b3f('0x7f'),{'UserId':_0x58b594['id'],'VoiceQueueId':_0x5cd274['id']});});});});});}})[_0x9b3f('0x25')](respondWithStatusCode(_0x221c2a,null))[_0x9b3f('0x4c')](handleError(_0x221c2a,null));};exports[_0x9b3f('0x80')]=function(_0x37bde7,_0x5304fe,_0x172ebb){return db[_0x9b3f('0x6b')][_0x9b3f('0x63')]({'where':{'id':_0x37bde7[_0x9b3f('0x3c')]['ids']},'attributes':['id'],'include':[{'model':db[_0x9b3f('0x81')],'as':_0x9b3f('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x9b3f('0x25')](handleEntityNotFound(_0x5304fe,null))[_0x9b3f('0x25')](function(_0x44b8af){var _0x1a7336=_['map'](_0x44b8af,'id');var _0x375ade=[];var _0x421cd8=[];var _0x3abe8f=squel[_0x9b3f('0x82')]();_0x3abe8f[_0x9b3f('0x83')]('tq.TeamId')[_0x9b3f('0x84')](_0x9b3f('0x85'),'tq')['join'](_0x9b3f('0x86'),'ut',_0x9b3f('0x87'))[_0x9b3f('0x46')](_0x9b3f('0x88'),_0x37bde7[_0x9b3f('0x57')]['id']);for(var _0xeda184=0x0;_0xeda184<_0x44b8af['length'];_0xeda184+=0x1){let _0x4b1b77=_0x44b8af[_0xeda184];for(var _0xc956ce=0x0;_0xc956ce<_0x4b1b77[_0x9b3f('0x6e')][_0x9b3f('0x42')];_0xc956ce+=0x1){let _0x1a73ab=_0x4b1b77[_0x9b3f('0x6e')][_0xc956ce];var _0xa85fa=_0x3abe8f['clone']();_0xa85fa['where'](_0x9b3f('0x89'),_0x1a73ab['id']);_0x421cd8[_0x9b3f('0x8a')](db[_0x9b3f('0x74')]['query'](_0xa85fa['toString'](),{'type':db[_0x9b3f('0x74')][_0x9b3f('0x8b')][_0x9b3f('0x8c')]})[_0x9b3f('0x25')](function(_0x429bc3){if(_0x429bc3['length']===0x1){return _0x1a73ab['id'];}else{var _0x224012=_['every'](_['map'](_0x429bc3,'TeamId'),function(_0x1c224a){return _[_0x9b3f('0x2d')](_0x1a7336,_0x1c224a);});if(_0x224012){return _0x1a73ab['id'];}}}));}}return BPromise[_0x9b3f('0x8d')](_0x421cd8)['then'](function(_0x58759e){_0x375ade=_(_0x375ade)[_0x9b3f('0x8e')](_0x58759e)[_0x9b3f('0x8f')]()[_0x9b3f('0x2c')]();return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x37bde7[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](function(_0x1c0eeb){return db[_0x9b3f('0x74')][_0x9b3f('0x90')](function(_0x5f2bf7){return _0x1c0eeb[_0x9b3f('0x80')](_0x37bde7['query'][_0x9b3f('0x91')],{'transaction':_0x5f2bf7})['then'](function(){if(!_[_0x9b3f('0x92')](_0x375ade)){return _0x1c0eeb[_0x9b3f('0x93')](_0x375ade,{'transaction':_0x5f2bf7})[_0x9b3f('0x25')](function(){return db[_0x9b3f('0x79')][_0x9b3f('0x26')]({'where':{'VoiceQueueId':_0x37bde7[_0x9b3f('0x57')]['id'],'UserId':_0x375ade},'transaction':_0x5f2bf7});});}})[_0x9b3f('0x25')](function(){_0x375ade[_0x9b3f('0x72')](function(_0x37886f){socket[_0x9b3f('0x7e')](_0x9b3f('0x94'),{'UserId':_0x37886f,'VoiceQueueId':_0x1c0eeb['id']});});});});});});})[_0x9b3f('0x25')](respondWithStatusCode(_0x5304fe,null))[_0x9b3f('0x4c')](handleError(_0x5304fe,null));};exports[_0x9b3f('0x95')]=function(_0x3c56a2,_0x23aa6c,_0x246813){var _0x268566,_0x2b21ec;return db[_0x9b3f('0x37')]['find']({'where':{'id':_0x3c56a2[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x23aa6c,null))[_0x9b3f('0x25')](function(_0x3b73b4){if(_0x3b73b4){_0x2b21ec=_0x3b73b4;return _0x3b73b4[_0x9b3f('0x95')](_0x3c56a2[_0x9b3f('0x4f')][_0x9b3f('0x91')],_[_0x9b3f('0x58')](_0x3c56a2[_0x9b3f('0x4f')],[_0x9b3f('0x91'),'id'])||{})['spread'](function(_0x262f23){for(var _0x491d83=0x0;_0x491d83<_0x3c56a2[_0x9b3f('0x4f')][_0x9b3f('0x91')][_0x9b3f('0x42')];_0x491d83+=0x1){socket[_0x9b3f('0x7e')](_0x9b3f('0x7f'),{'UserId':Number(_0x3c56a2[_0x9b3f('0x4f')][_0x9b3f('0x91')][_0x491d83]),'VoiceQueueId':Number(_0x3c56a2[_0x9b3f('0x57')]['id'])});}return _0x262f23;});}})['then'](function(_0x3504e1){_0x268566=_0x3504e1||[];if(_0x2b21ec){return db[_0x9b3f('0x81')][_0x9b3f('0x63')]({'where':{'id':_0x3c56a2[_0x9b3f('0x4f')][_0x9b3f('0x91')]},'attributes':['id',_0x9b3f('0x30'),'online',_0x9b3f('0x70'),_0x9b3f('0x96')],'raw':!![]});}})['then'](function(_0x9d437f){if(!_[_0x9b3f('0x92')](_0x9d437f)){var _0x209dce=[];for(var _0x572b1b=0x0;_0x572b1b<_0x9d437f[_0x9b3f('0x42')];_0x572b1b++){if(_0x9d437f[_0x572b1b][_0x9b3f('0x6f')]){_0x209dce[_0x9b3f('0x8a')](db[_0x9b3f('0x79')][_0x9b3f('0x7a')]({'membername':_0x9d437f[_0x572b1b][_0x9b3f('0x30')],'UserId':_0x9d437f[_0x572b1b]['id'],'queue_name':_0x2b21ec[_0x9b3f('0x30')],'VoiceQueueId':_0x2b21ec['id'],'interface':_[_0x9b3f('0x7b')](_0x9d437f[_0x572b1b][_0x9b3f('0x96')])?util[_0x9b3f('0x7c')]('SIP/%s',_0x9d437f[_0x572b1b]['name']):_0x9d437f[_0x572b1b][_0x9b3f('0x96')],'paused':_0x9d437f[_0x572b1b][_0x9b3f('0x70')]||![],'penalty':_0x3c56a2[_0x9b3f('0x4f')]['penalty']||0x0}));}}return BPromise[_0x9b3f('0x8d')](_0x209dce);}})[_0x9b3f('0x25')](function(){return _0x268566;})[_0x9b3f('0x25')](respondWithResult(_0x23aa6c,null))[_0x9b3f('0x4c')](handleError(_0x23aa6c,null));};exports['removeAgents']=function(_0x463bc3,_0x1d79f4,_0xa9c31b){return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x463bc3[_0x9b3f('0x57')]['id']}})['then'](handleEntityNotFound(_0x1d79f4,null))[_0x9b3f('0x25')](function(_0x4aaaa2){if(_0x4aaaa2){return _0x4aaaa2[_0x9b3f('0x93')](_0x463bc3[_0x9b3f('0x3c')]['ids'])[_0x9b3f('0x25')](function(){if(_[_0x9b3f('0x97')](_0x463bc3['query'][_0x9b3f('0x91')])){for(var _0x5a78c8=0x0;_0x5a78c8<_0x463bc3[_0x9b3f('0x3c')][_0x9b3f('0x91')][_0x9b3f('0x42')];_0x5a78c8+=0x1){socket[_0x9b3f('0x7e')](_0x9b3f('0x94'),{'UserId':Number(_0x463bc3[_0x9b3f('0x3c')]['ids'][_0x5a78c8]),'VoiceQueueId':Number(_0x463bc3['params']['id'])});}}else{socket[_0x9b3f('0x7e')](_0x9b3f('0x94'),{'UserId':Number(_0x463bc3[_0x9b3f('0x3c')][_0x9b3f('0x91')]),'VoiceQueueId':Number(_0x463bc3[_0x9b3f('0x57')]['id'])});}});}})[_0x9b3f('0x25')](function(_0x461f3c){return db[_0x9b3f('0x79')][_0x9b3f('0x26')]({'where':{'VoiceQueueId':_0x463bc3['params']['id'],'UserId':_0x463bc3[_0x9b3f('0x3c')]['ids']}})[_0x9b3f('0x25')](function(){return _0x461f3c;});})[_0x9b3f('0x25')](respondWithStatusCode(_0x1d79f4,null))['catch'](handleError(_0x1d79f4,null));};exports['getAgents']=function(_0x56ec83,_0x876a8b,_0x2f933a){var _0x5e369a={};var _0x2a661c={};var _0x115cb0;var _0x4cca54;return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0x56ec83[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x876a8b,null))[_0x9b3f('0x25')](function(_0x5d3261){if(_0x5d3261){_0x115cb0=_0x5d3261;_0x2a661c[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db[_0x9b3f('0x81')]['rawAttributes']);_0x2a661c['query']=_['keys'](_0x56ec83['query']);_0x2a661c[_0x9b3f('0x3e')]=_['intersection'](_0x2a661c['model'],_0x2a661c[_0x9b3f('0x3c')]);_0x5e369a[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x2a661c[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x56ec83['query']['fields']));_0x5e369a[_0x9b3f('0x40')]=_0x5e369a['attributes'][_0x9b3f('0x42')]?_0x5e369a[_0x9b3f('0x40')]:_0x2a661c[_0x9b3f('0x3b')];_0x5e369a[_0x9b3f('0x44')]=qs['sort'](_0x56ec83[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x5e369a[_0x9b3f('0x46')]=qs['filters'](_[_0x9b3f('0x62')](_0x56ec83['query'],_0x2a661c[_0x9b3f('0x3e')]));if(_0x56ec83[_0x9b3f('0x3c')]['filter']){_0x5e369a[_0x9b3f('0x46')]=_[_0x9b3f('0x48')](_0x5e369a['where'],{'$or':_[_0x9b3f('0x2b')](_0x5e369a[_0x9b3f('0x40')],function(_0x20bb74){var _0x4d5fd1={};_0x4d5fd1[_0x20bb74]={'$like':'%'+_0x56ec83[_0x9b3f('0x3c')][_0x9b3f('0x2a')]+'%'};return _0x4d5fd1;})});}_0x5e369a=_[_0x9b3f('0x48')]({},_0x5e369a,_0x56ec83[_0x9b3f('0x49')]);return _0x115cb0[_0x9b3f('0x98')](_0x5e369a);}})[_0x9b3f('0x25')](function(_0x35871a){if(_0x35871a){_0x4cca54=_0x35871a[_0x9b3f('0x42')];if(!_0x56ec83['query'][_0x9b3f('0x43')]('nolimit')){_0x5e369a['limit']=qs['limit'](_0x56ec83[_0x9b3f('0x3c')]['limit']);_0x5e369a['offset']=qs[_0x9b3f('0x1d')](_0x56ec83[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}return _0x115cb0[_0x9b3f('0x98')](_0x5e369a);}})[_0x9b3f('0x25')](function(_0x255dcb){if(_0x255dcb){return _0x255dcb?{'count':_0x4cca54,'rows':_0x255dcb}:null;}})[_0x9b3f('0x25')](respondWithResult(_0x876a8b,null))['catch'](handleError(_0x876a8b,null));};exports['getMembers']=function(_0x23fcf9,_0xb6cda0,_0x29f684){var _0x5084d1={};var _0x1aa0cb={};var _0x21aa68;var _0x4d991e;return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0x23fcf9[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0xb6cda0,null))['then'](function(_0x2d1511){if(_0x2d1511){_0x21aa68=_0x2d1511;_0x1aa0cb[_0x9b3f('0x3b')]=_['keys'](db[_0x9b3f('0x79')][_0x9b3f('0x38')]);_0x1aa0cb[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0x23fcf9[_0x9b3f('0x3c')]);_0x1aa0cb[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x1aa0cb[_0x9b3f('0x3b')],_0x1aa0cb[_0x9b3f('0x3c')]);_0x5084d1[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x1aa0cb[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x23fcf9['query'][_0x9b3f('0x41')]));_0x5084d1[_0x9b3f('0x40')]=_0x5084d1[_0x9b3f('0x40')]['length']?_0x5084d1[_0x9b3f('0x40')]:_0x1aa0cb[_0x9b3f('0x3b')];_0x5084d1[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x5084d1[_0x9b3f('0x46')]=qs['filters'](_[_0x9b3f('0x62')](_0x23fcf9[_0x9b3f('0x3c')],_0x1aa0cb[_0x9b3f('0x3e')]));if(_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x2a')]){_0x5084d1['where']=_[_0x9b3f('0x48')](_0x5084d1[_0x9b3f('0x46')],{'$or':_['map'](_0x5084d1['attributes'],function(_0x199477){var _0x2b71ff={};_0x2b71ff[_0x199477]={'$like':'%'+_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x2a')]+'%'};return _0x2b71ff;})});}_0x5084d1=_[_0x9b3f('0x48')]({},_0x5084d1,_0x23fcf9[_0x9b3f('0x49')]);return _0x21aa68['getMembers'](_0x5084d1);}})[_0x9b3f('0x25')](function(_0x5a96d8){if(_0x5a96d8){_0x4d991e=_0x5a96d8['length'];if(!_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x43')]('nolimit')){_0x5084d1[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x1f')]);_0x5084d1['offset']=qs[_0x9b3f('0x1d')](_0x23fcf9[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}return _0x21aa68['getMembers'](_0x5084d1);}})['then'](function(_0x1b3fb7){return _0x1b3fb7?{'count':_0x4d991e,'rows':_0x1b3fb7}:null;})[_0x9b3f('0x25')](respondWithResult(_0xb6cda0,null))[_0x9b3f('0x4c')](handleError(_0xb6cda0,null));};exports[_0x9b3f('0x99')]=function(_0xe8cbd1,_0x1d2887,_0x3c2e8d){var _0x113923={};var _0x4a84e8={};var _0x1ea162;var _0x229b52;return db[_0x9b3f('0x37')][_0x9b3f('0x5f')]({'where':{'id':_0xe8cbd1[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x1d2887,null))[_0x9b3f('0x25')](function(_0x50d6c1){if(_0x50d6c1){_0x1ea162=_0x50d6c1;_0x4a84e8[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db[_0x9b3f('0x9a')][_0x9b3f('0x38')]);_0x4a84e8[_0x9b3f('0x3c')]=_[_0x9b3f('0x3d')](_0xe8cbd1[_0x9b3f('0x3c')]);_0x4a84e8[_0x9b3f('0x3e')]=_[_0x9b3f('0x3f')](_0x4a84e8['model'],_0x4a84e8[_0x9b3f('0x3c')]);_0x113923[_0x9b3f('0x40')]=_[_0x9b3f('0x3f')](_0x4a84e8[_0x9b3f('0x3b')],qs['fields'](_0xe8cbd1[_0x9b3f('0x3c')][_0x9b3f('0x41')]));_0x113923[_0x9b3f('0x40')]=_0x113923[_0x9b3f('0x40')][_0x9b3f('0x42')]?_0x113923['attributes']:_0x4a84e8[_0x9b3f('0x3b')];_0x113923[_0x9b3f('0x44')]=qs[_0x9b3f('0x45')](_0xe8cbd1[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x113923[_0x9b3f('0x46')]=qs[_0x9b3f('0x3e')](_[_0x9b3f('0x62')](_0xe8cbd1['query'],_0x4a84e8[_0x9b3f('0x3e')]));if(_0xe8cbd1['query'][_0x9b3f('0x2a')]){_0x113923[_0x9b3f('0x46')]=_[_0x9b3f('0x48')](_0x113923['where'],{'$or':_[_0x9b3f('0x2b')](_0x113923[_0x9b3f('0x40')],function(_0x133095){var _0x102bfe={};_0x102bfe[_0x133095]={'$like':'%'+_0xe8cbd1['query'][_0x9b3f('0x2a')]+'%'};return _0x102bfe;})});}_0x113923=_[_0x9b3f('0x48')]({},_0x113923,_0xe8cbd1['options']);return _0x1ea162[_0x9b3f('0x99')](_0x113923);}})['then'](function(_0x357dd8){if(_0x357dd8){_0x229b52=_0x357dd8[_0x9b3f('0x42')];if(!_0xe8cbd1['query'][_0x9b3f('0x43')]('nolimit')){_0x113923[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0xe8cbd1['query']['limit']);_0x113923[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0xe8cbd1[_0x9b3f('0x3c')]['offset']);}return _0x1ea162['getLists'](_0x113923);}})[_0x9b3f('0x25')](function(_0x425b6e){if(_0x425b6e){return _0x425b6e?{'count':_0x229b52,'rows':_0x425b6e}:null;}})[_0x9b3f('0x25')](respondWithResult(_0x1d2887,null))[_0x9b3f('0x4c')](handleError(_0x1d2887,null));};exports[_0x9b3f('0x9b')]=function(_0x2317fd,_0x36131f,_0x55498b){var _0x291cbe=moment()[_0x9b3f('0x7c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e72b9,_0x2abfde;return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x2317fd[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x36131f,null))['then'](function(_0xbf63dc){if(_0xbf63dc){_0x2abfde=_0xbf63dc;return _0xbf63dc['addLists'](_0x2317fd[_0x9b3f('0x4f')]['ids'],_[_0x9b3f('0x58')](_0x2317fd[_0x9b3f('0x4f')],[_0x9b3f('0x91'),'id'])||{});}return null;})[_0x9b3f('0x9c')](function(_0x2896ad){var _0x19e8a6;_0x1e72b9=_0x2896ad||[];var _0x4f5d97=[];if(_0x2896ad){for(var _0x296fe8=0x0;_0x296fe8<_0x2896ad['length'];_0x296fe8+=0x1){var _0x567212=_0x2896ad[_0x296fe8]['get']({'plain':!![]});_0x2abfde[_0x9b3f('0x9d')]=_0x2317fd[_0x9b3f('0x4f')]['dialCheckDuplicateType']?_0x2317fd['body']['dialCheckDuplicateType']:_0x2abfde[_0x9b3f('0x9d')];switch(_0x2abfde[_0x9b3f('0x9d')]){case _0x9b3f('0x9e'):_0x19e8a6=squel['insert']()[_0x9b3f('0x9f')](_0x9b3f('0xa0'))[_0x9b3f('0xa1')]([_0x9b3f('0xa2'),_0x9b3f('0xa3'),_0x9b3f('0xa4'),'ListId',_0x9b3f('0x66'),_0x9b3f('0x59'),'updatedAt'],squel[_0x9b3f('0x82')]()['field'](_0x9b3f('0xa2'),_0x9b3f('0xa2'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27','scheduledAt')[_0x9b3f('0x83')]('id',_0x9b3f('0xa4'))['field'](_0x567212[_0x9b3f('0xa5')][_0x9b3f('0xa6')](),'ListId')[_0x9b3f('0x83')](_0x2317fd[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')](),'VoiceQueueId')[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x59'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27','updatedAt')[_0x9b3f('0x84')](_0x9b3f('0xa7'))[_0x9b3f('0x46')](_0x9b3f('0xa8'))['where']('ListId\x20=\x20?',_0x567212[_0x9b3f('0xa5')][_0x9b3f('0xa6')]())[_0x9b3f('0x46')](_0x9b3f('0xa9'))['where'](_0x9b3f('0xaa'),squel['select']()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0x9b3f('0xab'))[_0x9b3f('0x46')](_0x9b3f('0x88'),_0x2317fd[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')]()))[_0x9b3f('0x46')](_0x9b3f('0xaa'),squel[_0x9b3f('0x82')]()[_0x9b3f('0x83')](_0x9b3f('0xac'))[_0x9b3f('0x84')](_0x9b3f('0xa0'))[_0x9b3f('0x46')](_0x9b3f('0x88'),_0x2317fd[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')]())))[_0x9b3f('0xa6')]();break;case _0x9b3f('0xad'):_0x19e8a6=squel[_0x9b3f('0xae')]()['into'](_0x9b3f('0xa0'))['fromQuery']([_0x9b3f('0xa2'),_0x9b3f('0xa3'),'ContactId',_0x9b3f('0xaf'),_0x9b3f('0x66'),'createdAt',_0x9b3f('0x5a')],squel[_0x9b3f('0x82')]()[_0x9b3f('0x83')](_0x9b3f('0xa2'),_0x9b3f('0xa2'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0xa3'))['field']('id',_0x9b3f('0xa4'))[_0x9b3f('0x83')](_0x567212[_0x9b3f('0xa5')][_0x9b3f('0xa6')](),_0x9b3f('0xaf'))[_0x9b3f('0x83')](_0x2317fd[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')](),_0x9b3f('0x66'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x59'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x5a'))[_0x9b3f('0x84')](_0x9b3f('0xa7'))[_0x9b3f('0x46')]('deletedAt\x20IS\x20NULL')[_0x9b3f('0x46')]('ListId\x20=\x20?',_0x567212[_0x9b3f('0xa5')][_0x9b3f('0xa6')]())['where'](_0x9b3f('0xa9'))[_0x9b3f('0x46')](_0x9b3f('0xaa'),squel[_0x9b3f('0x82')]()[_0x9b3f('0x83')](_0x9b3f('0xac'))['from'](_0x9b3f('0xa0'))[_0x9b3f('0x46')](_0x9b3f('0x88'),_0x2317fd['params']['id'][_0x9b3f('0xa6')]())))[_0x9b3f('0xa6')]();break;default:_0x19e8a6=squel[_0x9b3f('0xae')]()[_0x9b3f('0x9f')](_0x9b3f('0xa0'))[_0x9b3f('0xa1')]([_0x9b3f('0xa2'),_0x9b3f('0xa3'),'ContactId',_0x9b3f('0xaf'),'VoiceQueueId',_0x9b3f('0x59'),_0x9b3f('0x5a')],squel['select']()['field'](_0x9b3f('0xa2'),_0x9b3f('0xa2'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0xa3'))['field']('id','ContactId')['field'](_0x567212['CmListId'][_0x9b3f('0xa6')](),_0x9b3f('0xaf'))[_0x9b3f('0x83')](_0x2317fd[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')](),_0x9b3f('0x66'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x59'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x5a'))[_0x9b3f('0x84')](_0x9b3f('0xa7'))[_0x9b3f('0x46')](_0x9b3f('0xa8'))['where']('ListId\x20=\x20?',_0x567212[_0x9b3f('0xa5')][_0x9b3f('0xa6')]())[_0x9b3f('0x46')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x4f5d97[_0x9b3f('0x8a')](db[_0x9b3f('0x74')][_0x9b3f('0x3c')](_0x19e8a6));}return BPromise[_0x9b3f('0x8d')](_0x4f5d97);}})['then'](function(){var _0x395455=[];var _0x542f0f=squel[_0x9b3f('0xae')]()[_0x9b3f('0x9f')](_0x9b3f('0xb0'))[_0x9b3f('0xa1')]([_0x9b3f('0xb1'),_0x9b3f('0xa2'),_0x9b3f('0xb2'),_0x9b3f('0x59'),_0x9b3f('0x5a')],squel[_0x9b3f('0x82')]()[_0x9b3f('0x83')](_0x9b3f('0xb3'))[_0x9b3f('0x83')](_0x9b3f('0xb4'))[_0x9b3f('0x83')](_0x9b3f('0xb5'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x59'))[_0x9b3f('0x83')]('\x27'+_0x291cbe+'\x27',_0x9b3f('0x5a'))[_0x9b3f('0x84')](_0x9b3f('0xb6'),'ci')[_0x9b3f('0xb7')](_0x9b3f('0xa0'),'h','h.ContactId=ci.CmContactId')[_0x9b3f('0x46')](_0x9b3f('0xb8'),_0x291cbe)['where'](_0x9b3f('0xb9'),_0x9b3f('0xba')))[_0x9b3f('0xa6')]();_0x395455[_0x9b3f('0x8a')](db[_0x9b3f('0x74')][_0x9b3f('0x3c')](_0x542f0f));return BPromise['all'](_0x395455);})['then'](function(){return _0x1e72b9;})['then'](respondWithResult(_0x36131f,null))[_0x9b3f('0x4c')](handleError(_0x36131f,null));};exports[_0x9b3f('0xbb')]=function(_0x13e7a5,_0xcf9bad,_0x168698){return db[_0x9b3f('0x37')][_0x9b3f('0x2f')]({'where':{'id':_0x13e7a5[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0xcf9bad,null))[_0x9b3f('0x25')](function(_0x11ffce){if(_0x11ffce){return _0x11ffce[_0x9b3f('0xbb')](_0x13e7a5[_0x9b3f('0x3c')][_0x9b3f('0x91')]);}})[_0x9b3f('0x25')](function(_0x35ecc7){if(_0x35ecc7){return db[_0x9b3f('0x60')]['destroy']({'where':{'ListId':_0x13e7a5['query'][_0x9b3f('0x91')],'VoiceQueueId':_0x13e7a5[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](function(){return _0x35ecc7;});}})[_0x9b3f('0x25')](respondWithStatusCode(_0xcf9bad,null))[_0x9b3f('0x4c')](handleError(_0xcf9bad,null));};exports[_0x9b3f('0xbc')]=function(_0x3081fd,_0xd0aa59,_0x114f15){var _0x2314e8={};var _0x50fd7a={};var _0x174182;var _0x5726ce;return db['VoiceQueue'][_0x9b3f('0x5f')]({'where':{'id':_0x3081fd['params']['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0xd0aa59,null))[_0x9b3f('0x25')](function(_0x2a30b9){if(_0x2a30b9){_0x174182=_0x2a30b9;_0x50fd7a[_0x9b3f('0x3b')]=_[_0x9b3f('0x3d')](db[_0x9b3f('0x9a')]['rawAttributes']);_0x50fd7a['query']=_['keys'](_0x3081fd[_0x9b3f('0x3c')]);_0x50fd7a['filters']=_[_0x9b3f('0x3f')](_0x50fd7a[_0x9b3f('0x3b')],_0x50fd7a[_0x9b3f('0x3c')]);_0x2314e8[_0x9b3f('0x40')]=_['intersection'](_0x50fd7a[_0x9b3f('0x3b')],qs[_0x9b3f('0x41')](_0x3081fd[_0x9b3f('0x3c')]['fields']));_0x2314e8['attributes']=_0x2314e8[_0x9b3f('0x40')][_0x9b3f('0x42')]?_0x2314e8[_0x9b3f('0x40')]:_0x50fd7a[_0x9b3f('0x3b')];_0x2314e8['order']=qs[_0x9b3f('0x45')](_0x3081fd[_0x9b3f('0x3c')][_0x9b3f('0x45')]);_0x2314e8[_0x9b3f('0x46')]=qs[_0x9b3f('0x3e')](_['pick'](_0x3081fd[_0x9b3f('0x3c')],_0x50fd7a[_0x9b3f('0x3e')]));if(_0x3081fd[_0x9b3f('0x3c')]['filter']){_0x2314e8[_0x9b3f('0x46')]=_[_0x9b3f('0x48')](_0x2314e8[_0x9b3f('0x46')],{'$or':_['map'](_0x2314e8[_0x9b3f('0x40')],function(_0x48082a){var _0x1b0f50={};_0x1b0f50[_0x48082a]={'$like':'%'+_0x3081fd[_0x9b3f('0x3c')][_0x9b3f('0x2a')]+'%'};return _0x1b0f50;})});}_0x2314e8=_['merge']({},_0x2314e8,_0x3081fd[_0x9b3f('0x49')]);return _0x174182[_0x9b3f('0xbc')](_0x2314e8);}})[_0x9b3f('0x25')](function(_0x4f9219){if(_0x4f9219){_0x5726ce=_0x4f9219[_0x9b3f('0x42')];if(!_0x3081fd[_0x9b3f('0x3c')][_0x9b3f('0x43')](_0x9b3f('0x61'))){_0x2314e8[_0x9b3f('0x1f')]=qs[_0x9b3f('0x1f')](_0x3081fd[_0x9b3f('0x3c')][_0x9b3f('0x1f')]);_0x2314e8[_0x9b3f('0x1d')]=qs[_0x9b3f('0x1d')](_0x3081fd[_0x9b3f('0x3c')][_0x9b3f('0x1d')]);}return _0x174182[_0x9b3f('0xbc')](_0x2314e8);}})[_0x9b3f('0x25')](function(_0x59cb79){if(_0x59cb79){return _0x59cb79?{'count':_0x5726ce,'rows':_0x59cb79}:null;}})[_0x9b3f('0x25')](respondWithResult(_0xd0aa59,null))[_0x9b3f('0x4c')](handleError(_0xd0aa59,null));};exports[_0x9b3f('0xbd')]=function(_0x34bb7c,_0x1390a7,_0xf542b5){var _0xa77f64,_0x47b122;return db[_0x9b3f('0x37')]['find']({'where':{'id':_0x34bb7c['params']['id']}})['then'](handleEntityNotFound(_0x1390a7,null))[_0x9b3f('0x25')](function(_0x45b9fa){if(_0x45b9fa){_0x47b122=_0x45b9fa;return _0x45b9fa['addBlackLists'](_0x34bb7c[_0x9b3f('0x4f')][_0x9b3f('0x91')],_['omit'](_0x34bb7c[_0x9b3f('0x4f')],[_0x9b3f('0x91'),'id'])||{});}return null;})[_0x9b3f('0x9c')](function(_0x4df618){var _0x1327cc;_0xa77f64=_0x4df618||[];var _0x2aa355=[];if(_0x4df618){for(var _0x48457d=0x0;_0x48457d<_0x4df618['length'];_0x48457d+=0x1){var _0xf75f7e=_0x4df618[_0x48457d][_0x9b3f('0x27')]({'plain':!![]});_0x1327cc=squel[_0x9b3f('0xae')]()[_0x9b3f('0x9f')]('cm_hopper_black')['fromQuery']([_0x9b3f('0xa2'),'ContactId',_0x9b3f('0xaf'),_0x9b3f('0x66'),_0x9b3f('0x59'),_0x9b3f('0x5a')],squel[_0x9b3f('0x82')]()['field']('phone','phone')['field']('id',_0x9b3f('0xa4'))[_0x9b3f('0x83')](_0xf75f7e[_0x9b3f('0xa5')][_0x9b3f('0xa6')](),'ListId')['field'](_0x34bb7c[_0x9b3f('0x57')]['id'][_0x9b3f('0xa6')](),_0x9b3f('0x66'))[_0x9b3f('0x83')](_0x9b3f('0xbe'),_0x9b3f('0x59'))['field']('NOW()','updatedAt')[_0x9b3f('0x84')](_0x9b3f('0xa7'))[_0x9b3f('0x46')](_0x9b3f('0xa8'))[_0x9b3f('0x46')](_0x9b3f('0xbf'),_0xf75f7e[_0x9b3f('0xa5')]['toString']())[_0x9b3f('0x46')](_0x9b3f('0xa9')))[_0x9b3f('0xa6')]();_0x2aa355[_0x9b3f('0x8a')](db['sequelize'][_0x9b3f('0x3c')](_0x1327cc));}return BPromise[_0x9b3f('0x8d')](_0x2aa355);}})[_0x9b3f('0x25')](function(){return _0xa77f64;})[_0x9b3f('0x25')](respondWithResult(_0x1390a7,null))[_0x9b3f('0x4c')](handleError(_0x1390a7,null));};exports[_0x9b3f('0xc0')]=function(_0x2ef027,_0x3b1a67,_0x5e6d5d){return db['VoiceQueue'][_0x9b3f('0x2f')]({'where':{'id':_0x2ef027[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](handleEntityNotFound(_0x3b1a67,null))[_0x9b3f('0x25')](function(_0x453c16){if(_0x453c16){return _0x453c16[_0x9b3f('0xc0')](_0x2ef027[_0x9b3f('0x3c')]['ids']);}})[_0x9b3f('0x25')](function(_0x61e89b){if(_0x61e89b){return db[_0x9b3f('0x6a')][_0x9b3f('0x26')]({'where':{'ListId':_0x2ef027[_0x9b3f('0x3c')][_0x9b3f('0x91')],'VoiceQueueId':_0x2ef027[_0x9b3f('0x57')]['id']}})[_0x9b3f('0x25')](function(){return _0x61e89b;});}})[_0x9b3f('0x25')](respondWithStatusCode(_0x3b1a67,null))[_0x9b3f('0x4c')](handleError(_0x3b1a67,null));};
\ No newline at end of file
+var _0x55ca=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','omit','createdAt','updatedAt','VoiceQueues','UserProfileResource','findOne','CmHopper','hasOwnProperty','nolimit','limit','order','sort','where','rows','getHopperHistories','CmHopperHistory','pick','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','voicePause','flatMap','penalty','sequelize','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','transaction','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','field','ContactId','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','COALESCE(phone,\x27\x27)','push','cm_hopper_additional_phones','CmHopperId','h.id','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','phone\x20IS\x20NOT\x20NULL','removeBlackLists','moment','bluebird','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./voiceQueue.socket','status','end','json','undefined','count','offset','set','Content-Range','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','sendStatus','error','stack','name','send','index','map','VoiceQueue','key','getOptions','include','query','findAll','catch','params','model','keys','rawAttributes','filters','intersection','attributes','fields','length','includeAll','options'];(function(_0x3ec4bb,_0xce2e57){var _0x34c410=function(_0x1d1607){while(--_0x1d1607){_0x3ec4bb['push'](_0x3ec4bb['shift']());}};_0x34c410(++_0xce2e57);}(_0x55ca,0x126));var _0xa55c=function(_0x101d5b,_0x40cfd){_0x101d5b=_0x101d5b-0x0;var _0x382a50=_0x55ca[_0x101d5b];return _0x382a50;};'use strict';var moment=require(_0xa55c('0x0'));var BPromise=require(_0xa55c('0x1'));var util=require('util');var _=require('lodash');var squel=require('squel');var Redis=require(_0xa55c('0x2'));var qs=require(_0xa55c('0x3'));var logger=require('../../config/logger')(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var db=require(_0xa55c('0x6'))['db'];config[_0xa55c('0x7')]=_[_0xa55c('0x8')](config[_0xa55c('0x7')],{'host':_0xa55c('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa55c('0x7')]));require(_0xa55c('0xa'))['register'](socket);function respondWithStatusCode(_0x291996,_0x290d28){_0x290d28=_0x290d28||0xcc;return function(_0x52a3bc){if(_0x52a3bc){return _0x291996['sendStatus'](_0x290d28);}return _0x291996[_0xa55c('0xb')](_0x290d28)[_0xa55c('0xc')]();};}function respondWithResult(_0x381d07,_0x5d8e5a){_0x5d8e5a=_0x5d8e5a||0xc8;return function(_0x31646d){if(_0x31646d){return _0x381d07[_0xa55c('0xb')](_0x5d8e5a)[_0xa55c('0xd')](_0x31646d);}};}function respondWithFilteredResult(_0x70c2de,_0x3998f7){return function(_0x15eec8){if(_0x15eec8){var _0x5d47ff=typeof _0x3998f7['offset']===_0xa55c('0xe')&&typeof _0x3998f7['limit']==='undefined';var _0x59ea8d=_0x15eec8[_0xa55c('0xf')];var _0x3930e4=_0x5d47ff?0x0:_0x3998f7[_0xa55c('0x10')];var _0x938bd6=_0x5d47ff?_0x15eec8[_0xa55c('0xf')]:_0x3998f7[_0xa55c('0x10')]+_0x3998f7['limit'];var _0x3ccf65;if(_0x938bd6>=_0x59ea8d){_0x938bd6=_0x59ea8d;_0x3ccf65=0xc8;}else{_0x3ccf65=0xce;}_0x70c2de[_0xa55c('0xb')](_0x3ccf65);return _0x70c2de[_0xa55c('0x11')](_0xa55c('0x12'),_0x3930e4+'-'+_0x938bd6+'/'+_0x59ea8d)[_0xa55c('0xd')](_0x15eec8);}return null;};}function saveUpdates(_0x3ae86b){return function(_0x51590e){if(_0x51590e){return _0x51590e[_0xa55c('0x13')](_0x3ae86b)[_0xa55c('0x14')](function(_0x4cee3c){return _0x4cee3c;});}return null;};}function removeEntity(_0x3d4c9e){return function(_0x104a99){if(_0x104a99){return _0x104a99[_0xa55c('0x15')]()[_0xa55c('0x14')](function(){var _0x23a1ae=_0x104a99[_0xa55c('0x16')]({'plain':!![]});var _0x4c0daf=[{'name':'VoiceQueues','value':_0xa55c('0x17'),'ignore':![]},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19'),'ignore':![]}];var _0x4cfe10=_(_0x4c0daf)[_0xa55c('0x1a')](_0xa55c('0x1b'))['map'](_0xa55c('0x1c'))[_0xa55c('0x1c')]();if(_[_0xa55c('0x1d')](_0x4cfe10,_0x23a1ae[_0xa55c('0x1e')])){return;}var _0x234372=_['find'](_0x4c0daf,[_0xa55c('0x1c'),_0x23a1ae['type']])['name'];return db['UserProfileResource'][_0xa55c('0x15')]({'where':{'type':_0x234372,'resourceId':_0x23a1ae['id']}})['then'](function(){return _0x104a99;});})[_0xa55c('0x14')](function(){_0x3d4c9e[_0xa55c('0xb')](0xcc)[_0xa55c('0xc')]();});}};}function handleEntityNotFound(_0xf0e574){return function(_0x2313a9){if(!_0x2313a9){_0xf0e574[_0xa55c('0x1f')](0x194);}return _0x2313a9;};}function handleError(_0x1da633,_0x11e7f7){_0x11e7f7=_0x11e7f7||0x1f4;return function(_0x192df2){logger[_0xa55c('0x20')](_0x192df2[_0xa55c('0x21')]);if(_0x192df2['name']){delete _0x192df2[_0xa55c('0x22')];}_0x1da633[_0xa55c('0xb')](_0x11e7f7)[_0xa55c('0x23')](_0x192df2);};}exports[_0xa55c('0x24')]=function(_0x5d940d,_0x1377b0){var _0x22f6b6={};var _0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x25')](db[_0xa55c('0x26')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x1e')][_0xa55c('0x27')]};});_0x22f6b6=qs[_0xa55c('0x28')](_0x201941,_0x5d940d);var _0x223813={'where':_0x22f6b6['where']};return db[_0xa55c('0x26')][_0xa55c('0xf')](_0x223813)[_0xa55c('0x14')](function(_0x20da31){_0x1b8388[_0xa55c('0xf')]=_0x20da31;_0x22f6b6[_0xa55c('0x29')]=qs[_0xa55c('0x29')](_0x5d940d[_0xa55c('0x2a')]);return db[_0xa55c('0x26')][_0xa55c('0x2b')](_0x22f6b6);})[_0xa55c('0x14')](function(_0x4eb7c4){_0x1b8388['rows']=_0x4eb7c4;return _0x1b8388;})[_0xa55c('0x14')](respondWithFilteredResult(_0x1377b0,_0x22f6b6))[_0xa55c('0x2c')](handleError(_0x1377b0,null));};exports['show']=function(_0x30fadd,_0x2f0110){var _0x2e9623={'raw':![],'where':{'id':_0x30fadd[_0xa55c('0x2d')]['id']}},_0x1839ac={};_0x1839ac[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x26')][_0xa55c('0x30')]);_0x1839ac['query']=_['keys'](_0x30fadd['query']);_0x1839ac[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x1839ac[_0xa55c('0x2e')],_0x1839ac['query']);_0x2e9623[_0xa55c('0x33')]=_['intersection'](_0x1839ac[_0xa55c('0x2e')],qs['fields'](_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2e9623[_0xa55c('0x33')]=_0x2e9623['attributes'][_0xa55c('0x35')]?_0x2e9623[_0xa55c('0x33')]:_0x1839ac['model'];if(_0x30fadd[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x2e9623['include']=[{'all':!![]}];}_0x2e9623=_['merge']({},_0x2e9623,_0x30fadd[_0xa55c('0x37')]);return db['VoiceQueue'][_0xa55c('0x38')](_0x2e9623)[_0xa55c('0x14')](handleEntityNotFound(_0x2f0110,null))['then'](respondWithResult(_0x2f0110,null))['catch'](handleError(_0x2f0110,null));};exports['create']=function(_0x4de781,_0x3b3308){return db[_0xa55c('0x26')][_0xa55c('0x39')](_0x4de781[_0xa55c('0x3a')],{})[_0xa55c('0x14')](function(_0x56d17c){var _0x3d52d8=_0x4de781[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x3d52d8)throw new Error(_0xa55c('0x3c'));if(_0x3d52d8[_0xa55c('0x3d')]===_0xa55c('0x3b')){var _0x554620=_0x56d17c[_0xa55c('0x16')]({'plain':!![]});var _0x5ee63d=[{'name':'VoiceQueues','value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':'outbound'}];var _0x2bd98b=_['find'](_0x5ee63d,['value',_0x554620[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x2bd98b,'userProfileId':_0x3d52d8[_0xa55c('0x3f')]},'raw':!![]})[_0xa55c('0x14')](function(_0x5d9d5d){if(_0x5d9d5d&&_0x5d9d5d[_0xa55c('0x40')]===0x0){return db['UserProfileResource'][_0xa55c('0x39')]({'name':_0x554620[_0xa55c('0x22')],'resourceId':_0x554620['id'],'type':_0x5d9d5d['name'],'sectionId':_0x5d9d5d['id']},{})[_0xa55c('0x14')](function(){return _0x56d17c;});}else{return _0x56d17c;}})[_0xa55c('0x2c')](function(_0x5d834d){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x5d834d);throw _0x5d834d;});}return _0x56d17c;})[_0xa55c('0x14')](respondWithResult(_0x3b3308,0xc9))['catch'](handleError(_0x3b3308,null));};exports[_0xa55c('0x42')]=function(_0x582901,_0x2f9717){var _0x3a8af4={'where':{'id':_0x582901['params']['id']}},_0x451269={};_0x451269[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['VoiceQueue'][_0xa55c('0x30')]);_0x3a8af4[_0xa55c('0x33')]=_['intersection'](_0x451269[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x582901['query'][_0xa55c('0x34')]));_0x3a8af4[_0xa55c('0x33')]=_0x3a8af4[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3a8af4['attributes']:_0x451269[_0xa55c('0x2e')];if(_0x582901['query'][_0xa55c('0x36')]){_0x3a8af4[_0xa55c('0x29')]=[{'all':!![]}];}_0x3a8af4=_[_0xa55c('0x43')]({},_0x3a8af4,_0x582901['options']);return db[_0xa55c('0x26')][_0xa55c('0x38')](_0x3a8af4)['then'](handleEntityNotFound(_0x2f9717,null))[_0xa55c('0x14')](function(_0x34de95){if(_0x34de95){var _0x3822b7=_0x34de95[_0xa55c('0x16')]({'plain':!![]});_0x3822b7=qs[_0xa55c('0x44')](_0x3822b7,['id',_0xa55c('0x45'),_0xa55c('0x46')]);_0x582901[_0xa55c('0x3a')]=_[_0xa55c('0x44')](_0x582901[_0xa55c('0x3a')],['id','createdAt',_0xa55c('0x46')]);return db[_0xa55c('0x26')][_0xa55c('0x39')](_['merge'](_0x3822b7,_0x582901[_0xa55c('0x3a')]),{'include':_0x582901[_0xa55c('0x2a')]['includeAll']?[{'all':!![]}]:undefined})[_0xa55c('0x14')](function(_0x4fa412){var _0x2b6a0e=_0x582901[_0xa55c('0x3b')][_0xa55c('0x16')]({'plain':!![]});if(!_0x2b6a0e)throw new Error(_0xa55c('0x3c'));if(_0x2b6a0e[_0xa55c('0x3d')]==='user'){var _0x44b7c1=_0x4fa412[_0xa55c('0x16')]({'plain':!![]});var _0x4b85cc=[{'name':_0xa55c('0x47'),'value':_0xa55c('0x17')},{'name':_0xa55c('0x18'),'value':_0xa55c('0x19')}];var _0x50176b=_['find'](_0x4b85cc,[_0xa55c('0x1c'),_0x44b7c1[_0xa55c('0x1e')]])[_0xa55c('0x22')];return db[_0xa55c('0x3e')]['find']({'where':{'name':_0x50176b,'userProfileId':_0x2b6a0e[_0xa55c('0x3f')]},'raw':!![]})['then'](function(_0x2742e4){if(_0x2742e4&&_0x2742e4[_0xa55c('0x40')]===0x0){return db[_0xa55c('0x48')][_0xa55c('0x39')]({'name':_0x44b7c1[_0xa55c('0x22')],'resourceId':_0x44b7c1['id'],'type':_0x2742e4['name'],'sectionId':_0x2742e4['id']},{})[_0xa55c('0x14')](function(){return _0x4fa412;});}else{return _0x4fa412;}})['catch'](function(_0x23f67f){logger[_0xa55c('0x20')](_0xa55c('0x41'),_0x23f67f);throw _0x23f67f;});}return _0x4fa412;});}})[_0xa55c('0x14')](respondWithResult(_0x2f9717,0xc9))[_0xa55c('0x2c')](handleError(_0x2f9717,null));};exports[_0xa55c('0x13')]=function(_0x5d14e0,_0x53e2be){if(_0x5d14e0[_0xa55c('0x3a')]['id']){delete _0x5d14e0[_0xa55c('0x3a')]['id'];}return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x5d14e0[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x53e2be,null))[_0xa55c('0x14')](saveUpdates(_0x5d14e0[_0xa55c('0x3a')],null))[_0xa55c('0x14')](respondWithResult(_0x53e2be,null))[_0xa55c('0x2c')](handleError(_0x53e2be,null));};exports[_0xa55c('0x15')]=function(_0x493f51,_0xdd92c1){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x493f51[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0xdd92c1,null))['then'](removeEntity(_0xdd92c1,null))[_0xa55c('0x2c')](handleError(_0xdd92c1,null));};exports['getHoppers']=function(_0x2e482a,_0x5e3a28){var _0x3495a7={'raw':![],'where':{}};var _0x5a8897={};var _0x34edc5={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x2e482a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x5e3a28,null))[_0xa55c('0x14')](function(_0xafaf8c){if(_0xafaf8c){_0x5a8897[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x4a')]['rawAttributes']);_0x5a8897[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x2e482a['query']);_0x5a8897[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],_0x5a8897[_0xa55c('0x2a')]);_0x3495a7[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x5a8897[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x2e482a['query'][_0xa55c('0x34')]));_0x3495a7[_0xa55c('0x33')]=_0x3495a7[_0xa55c('0x33')][_0xa55c('0x35')]?_0x3495a7[_0xa55c('0x33')]:_0x5a8897[_0xa55c('0x2e')];if(!_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x3495a7['limit']=qs[_0xa55c('0x4d')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x3495a7[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x3495a7[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x3495a7['where']=qs[_0xa55c('0x31')](_['pick'](_0x2e482a[_0xa55c('0x2a')],_0x5a8897[_0xa55c('0x31')]));_0x3495a7[_0xa55c('0x50')]['VoiceQueueId']=_0xafaf8c['id'];if(_0x2e482a['query'][_0xa55c('0x1a')]){_0x3495a7[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x3495a7[_0xa55c('0x50')],{'$or':_['map'](_0x3495a7[_0xa55c('0x33')],function(_0xd02251){var _0x8ea1c6={};_0x8ea1c6[_0xd02251]={'$like':'%'+_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x8ea1c6;})});}_0x3495a7=_['merge']({},_0x3495a7,_0x2e482a['options']);return db[_0xa55c('0x4a')][_0xa55c('0xf')]({'where':_0x3495a7[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x1af9d5){_0x34edc5['count']=_0x1af9d5;if(_0x2e482a[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x3495a7['include']=[{'all':!![]}];}return db[_0xa55c('0x4a')][_0xa55c('0x2b')](_0x3495a7);})[_0xa55c('0x14')](function(_0x4dcb93){_0x34edc5[_0xa55c('0x51')]=_0x4dcb93;return _0x34edc5;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x5e3a28,_0x3495a7))[_0xa55c('0x2c')](handleError(_0x5e3a28,null));};exports[_0xa55c('0x52')]=function(_0x232143,_0x506f74){var _0x25bd5b={'raw':!![],'where':{}};var _0x2e2cf6={};var _0x4bf233={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x232143['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x506f74,null))[_0xa55c('0x14')](function(_0x2f13db){if(_0x2f13db){_0x2e2cf6[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x53')][_0xa55c('0x30')]);_0x2e2cf6[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x232143['query']);_0x2e2cf6[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],_0x2e2cf6[_0xa55c('0x2a')]);_0x25bd5b['attributes']=_[_0xa55c('0x32')](_0x2e2cf6[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x232143[_0xa55c('0x2a')]['fields']));_0x25bd5b['attributes']=_0x25bd5b[_0xa55c('0x33')][_0xa55c('0x35')]?_0x25bd5b[_0xa55c('0x33')]:_0x2e2cf6[_0xa55c('0x2e')];if(!_0x232143['query']['hasOwnProperty'](_0xa55c('0x4c'))){_0x25bd5b[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x232143[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x25bd5b[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x232143['query'][_0xa55c('0x10')]);}_0x25bd5b['order']=qs[_0xa55c('0x4f')](_0x232143['query'][_0xa55c('0x4f')]);_0x25bd5b[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x232143[_0xa55c('0x2a')],_0x2e2cf6[_0xa55c('0x31')]));_0x25bd5b[_0xa55c('0x50')][_0xa55c('0x55')]=_0x2f13db['id'];if(_0x232143['query']['filter']){_0x25bd5b[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x25bd5b[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x25bd5b[_0xa55c('0x33')],function(_0x137728){var _0x47e8e2={};_0x47e8e2[_0x137728]={'$like':'%'+_0x232143[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x47e8e2;})});}_0x25bd5b=_[_0xa55c('0x43')]({},_0x25bd5b,_0x232143[_0xa55c('0x37')]);return db[_0xa55c('0x53')][_0xa55c('0xf')]({'where':_0x25bd5b[_0xa55c('0x50')]})[_0xa55c('0x14')](function(_0x58b670){_0x4bf233[_0xa55c('0xf')]=_0x58b670;if(_0x232143[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x25bd5b[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x53')]['findAll'](_0x25bd5b);})[_0xa55c('0x14')](function(_0x2ab1f2){_0x4bf233['rows']=_0x2ab1f2;return _0x4bf233;});}})['then'](respondWithFilteredResult(_0x506f74,_0x25bd5b))[_0xa55c('0x2c')](handleError(_0x506f74,null));};exports[_0xa55c('0x56')]=function(_0x5c2229,_0x559e71){var _0x579726={'raw':!![],'where':{}};var _0x5ab79e={};var _0xf8e295={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x5c2229[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x559e71,null))[_0xa55c('0x14')](function(_0x568a5b){if(_0x568a5b){_0x5ab79e[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x57')][_0xa55c('0x30')]);_0x5ab79e['query']=_[_0xa55c('0x2f')](_0x5c2229[_0xa55c('0x2a')]);_0x5ab79e[_0xa55c('0x31')]=_['intersection'](_0x5ab79e[_0xa55c('0x2e')],_0x5ab79e['query']);_0x579726['attributes']=_[_0xa55c('0x32')](_0x5ab79e[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x579726[_0xa55c('0x33')]=_0x579726[_0xa55c('0x33')]['length']?_0x579726['attributes']:_0x5ab79e[_0xa55c('0x2e')];if(!_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x579726[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x579726[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x5c2229['query'][_0xa55c('0x10')]);}_0x579726[_0xa55c('0x4e')]=qs['sort'](_0x5c2229[_0xa55c('0x2a')]['sort']);_0x579726[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x5c2229[_0xa55c('0x2a')],_0x5ab79e[_0xa55c('0x31')]));_0x579726['where'][_0xa55c('0x55')]=_0x568a5b['id'];if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x579726[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x579726[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x579726['attributes'],function(_0x49a307){var _0x5c08e5={};_0x5c08e5[_0x49a307]={'$like':'%'+_0x5c2229[_0xa55c('0x2a')]['filter']+'%'};return _0x5c08e5;})});}_0x579726=_[_0xa55c('0x43')]({},_0x579726,_0x5c2229[_0xa55c('0x37')]);return db[_0xa55c('0x57')][_0xa55c('0xf')]({'where':_0x579726[_0xa55c('0x50')]})['then'](function(_0x253d7a){_0xf8e295['count']=_0x253d7a;if(_0x5c2229[_0xa55c('0x2a')][_0xa55c('0x36')]){_0x579726[_0xa55c('0x29')]=[{'all':!![]}];}return db[_0xa55c('0x57')]['findAll'](_0x579726);})[_0xa55c('0x14')](function(_0x46f8ab){_0xf8e295[_0xa55c('0x51')]=_0x46f8ab;return _0xf8e295;});}})[_0xa55c('0x14')](respondWithFilteredResult(_0x559e71,_0x579726))[_0xa55c('0x2c')](handleError(_0x559e71,null));};exports[_0xa55c('0x58')]=function(_0x270bd0,_0x472c73){var _0x5bae40={'raw':!![],'where':{}};var _0x147962={};var _0x1538dc={'count':0x0,'rows':[]};return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x270bd0[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x472c73,null))['then'](function(_0x46124b){if(_0x46124b){_0x147962['model']=_[_0xa55c('0x2f')](db['CmHopperBlack'][_0xa55c('0x30')]);_0x147962[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x270bd0['query']);_0x147962[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x147962[_0xa55c('0x2e')],_0x147962['query']);_0x5bae40[_0xa55c('0x33')]=_['intersection'](_0x147962[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x270bd0['query'][_0xa55c('0x34')]));_0x5bae40['attributes']=_0x5bae40[_0xa55c('0x33')][_0xa55c('0x35')]?_0x5bae40['attributes']:_0x147962[_0xa55c('0x2e')];if(!_0x270bd0[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x5bae40[_0xa55c('0x4d')]=qs['limit'](_0x270bd0[_0xa55c('0x2a')]['limit']);_0x5bae40['offset']=qs[_0xa55c('0x10')](_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x10')]);}_0x5bae40[_0xa55c('0x4e')]=qs['sort'](_0x270bd0[_0xa55c('0x2a')]['sort']);_0x5bae40[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x270bd0['query'],_0x147962[_0xa55c('0x31')]));_0x5bae40['where']['VoiceQueueId']=_0x46124b['id'];if(_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x5bae40[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x5bae40[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x5bae40[_0xa55c('0x33')],function(_0x9225d9){var _0x465801={};_0x465801[_0x9225d9]={'$like':'%'+_0x270bd0[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x465801;})});}_0x5bae40=_[_0xa55c('0x43')]({},_0x5bae40,_0x270bd0[_0xa55c('0x37')]);return db['CmHopperBlack'][_0xa55c('0xf')]({'where':_0x5bae40['where']})['then'](function(_0x5c8003){_0x1538dc[_0xa55c('0xf')]=_0x5c8003;if(_0x270bd0['query'][_0xa55c('0x36')]){_0x5bae40['include']=[{'all':!![]}];}return db[_0xa55c('0x59')]['findAll'](_0x5bae40);})['then'](function(_0xfb1954){_0x1538dc['rows']=_0xfb1954;return _0x1538dc;});}})['then'](respondWithFilteredResult(_0x472c73,_0x5bae40))[_0xa55c('0x2c')](handleError(_0x472c73,null));};exports[_0xa55c('0x5a')]=function(_0x4ba496,_0x11349d){var _0x55caeb={};var _0x294e54={};var _0x403dff;var _0x1dcd8a;return db['VoiceQueue']['findOne']({'where':{'id':_0x4ba496[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x11349d,null))[_0xa55c('0x14')](function(_0xfda07f){if(_0xfda07f){_0x403dff=_0xfda07f;_0x294e54[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x5b')][_0xa55c('0x30')]);_0x294e54['query']=_[_0xa55c('0x2f')](_0x4ba496[_0xa55c('0x2a')]);_0x294e54[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],_0x294e54[_0xa55c('0x2a')]);_0x55caeb[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x294e54[_0xa55c('0x2e')],qs['fields'](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x55caeb[_0xa55c('0x33')]=_0x55caeb['attributes']['length']?_0x55caeb['attributes']:_0x294e54[_0xa55c('0x2e')];_0x55caeb['order']=qs[_0xa55c('0x4f')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x55caeb[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x4ba496[_0xa55c('0x2a')],_0x294e54[_0xa55c('0x31')]));if(_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x55caeb[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x55caeb[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x55caeb[_0xa55c('0x33')],function(_0x1c7aec){var _0xf0bcac={};_0xf0bcac[_0x1c7aec]={'$like':'%'+_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0xf0bcac;})});}_0x55caeb=_[_0xa55c('0x43')]({},_0x55caeb,_0x4ba496[_0xa55c('0x37')]);return _0x403dff[_0xa55c('0x5a')](_0x55caeb);}})[_0xa55c('0x14')](function(_0x168b3f){if(_0x168b3f){_0x1dcd8a=_0x168b3f['length'];if(!_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4b')]('nolimit')){_0x55caeb[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x4ba496[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x55caeb[_0xa55c('0x10')]=qs['offset'](_0x4ba496[_0xa55c('0x2a')]['offset']);}return _0x403dff['getTeams'](_0x55caeb);}})[_0xa55c('0x14')](function(_0x1c9903){if(_0x1c9903){return _0x1c9903?{'count':_0x1dcd8a,'rows':_0x1c9903}:null;}})[_0xa55c('0x14')](respondWithResult(_0x11349d,null))[_0xa55c('0x2c')](handleError(_0x11349d,null));};exports[_0xa55c('0x5c')]=function(_0x23b513,_0x1e4464){var _0xd9f634=_0x23b513[_0xa55c('0x3a')][_0xa55c('0x5d')];var _0x1036b3=_[_0xa55c('0x25')](_0xd9f634,'id');return db[_0xa55c('0x5b')][_0xa55c('0x2b')]({'where':{'id':_0x1036b3},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':_0xa55c('0x5f'),'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),'interface'],'raw':!![]}]})['then'](function(_0x55a98d){if(_0x55a98d){var _0x200c28=_[_0xa55c('0x62')](_0x55a98d,function(_0x5e41b3){var _0x45b329=_0x5e41b3['get']({'plain':!![]});_0x45b329[_0xa55c('0x5f')]['forEach'](function(_0x3060f2){_0x3060f2[_0xa55c('0x63')]=_[_0xa55c('0x38')](_0xd9f634,{'id':_0x45b329['id']})[_0xa55c('0x63')];});return _0x45b329[_0xa55c('0x5f')];});return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x23b513[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x665054){return db[_0xa55c('0x64')]['transaction'](function(_0x59f3a4){return _0x665054[_0xa55c('0x5c')](_0x1036b3,{'transaction':_0x59f3a4})['then'](function(){return BPromise[_0xa55c('0x65')](_0xd9f634,function(_0x5447a4){return db[_0xa55c('0x66')][_0xa55c('0x67')]({'TeamId':_0x5447a4['id'],'VoiceQueueId':_0x23b513[_0xa55c('0x2d')]['id'],'penalty':_0x5447a4['penalty']},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){return BPromise[_0xa55c('0x65')](_0x200c28,function(_0x130c5f){return db['UserVoiceQueue'][_0xa55c('0x68')]({'where':{'UserId':_0x130c5f['id'],'VoiceQueueId':_0x23b513['params']['id']},'defaults':{'penalty':_0x130c5f[_0xa55c('0x63')]},'transaction':_0x59f3a4});});})['then'](function(){return BPromise['each'](_[_0xa55c('0x1a')](_0x200c28,{'online':!![]}),function(_0x40e121){return db[_0xa55c('0x69')]['upsert']({'membername':_0x40e121[_0xa55c('0x22')],'UserId':_0x40e121['id'],'queue_name':_0x665054[_0xa55c('0x22')],'VoiceQueueId':_0x665054['id'],'interface':_[_0xa55c('0x6a')](_0x40e121[_0xa55c('0x6b')])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0x40e121[_0xa55c('0x22')]):_0x40e121[_0xa55c('0x6b')],'paused':_0x40e121['voicePause']||![],'penalty':_0x40e121[_0xa55c('0x63')]},{'transaction':_0x59f3a4});});})[_0xa55c('0x14')](function(){_0x200c28[_0xa55c('0x6e')](function(_0x151533){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':_0x151533['id'],'VoiceQueueId':_0x665054['id']});});});});});}})[_0xa55c('0x14')](respondWithStatusCode(_0x1e4464,null))[_0xa55c('0x2c')](handleError(_0x1e4464,null));};exports[_0xa55c('0x71')]=function(_0x261087,_0x2ef9dd){return db['Team'][_0xa55c('0x2b')]({'where':{'id':_0x261087['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xa55c('0x5e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xa55c('0x14')](handleEntityNotFound(_0x2ef9dd,null))['then'](function(_0x302284){var _0x231499=_[_0xa55c('0x25')](_0x302284,'id');var _0x2d3e42=[];var _0x97275b=[];var _0x5c7c60=squel[_0xa55c('0x72')]();_0x5c7c60['field'](_0xa55c('0x73'))['from']('team_has_voice_queues','tq')[_0xa55c('0x74')](_0xa55c('0x75'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xa55c('0x50')](_0xa55c('0x76'),_0x261087[_0xa55c('0x2d')]['id']);for(var _0x485652=0x0;_0x485652<_0x302284['length'];_0x485652+=0x1){let _0x57a1fc=_0x302284[_0x485652];for(var _0x50018c=0x0;_0x50018c<_0x57a1fc[_0xa55c('0x5f')][_0xa55c('0x35')];_0x50018c+=0x1){let _0x4c77c4=_0x57a1fc[_0xa55c('0x5f')][_0x50018c];var _0x1322a0=_0x5c7c60[_0xa55c('0x42')]();_0x1322a0['where'](_0xa55c('0x77'),_0x4c77c4['id']);_0x97275b['push'](db['sequelize']['query'](_0x1322a0[_0xa55c('0x78')](),{'type':db['sequelize'][_0xa55c('0x79')]['SELECT']})[_0xa55c('0x14')](function(_0x21e529){if(_0x21e529[_0xa55c('0x35')]===0x1){return _0x4c77c4['id'];}else{var _0x5063e7=_[_0xa55c('0x7a')](_[_0xa55c('0x25')](_0x21e529,_0xa55c('0x7b')),function(_0x16401f){return _[_0xa55c('0x1d')](_0x231499,_0x16401f);});if(_0x5063e7){return _0x4c77c4['id'];}}}));}}return BPromise[_0xa55c('0x7c')](_0x97275b)[_0xa55c('0x14')](function(_0x34d755){_0x2d3e42=_(_0x2d3e42)[_0xa55c('0x7d')](_0x34d755)['compact']()[_0xa55c('0x1c')]();return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x261087[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(_0x2c0b71){return db['sequelize'][_0xa55c('0x7e')](function(_0x5bae58){return _0x2c0b71[_0xa55c('0x71')](_0x261087[_0xa55c('0x2a')]['ids'],{'transaction':_0x5bae58})[_0xa55c('0x14')](function(){if(!_[_0xa55c('0x7f')](_0x2d3e42)){return _0x2c0b71['removeAgents'](_0x2d3e42,{'transaction':_0x5bae58})['then'](function(){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0x261087[_0xa55c('0x2d')]['id'],'UserId':_0x2d3e42},'transaction':_0x5bae58});});}})[_0xa55c('0x14')](function(){_0x2d3e42[_0xa55c('0x6e')](function(_0x1a335b){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':_0x1a335b,'VoiceQueueId':_0x2c0b71['id']});});});});});});})['then'](respondWithStatusCode(_0x2ef9dd,null))[_0xa55c('0x2c')](handleError(_0x2ef9dd,null));};exports[_0xa55c('0x81')]=function(_0xc8cd97,_0x21a206){var _0x29469d,_0x59a69d;return db[_0xa55c('0x26')]['find']({'where':{'id':_0xc8cd97['params']['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x21a206,null))[_0xa55c('0x14')](function(_0x6fcc){if(_0x6fcc){_0x59a69d=_0x6fcc;return _0x6fcc[_0xa55c('0x81')](_0xc8cd97['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0xc8cd97[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{})[_0xa55c('0x83')](function(_0x4295c1){for(var _0x37f242=0x0;_0x37f242<_0xc8cd97[_0xa55c('0x3a')]['ids'][_0xa55c('0x35')];_0x37f242+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x70'),{'UserId':Number(_0xc8cd97[_0xa55c('0x3a')]['ids'][_0x37f242]),'VoiceQueueId':Number(_0xc8cd97[_0xa55c('0x2d')]['id'])});}return _0x4295c1;});}})[_0xa55c('0x14')](function(_0x65c752){_0x29469d=_0x65c752||[];if(_0x59a69d){return db['User'][_0xa55c('0x2b')]({'where':{'id':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x82')]},'attributes':['id',_0xa55c('0x22'),_0xa55c('0x60'),_0xa55c('0x61'),_0xa55c('0x6b')],'raw':!![]});}})['then'](function(_0xcd4f3a){if(!_[_0xa55c('0x7f')](_0xcd4f3a)){var _0x496e8c=[];for(var _0x1c930b=0x0;_0x1c930b<_0xcd4f3a[_0xa55c('0x35')];_0x1c930b++){if(_0xcd4f3a[_0x1c930b][_0xa55c('0x60')]){_0x496e8c['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0xcd4f3a[_0x1c930b][_0xa55c('0x22')],'UserId':_0xcd4f3a[_0x1c930b]['id'],'queue_name':_0x59a69d[_0xa55c('0x22')],'VoiceQueueId':_0x59a69d['id'],'interface':_['isNil'](_0xcd4f3a[_0x1c930b]['interface'])?util[_0xa55c('0x6c')](_0xa55c('0x6d'),_0xcd4f3a[_0x1c930b]['name']):_0xcd4f3a[_0x1c930b]['interface'],'paused':_0xcd4f3a[_0x1c930b][_0xa55c('0x61')]||![],'penalty':_0xc8cd97[_0xa55c('0x3a')][_0xa55c('0x63')]||0x0}));}}return BPromise['all'](_0x496e8c);}})['then'](function(){return _0x29469d;})[_0xa55c('0x14')](respondWithResult(_0x21a206,null))['catch'](handleError(_0x21a206,null));};exports[_0xa55c('0x84')]=function(_0xe0a356,_0x5a4e69){return db[_0xa55c('0x26')]['find']({'where':{'id':_0xe0a356['params']['id']}})['then'](handleEntityNotFound(_0x5a4e69,null))['then'](function(_0x527669){if(_0x527669){return _0x527669[_0xa55c('0x84')](_0xe0a356['query'][_0xa55c('0x82')])[_0xa55c('0x14')](function(){if(_[_0xa55c('0x85')](_0xe0a356['query'][_0xa55c('0x82')])){for(var _0x111ff8=0x0;_0x111ff8<_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0xa55c('0x35')];_0x111ff8+=0x1){socket[_0xa55c('0x6f')](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')][_0x111ff8]),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}}else{socket['emit'](_0xa55c('0x80'),{'UserId':Number(_0xe0a356[_0xa55c('0x2a')]['ids']),'VoiceQueueId':Number(_0xe0a356[_0xa55c('0x2d')]['id'])});}});}})[_0xa55c('0x14')](function(_0x940871){return db[_0xa55c('0x69')][_0xa55c('0x15')]({'where':{'VoiceQueueId':_0xe0a356[_0xa55c('0x2d')]['id'],'UserId':_0xe0a356[_0xa55c('0x2a')][_0xa55c('0x82')]}})[_0xa55c('0x14')](function(){return _0x940871;});})[_0xa55c('0x14')](respondWithStatusCode(_0x5a4e69,null))[_0xa55c('0x2c')](handleError(_0x5a4e69,null));};exports[_0xa55c('0x86')]=function(_0x262d72,_0x228d12){var _0x16e229={};var _0x5c8713={};var _0x2d03b2;var _0x4b2e75;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x262d72[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x228d12,null))['then'](function(_0x537011){if(_0x537011){_0x2d03b2=_0x537011;_0x5c8713[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db['User'][_0xa55c('0x30')]);_0x5c8713[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x262d72['query']);_0x5c8713[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x5c8713[_0xa55c('0x2e')],_0x5c8713['query']);_0x16e229[_0xa55c('0x33')]=_['intersection'](_0x5c8713[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x16e229[_0xa55c('0x33')]=_0x16e229['attributes'][_0xa55c('0x35')]?_0x16e229[_0xa55c('0x33')]:_0x5c8713[_0xa55c('0x2e')];_0x16e229['order']=qs[_0xa55c('0x4f')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x16e229['where']=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x262d72[_0xa55c('0x2a')],_0x5c8713[_0xa55c('0x31')]));if(_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x16e229[_0xa55c('0x50')]=_['merge'](_0x16e229[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x16e229[_0xa55c('0x33')],function(_0x100ccb){var _0x531e60={};_0x531e60[_0x100ccb]={'$like':'%'+_0x262d72[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x531e60;})});}_0x16e229=_[_0xa55c('0x43')]({},_0x16e229,_0x262d72[_0xa55c('0x37')]);return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0x243cf3){if(_0x243cf3){_0x4b2e75=_0x243cf3['length'];if(!_0x262d72[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x16e229[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x262d72['query']['limit']);_0x16e229['offset']=qs[_0xa55c('0x10')](_0x262d72[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x2d03b2[_0xa55c('0x86')](_0x16e229);}})[_0xa55c('0x14')](function(_0xb22076){if(_0xb22076){return _0xb22076?{'count':_0x4b2e75,'rows':_0xb22076}:null;}})[_0xa55c('0x14')](respondWithResult(_0x228d12,null))[_0xa55c('0x2c')](handleError(_0x228d12,null));};exports['getMembers']=function(_0x35c42c,_0x3b2174){var _0x35375e={};var _0x19a5f1={};var _0x3e7cfa;var _0xd511c0;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x35c42c['params']['id']}})['then'](handleEntityNotFound(_0x3b2174,null))['then'](function(_0x58831d){if(_0x58831d){_0x3e7cfa=_0x58831d;_0x19a5f1[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x69')][_0xa55c('0x30')]);_0x19a5f1[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x35c42c[_0xa55c('0x2a')]);_0x19a5f1[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x19a5f1[_0xa55c('0x2e')],_0x19a5f1[_0xa55c('0x2a')]);_0x35375e['attributes']=_['intersection'](_0x19a5f1[_0xa55c('0x2e')],qs['fields'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x35375e[_0xa55c('0x33')]=_0x35375e[_0xa55c('0x33')][_0xa55c('0x35')]?_0x35375e[_0xa55c('0x33')]:_0x19a5f1[_0xa55c('0x2e')];_0x35375e[_0xa55c('0x4e')]=qs[_0xa55c('0x4f')](_0x35c42c['query'][_0xa55c('0x4f')]);_0x35375e[_0xa55c('0x50')]=qs['filters'](_['pick'](_0x35c42c[_0xa55c('0x2a')],_0x19a5f1[_0xa55c('0x31')]));if(_0x35c42c[_0xa55c('0x2a')]['filter']){_0x35375e[_0xa55c('0x50')]=_[_0xa55c('0x43')](_0x35375e[_0xa55c('0x50')],{'$or':_[_0xa55c('0x25')](_0x35375e['attributes'],function(_0x55459c){var _0x33d58c={};_0x33d58c[_0x55459c]={'$like':'%'+_0x35c42c['query']['filter']+'%'};return _0x33d58c;})});}_0x35375e=_[_0xa55c('0x43')]({},_0x35375e,_0x35c42c[_0xa55c('0x37')]);return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})[_0xa55c('0x14')](function(_0x5184ea){if(_0x5184ea){_0xd511c0=_0x5184ea[_0xa55c('0x35')];if(!_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x35375e[_0xa55c('0x4d')]=qs['limit'](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x35375e[_0xa55c('0x10')]=qs[_0xa55c('0x10')](_0x35c42c[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x3e7cfa[_0xa55c('0x87')](_0x35375e);}})['then'](function(_0x2d5e0e){return _0x2d5e0e?{'count':_0xd511c0,'rows':_0x2d5e0e}:null;})['then'](respondWithResult(_0x3b2174,null))[_0xa55c('0x2c')](handleError(_0x3b2174,null));};exports[_0xa55c('0x88')]=function(_0x3755a7,_0x50663f){var _0x50b42f={};var _0x307b39={};var _0x1319c6;var _0x536e1d;return db['VoiceQueue'][_0xa55c('0x49')]({'where':{'id':_0x3755a7[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x50663f,null))[_0xa55c('0x14')](function(_0x568a42){if(_0x568a42){_0x1319c6=_0x568a42;_0x307b39[_0xa55c('0x2e')]=_[_0xa55c('0x2f')](db[_0xa55c('0x89')][_0xa55c('0x30')]);_0x307b39['query']=_[_0xa55c('0x2f')](_0x3755a7[_0xa55c('0x2a')]);_0x307b39[_0xa55c('0x31')]=_['intersection'](_0x307b39['model'],_0x307b39[_0xa55c('0x2a')]);_0x50b42f['attributes']=_['intersection'](_0x307b39[_0xa55c('0x2e')],qs[_0xa55c('0x34')](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x50b42f[_0xa55c('0x33')]=_0x50b42f[_0xa55c('0x33')][_0xa55c('0x35')]?_0x50b42f[_0xa55c('0x33')]:_0x307b39[_0xa55c('0x2e')];_0x50b42f[_0xa55c('0x4e')]=qs['sort'](_0x3755a7['query'][_0xa55c('0x4f')]);_0x50b42f[_0xa55c('0x50')]=qs[_0xa55c('0x31')](_[_0xa55c('0x54')](_0x3755a7['query'],_0x307b39[_0xa55c('0x31')]));if(_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]){_0x50b42f[_0xa55c('0x50')]=_['merge'](_0x50b42f[_0xa55c('0x50')],{'$or':_['map'](_0x50b42f['attributes'],function(_0x545806){var _0x4fbb59={};_0x4fbb59[_0x545806]={'$like':'%'+_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x4fbb59;})});}_0x50b42f=_['merge']({},_0x50b42f,_0x3755a7[_0xa55c('0x37')]);return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x3899bd){if(_0x3899bd){_0x536e1d=_0x3899bd[_0xa55c('0x35')];if(!_0x3755a7[_0xa55c('0x2a')]['hasOwnProperty'](_0xa55c('0x4c'))){_0x50b42f[_0xa55c('0x4d')]=qs[_0xa55c('0x4d')](_0x3755a7[_0xa55c('0x2a')]['limit']);_0x50b42f['offset']=qs['offset'](_0x3755a7[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1319c6[_0xa55c('0x88')](_0x50b42f);}})[_0xa55c('0x14')](function(_0x1205cb){if(_0x1205cb){return _0x1205cb?{'count':_0x536e1d,'rows':_0x1205cb}:null;}})[_0xa55c('0x14')](respondWithResult(_0x50663f,null))[_0xa55c('0x2c')](handleError(_0x50663f,null));};exports[_0xa55c('0x8a')]=function(_0x499008,_0x4ef239){var _0x3e3208=moment()[_0xa55c('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x1e19d6,_0x286b33;return db['VoiceQueue']['find']({'where':{'id':_0x499008[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x4ef239,null))[_0xa55c('0x14')](function(_0x236015){if(_0x236015){_0x286b33=_0x236015;return _0x236015['addLists'](_0x499008['body'][_0xa55c('0x82')],_[_0xa55c('0x44')](_0x499008[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x18e4fd){var _0x185c5b;_0x1e19d6=_0x18e4fd||[];var _0x2511fe=[];if(_0x18e4fd){for(var _0x3ba948=0x0;_0x3ba948<_0x18e4fd[_0xa55c('0x35')];_0x3ba948+=0x1){var _0x5e83e9=_0x18e4fd[_0x3ba948][_0xa55c('0x16')]({'plain':!![]});_0x286b33['dialCheckDuplicateType']=_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]?_0x499008[_0xa55c('0x3a')][_0xa55c('0x8b')]:_0x286b33[_0xa55c('0x8b')];switch(_0x286b33[_0xa55c('0x8b')]){case _0xa55c('0x8c'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('phone',_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','scheduledAt')[_0xa55c('0x94')]('id',_0xa55c('0x95'))['field'](_0x5e83e9[_0xa55c('0x96')]['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')]['toString']())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()['field'](_0xa55c('0x9c'))[_0xa55c('0x97')](_0xa55c('0x9d'))[_0xa55c('0x50')]('VoiceQueueId\x20=\x20?',_0x499008['params']['id'][_0xa55c('0x78')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xa55c('0x72')]()[_0xa55c('0x94')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008['params']['id'][_0xa55c('0x78')]())))[_0xa55c('0x78')]();break;case _0xa55c('0x9e'):_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))[_0xa55c('0x94')](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))['field']('\x27'+_0x3e3208+'\x27',_0xa55c('0x45'))['field']('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))['where'](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL')[_0xa55c('0x50')](_0xa55c('0x9b'),squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x9f'))[_0xa55c('0x97')](_0xa55c('0x8f'))[_0xa55c('0x50')](_0xa55c('0x76'),_0x499008[_0xa55c('0x2d')]['id']['toString']())))[_0xa55c('0x78')]();break;default:_0x185c5b=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0x8f'))[_0xa55c('0x90')]([_0xa55c('0x91'),_0xa55c('0x92'),_0xa55c('0x95'),_0xa55c('0x93'),'VoiceQueueId',_0xa55c('0x45'),'updatedAt'],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x92'))[_0xa55c('0x94')]('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x5e83e9['CmListId']['toString'](),_0xa55c('0x93'))['field'](_0x499008[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),_0xa55c('0x55'))[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')](_0xa55c('0x9a'),_0x5e83e9[_0xa55c('0x96')][_0xa55c('0x78')]())[_0xa55c('0x50')]('phone\x20IS\x20NOT\x20NULL'))[_0xa55c('0x78')]();}_0x2511fe[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x185c5b));}return BPromise[_0xa55c('0x7c')](_0x2511fe);}})[_0xa55c('0x14')](function(){var _0x4457e9=[];var _0x456cb9=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xa1'))[_0xa55c('0x90')]([_0xa55c('0xa2'),_0xa55c('0x91'),'OrderBy',_0xa55c('0x45'),_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0xa3'))['field']('ci.item')['field']('ci.OrderBy+1')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27','createdAt')[_0xa55c('0x94')]('\x27'+_0x3e3208+'\x27',_0xa55c('0x46'))[_0xa55c('0x97')](_0xa55c('0xa4'),'ci')[_0xa55c('0x74')](_0xa55c('0x8f'),'h',_0xa55c('0xa5'))[_0xa55c('0x50')](_0xa55c('0xa6'),_0x3e3208)[_0xa55c('0x50')](_0xa55c('0xa7'),'PHONE'))[_0xa55c('0x78')]();_0x4457e9[_0xa55c('0xa0')](db[_0xa55c('0x64')]['query'](_0x456cb9));return BPromise['all'](_0x4457e9);})['then'](function(){return _0x1e19d6;})[_0xa55c('0x14')](respondWithResult(_0x4ef239,null))[_0xa55c('0x2c')](handleError(_0x4ef239,null));};exports[_0xa55c('0xa8')]=function(_0x27cd1b,_0x3ed3a5){return db[_0xa55c('0x26')][_0xa55c('0x38')]({'where':{'id':_0x27cd1b[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x3ed3a5,null))[_0xa55c('0x14')](function(_0x3def57){if(_0x3def57){return _0x3def57[_0xa55c('0xa8')](_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x4f5f1a){if(_0x4f5f1a){return db[_0xa55c('0x4a')]['destroy']({'where':{'ListId':_0x27cd1b[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x27cd1b[_0xa55c('0x2d')]['id']}})['then'](function(){return _0x4f5f1a;});}})['then'](respondWithStatusCode(_0x3ed3a5,null))[_0xa55c('0x2c')](handleError(_0x3ed3a5,null));};exports[_0xa55c('0xa9')]=function(_0x30af02,_0x5ebd8a){var _0x2420da={};var _0x2a4b78={};var _0x1e4c2d;var _0x2bf777;return db[_0xa55c('0x26')][_0xa55c('0x49')]({'where':{'id':_0x30af02[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0x5ebd8a,null))[_0xa55c('0x14')](function(_0x266b12){if(_0x266b12){_0x1e4c2d=_0x266b12;_0x2a4b78[_0xa55c('0x2e')]=_['keys'](db[_0xa55c('0x89')]['rawAttributes']);_0x2a4b78[_0xa55c('0x2a')]=_[_0xa55c('0x2f')](_0x30af02['query']);_0x2a4b78[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x2a4b78[_0xa55c('0x2e')],_0x2a4b78['query']);_0x2420da[_0xa55c('0x33')]=_[_0xa55c('0x32')](_0x2a4b78['model'],qs['fields'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x34')]));_0x2420da[_0xa55c('0x33')]=_0x2420da[_0xa55c('0x33')][_0xa55c('0x35')]?_0x2420da['attributes']:_0x2a4b78[_0xa55c('0x2e')];_0x2420da['order']=qs['sort'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4f')]);_0x2420da['where']=qs[_0xa55c('0x31')](_['pick'](_0x30af02[_0xa55c('0x2a')],_0x2a4b78[_0xa55c('0x31')]));if(_0x30af02['query'][_0xa55c('0x1a')]){_0x2420da[_0xa55c('0x50')]=_['merge'](_0x2420da[_0xa55c('0x50')],{'$or':_['map'](_0x2420da['attributes'],function(_0x37273b){var _0x1cd529={};_0x1cd529[_0x37273b]={'$like':'%'+_0x30af02[_0xa55c('0x2a')][_0xa55c('0x1a')]+'%'};return _0x1cd529;})});}_0x2420da=_[_0xa55c('0x43')]({},_0x2420da,_0x30af02[_0xa55c('0x37')]);return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})['then'](function(_0x27e791){if(_0x27e791){_0x2bf777=_0x27e791[_0xa55c('0x35')];if(!_0x30af02['query'][_0xa55c('0x4b')](_0xa55c('0x4c'))){_0x2420da['limit']=qs[_0xa55c('0x4d')](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x4d')]);_0x2420da[_0xa55c('0x10')]=qs['offset'](_0x30af02[_0xa55c('0x2a')][_0xa55c('0x10')]);}return _0x1e4c2d[_0xa55c('0xa9')](_0x2420da);}})[_0xa55c('0x14')](function(_0x365331){if(_0x365331){return _0x365331?{'count':_0x2bf777,'rows':_0x365331}:null;}})[_0xa55c('0x14')](respondWithResult(_0x5ebd8a,null))['catch'](handleError(_0x5ebd8a,null));};exports[_0xa55c('0xaa')]=function(_0x4d7cd6,_0x1ca9bd){var _0x2bf932;return db['VoiceQueue']['find']({'where':{'id':_0x4d7cd6[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](handleEntityNotFound(_0x1ca9bd,null))[_0xa55c('0x14')](function(_0x3c9d2b){if(_0x3c9d2b){return _0x3c9d2b[_0xa55c('0xaa')](_0x4d7cd6[_0xa55c('0x3a')][_0xa55c('0x82')],_['omit'](_0x4d7cd6[_0xa55c('0x3a')],[_0xa55c('0x82'),'id'])||{});}return null;})[_0xa55c('0x83')](function(_0x158b01){var _0x19f576;_0x2bf932=_0x158b01||[];var _0x10da4b=[];if(_0x158b01){for(var _0x3320ab=0x0;_0x3320ab<_0x158b01[_0xa55c('0x35')];_0x3320ab+=0x1){var _0x298cf5=_0x158b01[_0x3320ab][_0xa55c('0x16')]({'plain':!![]});_0x19f576=squel[_0xa55c('0x8d')]()[_0xa55c('0x8e')](_0xa55c('0xab'))['fromQuery']([_0xa55c('0x91'),'ContactId',_0xa55c('0x93'),_0xa55c('0x55'),'createdAt',_0xa55c('0x46')],squel[_0xa55c('0x72')]()[_0xa55c('0x94')](_0xa55c('0x91'),_0xa55c('0x91'))['field']('id',_0xa55c('0x95'))[_0xa55c('0x94')](_0x298cf5[_0xa55c('0x96')]['toString'](),'ListId')['field'](_0x4d7cd6[_0xa55c('0x2d')]['id'][_0xa55c('0x78')](),'VoiceQueueId')[_0xa55c('0x94')](_0xa55c('0xac'),_0xa55c('0x45'))[_0xa55c('0x94')](_0xa55c('0xac'),'updatedAt')[_0xa55c('0x97')](_0xa55c('0x98'))[_0xa55c('0x50')](_0xa55c('0x99'))[_0xa55c('0x50')]('ListId\x20=\x20?',_0x298cf5['CmListId'][_0xa55c('0x78')]())[_0xa55c('0x50')](_0xa55c('0xad')))['toString']();_0x10da4b[_0xa55c('0xa0')](db[_0xa55c('0x64')][_0xa55c('0x2a')](_0x19f576));}return BPromise[_0xa55c('0x7c')](_0x10da4b);}})[_0xa55c('0x14')](function(){return _0x2bf932;})[_0xa55c('0x14')](respondWithResult(_0x1ca9bd,null))[_0xa55c('0x2c')](handleError(_0x1ca9bd,null));};exports[_0xa55c('0xae')]=function(_0x23862a,_0xb432d1){return db['VoiceQueue'][_0xa55c('0x38')]({'where':{'id':_0x23862a[_0xa55c('0x2d')]['id']}})['then'](handleEntityNotFound(_0xb432d1,null))[_0xa55c('0x14')](function(_0x5bc270){if(_0x5bc270){return _0x5bc270[_0xa55c('0xae')](_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')]);}})[_0xa55c('0x14')](function(_0x543b4a){if(_0x543b4a){return db[_0xa55c('0x59')]['destroy']({'where':{'ListId':_0x23862a[_0xa55c('0x2a')][_0xa55c('0x82')],'VoiceQueueId':_0x23862a[_0xa55c('0x2d')]['id']}})[_0xa55c('0x14')](function(){return _0x543b4a;});}})[_0xa55c('0x14')](respondWithStatusCode(_0xb432d1,null))['catch'](handleError(_0xb432d1,null));};
\ No newline at end of file