Built motion from commit (unavailable).|2.5.29
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index 4b012f5..b397792 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x1712=['bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','sendStatus','error','stack','send','index','VoiceQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','options','count','include','findAll','rows','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','getHoppers','findOne','CmHopper','order','VoiceQueueId','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','Team','teams','User','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','upsert','each','UserVoiceQueue','UserVoiceQueueRt','isNil','SIP/%s','userVoiceQueue:save','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','removeTeams','ids','isEmpty','removeAgents','emit','userVoiceQueue:remove','addAgents','format','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','NOW()','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','removeLists','getBlackLists','addBlackLists','cm_hopper_black','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x1712,0x169));var _0x2171=function(_0x65c0bb,_0x82e7b8){_0x65c0bb=_0x65c0bb-0x0;var _0x320bd5=_0x1712[_0x65c0bb];return _0x320bd5;};'use strict';var emlformat=require(_0x2171('0x0'));var rimraf=require(_0x2171('0x1'));var zipdir=require(_0x2171('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2171('0x3'));var moment=require(_0x2171('0x4'));var BPromise=require(_0x2171('0x5'));var Mustache=require(_0x2171('0x6'));var util=require(_0x2171('0x7'));var path=require(_0x2171('0x8'));var sox=require(_0x2171('0x9'));var csv=require(_0x2171('0xa'));var ejs=require(_0x2171('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2171('0xc'));var squel=require(_0x2171('0xd'));var crypto=require('crypto');var jsforce=require(_0x2171('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2171('0xa'));var querystring=require(_0x2171('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2171('0x10'));var qs=require(_0x2171('0x11'));var as=require(_0x2171('0x12'));var hardwareService=require(_0x2171('0x13'));var logger=require(_0x2171('0x14'))('api');var utils=require(_0x2171('0x15'));var config=require(_0x2171('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x2171('0x17'))['db'];config[_0x2171('0x18')]=_[_0x2171('0x19')](config[_0x2171('0x18')],{'host':_0x2171('0x1a'),'port':0x18eb});var socket=require(_0x2171('0x1b'))(new Redis(config[_0x2171('0x18')]));require(_0x2171('0x1c'))[_0x2171('0x1d')](socket);function respondWithStatusCode(_0x4f2d03,_0x424355){_0x424355=_0x424355||0xcc;return function(_0x50f8ab){if(_0x50f8ab){return _0x4f2d03['sendStatus'](_0x424355);}return _0x4f2d03[_0x2171('0x1e')](_0x424355)[_0x2171('0x1f')]();};}function respondWithResult(_0x1825a4,_0x1c738c){_0x1c738c=_0x1c738c||0xc8;return function(_0x321d63){if(_0x321d63){return _0x1825a4[_0x2171('0x1e')](_0x1c738c)[_0x2171('0x20')](_0x321d63);}};}function respondWithFilteredResult(_0x48bb7c,_0x801029){return function(_0x5446fc){if(_0x5446fc){var _0x322e33=_0x5446fc['count'],_0x4ae8ea=_0x801029['offset'],_0x35e7e6=_0x801029[_0x2171('0x21')]+_0x801029[_0x2171('0x22')],_0x4bb48c;if(_0x35e7e6>=_0x322e33){_0x35e7e6=_0x322e33;_0x4bb48c=0xc8;}else{_0x4bb48c=0xce;}_0x48bb7c[_0x2171('0x1e')](_0x4bb48c);return _0x48bb7c[_0x2171('0x23')](_0x2171('0x24'),_0x4ae8ea+'-'+_0x35e7e6+'/'+_0x322e33)['json'](_0x5446fc);}return null;};}function patchUpdates(_0x790248){return function(_0x5de81b){try{jsonpatch[_0x2171('0x25')](_0x5de81b,_0x790248,!![]);}catch(_0x147809){return BPromise[_0x2171('0x26')](_0x147809);}return _0x5de81b[_0x2171('0x27')]();};}function saveUpdates(_0x9beb04,_0x44aa6a){return function(_0x306c7f){if(_0x306c7f){return _0x306c7f[_0x2171('0x28')](_0x9beb04)[_0x2171('0x29')](function(_0x92c260){return _0x92c260;});}return null;};}function removeEntity(_0x1b525c,_0x14cd31){return function(_0x3c02d5){if(_0x3c02d5){return _0x3c02d5[_0x2171('0x2a')]()['then'](function(){var _0x54aa42=_0x3c02d5[_0x2171('0x2b')]({'plain':!![]});var _0x40b12c=[{'name':_0x2171('0x2c'),'value':_0x2171('0x2d'),'ignore':![]},{'name':'QueueCampaigns','value':_0x2171('0x2e'),'ignore':![]}];var _0x5076bc=_(_0x40b12c)[_0x2171('0x2f')](_0x2171('0x30'))[_0x2171('0x31')](_0x2171('0x32'))[_0x2171('0x32')]();if(_[_0x2171('0x33')](_0x5076bc,_0x54aa42[_0x2171('0x34')])){return;}var _0x161834=_[_0x2171('0x35')](_0x40b12c,['value',_0x54aa42[_0x2171('0x34')]])[_0x2171('0x36')];return db[_0x2171('0x37')]['destroy']({'where':{'type':_0x161834,'resourceId':_0x54aa42['id']}})[_0x2171('0x29')](function(){return _0x3c02d5;});})['then'](function(){_0x1b525c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xe19776,_0x493390){return function(_0x454ced){if(!_0x454ced){_0xe19776[_0x2171('0x38')](0x194);}return _0x454ced;};}function handleError(_0x370493,_0x26da2c){_0x26da2c=_0x26da2c||0x1f4;return function(_0x4ddf69){logger[_0x2171('0x39')](_0x4ddf69[_0x2171('0x3a')]);if(_0x4ddf69[_0x2171('0x36')]){delete _0x4ddf69['name'];}_0x370493[_0x2171('0x1e')](_0x26da2c)[_0x2171('0x3b')](_0x4ddf69);};}exports[_0x2171('0x3c')]=function(_0x29f540,_0x22ae38){var _0x5097f9={},_0x4998e5={},_0x4a0608={'count':0x0,'rows':[]};var _0x312163=_[_0x2171('0x31')](db[_0x2171('0x3d')][_0x2171('0x3e')],function(_0x26c736){return{'name':_0x26c736['fieldName'],'type':_0x26c736[_0x2171('0x34')][_0x2171('0x3f')]};});_0x4998e5[_0x2171('0x40')]=_[_0x2171('0x31')](_0x312163,'name');_0x4998e5[_0x2171('0x41')]=_[_0x2171('0x42')](_0x29f540['query']);_0x4998e5[_0x2171('0x43')]=_[_0x2171('0x44')](_0x4998e5[_0x2171('0x40')],_0x4998e5[_0x2171('0x41')]);_0x5097f9[_0x2171('0x45')]=_[_0x2171('0x44')](_0x4998e5[_0x2171('0x40')],qs['fields'](_0x29f540[_0x2171('0x41')][_0x2171('0x46')]));_0x5097f9['attributes']=_0x5097f9[_0x2171('0x45')][_0x2171('0x47')]?_0x5097f9['attributes']:_0x4998e5[_0x2171('0x40')];if(!_0x29f540[_0x2171('0x41')][_0x2171('0x48')](_0x2171('0x49'))){_0x5097f9[_0x2171('0x22')]=qs['limit'](_0x29f540['query'][_0x2171('0x22')]);_0x5097f9['offset']=qs['offset'](_0x29f540['query'][_0x2171('0x21')]);}_0x5097f9['order']=qs[_0x2171('0x4a')](_0x29f540['query']['sort']);_0x5097f9['where']=qs[_0x2171('0x43')](_[_0x2171('0x4b')](_0x29f540[_0x2171('0x41')],_0x4998e5[_0x2171('0x43')]),_0x312163);if(_0x29f540[_0x2171('0x41')][_0x2171('0x2f')]){_0x5097f9[_0x2171('0x4c')]=_[_0x2171('0x4d')](_0x5097f9[_0x2171('0x4c')],{'$or':_[_0x2171('0x31')](_0x312163,function(_0x5ad886){if(_0x5ad886['type']!==_0x2171('0x4e')){var _0x16ad43={};_0x16ad43[_0x5ad886['name']]={'$like':'%'+_0x29f540[_0x2171('0x41')][_0x2171('0x2f')]+'%'};return _0x16ad43;}})});}_0x5097f9=_['merge']({},_0x5097f9,_0x29f540[_0x2171('0x4f')]);var _0x136865={'where':_0x5097f9[_0x2171('0x4c')]};return db[_0x2171('0x3d')][_0x2171('0x50')](_0x136865)[_0x2171('0x29')](function(_0x3cbe41){_0x4a0608[_0x2171('0x50')]=_0x3cbe41;if(_0x29f540[_0x2171('0x41')]['includeAll']){_0x5097f9[_0x2171('0x51')]=[{'all':!![]}];}return db[_0x2171('0x3d')][_0x2171('0x52')](_0x5097f9);})[_0x2171('0x29')](function(_0x54667c){_0x4a0608[_0x2171('0x53')]=_0x54667c;return _0x4a0608;})[_0x2171('0x29')](respondWithFilteredResult(_0x22ae38,_0x5097f9))[_0x2171('0x54')](handleError(_0x22ae38,null));};exports['show']=function(_0x109891,_0x4082da){var _0x3355d0={'raw':![],'where':{'id':_0x109891[_0x2171('0x55')]['id']}},_0x2d65cc={};_0x2d65cc[_0x2171('0x40')]=_[_0x2171('0x42')](db[_0x2171('0x3d')][_0x2171('0x3e')]);_0x2d65cc[_0x2171('0x41')]=_[_0x2171('0x42')](_0x109891['query']);_0x2d65cc[_0x2171('0x43')]=_['intersection'](_0x2d65cc[_0x2171('0x40')],_0x2d65cc[_0x2171('0x41')]);_0x3355d0[_0x2171('0x45')]=_['intersection'](_0x2d65cc['model'],qs[_0x2171('0x46')](_0x109891[_0x2171('0x41')][_0x2171('0x46')]));_0x3355d0[_0x2171('0x45')]=_0x3355d0[_0x2171('0x45')]['length']?_0x3355d0[_0x2171('0x45')]:_0x2d65cc['model'];if(_0x109891[_0x2171('0x41')][_0x2171('0x56')]){_0x3355d0[_0x2171('0x51')]=[{'all':!![]}];}_0x3355d0=_[_0x2171('0x4d')]({},_0x3355d0,_0x109891[_0x2171('0x4f')]);return db[_0x2171('0x3d')]['find'](_0x3355d0)['then'](handleEntityNotFound(_0x4082da,null))[_0x2171('0x29')](respondWithResult(_0x4082da,null))[_0x2171('0x54')](handleError(_0x4082da,null));};exports[_0x2171('0x57')]=function(_0x547aaa,_0x194bd8){return db['VoiceQueue'][_0x2171('0x57')](_0x547aaa[_0x2171('0x58')],{})[_0x2171('0x29')](function(_0x454cc0){var _0xb3c277=_0x547aaa[_0x2171('0x59')]['get']({'plain':!![]});if(!_0xb3c277)throw new Error(_0x2171('0x5a'));if(_0xb3c277[_0x2171('0x5b')]===_0x2171('0x59')){var _0x4611cf=_0x454cc0['get']({'plain':!![]});var _0x4282b8=[{'name':_0x2171('0x2c'),'value':_0x2171('0x2d')},{'name':_0x2171('0x5c'),'value':_0x2171('0x2e')}];var _0x133a1a=_[_0x2171('0x35')](_0x4282b8,['value',_0x4611cf[_0x2171('0x34')]])[_0x2171('0x36')];return db[_0x2171('0x5d')][_0x2171('0x35')]({'where':{'name':_0x133a1a,'userProfileId':_0xb3c277['userProfileId']},'raw':!![]})['then'](function(_0x32008c){if(_0x32008c&&_0x32008c[_0x2171('0x5e')]===0x0){return db['UserProfileResource'][_0x2171('0x57')]({'name':_0x4611cf[_0x2171('0x36')],'resourceId':_0x4611cf['id'],'type':_0x32008c['name'],'sectionId':_0x32008c['id']},{})[_0x2171('0x29')](function(){return _0x454cc0;});}else{return _0x454cc0;}})[_0x2171('0x54')](function(_0x1848b6){logger[_0x2171('0x39')](_0x2171('0x5f'),_0x1848b6);throw _0x1848b6;});}return _0x454cc0;})['then'](respondWithResult(_0x194bd8,0xc9))['catch'](handleError(_0x194bd8,null));};exports[_0x2171('0x60')]=function(_0x5abf4d,_0x4ac3a9){var _0x13b428={'where':{'id':_0x5abf4d[_0x2171('0x55')]['id']}},_0x3f4bd1={};_0x3f4bd1[_0x2171('0x40')]=_['keys'](db[_0x2171('0x3d')][_0x2171('0x3e')]);_0x13b428[_0x2171('0x45')]=_['intersection'](_0x3f4bd1['model'],qs[_0x2171('0x46')](_0x5abf4d[_0x2171('0x41')][_0x2171('0x46')]));_0x13b428['attributes']=_0x13b428['attributes'][_0x2171('0x47')]?_0x13b428[_0x2171('0x45')]:_0x3f4bd1['model'];if(_0x5abf4d[_0x2171('0x41')][_0x2171('0x56')]){_0x13b428[_0x2171('0x51')]=[{'all':!![]}];}_0x13b428=_[_0x2171('0x4d')]({},_0x13b428,_0x5abf4d[_0x2171('0x4f')]);return db['VoiceQueue'][_0x2171('0x35')](_0x13b428)[_0x2171('0x29')](handleEntityNotFound(_0x4ac3a9,null))[_0x2171('0x29')](function(_0x2e1f33){if(_0x2e1f33){var _0x31e183=_0x2e1f33['get']({'plain':!![]});_0x31e183=qs[_0x2171('0x61')](_0x31e183,['id',_0x2171('0x62'),_0x2171('0x63')]);_0x5abf4d['body']=_[_0x2171('0x61')](_0x5abf4d[_0x2171('0x58')],['id',_0x2171('0x62'),_0x2171('0x63')]);return db[_0x2171('0x3d')]['create'](_[_0x2171('0x4d')](_0x31e183,_0x5abf4d['body']),{'include':_0x5abf4d['query']['includeAll']?[{'all':!![]}]:undefined})[_0x2171('0x29')](function(_0x5a6624){var _0x35b41e=_0x5abf4d['user'][_0x2171('0x2b')]({'plain':!![]});if(!_0x35b41e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35b41e['role']===_0x2171('0x59')){var _0x3d5bb7=_0x5a6624[_0x2171('0x2b')]({'plain':!![]});var _0x1a01c4=[{'name':_0x2171('0x2c'),'value':_0x2171('0x2d')},{'name':'QueueCampaigns','value':'outbound'}];var _0xfc62f7=_[_0x2171('0x35')](_0x1a01c4,[_0x2171('0x32'),_0x3d5bb7[_0x2171('0x34')]])[_0x2171('0x36')];return db[_0x2171('0x5d')][_0x2171('0x35')]({'where':{'name':_0xfc62f7,'userProfileId':_0x35b41e[_0x2171('0x64')]},'raw':!![]})[_0x2171('0x29')](function(_0x140799){if(_0x140799&&_0x140799[_0x2171('0x5e')]===0x0){return db['UserProfileResource'][_0x2171('0x57')]({'name':_0x3d5bb7[_0x2171('0x36')],'resourceId':_0x3d5bb7['id'],'type':_0x140799[_0x2171('0x36')],'sectionId':_0x140799['id']},{})[_0x2171('0x29')](function(){return _0x5a6624;});}else{return _0x5a6624;}})[_0x2171('0x54')](function(_0x213c04){logger[_0x2171('0x39')](_0x2171('0x5f'),_0x213c04);throw _0x213c04;});}return _0x5a6624;});}})['then'](respondWithResult(_0x4ac3a9,0xc9))[_0x2171('0x54')](handleError(_0x4ac3a9,null));};exports[_0x2171('0x28')]=function(_0x5a28b6,_0x4ff9ff){if(_0x5a28b6[_0x2171('0x58')]['id']){delete _0x5a28b6[_0x2171('0x58')]['id'];}return db[_0x2171('0x3d')][_0x2171('0x35')]({'where':{'id':_0x5a28b6['params']['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x4ff9ff,null))[_0x2171('0x29')](saveUpdates(_0x5a28b6[_0x2171('0x58')],null))[_0x2171('0x29')](respondWithResult(_0x4ff9ff,null))[_0x2171('0x54')](handleError(_0x4ff9ff,null));};exports[_0x2171('0x2a')]=function(_0x569c82,_0x2b131){return db['VoiceQueue']['find']({'where':{'id':_0x569c82[_0x2171('0x55')]['id']}})['then'](handleEntityNotFound(_0x2b131,null))['then'](removeEntity(_0x2b131,null))[_0x2171('0x54')](handleError(_0x2b131,null));};exports[_0x2171('0x65')]=function(_0xabcb6f,_0x55320b,_0x659a26){var _0x4df87f={'raw':![],'where':{}};var _0x64c0fa={};var _0x4d949f={'count':0x0,'rows':[]};return db[_0x2171('0x3d')][_0x2171('0x66')]({'where':{'id':_0xabcb6f[_0x2171('0x55')]['id']}})['then'](handleEntityNotFound(_0x55320b,null))[_0x2171('0x29')](function(_0x345368){if(_0x345368){_0x64c0fa[_0x2171('0x40')]=_[_0x2171('0x42')](db[_0x2171('0x67')][_0x2171('0x3e')]);_0x64c0fa[_0x2171('0x41')]=_[_0x2171('0x42')](_0xabcb6f[_0x2171('0x41')]);_0x64c0fa[_0x2171('0x43')]=_['intersection'](_0x64c0fa['model'],_0x64c0fa[_0x2171('0x41')]);_0x4df87f[_0x2171('0x45')]=_[_0x2171('0x44')](_0x64c0fa[_0x2171('0x40')],qs[_0x2171('0x46')](_0xabcb6f['query']['fields']));_0x4df87f[_0x2171('0x45')]=_0x4df87f[_0x2171('0x45')][_0x2171('0x47')]?_0x4df87f[_0x2171('0x45')]:_0x64c0fa[_0x2171('0x40')];if(!_0xabcb6f[_0x2171('0x41')][_0x2171('0x48')](_0x2171('0x49'))){_0x4df87f['limit']=qs[_0x2171('0x22')](_0xabcb6f[_0x2171('0x41')][_0x2171('0x22')]);_0x4df87f['offset']=qs[_0x2171('0x21')](_0xabcb6f[_0x2171('0x41')]['offset']);}_0x4df87f[_0x2171('0x68')]=qs[_0x2171('0x4a')](_0xabcb6f['query'][_0x2171('0x4a')]);_0x4df87f[_0x2171('0x4c')]=qs[_0x2171('0x43')](_['pick'](_0xabcb6f[_0x2171('0x41')],_0x64c0fa[_0x2171('0x43')]));_0x4df87f[_0x2171('0x4c')][_0x2171('0x69')]=_0x345368['id'];if(_0xabcb6f[_0x2171('0x41')][_0x2171('0x2f')]){_0x4df87f[_0x2171('0x4c')]=_[_0x2171('0x4d')](_0x4df87f[_0x2171('0x4c')],{'$or':_[_0x2171('0x31')](_0x4df87f[_0x2171('0x45')],function(_0x14ecb8){var _0x5abbed={};_0x5abbed[_0x14ecb8]={'$like':'%'+_0xabcb6f[_0x2171('0x41')]['filter']+'%'};return _0x5abbed;})});}_0x4df87f=_['merge']({},_0x4df87f,_0xabcb6f[_0x2171('0x4f')]);return db['CmHopper']['count']({'where':_0x4df87f[_0x2171('0x4c')]})[_0x2171('0x29')](function(_0x33a358){_0x4d949f[_0x2171('0x50')]=_0x33a358;if(_0xabcb6f[_0x2171('0x41')][_0x2171('0x56')]){_0x4df87f[_0x2171('0x51')]=[{'all':!![]}];}return db[_0x2171('0x67')]['findAll'](_0x4df87f);})[_0x2171('0x29')](function(_0x2b057d){_0x4d949f[_0x2171('0x53')]=_0x2b057d;return _0x4d949f;});}})[_0x2171('0x29')](respondWithFilteredResult(_0x55320b,_0x4df87f))[_0x2171('0x54')](handleError(_0x55320b,null));};exports['getHopperHistories']=function(_0x55dbb9,_0x4ffb17,_0xed225a){var _0x3bdcf3={'raw':!![],'where':{}};var _0x5931e0={};var _0x1ad796={'count':0x0,'rows':[]};return db[_0x2171('0x3d')]['findOne']({'where':{'id':_0x55dbb9[_0x2171('0x55')]['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x4ffb17,null))[_0x2171('0x29')](function(_0x36e787){if(_0x36e787){_0x5931e0[_0x2171('0x40')]=_[_0x2171('0x42')](db[_0x2171('0x6a')][_0x2171('0x3e')]);_0x5931e0[_0x2171('0x41')]=_[_0x2171('0x42')](_0x55dbb9['query']);_0x5931e0[_0x2171('0x43')]=_[_0x2171('0x44')](_0x5931e0[_0x2171('0x40')],_0x5931e0[_0x2171('0x41')]);_0x3bdcf3[_0x2171('0x45')]=_[_0x2171('0x44')](_0x5931e0[_0x2171('0x40')],qs[_0x2171('0x46')](_0x55dbb9[_0x2171('0x41')]['fields']));_0x3bdcf3[_0x2171('0x45')]=_0x3bdcf3[_0x2171('0x45')][_0x2171('0x47')]?_0x3bdcf3[_0x2171('0x45')]:_0x5931e0[_0x2171('0x40')];if(!_0x55dbb9[_0x2171('0x41')][_0x2171('0x48')](_0x2171('0x49'))){_0x3bdcf3[_0x2171('0x22')]=qs[_0x2171('0x22')](_0x55dbb9[_0x2171('0x41')]['limit']);_0x3bdcf3[_0x2171('0x21')]=qs[_0x2171('0x21')](_0x55dbb9[_0x2171('0x41')][_0x2171('0x21')]);}_0x3bdcf3[_0x2171('0x68')]=qs['sort'](_0x55dbb9[_0x2171('0x41')][_0x2171('0x4a')]);_0x3bdcf3[_0x2171('0x4c')]=qs[_0x2171('0x43')](_[_0x2171('0x4b')](_0x55dbb9['query'],_0x5931e0['filters']));_0x3bdcf3['where']['VoiceQueueId']=_0x36e787['id'];if(_0x55dbb9['query'][_0x2171('0x2f')]){_0x3bdcf3[_0x2171('0x4c')]=_[_0x2171('0x4d')](_0x3bdcf3['where'],{'$or':_['map'](_0x3bdcf3[_0x2171('0x45')],function(_0x28eb83){var _0x385b22={};_0x385b22[_0x28eb83]={'$like':'%'+_0x55dbb9[_0x2171('0x41')][_0x2171('0x2f')]+'%'};return _0x385b22;})});}_0x3bdcf3=_[_0x2171('0x4d')]({},_0x3bdcf3,_0x55dbb9[_0x2171('0x4f')]);return db[_0x2171('0x6a')]['count']({'where':_0x3bdcf3[_0x2171('0x4c')]})[_0x2171('0x29')](function(_0x5a5564){_0x1ad796[_0x2171('0x50')]=_0x5a5564;if(_0x55dbb9[_0x2171('0x41')][_0x2171('0x56')]){_0x3bdcf3[_0x2171('0x51')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x2171('0x52')](_0x3bdcf3);})[_0x2171('0x29')](function(_0x3f1fd3){_0x1ad796['rows']=_0x3f1fd3;return _0x1ad796;});}})['then'](respondWithFilteredResult(_0x4ffb17,_0x3bdcf3))[_0x2171('0x54')](handleError(_0x4ffb17,null));};exports[_0x2171('0x6b')]=function(_0x2c6cb2,_0x55ee0e,_0x36a252){var _0x34f784={'raw':!![],'where':{}};var _0x12ffe5={};var _0x54b587={'count':0x0,'rows':[]};return db[_0x2171('0x3d')]['findOne']({'where':{'id':_0x2c6cb2[_0x2171('0x55')]['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x55ee0e,null))['then'](function(_0x2ed589){if(_0x2ed589){_0x12ffe5[_0x2171('0x40')]=_['keys'](db[_0x2171('0x6c')][_0x2171('0x3e')]);_0x12ffe5[_0x2171('0x41')]=_['keys'](_0x2c6cb2['query']);_0x12ffe5[_0x2171('0x43')]=_[_0x2171('0x44')](_0x12ffe5[_0x2171('0x40')],_0x12ffe5[_0x2171('0x41')]);_0x34f784['attributes']=_[_0x2171('0x44')](_0x12ffe5[_0x2171('0x40')],qs[_0x2171('0x46')](_0x2c6cb2[_0x2171('0x41')]['fields']));_0x34f784['attributes']=_0x34f784[_0x2171('0x45')][_0x2171('0x47')]?_0x34f784['attributes']:_0x12ffe5[_0x2171('0x40')];if(!_0x2c6cb2[_0x2171('0x41')]['hasOwnProperty'](_0x2171('0x49'))){_0x34f784['limit']=qs[_0x2171('0x22')](_0x2c6cb2['query']['limit']);_0x34f784[_0x2171('0x21')]=qs[_0x2171('0x21')](_0x2c6cb2['query'][_0x2171('0x21')]);}_0x34f784[_0x2171('0x68')]=qs[_0x2171('0x4a')](_0x2c6cb2[_0x2171('0x41')]['sort']);_0x34f784[_0x2171('0x4c')]=qs[_0x2171('0x43')](_[_0x2171('0x4b')](_0x2c6cb2['query'],_0x12ffe5[_0x2171('0x43')]));_0x34f784[_0x2171('0x4c')][_0x2171('0x69')]=_0x2ed589['id'];if(_0x2c6cb2[_0x2171('0x41')][_0x2171('0x2f')]){_0x34f784[_0x2171('0x4c')]=_['merge'](_0x34f784[_0x2171('0x4c')],{'$or':_['map'](_0x34f784[_0x2171('0x45')],function(_0x2bb893){var _0x2b23a8={};_0x2b23a8[_0x2bb893]={'$like':'%'+_0x2c6cb2['query'][_0x2171('0x2f')]+'%'};return _0x2b23a8;})});}_0x34f784=_[_0x2171('0x4d')]({},_0x34f784,_0x2c6cb2['options']);return db[_0x2171('0x6c')]['count']({'where':_0x34f784[_0x2171('0x4c')]})['then'](function(_0x59d1cc){_0x54b587['count']=_0x59d1cc;if(_0x2c6cb2[_0x2171('0x41')][_0x2171('0x56')]){_0x34f784[_0x2171('0x51')]=[{'all':!![]}];}return db[_0x2171('0x6c')][_0x2171('0x52')](_0x34f784);})[_0x2171('0x29')](function(_0x27772d){_0x54b587[_0x2171('0x53')]=_0x27772d;return _0x54b587;});}})[_0x2171('0x29')](respondWithFilteredResult(_0x55ee0e,_0x34f784))[_0x2171('0x54')](handleError(_0x55ee0e,null));};exports['getHopperBlacks']=function(_0x1dcce8,_0x574f64,_0x4647b0){var _0x53ea1f={'raw':!![],'where':{}};var _0x2f9f32={};var _0x12edde={'count':0x0,'rows':[]};return db[_0x2171('0x3d')][_0x2171('0x66')]({'where':{'id':_0x1dcce8[_0x2171('0x55')]['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x574f64,null))['then'](function(_0x918684){if(_0x918684){_0x2f9f32[_0x2171('0x40')]=_[_0x2171('0x42')](db[_0x2171('0x6d')][_0x2171('0x3e')]);_0x2f9f32['query']=_[_0x2171('0x42')](_0x1dcce8['query']);_0x2f9f32['filters']=_['intersection'](_0x2f9f32['model'],_0x2f9f32['query']);_0x53ea1f[_0x2171('0x45')]=_[_0x2171('0x44')](_0x2f9f32[_0x2171('0x40')],qs[_0x2171('0x46')](_0x1dcce8[_0x2171('0x41')][_0x2171('0x46')]));_0x53ea1f['attributes']=_0x53ea1f[_0x2171('0x45')][_0x2171('0x47')]?_0x53ea1f[_0x2171('0x45')]:_0x2f9f32[_0x2171('0x40')];if(!_0x1dcce8[_0x2171('0x41')][_0x2171('0x48')](_0x2171('0x49'))){_0x53ea1f[_0x2171('0x22')]=qs[_0x2171('0x22')](_0x1dcce8[_0x2171('0x41')]['limit']);_0x53ea1f[_0x2171('0x21')]=qs[_0x2171('0x21')](_0x1dcce8[_0x2171('0x41')]['offset']);}_0x53ea1f[_0x2171('0x68')]=qs[_0x2171('0x4a')](_0x1dcce8['query'][_0x2171('0x4a')]);_0x53ea1f[_0x2171('0x4c')]=qs[_0x2171('0x43')](_[_0x2171('0x4b')](_0x1dcce8[_0x2171('0x41')],_0x2f9f32['filters']));_0x53ea1f['where'][_0x2171('0x69')]=_0x918684['id'];if(_0x1dcce8['query']['filter']){_0x53ea1f[_0x2171('0x4c')]=_[_0x2171('0x4d')](_0x53ea1f[_0x2171('0x4c')],{'$or':_[_0x2171('0x31')](_0x53ea1f[_0x2171('0x45')],function(_0x1415ea){var _0x38e8b1={};_0x38e8b1[_0x1415ea]={'$like':'%'+_0x1dcce8[_0x2171('0x41')]['filter']+'%'};return _0x38e8b1;})});}_0x53ea1f=_[_0x2171('0x4d')]({},_0x53ea1f,_0x1dcce8[_0x2171('0x4f')]);return db['CmHopperBlack']['count']({'where':_0x53ea1f[_0x2171('0x4c')]})['then'](function(_0x45c3ec){_0x12edde[_0x2171('0x50')]=_0x45c3ec;if(_0x1dcce8[_0x2171('0x41')]['includeAll']){_0x53ea1f['include']=[{'all':!![]}];}return db[_0x2171('0x6d')][_0x2171('0x52')](_0x53ea1f);})[_0x2171('0x29')](function(_0x17260f){_0x12edde[_0x2171('0x53')]=_0x17260f;return _0x12edde;});}})[_0x2171('0x29')](respondWithFilteredResult(_0x574f64,_0x53ea1f))[_0x2171('0x54')](handleError(_0x574f64,null));};exports[_0x2171('0x6e')]=function(_0x1f76b2,_0x3f9756,_0x3aa3ef){var _0x4fab8c={};var _0x46be2c={};var _0x3f6958;var _0xf99102;return db[_0x2171('0x3d')][_0x2171('0x66')]({'where':{'id':_0x1f76b2['params']['id']}})['then'](handleEntityNotFound(_0x3f9756,null))[_0x2171('0x29')](function(_0x53d26a){if(_0x53d26a){_0x3f6958=_0x53d26a;_0x46be2c['model']=_[_0x2171('0x42')](db[_0x2171('0x6f')][_0x2171('0x3e')]);_0x46be2c[_0x2171('0x41')]=_['keys'](_0x1f76b2['query']);_0x46be2c['filters']=_[_0x2171('0x44')](_0x46be2c[_0x2171('0x40')],_0x46be2c['query']);_0x4fab8c[_0x2171('0x45')]=_[_0x2171('0x44')](_0x46be2c[_0x2171('0x40')],qs[_0x2171('0x46')](_0x1f76b2[_0x2171('0x41')][_0x2171('0x46')]));_0x4fab8c[_0x2171('0x45')]=_0x4fab8c['attributes'][_0x2171('0x47')]?_0x4fab8c['attributes']:_0x46be2c[_0x2171('0x40')];_0x4fab8c[_0x2171('0x68')]=qs[_0x2171('0x4a')](_0x1f76b2['query'][_0x2171('0x4a')]);_0x4fab8c['where']=qs[_0x2171('0x43')](_[_0x2171('0x4b')](_0x1f76b2[_0x2171('0x41')],_0x46be2c[_0x2171('0x43')]));if(_0x1f76b2[_0x2171('0x41')][_0x2171('0x2f')]){_0x4fab8c[_0x2171('0x4c')]=_[_0x2171('0x4d')](_0x4fab8c[_0x2171('0x4c')],{'$or':_['map'](_0x4fab8c[_0x2171('0x45')],function(_0x123319){var _0x33ad66={};_0x33ad66[_0x123319]={'$like':'%'+_0x1f76b2[_0x2171('0x41')][_0x2171('0x2f')]+'%'};return _0x33ad66;})});}_0x4fab8c=_[_0x2171('0x4d')]({},_0x4fab8c,_0x1f76b2[_0x2171('0x4f')]);return _0x3f6958[_0x2171('0x6e')](_0x4fab8c);}})['then'](function(_0x5545da){if(_0x5545da){_0xf99102=_0x5545da[_0x2171('0x47')];if(!_0x1f76b2['query'][_0x2171('0x48')](_0x2171('0x49'))){_0x4fab8c['limit']=qs[_0x2171('0x22')](_0x1f76b2[_0x2171('0x41')][_0x2171('0x22')]);_0x4fab8c['offset']=qs[_0x2171('0x21')](_0x1f76b2[_0x2171('0x41')]['offset']);}return _0x3f6958[_0x2171('0x6e')](_0x4fab8c);}})[_0x2171('0x29')](function(_0x364d11){if(_0x364d11){return _0x364d11?{'count':_0xf99102,'rows':_0x364d11}:null;}})[_0x2171('0x29')](respondWithResult(_0x3f9756,null))['catch'](handleError(_0x3f9756,null));};exports['addTeams']=function(_0xacb449,_0x581c62,_0x18e61c){var _0x58f41b=_0xacb449['body'][_0x2171('0x70')];var _0x10f2a1=_[_0x2171('0x31')](_0x58f41b,'id');return db[_0x2171('0x6f')][_0x2171('0x52')]({'where':{'id':_0x10f2a1},'attributes':['id'],'include':[{'model':db[_0x2171('0x71')],'as':'Agents','attributes':['id','name',_0x2171('0x72'),_0x2171('0x73'),_0x2171('0x74')],'raw':!![]}]})[_0x2171('0x29')](function(_0x3435a6){if(_0x3435a6){var _0x2ab428=_['flatMap'](_0x3435a6,function(_0x181b8d){var _0x26248b=_0x181b8d[_0x2171('0x2b')]({'plain':!![]});_0x26248b[_0x2171('0x75')][_0x2171('0x76')](function(_0x5c84a0){_0x5c84a0[_0x2171('0x77')]=_[_0x2171('0x35')](_0x58f41b,{'id':_0x26248b['id']})[_0x2171('0x77')];});return _0x26248b[_0x2171('0x75')];});return db['VoiceQueue'][_0x2171('0x35')]({'where':{'id':_0xacb449[_0x2171('0x55')]['id']}})[_0x2171('0x29')](function(_0x15daf0){return db[_0x2171('0x78')][_0x2171('0x79')](function(_0x4ddd48){return _0x15daf0['addTeams'](_0x10f2a1,{'transaction':_0x4ddd48})['then'](function(){return BPromise['each'](_0x58f41b,function(_0x4afbaf){return db['TeamVoiceQueue'][_0x2171('0x7a')]({'TeamId':_0x4afbaf['id'],'VoiceQueueId':_0xacb449['params']['id'],'penalty':_0x4afbaf[_0x2171('0x77')]},{'transaction':_0x4ddd48});});})[_0x2171('0x29')](function(){return BPromise[_0x2171('0x7b')](_0x2ab428,function(_0x5e6c81){return db[_0x2171('0x7c')]['findOrCreate']({'where':{'UserId':_0x5e6c81['id'],'VoiceQueueId':_0xacb449['params']['id']},'defaults':{'penalty':_0x5e6c81[_0x2171('0x77')]},'transaction':_0x4ddd48});});})[_0x2171('0x29')](function(){return BPromise[_0x2171('0x7b')](_[_0x2171('0x2f')](_0x2ab428,{'online':!![]}),function(_0x281be5){return db[_0x2171('0x7d')]['upsert']({'membername':_0x281be5['name'],'UserId':_0x281be5['id'],'queue_name':_0x15daf0[_0x2171('0x36')],'VoiceQueueId':_0x15daf0['id'],'interface':_[_0x2171('0x7e')](_0x281be5[_0x2171('0x74')])?util['format'](_0x2171('0x7f'),_0x281be5[_0x2171('0x36')]):_0x281be5[_0x2171('0x74')],'paused':_0x281be5['voicePause']||![],'penalty':_0x281be5['penalty']},{'transaction':_0x4ddd48});});})['then'](function(){_0x2ab428[_0x2171('0x76')](function(_0x5e2481){socket['emit'](_0x2171('0x80'),{'UserId':_0x5e2481['id'],'VoiceQueueId':_0x15daf0['id']});});});});});}})[_0x2171('0x29')](respondWithStatusCode(_0x581c62,null))[_0x2171('0x54')](handleError(_0x581c62,null));};exports['removeTeams']=function(_0x55ca90,_0x529d46,_0xeb9676){return db['Team'][_0x2171('0x52')]({'where':{'id':_0x55ca90['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2171('0x71')],'as':_0x2171('0x75'),'attributes':['id'],'raw':!![]}]})[_0x2171('0x29')](handleEntityNotFound(_0x529d46,null))[_0x2171('0x29')](function(_0x4da6e4){var _0xfbac09=_[_0x2171('0x31')](_0x4da6e4,'id');var _0x2cf00f=[];var _0x3334fc=[];var _0x3a5a43=squel['select']();_0x3a5a43[_0x2171('0x81')](_0x2171('0x82'))[_0x2171('0x83')](_0x2171('0x84'),'tq')[_0x2171('0x85')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2171('0x86'),_0x55ca90['params']['id']);for(var _0x460cbe=0x0;_0x460cbe<_0x4da6e4[_0x2171('0x47')];_0x460cbe+=0x1){let _0x61785e=_0x4da6e4[_0x460cbe];for(var _0x257372=0x0;_0x257372<_0x61785e[_0x2171('0x75')][_0x2171('0x47')];_0x257372+=0x1){let _0x9bffe9=_0x61785e[_0x2171('0x75')][_0x257372];var _0x523efd=_0x3a5a43[_0x2171('0x60')]();_0x523efd[_0x2171('0x4c')]('ut.UserId\x20=\x20?',_0x9bffe9['id']);_0x3334fc[_0x2171('0x87')](db['sequelize'][_0x2171('0x41')](_0x523efd[_0x2171('0x88')](),{'type':db[_0x2171('0x78')][_0x2171('0x89')][_0x2171('0x8a')]})['then'](function(_0x2b5c8c){if(_0x2b5c8c[_0x2171('0x47')]===0x1){return _0x9bffe9['id'];}else{var _0xd6b88c=_[_0x2171('0x8b')](_[_0x2171('0x31')](_0x2b5c8c,_0x2171('0x8c')),function(_0x9a6292){return _[_0x2171('0x33')](_0xfbac09,_0x9a6292);});if(_0xd6b88c){return _0x9bffe9['id'];}}}));}}return BPromise[_0x2171('0x8d')](_0x3334fc)[_0x2171('0x29')](function(_0x501a75){_0x2cf00f=_(_0x2cf00f)[_0x2171('0x8e')](_0x501a75)[_0x2171('0x8f')]()[_0x2171('0x32')]();return db[_0x2171('0x3d')][_0x2171('0x35')]({'where':{'id':_0x55ca90[_0x2171('0x55')]['id']}})[_0x2171('0x29')](function(_0x49708c){return db[_0x2171('0x78')][_0x2171('0x79')](function(_0x4bb735){return _0x49708c[_0x2171('0x90')](_0x55ca90[_0x2171('0x41')][_0x2171('0x91')],{'transaction':_0x4bb735})[_0x2171('0x29')](function(){if(!_[_0x2171('0x92')](_0x2cf00f)){return _0x49708c[_0x2171('0x93')](_0x2cf00f,{'transaction':_0x4bb735})[_0x2171('0x29')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x55ca90[_0x2171('0x55')]['id'],'UserId':_0x2cf00f},'transaction':_0x4bb735});});}})[_0x2171('0x29')](function(){_0x2cf00f[_0x2171('0x76')](function(_0x402afe){socket[_0x2171('0x94')](_0x2171('0x95'),{'UserId':_0x402afe,'VoiceQueueId':_0x49708c['id']});});});});});});})[_0x2171('0x29')](respondWithStatusCode(_0x529d46,null))[_0x2171('0x54')](handleError(_0x529d46,null));};exports[_0x2171('0x96')]=function(_0x17c172,_0x1ccd5c,_0x13abe9){var _0x1112d7,_0x244a23;return db[_0x2171('0x3d')]['find']({'where':{'id':_0x17c172[_0x2171('0x55')]['id']}})['then'](handleEntityNotFound(_0x1ccd5c,null))[_0x2171('0x29')](function(_0x3b9dae){if(_0x3b9dae){_0x244a23=_0x3b9dae;return _0x3b9dae['addAgents'](_0x17c172[_0x2171('0x58')][_0x2171('0x91')],_[_0x2171('0x61')](_0x17c172['body'],[_0x2171('0x91'),'id'])||{})['spread'](function(_0x54a0d7){for(var _0x413512=0x0;_0x413512<_0x17c172['body'][_0x2171('0x91')]['length'];_0x413512+=0x1){socket['emit'](_0x2171('0x80'),{'UserId':_0x17c172[_0x2171('0x58')][_0x2171('0x91')][_0x413512],'VoiceQueueId':_0x17c172[_0x2171('0x55')]['id']});}return _0x54a0d7;});}})[_0x2171('0x29')](function(_0x4c4e9a){_0x1112d7=_0x4c4e9a||[];if(_0x244a23){return db[_0x2171('0x71')][_0x2171('0x52')]({'where':{'id':_0x17c172[_0x2171('0x58')]['ids']},'attributes':['id',_0x2171('0x36'),_0x2171('0x72'),_0x2171('0x73'),'interface'],'raw':!![]});}})[_0x2171('0x29')](function(_0x5a043d){if(!_[_0x2171('0x92')](_0x5a043d)){var _0x13809d=[];for(var _0x2009ab=0x0;_0x2009ab<_0x5a043d[_0x2171('0x47')];_0x2009ab++){if(_0x5a043d[_0x2009ab][_0x2171('0x72')]){_0x13809d['push'](db['UserVoiceQueueRt'][_0x2171('0x7a')]({'membername':_0x5a043d[_0x2009ab][_0x2171('0x36')],'UserId':_0x5a043d[_0x2009ab]['id'],'queue_name':_0x244a23[_0x2171('0x36')],'VoiceQueueId':_0x244a23['id'],'interface':_[_0x2171('0x7e')](_0x5a043d[_0x2009ab][_0x2171('0x74')])?util[_0x2171('0x97')]('SIP/%s',_0x5a043d[_0x2009ab][_0x2171('0x36')]):_0x5a043d[_0x2009ab][_0x2171('0x74')],'paused':_0x5a043d[_0x2009ab][_0x2171('0x73')]||![],'penalty':_0x17c172[_0x2171('0x58')][_0x2171('0x77')]||0x0}));}}return BPromise[_0x2171('0x8d')](_0x13809d);}})[_0x2171('0x29')](function(){return _0x1112d7;})[_0x2171('0x29')](respondWithResult(_0x1ccd5c,null))[_0x2171('0x54')](handleError(_0x1ccd5c,null));};exports[_0x2171('0x93')]=function(_0x430f3e,_0x27ec58,_0x37ef71){return db['VoiceQueue'][_0x2171('0x35')]({'where':{'id':_0x430f3e[_0x2171('0x55')]['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x27ec58,null))[_0x2171('0x29')](function(_0x1e826d){if(_0x1e826d){return _0x1e826d[_0x2171('0x93')](_0x430f3e['query'][_0x2171('0x91')])[_0x2171('0x29')](function(){if(_[_0x2171('0x98')](_0x430f3e[_0x2171('0x41')][_0x2171('0x91')])){for(var _0x2add97=0x0;_0x2add97<_0x430f3e[_0x2171('0x41')][_0x2171('0x91')]['length'];_0x2add97+=0x1){socket[_0x2171('0x94')]('userVoiceQueue:remove',{'UserId':Number(_0x430f3e[_0x2171('0x41')][_0x2171('0x91')][_0x2add97]),'VoiceQueueId':Number(_0x430f3e[_0x2171('0x55')]['id'])});}}else{socket[_0x2171('0x94')](_0x2171('0x95'),{'UserId':Number(_0x430f3e[_0x2171('0x41')][_0x2171('0x91')]),'VoiceQueueId':Number(_0x430f3e['params']['id'])});}});}})[_0x2171('0x29')](function(_0x1ae0e4){return db[_0x2171('0x7d')][_0x2171('0x2a')]({'where':{'VoiceQueueId':_0x430f3e[_0x2171('0x55')]['id'],'UserId':_0x430f3e[_0x2171('0x41')][_0x2171('0x91')]}})[_0x2171('0x29')](function(){return _0x1ae0e4;});})[_0x2171('0x29')](respondWithStatusCode(_0x27ec58,null))[_0x2171('0x54')](handleError(_0x27ec58,null));};exports[_0x2171('0x99')]=function(_0x3aa11a,_0x5da6b6,_0x2f667c){var _0x5bd458={};var _0x14eeb1={};var _0x5d5ea0;var _0x4ebea1;return db['VoiceQueue'][_0x2171('0x66')]({'where':{'id':_0x3aa11a[_0x2171('0x55')]['id']}})['then'](handleEntityNotFound(_0x5da6b6,null))['then'](function(_0x21e147){if(_0x21e147){_0x5d5ea0=_0x21e147;_0x14eeb1['model']=_[_0x2171('0x42')](db[_0x2171('0x71')][_0x2171('0x3e')]);_0x14eeb1[_0x2171('0x41')]=_[_0x2171('0x42')](_0x3aa11a[_0x2171('0x41')]);_0x14eeb1[_0x2171('0x43')]=_[_0x2171('0x44')](_0x14eeb1['model'],_0x14eeb1[_0x2171('0x41')]);_0x5bd458['attributes']=_['intersection'](_0x14eeb1[_0x2171('0x40')],qs[_0x2171('0x46')](_0x3aa11a[_0x2171('0x41')][_0x2171('0x46')]));_0x5bd458['attributes']=_0x5bd458[_0x2171('0x45')][_0x2171('0x47')]?_0x5bd458[_0x2171('0x45')]:_0x14eeb1[_0x2171('0x40')];_0x5bd458[_0x2171('0x68')]=qs[_0x2171('0x4a')](_0x3aa11a[_0x2171('0x41')][_0x2171('0x4a')]);_0x5bd458[_0x2171('0x4c')]=qs['filters'](_[_0x2171('0x4b')](_0x3aa11a['query'],_0x14eeb1[_0x2171('0x43')]));if(_0x3aa11a[_0x2171('0x41')][_0x2171('0x2f')]){_0x5bd458['where']=_[_0x2171('0x4d')](_0x5bd458[_0x2171('0x4c')],{'$or':_[_0x2171('0x31')](_0x5bd458[_0x2171('0x45')],function(_0x5af8af){var _0x28caf8={};_0x28caf8[_0x5af8af]={'$like':'%'+_0x3aa11a[_0x2171('0x41')][_0x2171('0x2f')]+'%'};return _0x28caf8;})});}_0x5bd458=_[_0x2171('0x4d')]({},_0x5bd458,_0x3aa11a[_0x2171('0x4f')]);return _0x5d5ea0[_0x2171('0x99')](_0x5bd458);}})['then'](function(_0x4e1e51){if(_0x4e1e51){_0x4ebea1=_0x4e1e51['length'];if(!_0x3aa11a['query'][_0x2171('0x48')]('nolimit')){_0x5bd458[_0x2171('0x22')]=qs[_0x2171('0x22')](_0x3aa11a[_0x2171('0x41')]['limit']);_0x5bd458['offset']=qs[_0x2171('0x21')](_0x3aa11a[_0x2171('0x41')][_0x2171('0x21')]);}return _0x5d5ea0[_0x2171('0x99')](_0x5bd458);}})[_0x2171('0x29')](function(_0x15efd0){if(_0x15efd0){return _0x15efd0?{'count':_0x4ebea1,'rows':_0x15efd0}:null;}})[_0x2171('0x29')](respondWithResult(_0x5da6b6,null))[_0x2171('0x54')](handleError(_0x5da6b6,null));};exports[_0x2171('0x9a')]=function(_0x214a60,_0x484f8b,_0x37909c){var _0x4baf83={};var _0x576953={};var _0x4b9a72;var _0x56a279;return db[_0x2171('0x3d')]['findOne']({'where':{'id':_0x214a60[_0x2171('0x55')]['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x484f8b,null))['then'](function(_0x3e8efa){if(_0x3e8efa){_0x4b9a72=_0x3e8efa;_0x576953[_0x2171('0x40')]=_[_0x2171('0x42')](db[_0x2171('0x7d')][_0x2171('0x3e')]);_0x576953[_0x2171('0x41')]=_[_0x2171('0x42')](_0x214a60[_0x2171('0x41')]);_0x576953['filters']=_[_0x2171('0x44')](_0x576953[_0x2171('0x40')],_0x576953[_0x2171('0x41')]);_0x4baf83[_0x2171('0x45')]=_[_0x2171('0x44')](_0x576953[_0x2171('0x40')],qs[_0x2171('0x46')](_0x214a60[_0x2171('0x41')]['fields']));_0x4baf83[_0x2171('0x45')]=_0x4baf83[_0x2171('0x45')][_0x2171('0x47')]?_0x4baf83[_0x2171('0x45')]:_0x576953[_0x2171('0x40')];_0x4baf83['order']=qs[_0x2171('0x4a')](_0x214a60[_0x2171('0x41')][_0x2171('0x4a')]);_0x4baf83[_0x2171('0x4c')]=qs[_0x2171('0x43')](_[_0x2171('0x4b')](_0x214a60[_0x2171('0x41')],_0x576953[_0x2171('0x43')]));if(_0x214a60[_0x2171('0x41')]['filter']){_0x4baf83[_0x2171('0x4c')]=_[_0x2171('0x4d')](_0x4baf83[_0x2171('0x4c')],{'$or':_[_0x2171('0x31')](_0x4baf83[_0x2171('0x45')],function(_0x1f3b98){var _0x5ac37d={};_0x5ac37d[_0x1f3b98]={'$like':'%'+_0x214a60[_0x2171('0x41')][_0x2171('0x2f')]+'%'};return _0x5ac37d;})});}_0x4baf83=_[_0x2171('0x4d')]({},_0x4baf83,_0x214a60[_0x2171('0x4f')]);return _0x4b9a72[_0x2171('0x9a')](_0x4baf83);}})['then'](function(_0x1eb8a6){if(_0x1eb8a6){_0x56a279=_0x1eb8a6[_0x2171('0x47')];if(!_0x214a60[_0x2171('0x41')][_0x2171('0x48')](_0x2171('0x49'))){_0x4baf83[_0x2171('0x22')]=qs[_0x2171('0x22')](_0x214a60[_0x2171('0x41')][_0x2171('0x22')]);_0x4baf83[_0x2171('0x21')]=qs[_0x2171('0x21')](_0x214a60[_0x2171('0x41')][_0x2171('0x21')]);}return _0x4b9a72[_0x2171('0x9a')](_0x4baf83);}})['then'](function(_0x231fa7){return _0x231fa7?{'count':_0x56a279,'rows':_0x231fa7}:null;})[_0x2171('0x29')](respondWithResult(_0x484f8b,null))[_0x2171('0x54')](handleError(_0x484f8b,null));};exports[_0x2171('0x9b')]=function(_0x19ae4c,_0x4728f7,_0x24e4d3){var _0x589a8d={};var _0x47a6eb={};var _0x25cec5;var _0x2e64de;return db[_0x2171('0x3d')][_0x2171('0x66')]({'where':{'id':_0x19ae4c['params']['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x4728f7,null))[_0x2171('0x29')](function(_0x547993){if(_0x547993){_0x25cec5=_0x547993;_0x47a6eb[_0x2171('0x40')]=_[_0x2171('0x42')](db[_0x2171('0x9c')][_0x2171('0x3e')]);_0x47a6eb[_0x2171('0x41')]=_[_0x2171('0x42')](_0x19ae4c['query']);_0x47a6eb[_0x2171('0x43')]=_['intersection'](_0x47a6eb[_0x2171('0x40')],_0x47a6eb[_0x2171('0x41')]);_0x589a8d['attributes']=_['intersection'](_0x47a6eb[_0x2171('0x40')],qs[_0x2171('0x46')](_0x19ae4c['query'][_0x2171('0x46')]));_0x589a8d[_0x2171('0x45')]=_0x589a8d[_0x2171('0x45')][_0x2171('0x47')]?_0x589a8d['attributes']:_0x47a6eb[_0x2171('0x40')];_0x589a8d[_0x2171('0x68')]=qs[_0x2171('0x4a')](_0x19ae4c[_0x2171('0x41')][_0x2171('0x4a')]);_0x589a8d[_0x2171('0x4c')]=qs['filters'](_[_0x2171('0x4b')](_0x19ae4c['query'],_0x47a6eb[_0x2171('0x43')]));if(_0x19ae4c[_0x2171('0x41')][_0x2171('0x2f')]){_0x589a8d[_0x2171('0x4c')]=_[_0x2171('0x4d')](_0x589a8d['where'],{'$or':_[_0x2171('0x31')](_0x589a8d[_0x2171('0x45')],function(_0x211a9b){var _0x39ac9e={};_0x39ac9e[_0x211a9b]={'$like':'%'+_0x19ae4c[_0x2171('0x41')][_0x2171('0x2f')]+'%'};return _0x39ac9e;})});}_0x589a8d=_[_0x2171('0x4d')]({},_0x589a8d,_0x19ae4c[_0x2171('0x4f')]);return _0x25cec5['getLists'](_0x589a8d);}})['then'](function(_0x10e989){if(_0x10e989){_0x2e64de=_0x10e989[_0x2171('0x47')];if(!_0x19ae4c[_0x2171('0x41')][_0x2171('0x48')](_0x2171('0x49'))){_0x589a8d[_0x2171('0x22')]=qs['limit'](_0x19ae4c[_0x2171('0x41')][_0x2171('0x22')]);_0x589a8d['offset']=qs['offset'](_0x19ae4c[_0x2171('0x41')][_0x2171('0x21')]);}return _0x25cec5[_0x2171('0x9b')](_0x589a8d);}})[_0x2171('0x29')](function(_0x93ab9a){if(_0x93ab9a){return _0x93ab9a?{'count':_0x2e64de,'rows':_0x93ab9a}:null;}})['then'](respondWithResult(_0x4728f7,null))[_0x2171('0x54')](handleError(_0x4728f7,null));};exports[_0x2171('0x9d')]=function(_0x2153c9,_0x235f26,_0x46e4f1){var _0xb4ebcf,_0x3a66f6;return db[_0x2171('0x3d')][_0x2171('0x35')]({'where':{'id':_0x2153c9['params']['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x235f26,null))[_0x2171('0x29')](function(_0xb6871c){if(_0xb6871c){_0x3a66f6=_0xb6871c;return _0xb6871c['addLists'](_0x2153c9[_0x2171('0x58')][_0x2171('0x91')],_[_0x2171('0x61')](_0x2153c9[_0x2171('0x58')],[_0x2171('0x91'),'id'])||{});}return null;})[_0x2171('0x9e')](function(_0x50ce71){var _0xb252f5;_0xb4ebcf=_0x50ce71||[];var _0x32e033=[];if(_0x50ce71){for(var _0x172d9a=0x0;_0x172d9a<_0x50ce71[_0x2171('0x47')];_0x172d9a+=0x1){var _0x27db94=_0x50ce71[_0x172d9a][_0x2171('0x2b')]({'plain':!![]});_0x3a66f6[_0x2171('0x9f')]=_0x2153c9[_0x2171('0x58')]['dialCheckDuplicateType']?_0x2153c9['body']['dialCheckDuplicateType']:_0x3a66f6['dialCheckDuplicateType'];switch(_0x3a66f6['dialCheckDuplicateType']){case'always':_0xb252f5=squel[_0x2171('0xa0')]()[_0x2171('0xa1')](_0x2171('0xa2'))[_0x2171('0xa3')](['phone',_0x2171('0xa4'),_0x2171('0xa5'),_0x2171('0xa6'),_0x2171('0x69'),'createdAt',_0x2171('0x63')],squel[_0x2171('0xa7')]()[_0x2171('0x81')](_0x2171('0xa8'),_0x2171('0xa8'))[_0x2171('0x81')](_0x2171('0xa9'),_0x2171('0xa4'))[_0x2171('0x81')]('id','ContactId')[_0x2171('0x81')](_0x27db94[_0x2171('0xaa')][_0x2171('0x88')](),_0x2171('0xa6'))[_0x2171('0x81')](_0x2153c9[_0x2171('0x55')]['id'][_0x2171('0x88')](),_0x2171('0x69'))[_0x2171('0x81')](_0x2171('0xa9'),_0x2171('0x62'))['field'](_0x2171('0xa9'),_0x2171('0x63'))[_0x2171('0x83')]('cm_contacts')[_0x2171('0x4c')](_0x2171('0xab'))[_0x2171('0x4c')](_0x2171('0xac'),_0x27db94[_0x2171('0xaa')][_0x2171('0x88')]())[_0x2171('0x4c')](_0x2171('0xad'))[_0x2171('0x4c')](_0x2171('0xae'),squel['select']()[_0x2171('0x81')](_0x2171('0xaf'))[_0x2171('0x83')]('cm_hopper_final')[_0x2171('0x4c')](_0x2171('0x86'),_0x2153c9[_0x2171('0x55')]['id'][_0x2171('0x88')]()))[_0x2171('0x4c')](_0x2171('0xae'),squel[_0x2171('0xa7')]()[_0x2171('0x81')](_0x2171('0xb0'))[_0x2171('0x83')]('cm_hopper')[_0x2171('0x4c')]('VoiceQueueId\x20=\x20?',_0x2153c9[_0x2171('0x55')]['id'][_0x2171('0x88')]())))[_0x2171('0x88')]();break;case _0x2171('0xb1'):_0xb252f5=squel['insert']()['into']('cm_hopper')[_0x2171('0xa3')]([_0x2171('0xa8'),_0x2171('0xa4'),_0x2171('0xa5'),_0x2171('0xa6'),_0x2171('0x69'),'createdAt','updatedAt'],squel[_0x2171('0xa7')]()[_0x2171('0x81')]('phone',_0x2171('0xa8'))[_0x2171('0x81')](_0x2171('0xa9'),_0x2171('0xa4'))[_0x2171('0x81')]('id',_0x2171('0xa5'))['field'](_0x27db94[_0x2171('0xaa')][_0x2171('0x88')](),_0x2171('0xa6'))[_0x2171('0x81')](_0x2153c9[_0x2171('0x55')]['id']['toString'](),_0x2171('0x69'))[_0x2171('0x81')](_0x2171('0xa9'),_0x2171('0x62'))['field']('NOW()',_0x2171('0x63'))['from'](_0x2171('0xb2'))[_0x2171('0x4c')](_0x2171('0xab'))[_0x2171('0x4c')](_0x2171('0xac'),_0x27db94[_0x2171('0xaa')][_0x2171('0x88')]())[_0x2171('0x4c')]('phone\x20IS\x20NOT\x20NULL')[_0x2171('0x4c')](_0x2171('0xae'),squel[_0x2171('0xa7')]()[_0x2171('0x81')](_0x2171('0xb0'))[_0x2171('0x83')](_0x2171('0xa2'))[_0x2171('0x4c')](_0x2171('0x86'),_0x2153c9[_0x2171('0x55')]['id'][_0x2171('0x88')]())))[_0x2171('0x88')]();break;default:_0xb252f5=squel['insert']()[_0x2171('0xa1')]('cm_hopper')[_0x2171('0xa3')]([_0x2171('0xa8'),_0x2171('0xa4'),_0x2171('0xa5'),_0x2171('0xa6'),_0x2171('0x69'),_0x2171('0x62'),_0x2171('0x63')],squel['select']()[_0x2171('0x81')](_0x2171('0xa8'),_0x2171('0xa8'))[_0x2171('0x81')](_0x2171('0xa9'),_0x2171('0xa4'))['field']('id',_0x2171('0xa5'))['field'](_0x27db94['CmListId'][_0x2171('0x88')](),_0x2171('0xa6'))['field'](_0x2153c9[_0x2171('0x55')]['id'][_0x2171('0x88')](),_0x2171('0x69'))['field'](_0x2171('0xa9'),_0x2171('0x62'))['field']('NOW()',_0x2171('0x63'))[_0x2171('0x83')](_0x2171('0xb2'))['where'](_0x2171('0xab'))[_0x2171('0x4c')]('ListId\x20=\x20?',_0x27db94['CmListId'][_0x2171('0x88')]())['where']('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x32e033[_0x2171('0x87')](db[_0x2171('0x78')][_0x2171('0x41')](_0xb252f5));}return BPromise[_0x2171('0x8d')](_0x32e033);}})['then'](function(){return _0xb4ebcf;})['then'](respondWithResult(_0x235f26,null))[_0x2171('0x54')](handleError(_0x235f26,null));};exports[_0x2171('0xb3')]=function(_0x4b11e5,_0x4e5f96,_0x4920b8){return db[_0x2171('0x3d')]['find']({'where':{'id':_0x4b11e5['params']['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x4e5f96,null))[_0x2171('0x29')](function(_0x2d9f12){if(_0x2d9f12){return _0x2d9f12[_0x2171('0xb3')](_0x4b11e5['query'][_0x2171('0x91')]);}})[_0x2171('0x29')](function(_0xe33377){if(_0xe33377){return db[_0x2171('0x67')][_0x2171('0x2a')]({'where':{'ListId':_0x4b11e5['query'][_0x2171('0x91')],'VoiceQueueId':_0x4b11e5[_0x2171('0x55')]['id']}})[_0x2171('0x29')](function(){return _0xe33377;});}})[_0x2171('0x29')](respondWithStatusCode(_0x4e5f96,null))['catch'](handleError(_0x4e5f96,null));};exports[_0x2171('0xb4')]=function(_0x531fc5,_0x3a2120,_0x4949e8){var _0x4a88a9={};var _0x3df8db={};var _0x3f2187;var _0xa5cd3d;return db[_0x2171('0x3d')][_0x2171('0x66')]({'where':{'id':_0x531fc5[_0x2171('0x55')]['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x3a2120,null))[_0x2171('0x29')](function(_0x42ca03){if(_0x42ca03){_0x3f2187=_0x42ca03;_0x3df8db[_0x2171('0x40')]=_['keys'](db['CmList'][_0x2171('0x3e')]);_0x3df8db[_0x2171('0x41')]=_['keys'](_0x531fc5['query']);_0x3df8db[_0x2171('0x43')]=_[_0x2171('0x44')](_0x3df8db['model'],_0x3df8db[_0x2171('0x41')]);_0x4a88a9['attributes']=_[_0x2171('0x44')](_0x3df8db['model'],qs[_0x2171('0x46')](_0x531fc5[_0x2171('0x41')]['fields']));_0x4a88a9[_0x2171('0x45')]=_0x4a88a9[_0x2171('0x45')][_0x2171('0x47')]?_0x4a88a9[_0x2171('0x45')]:_0x3df8db['model'];_0x4a88a9[_0x2171('0x68')]=qs[_0x2171('0x4a')](_0x531fc5[_0x2171('0x41')][_0x2171('0x4a')]);_0x4a88a9[_0x2171('0x4c')]=qs[_0x2171('0x43')](_['pick'](_0x531fc5[_0x2171('0x41')],_0x3df8db['filters']));if(_0x531fc5[_0x2171('0x41')][_0x2171('0x2f')]){_0x4a88a9[_0x2171('0x4c')]=_[_0x2171('0x4d')](_0x4a88a9[_0x2171('0x4c')],{'$or':_['map'](_0x4a88a9[_0x2171('0x45')],function(_0x12f263){var _0xff6d2c={};_0xff6d2c[_0x12f263]={'$like':'%'+_0x531fc5[_0x2171('0x41')][_0x2171('0x2f')]+'%'};return _0xff6d2c;})});}_0x4a88a9=_[_0x2171('0x4d')]({},_0x4a88a9,_0x531fc5[_0x2171('0x4f')]);return _0x3f2187[_0x2171('0xb4')](_0x4a88a9);}})[_0x2171('0x29')](function(_0x39bffa){if(_0x39bffa){_0xa5cd3d=_0x39bffa[_0x2171('0x47')];if(!_0x531fc5['query']['hasOwnProperty'](_0x2171('0x49'))){_0x4a88a9[_0x2171('0x22')]=qs['limit'](_0x531fc5[_0x2171('0x41')]['limit']);_0x4a88a9[_0x2171('0x21')]=qs[_0x2171('0x21')](_0x531fc5[_0x2171('0x41')]['offset']);}return _0x3f2187[_0x2171('0xb4')](_0x4a88a9);}})[_0x2171('0x29')](function(_0x46482b){if(_0x46482b){return _0x46482b?{'count':_0xa5cd3d,'rows':_0x46482b}:null;}})[_0x2171('0x29')](respondWithResult(_0x3a2120,null))[_0x2171('0x54')](handleError(_0x3a2120,null));};exports[_0x2171('0xb5')]=function(_0x27986f,_0xfc3bcd,_0x313c16){var _0x57a70d,_0x121301;return db['VoiceQueue'][_0x2171('0x35')]({'where':{'id':_0x27986f[_0x2171('0x55')]['id']}})[_0x2171('0x29')](handleEntityNotFound(_0xfc3bcd,null))['then'](function(_0xea5681){if(_0xea5681){_0x121301=_0xea5681;return _0xea5681[_0x2171('0xb5')](_0x27986f[_0x2171('0x58')][_0x2171('0x91')],_[_0x2171('0x61')](_0x27986f[_0x2171('0x58')],[_0x2171('0x91'),'id'])||{});}return null;})[_0x2171('0x9e')](function(_0x2d2b5e){var _0x45bcfd;_0x57a70d=_0x2d2b5e||[];var _0x27e02e=[];if(_0x2d2b5e){for(var _0x17b782=0x0;_0x17b782<_0x2d2b5e[_0x2171('0x47')];_0x17b782+=0x1){var _0x2cf782=_0x2d2b5e[_0x17b782][_0x2171('0x2b')]({'plain':!![]});_0x45bcfd=squel['insert']()[_0x2171('0xa1')](_0x2171('0xb6'))[_0x2171('0xa3')]([_0x2171('0xa8'),_0x2171('0xa5'),_0x2171('0xa6'),'VoiceQueueId',_0x2171('0x62'),_0x2171('0x63')],squel['select']()['field']('phone',_0x2171('0xa8'))[_0x2171('0x81')]('id',_0x2171('0xa5'))[_0x2171('0x81')](_0x2cf782['CmListId']['toString'](),_0x2171('0xa6'))[_0x2171('0x81')](_0x27986f[_0x2171('0x55')]['id'][_0x2171('0x88')](),'VoiceQueueId')[_0x2171('0x81')](_0x2171('0xa9'),'createdAt')[_0x2171('0x81')](_0x2171('0xa9'),_0x2171('0x63'))['from'](_0x2171('0xb2'))[_0x2171('0x4c')](_0x2171('0xab'))['where']('ListId\x20=\x20?',_0x2cf782['CmListId'][_0x2171('0x88')]())[_0x2171('0x4c')](_0x2171('0xad')))[_0x2171('0x88')]();_0x27e02e[_0x2171('0x87')](db['sequelize'][_0x2171('0x41')](_0x45bcfd));}return BPromise[_0x2171('0x8d')](_0x27e02e);}})[_0x2171('0x29')](function(){return _0x57a70d;})[_0x2171('0x29')](respondWithResult(_0xfc3bcd,null))[_0x2171('0x54')](handleError(_0xfc3bcd,null));};exports['removeBlackLists']=function(_0x61a258,_0x542cab,_0xcc5ea7){return db[_0x2171('0x3d')][_0x2171('0x35')]({'where':{'id':_0x61a258[_0x2171('0x55')]['id']}})[_0x2171('0x29')](handleEntityNotFound(_0x542cab,null))['then'](function(_0x3239a2){if(_0x3239a2){return _0x3239a2['removeBlackLists'](_0x61a258[_0x2171('0x41')][_0x2171('0x91')]);}})[_0x2171('0x29')](function(_0x2e3200){if(_0x2e3200){return db['CmHopperBlack'][_0x2171('0x2a')]({'where':{'ListId':_0x61a258[_0x2171('0x41')]['ids'],'VoiceQueueId':_0x61a258['params']['id']}})['then'](function(){return _0x2e3200;});}})[_0x2171('0x29')](respondWithStatusCode(_0x542cab,null))[_0x2171('0x54')](handleError(_0x542cab,null));};
\ No newline at end of file
+var _0x8cdb=['sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','QueueCampaigns','outbound','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','UserProfileSection','update','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','flatMap','penalty','sequelize','transaction','TeamVoiceQueue','upsert','each','UserVoiceQueue','findOrCreate','isNil','SIP/%s','forEach','emit','userVoiceQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','all','union','compact','ids','isEmpty','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','spread','interface','format','removeAgents','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','field','phone','scheduledAt','CmListId','NOW()','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','get','VoiceQueues','inbound','ignore','map','value','includes','type','find','UserProfileResource','end','error','stack','name','send','index','VoiceQueue','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x4dd964,_0x21344b){var _0x147d07=function(_0x34b14b){while(--_0x34b14b){_0x4dd964['push'](_0x4dd964['shift']());}};_0x147d07(++_0x21344b);}(_0x8cdb,0x138));var _0xb8cd=function(_0x17fac1,_0xbd5e4a){_0x17fac1=_0x17fac1-0x0;var _0x273546=_0x8cdb[_0x17fac1];return _0x273546;};'use strict';var emlformat=require(_0xb8cd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb8cd('0x1'));var jsonpatch=require(_0xb8cd('0x2'));var rp=require(_0xb8cd('0x3'));var moment=require('moment');var BPromise=require(_0xb8cd('0x4'));var Mustache=require(_0xb8cd('0x5'));var util=require(_0xb8cd('0x6'));var path=require(_0xb8cd('0x7'));var sox=require('sox');var csv=require(_0xb8cd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb8cd('0x9'));var _=require('lodash');var squel=require(_0xb8cd('0xa'));var crypto=require('crypto');var jsforce=require(_0xb8cd('0xb'));var deskjs=require(_0xb8cd('0xc'));var toCsv=require(_0xb8cd('0x8'));var querystring=require(_0xb8cd('0xd'));var Papa=require('papaparse');var Redis=require(_0xb8cd('0xe'));var authService=require(_0xb8cd('0xf'));var qs=require(_0xb8cd('0x10'));var as=require(_0xb8cd('0x11'));var hardwareService=require(_0xb8cd('0x12'));var logger=require(_0xb8cd('0x13'))(_0xb8cd('0x14'));var utils=require(_0xb8cd('0x15'));var config=require(_0xb8cd('0x16'));var licenseUtil=require(_0xb8cd('0x17'));var db=require(_0xb8cd('0x18'))['db'];config[_0xb8cd('0x19')]=_['defaults'](config[_0xb8cd('0x19')],{'host':_0xb8cd('0x1a'),'port':0x18eb});var socket=require(_0xb8cd('0x1b'))(new Redis(config['redis']));require(_0xb8cd('0x1c'))[_0xb8cd('0x1d')](socket);function respondWithStatusCode(_0x209083,_0x406882){_0x406882=_0x406882||0xcc;return function(_0x35f7ed){if(_0x35f7ed){return _0x209083[_0xb8cd('0x1e')](_0x406882);}return _0x209083[_0xb8cd('0x1f')](_0x406882)['end']();};}function respondWithResult(_0x2de8e4,_0x1dfc4e){_0x1dfc4e=_0x1dfc4e||0xc8;return function(_0x3a0be0){if(_0x3a0be0){return _0x2de8e4[_0xb8cd('0x1f')](_0x1dfc4e)['json'](_0x3a0be0);}};}function respondWithFilteredResult(_0x1d4a01,_0x248a1e){return function(_0x1d6e2f){if(_0x1d6e2f){var _0x1f49de=typeof _0x248a1e[_0xb8cd('0x20')]===_0xb8cd('0x21')&&typeof _0x248a1e[_0xb8cd('0x22')]===_0xb8cd('0x21');var _0x2dbc46=_0x1d6e2f[_0xb8cd('0x23')];var _0x54bedf=_0x1f49de?0x0:_0x248a1e[_0xb8cd('0x20')];var _0x52ac93=_0x1f49de?_0x1d6e2f[_0xb8cd('0x23')]:_0x248a1e[_0xb8cd('0x20')]+_0x248a1e[_0xb8cd('0x22')];var _0x1e7a38;if(_0x52ac93>=_0x2dbc46){_0x52ac93=_0x2dbc46;_0x1e7a38=0xc8;}else{_0x1e7a38=0xce;}_0x1d4a01[_0xb8cd('0x1f')](_0x1e7a38);return _0x1d4a01['set'](_0xb8cd('0x24'),_0x54bedf+'-'+_0x52ac93+'/'+_0x2dbc46)['json'](_0x1d6e2f);}return null;};}function patchUpdates(_0x5eb7b6){return function(_0xab003d){try{jsonpatch[_0xb8cd('0x25')](_0xab003d,_0x5eb7b6,!![]);}catch(_0x2c81b3){return BPromise[_0xb8cd('0x26')](_0x2c81b3);}return _0xab003d[_0xb8cd('0x27')]();};}function saveUpdates(_0x53fae3,_0x3d70a2){return function(_0x2d4614){if(_0x2d4614){return _0x2d4614['update'](_0x53fae3)[_0xb8cd('0x28')](function(_0x11c088){return _0x11c088;});}return null;};}function removeEntity(_0x34e9ee,_0x3ac283){return function(_0x31520d){if(_0x31520d){return _0x31520d[_0xb8cd('0x29')]()[_0xb8cd('0x28')](function(){var _0x5aea9f=_0x31520d[_0xb8cd('0x2a')]({'plain':!![]});var _0x41488f=[{'name':_0xb8cd('0x2b'),'value':_0xb8cd('0x2c'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x4694ac=_(_0x41488f)['filter'](_0xb8cd('0x2d'))[_0xb8cd('0x2e')]('value')[_0xb8cd('0x2f')]();if(_[_0xb8cd('0x30')](_0x4694ac,_0x5aea9f[_0xb8cd('0x31')])){return;}var _0x360076=_[_0xb8cd('0x32')](_0x41488f,['value',_0x5aea9f['type']])['name'];return db[_0xb8cd('0x33')][_0xb8cd('0x29')]({'where':{'type':_0x360076,'resourceId':_0x5aea9f['id']}})[_0xb8cd('0x28')](function(){return _0x31520d;});})[_0xb8cd('0x28')](function(){_0x34e9ee[_0xb8cd('0x1f')](0xcc)[_0xb8cd('0x34')]();});}};}function handleEntityNotFound(_0x4b7944,_0xf0b4d){return function(_0x1cbc98){if(!_0x1cbc98){_0x4b7944[_0xb8cd('0x1e')](0x194);}return _0x1cbc98;};}function handleError(_0x550ec9,_0x2bd003){_0x2bd003=_0x2bd003||0x1f4;return function(_0x21222b){logger[_0xb8cd('0x35')](_0x21222b[_0xb8cd('0x36')]);if(_0x21222b['name']){delete _0x21222b[_0xb8cd('0x37')];}_0x550ec9['status'](_0x2bd003)[_0xb8cd('0x38')](_0x21222b);};}exports[_0xb8cd('0x39')]=function(_0x5132a6,_0x27136d){var _0x3cb13a={},_0x2d49b7={},_0x27dc88={'count':0x0,'rows':[]};var _0x34256e=_[_0xb8cd('0x2e')](db[_0xb8cd('0x3a')]['rawAttributes'],function(_0x521859){return{'name':_0x521859[_0xb8cd('0x3b')],'type':_0x521859[_0xb8cd('0x31')][_0xb8cd('0x3c')]};});_0x2d49b7[_0xb8cd('0x3d')]=_[_0xb8cd('0x2e')](_0x34256e,_0xb8cd('0x37'));_0x2d49b7['query']=_[_0xb8cd('0x3e')](_0x5132a6[_0xb8cd('0x3f')]);_0x2d49b7[_0xb8cd('0x40')]=_['intersection'](_0x2d49b7['model'],_0x2d49b7[_0xb8cd('0x3f')]);_0x3cb13a['attributes']=_[_0xb8cd('0x41')](_0x2d49b7[_0xb8cd('0x3d')],qs[_0xb8cd('0x42')](_0x5132a6[_0xb8cd('0x3f')]['fields']));_0x3cb13a[_0xb8cd('0x43')]=_0x3cb13a[_0xb8cd('0x43')][_0xb8cd('0x44')]?_0x3cb13a[_0xb8cd('0x43')]:_0x2d49b7[_0xb8cd('0x3d')];if(!_0x5132a6[_0xb8cd('0x3f')][_0xb8cd('0x45')](_0xb8cd('0x46'))){_0x3cb13a['limit']=qs[_0xb8cd('0x22')](_0x5132a6['query'][_0xb8cd('0x22')]);_0x3cb13a[_0xb8cd('0x20')]=qs[_0xb8cd('0x20')](_0x5132a6['query'][_0xb8cd('0x20')]);}_0x3cb13a[_0xb8cd('0x47')]=qs['sort'](_0x5132a6[_0xb8cd('0x3f')][_0xb8cd('0x48')]);_0x3cb13a[_0xb8cd('0x49')]=qs['filters'](_[_0xb8cd('0x4a')](_0x5132a6[_0xb8cd('0x3f')],_0x2d49b7[_0xb8cd('0x40')]),_0x34256e);if(_0x5132a6[_0xb8cd('0x3f')]['filter']){_0x3cb13a['where']=_[_0xb8cd('0x4b')](_0x3cb13a['where'],{'$or':_['map'](_0x34256e,function(_0x477ebb){if(_0x477ebb[_0xb8cd('0x31')]!==_0xb8cd('0x4c')){var _0x5045ff={};_0x5045ff[_0x477ebb['name']]={'$like':'%'+_0x5132a6[_0xb8cd('0x3f')][_0xb8cd('0x4d')]+'%'};return _0x5045ff;}})});}_0x3cb13a=_[_0xb8cd('0x4b')]({},_0x3cb13a,_0x5132a6[_0xb8cd('0x4e')]);var _0x386e00={'where':_0x3cb13a[_0xb8cd('0x49')]};return db['VoiceQueue']['count'](_0x386e00)[_0xb8cd('0x28')](function(_0x7ceaf8){_0x27dc88['count']=_0x7ceaf8;if(_0x5132a6['query'][_0xb8cd('0x4f')]){_0x3cb13a[_0xb8cd('0x50')]=[{'all':!![]}];}return db[_0xb8cd('0x3a')][_0xb8cd('0x51')](_0x3cb13a);})['then'](function(_0x23effc){_0x27dc88[_0xb8cd('0x52')]=_0x23effc;return _0x27dc88;})['then'](respondWithFilteredResult(_0x27136d,_0x3cb13a))[_0xb8cd('0x53')](handleError(_0x27136d,null));};exports[_0xb8cd('0x54')]=function(_0x3debb0,_0x3c3a31){var _0x5ca89d={'raw':![],'where':{'id':_0x3debb0[_0xb8cd('0x55')]['id']}},_0x30687f={};_0x30687f[_0xb8cd('0x3d')]=_[_0xb8cd('0x3e')](db['VoiceQueue'][_0xb8cd('0x56')]);_0x30687f[_0xb8cd('0x3f')]=_[_0xb8cd('0x3e')](_0x3debb0[_0xb8cd('0x3f')]);_0x30687f['filters']=_[_0xb8cd('0x41')](_0x30687f[_0xb8cd('0x3d')],_0x30687f[_0xb8cd('0x3f')]);_0x5ca89d[_0xb8cd('0x43')]=_[_0xb8cd('0x41')](_0x30687f[_0xb8cd('0x3d')],qs[_0xb8cd('0x42')](_0x3debb0[_0xb8cd('0x3f')]['fields']));_0x5ca89d[_0xb8cd('0x43')]=_0x5ca89d['attributes'][_0xb8cd('0x44')]?_0x5ca89d[_0xb8cd('0x43')]:_0x30687f['model'];if(_0x3debb0['query']['includeAll']){_0x5ca89d[_0xb8cd('0x50')]=[{'all':!![]}];}_0x5ca89d=_['merge']({},_0x5ca89d,_0x3debb0[_0xb8cd('0x4e')]);return db[_0xb8cd('0x3a')][_0xb8cd('0x32')](_0x5ca89d)[_0xb8cd('0x28')](handleEntityNotFound(_0x3c3a31,null))[_0xb8cd('0x28')](respondWithResult(_0x3c3a31,null))[_0xb8cd('0x53')](handleError(_0x3c3a31,null));};exports['create']=function(_0x48cb3d,_0x53bd84){return db[_0xb8cd('0x3a')]['create'](_0x48cb3d[_0xb8cd('0x57')],{})[_0xb8cd('0x28')](function(_0x6761db){var _0x359463=_0x48cb3d['user'][_0xb8cd('0x2a')]({'plain':!![]});if(!_0x359463)throw new Error(_0xb8cd('0x58'));if(_0x359463[_0xb8cd('0x59')]===_0xb8cd('0x5a')){var _0x5b7c42=_0x6761db[_0xb8cd('0x2a')]({'plain':!![]});var _0xc3e6a4=[{'name':'VoiceQueues','value':_0xb8cd('0x2c')},{'name':_0xb8cd('0x5b'),'value':_0xb8cd('0x5c')}];var _0x265e01=_[_0xb8cd('0x32')](_0xc3e6a4,[_0xb8cd('0x2f'),_0x5b7c42[_0xb8cd('0x31')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x265e01,'userProfileId':_0x359463[_0xb8cd('0x5d')]},'raw':!![]})[_0xb8cd('0x28')](function(_0x5561ca){if(_0x5561ca&&_0x5561ca[_0xb8cd('0x5e')]===0x0){return db[_0xb8cd('0x33')][_0xb8cd('0x5f')]({'name':_0x5b7c42[_0xb8cd('0x37')],'resourceId':_0x5b7c42['id'],'type':_0x5561ca[_0xb8cd('0x37')],'sectionId':_0x5561ca['id']},{})['then'](function(){return _0x6761db;});}else{return _0x6761db;}})[_0xb8cd('0x53')](function(_0x2c196c){logger[_0xb8cd('0x35')](_0xb8cd('0x60'),_0x2c196c);throw _0x2c196c;});}return _0x6761db;})[_0xb8cd('0x28')](respondWithResult(_0x53bd84,0xc9))[_0xb8cd('0x53')](handleError(_0x53bd84,null));};exports[_0xb8cd('0x61')]=function(_0x1b1c3e,_0x5ddc80){var _0x5eec22={'where':{'id':_0x1b1c3e[_0xb8cd('0x55')]['id']}},_0x499333={};_0x499333['model']=_[_0xb8cd('0x3e')](db[_0xb8cd('0x3a')][_0xb8cd('0x56')]);_0x5eec22[_0xb8cd('0x43')]=_['intersection'](_0x499333[_0xb8cd('0x3d')],qs[_0xb8cd('0x42')](_0x1b1c3e[_0xb8cd('0x3f')][_0xb8cd('0x42')]));_0x5eec22[_0xb8cd('0x43')]=_0x5eec22[_0xb8cd('0x43')][_0xb8cd('0x44')]?_0x5eec22['attributes']:_0x499333['model'];if(_0x1b1c3e[_0xb8cd('0x3f')][_0xb8cd('0x4f')]){_0x5eec22[_0xb8cd('0x50')]=[{'all':!![]}];}_0x5eec22=_[_0xb8cd('0x4b')]({},_0x5eec22,_0x1b1c3e['options']);return db[_0xb8cd('0x3a')]['find'](_0x5eec22)[_0xb8cd('0x28')](handleEntityNotFound(_0x5ddc80,null))['then'](function(_0x2b1f32){if(_0x2b1f32){var _0x3628d9=_0x2b1f32[_0xb8cd('0x2a')]({'plain':!![]});_0x3628d9=qs[_0xb8cd('0x62')](_0x3628d9,['id',_0xb8cd('0x63'),'updatedAt']);_0x1b1c3e[_0xb8cd('0x57')]=_[_0xb8cd('0x62')](_0x1b1c3e['body'],['id',_0xb8cd('0x63'),_0xb8cd('0x64')]);return db[_0xb8cd('0x3a')][_0xb8cd('0x5f')](_['merge'](_0x3628d9,_0x1b1c3e[_0xb8cd('0x57')]),{'include':_0x1b1c3e[_0xb8cd('0x3f')][_0xb8cd('0x4f')]?[{'all':!![]}]:undefined})[_0xb8cd('0x28')](function(_0x5a287a){var _0x22106f=_0x1b1c3e[_0xb8cd('0x5a')]['get']({'plain':!![]});if(!_0x22106f)throw new Error(_0xb8cd('0x58'));if(_0x22106f[_0xb8cd('0x59')]===_0xb8cd('0x5a')){var _0x56c926=_0x5a287a[_0xb8cd('0x2a')]({'plain':!![]});var _0x52d736=[{'name':_0xb8cd('0x2b'),'value':_0xb8cd('0x2c')},{'name':_0xb8cd('0x5b'),'value':_0xb8cd('0x5c')}];var _0xada58f=_[_0xb8cd('0x32')](_0x52d736,['value',_0x56c926[_0xb8cd('0x31')]])['name'];return db[_0xb8cd('0x65')][_0xb8cd('0x32')]({'where':{'name':_0xada58f,'userProfileId':_0x22106f[_0xb8cd('0x5d')]},'raw':!![]})[_0xb8cd('0x28')](function(_0x445ac3){if(_0x445ac3&&_0x445ac3[_0xb8cd('0x5e')]===0x0){return db['UserProfileResource'][_0xb8cd('0x5f')]({'name':_0x56c926[_0xb8cd('0x37')],'resourceId':_0x56c926['id'],'type':_0x445ac3[_0xb8cd('0x37')],'sectionId':_0x445ac3['id']},{})[_0xb8cd('0x28')](function(){return _0x5a287a;});}else{return _0x5a287a;}})[_0xb8cd('0x53')](function(_0x422012){logger[_0xb8cd('0x35')](_0xb8cd('0x60'),_0x422012);throw _0x422012;});}return _0x5a287a;});}})[_0xb8cd('0x28')](respondWithResult(_0x5ddc80,0xc9))[_0xb8cd('0x53')](handleError(_0x5ddc80,null));};exports[_0xb8cd('0x66')]=function(_0x4e742d,_0xd70b42){if(_0x4e742d[_0xb8cd('0x57')]['id']){delete _0x4e742d[_0xb8cd('0x57')]['id'];}return db[_0xb8cd('0x3a')][_0xb8cd('0x32')]({'where':{'id':_0x4e742d['params']['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0xd70b42,null))[_0xb8cd('0x28')](saveUpdates(_0x4e742d[_0xb8cd('0x57')],null))[_0xb8cd('0x28')](respondWithResult(_0xd70b42,null))['catch'](handleError(_0xd70b42,null));};exports['destroy']=function(_0x345ceb,_0x22de1d){return db[_0xb8cd('0x3a')][_0xb8cd('0x32')]({'where':{'id':_0x345ceb['params']['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x22de1d,null))['then'](removeEntity(_0x22de1d,null))[_0xb8cd('0x53')](handleError(_0x22de1d,null));};exports[_0xb8cd('0x67')]=function(_0x45065f,_0x4318c6,_0x5ad644){var _0x339c6a={'raw':![],'where':{}};var _0x2ffac8={};var _0x336d0e={'count':0x0,'rows':[]};return db[_0xb8cd('0x3a')][_0xb8cd('0x68')]({'where':{'id':_0x45065f['params']['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x4318c6,null))[_0xb8cd('0x28')](function(_0x20a5e9){if(_0x20a5e9){_0x2ffac8[_0xb8cd('0x3d')]=_[_0xb8cd('0x3e')](db[_0xb8cd('0x69')][_0xb8cd('0x56')]);_0x2ffac8[_0xb8cd('0x3f')]=_[_0xb8cd('0x3e')](_0x45065f['query']);_0x2ffac8[_0xb8cd('0x40')]=_[_0xb8cd('0x41')](_0x2ffac8[_0xb8cd('0x3d')],_0x2ffac8[_0xb8cd('0x3f')]);_0x339c6a['attributes']=_['intersection'](_0x2ffac8[_0xb8cd('0x3d')],qs[_0xb8cd('0x42')](_0x45065f[_0xb8cd('0x3f')][_0xb8cd('0x42')]));_0x339c6a[_0xb8cd('0x43')]=_0x339c6a[_0xb8cd('0x43')][_0xb8cd('0x44')]?_0x339c6a[_0xb8cd('0x43')]:_0x2ffac8[_0xb8cd('0x3d')];if(!_0x45065f['query'][_0xb8cd('0x45')](_0xb8cd('0x46'))){_0x339c6a[_0xb8cd('0x22')]=qs[_0xb8cd('0x22')](_0x45065f[_0xb8cd('0x3f')][_0xb8cd('0x22')]);_0x339c6a[_0xb8cd('0x20')]=qs[_0xb8cd('0x20')](_0x45065f[_0xb8cd('0x3f')][_0xb8cd('0x20')]);}_0x339c6a[_0xb8cd('0x47')]=qs[_0xb8cd('0x48')](_0x45065f[_0xb8cd('0x3f')]['sort']);_0x339c6a['where']=qs[_0xb8cd('0x40')](_[_0xb8cd('0x4a')](_0x45065f[_0xb8cd('0x3f')],_0x2ffac8['filters']));_0x339c6a[_0xb8cd('0x49')][_0xb8cd('0x6a')]=_0x20a5e9['id'];if(_0x45065f['query'][_0xb8cd('0x4d')]){_0x339c6a[_0xb8cd('0x49')]=_['merge'](_0x339c6a[_0xb8cd('0x49')],{'$or':_['map'](_0x339c6a[_0xb8cd('0x43')],function(_0x39c55e){var _0x410893={};_0x410893[_0x39c55e]={'$like':'%'+_0x45065f[_0xb8cd('0x3f')][_0xb8cd('0x4d')]+'%'};return _0x410893;})});}_0x339c6a=_[_0xb8cd('0x4b')]({},_0x339c6a,_0x45065f[_0xb8cd('0x4e')]);return db[_0xb8cd('0x69')][_0xb8cd('0x23')]({'where':_0x339c6a[_0xb8cd('0x49')]})[_0xb8cd('0x28')](function(_0x2e7714){_0x336d0e[_0xb8cd('0x23')]=_0x2e7714;if(_0x45065f[_0xb8cd('0x3f')][_0xb8cd('0x4f')]){_0x339c6a['include']=[{'all':!![]}];}return db[_0xb8cd('0x69')][_0xb8cd('0x51')](_0x339c6a);})[_0xb8cd('0x28')](function(_0x4472f7){_0x336d0e[_0xb8cd('0x52')]=_0x4472f7;return _0x336d0e;});}})[_0xb8cd('0x28')](respondWithFilteredResult(_0x4318c6,_0x339c6a))['catch'](handleError(_0x4318c6,null));};exports[_0xb8cd('0x6b')]=function(_0x4da410,_0x392f1e,_0x3680ab){var _0x2ebfad={'raw':!![],'where':{}};var _0x2e90c5={};var _0x184712={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x4da410['params']['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x392f1e,null))[_0xb8cd('0x28')](function(_0x3768c5){if(_0x3768c5){_0x2e90c5[_0xb8cd('0x3d')]=_['keys'](db[_0xb8cd('0x6c')]['rawAttributes']);_0x2e90c5[_0xb8cd('0x3f')]=_[_0xb8cd('0x3e')](_0x4da410[_0xb8cd('0x3f')]);_0x2e90c5[_0xb8cd('0x40')]=_[_0xb8cd('0x41')](_0x2e90c5[_0xb8cd('0x3d')],_0x2e90c5['query']);_0x2ebfad['attributes']=_[_0xb8cd('0x41')](_0x2e90c5[_0xb8cd('0x3d')],qs['fields'](_0x4da410[_0xb8cd('0x3f')][_0xb8cd('0x42')]));_0x2ebfad[_0xb8cd('0x43')]=_0x2ebfad[_0xb8cd('0x43')]['length']?_0x2ebfad['attributes']:_0x2e90c5[_0xb8cd('0x3d')];if(!_0x4da410[_0xb8cd('0x3f')][_0xb8cd('0x45')]('nolimit')){_0x2ebfad[_0xb8cd('0x22')]=qs[_0xb8cd('0x22')](_0x4da410[_0xb8cd('0x3f')][_0xb8cd('0x22')]);_0x2ebfad[_0xb8cd('0x20')]=qs[_0xb8cd('0x20')](_0x4da410[_0xb8cd('0x3f')][_0xb8cd('0x20')]);}_0x2ebfad['order']=qs[_0xb8cd('0x48')](_0x4da410[_0xb8cd('0x3f')]['sort']);_0x2ebfad[_0xb8cd('0x49')]=qs['filters'](_['pick'](_0x4da410['query'],_0x2e90c5[_0xb8cd('0x40')]));_0x2ebfad[_0xb8cd('0x49')][_0xb8cd('0x6a')]=_0x3768c5['id'];if(_0x4da410[_0xb8cd('0x3f')]['filter']){_0x2ebfad[_0xb8cd('0x49')]=_[_0xb8cd('0x4b')](_0x2ebfad['where'],{'$or':_[_0xb8cd('0x2e')](_0x2ebfad['attributes'],function(_0x2fc187){var _0x97158f={};_0x97158f[_0x2fc187]={'$like':'%'+_0x4da410[_0xb8cd('0x3f')][_0xb8cd('0x4d')]+'%'};return _0x97158f;})});}_0x2ebfad=_['merge']({},_0x2ebfad,_0x4da410[_0xb8cd('0x4e')]);return db[_0xb8cd('0x6c')][_0xb8cd('0x23')]({'where':_0x2ebfad['where']})[_0xb8cd('0x28')](function(_0x44245e){_0x184712['count']=_0x44245e;if(_0x4da410['query']['includeAll']){_0x2ebfad[_0xb8cd('0x50')]=[{'all':!![]}];}return db[_0xb8cd('0x6c')][_0xb8cd('0x51')](_0x2ebfad);})['then'](function(_0x5833fa){_0x184712[_0xb8cd('0x52')]=_0x5833fa;return _0x184712;});}})[_0xb8cd('0x28')](respondWithFilteredResult(_0x392f1e,_0x2ebfad))[_0xb8cd('0x53')](handleError(_0x392f1e,null));};exports[_0xb8cd('0x6d')]=function(_0x230373,_0x3ffc62,_0x5735e5){var _0x62405d={'raw':!![],'where':{}};var _0x285c78={};var _0x4cf522={'count':0x0,'rows':[]};return db[_0xb8cd('0x3a')][_0xb8cd('0x68')]({'where':{'id':_0x230373[_0xb8cd('0x55')]['id']}})['then'](handleEntityNotFound(_0x3ffc62,null))[_0xb8cd('0x28')](function(_0x46f56e){if(_0x46f56e){_0x285c78['model']=_[_0xb8cd('0x3e')](db[_0xb8cd('0x6e')][_0xb8cd('0x56')]);_0x285c78['query']=_[_0xb8cd('0x3e')](_0x230373[_0xb8cd('0x3f')]);_0x285c78['filters']=_[_0xb8cd('0x41')](_0x285c78[_0xb8cd('0x3d')],_0x285c78[_0xb8cd('0x3f')]);_0x62405d[_0xb8cd('0x43')]=_['intersection'](_0x285c78[_0xb8cd('0x3d')],qs[_0xb8cd('0x42')](_0x230373['query']['fields']));_0x62405d[_0xb8cd('0x43')]=_0x62405d[_0xb8cd('0x43')][_0xb8cd('0x44')]?_0x62405d[_0xb8cd('0x43')]:_0x285c78[_0xb8cd('0x3d')];if(!_0x230373[_0xb8cd('0x3f')][_0xb8cd('0x45')](_0xb8cd('0x46'))){_0x62405d['limit']=qs['limit'](_0x230373[_0xb8cd('0x3f')][_0xb8cd('0x22')]);_0x62405d['offset']=qs[_0xb8cd('0x20')](_0x230373[_0xb8cd('0x3f')]['offset']);}_0x62405d[_0xb8cd('0x47')]=qs[_0xb8cd('0x48')](_0x230373[_0xb8cd('0x3f')][_0xb8cd('0x48')]);_0x62405d[_0xb8cd('0x49')]=qs['filters'](_['pick'](_0x230373[_0xb8cd('0x3f')],_0x285c78[_0xb8cd('0x40')]));_0x62405d[_0xb8cd('0x49')]['VoiceQueueId']=_0x46f56e['id'];if(_0x230373['query'][_0xb8cd('0x4d')]){_0x62405d[_0xb8cd('0x49')]=_[_0xb8cd('0x4b')](_0x62405d['where'],{'$or':_['map'](_0x62405d['attributes'],function(_0xfcad91){var _0x128bc={};_0x128bc[_0xfcad91]={'$like':'%'+_0x230373[_0xb8cd('0x3f')][_0xb8cd('0x4d')]+'%'};return _0x128bc;})});}_0x62405d=_['merge']({},_0x62405d,_0x230373[_0xb8cd('0x4e')]);return db[_0xb8cd('0x6e')][_0xb8cd('0x23')]({'where':_0x62405d[_0xb8cd('0x49')]})[_0xb8cd('0x28')](function(_0x3d1d5a){_0x4cf522['count']=_0x3d1d5a;if(_0x230373[_0xb8cd('0x3f')]['includeAll']){_0x62405d[_0xb8cd('0x50')]=[{'all':!![]}];}return db[_0xb8cd('0x6e')]['findAll'](_0x62405d);})[_0xb8cd('0x28')](function(_0x64eca3){_0x4cf522['rows']=_0x64eca3;return _0x4cf522;});}})[_0xb8cd('0x28')](respondWithFilteredResult(_0x3ffc62,_0x62405d))[_0xb8cd('0x53')](handleError(_0x3ffc62,null));};exports[_0xb8cd('0x6f')]=function(_0x1314ad,_0x471766,_0x3fcff9){var _0xd07dea={'raw':!![],'where':{}};var _0x4e5c4f={};var _0x2a8f7d={'count':0x0,'rows':[]};return db[_0xb8cd('0x3a')][_0xb8cd('0x68')]({'where':{'id':_0x1314ad[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x471766,null))[_0xb8cd('0x28')](function(_0x5e5da6){if(_0x5e5da6){_0x4e5c4f['model']=_[_0xb8cd('0x3e')](db[_0xb8cd('0x70')]['rawAttributes']);_0x4e5c4f[_0xb8cd('0x3f')]=_[_0xb8cd('0x3e')](_0x1314ad[_0xb8cd('0x3f')]);_0x4e5c4f[_0xb8cd('0x40')]=_[_0xb8cd('0x41')](_0x4e5c4f[_0xb8cd('0x3d')],_0x4e5c4f['query']);_0xd07dea[_0xb8cd('0x43')]=_[_0xb8cd('0x41')](_0x4e5c4f[_0xb8cd('0x3d')],qs[_0xb8cd('0x42')](_0x1314ad['query'][_0xb8cd('0x42')]));_0xd07dea[_0xb8cd('0x43')]=_0xd07dea['attributes'][_0xb8cd('0x44')]?_0xd07dea[_0xb8cd('0x43')]:_0x4e5c4f[_0xb8cd('0x3d')];if(!_0x1314ad['query'][_0xb8cd('0x45')](_0xb8cd('0x46'))){_0xd07dea['limit']=qs[_0xb8cd('0x22')](_0x1314ad[_0xb8cd('0x3f')][_0xb8cd('0x22')]);_0xd07dea[_0xb8cd('0x20')]=qs[_0xb8cd('0x20')](_0x1314ad[_0xb8cd('0x3f')][_0xb8cd('0x20')]);}_0xd07dea[_0xb8cd('0x47')]=qs['sort'](_0x1314ad['query'][_0xb8cd('0x48')]);_0xd07dea['where']=qs[_0xb8cd('0x40')](_[_0xb8cd('0x4a')](_0x1314ad[_0xb8cd('0x3f')],_0x4e5c4f['filters']));_0xd07dea['where'][_0xb8cd('0x6a')]=_0x5e5da6['id'];if(_0x1314ad[_0xb8cd('0x3f')][_0xb8cd('0x4d')]){_0xd07dea['where']=_[_0xb8cd('0x4b')](_0xd07dea[_0xb8cd('0x49')],{'$or':_['map'](_0xd07dea['attributes'],function(_0x1120d9){var _0x579c3d={};_0x579c3d[_0x1120d9]={'$like':'%'+_0x1314ad[_0xb8cd('0x3f')]['filter']+'%'};return _0x579c3d;})});}_0xd07dea=_['merge']({},_0xd07dea,_0x1314ad[_0xb8cd('0x4e')]);return db[_0xb8cd('0x70')][_0xb8cd('0x23')]({'where':_0xd07dea[_0xb8cd('0x49')]})['then'](function(_0x93e31e){_0x2a8f7d[_0xb8cd('0x23')]=_0x93e31e;if(_0x1314ad['query'][_0xb8cd('0x4f')]){_0xd07dea[_0xb8cd('0x50')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0xd07dea);})['then'](function(_0x7767ab){_0x2a8f7d[_0xb8cd('0x52')]=_0x7767ab;return _0x2a8f7d;});}})[_0xb8cd('0x28')](respondWithFilteredResult(_0x471766,_0xd07dea))['catch'](handleError(_0x471766,null));};exports[_0xb8cd('0x71')]=function(_0x169c08,_0x331d95,_0x5a1697){var _0x231116={};var _0x56faff={};var _0x3c4358;var _0x1124d0;return db[_0xb8cd('0x3a')][_0xb8cd('0x68')]({'where':{'id':_0x169c08[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x331d95,null))[_0xb8cd('0x28')](function(_0x5a8e7c){if(_0x5a8e7c){_0x3c4358=_0x5a8e7c;_0x56faff['model']=_['keys'](db['Team'][_0xb8cd('0x56')]);_0x56faff['query']=_['keys'](_0x169c08[_0xb8cd('0x3f')]);_0x56faff['filters']=_[_0xb8cd('0x41')](_0x56faff[_0xb8cd('0x3d')],_0x56faff[_0xb8cd('0x3f')]);_0x231116['attributes']=_[_0xb8cd('0x41')](_0x56faff[_0xb8cd('0x3d')],qs['fields'](_0x169c08[_0xb8cd('0x3f')][_0xb8cd('0x42')]));_0x231116[_0xb8cd('0x43')]=_0x231116[_0xb8cd('0x43')][_0xb8cd('0x44')]?_0x231116[_0xb8cd('0x43')]:_0x56faff[_0xb8cd('0x3d')];_0x231116[_0xb8cd('0x47')]=qs['sort'](_0x169c08[_0xb8cd('0x3f')]['sort']);_0x231116[_0xb8cd('0x49')]=qs[_0xb8cd('0x40')](_['pick'](_0x169c08[_0xb8cd('0x3f')],_0x56faff[_0xb8cd('0x40')]));if(_0x169c08[_0xb8cd('0x3f')][_0xb8cd('0x4d')]){_0x231116[_0xb8cd('0x49')]=_[_0xb8cd('0x4b')](_0x231116[_0xb8cd('0x49')],{'$or':_['map'](_0x231116[_0xb8cd('0x43')],function(_0x4d8be3){var _0x117269={};_0x117269[_0x4d8be3]={'$like':'%'+_0x169c08[_0xb8cd('0x3f')][_0xb8cd('0x4d')]+'%'};return _0x117269;})});}_0x231116=_[_0xb8cd('0x4b')]({},_0x231116,_0x169c08[_0xb8cd('0x4e')]);return _0x3c4358['getTeams'](_0x231116);}})['then'](function(_0x126e5f){if(_0x126e5f){_0x1124d0=_0x126e5f['length'];if(!_0x169c08[_0xb8cd('0x3f')][_0xb8cd('0x45')](_0xb8cd('0x46'))){_0x231116[_0xb8cd('0x22')]=qs[_0xb8cd('0x22')](_0x169c08['query'][_0xb8cd('0x22')]);_0x231116[_0xb8cd('0x20')]=qs[_0xb8cd('0x20')](_0x169c08[_0xb8cd('0x3f')][_0xb8cd('0x20')]);}return _0x3c4358[_0xb8cd('0x71')](_0x231116);}})['then'](function(_0x35fbe1){if(_0x35fbe1){return _0x35fbe1?{'count':_0x1124d0,'rows':_0x35fbe1}:null;}})['then'](respondWithResult(_0x331d95,null))[_0xb8cd('0x53')](handleError(_0x331d95,null));};exports[_0xb8cd('0x72')]=function(_0x48edf7,_0x4635,_0x4aa6fe){var _0x72cd46=_0x48edf7[_0xb8cd('0x57')][_0xb8cd('0x73')];var _0x3944a8=_[_0xb8cd('0x2e')](_0x72cd46,'id');return db[_0xb8cd('0x74')][_0xb8cd('0x51')]({'where':{'id':_0x3944a8},'attributes':['id'],'include':[{'model':db[_0xb8cd('0x75')],'as':_0xb8cd('0x76'),'attributes':['id',_0xb8cd('0x37'),_0xb8cd('0x77'),_0xb8cd('0x78'),'interface'],'raw':!![]}]})['then'](function(_0x274b08){if(_0x274b08){var _0x597e47=_[_0xb8cd('0x79')](_0x274b08,function(_0x59d140){var _0x289a84=_0x59d140['get']({'plain':!![]});_0x289a84[_0xb8cd('0x76')]['forEach'](function(_0x1f666c){_0x1f666c[_0xb8cd('0x7a')]=_[_0xb8cd('0x32')](_0x72cd46,{'id':_0x289a84['id']})[_0xb8cd('0x7a')];});return _0x289a84[_0xb8cd('0x76')];});return db['VoiceQueue'][_0xb8cd('0x32')]({'where':{'id':_0x48edf7[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](function(_0x2f6c91){return db[_0xb8cd('0x7b')][_0xb8cd('0x7c')](function(_0x1e3a29){return _0x2f6c91[_0xb8cd('0x72')](_0x3944a8,{'transaction':_0x1e3a29})[_0xb8cd('0x28')](function(){return BPromise['each'](_0x72cd46,function(_0x8403e5){return db[_0xb8cd('0x7d')][_0xb8cd('0x7e')]({'TeamId':_0x8403e5['id'],'VoiceQueueId':_0x48edf7[_0xb8cd('0x55')]['id'],'penalty':_0x8403e5[_0xb8cd('0x7a')]},{'transaction':_0x1e3a29});});})[_0xb8cd('0x28')](function(){return BPromise[_0xb8cd('0x7f')](_0x597e47,function(_0x15bb1e){return db[_0xb8cd('0x80')][_0xb8cd('0x81')]({'where':{'UserId':_0x15bb1e['id'],'VoiceQueueId':_0x48edf7['params']['id']},'defaults':{'penalty':_0x15bb1e[_0xb8cd('0x7a')]},'transaction':_0x1e3a29});});})[_0xb8cd('0x28')](function(){return BPromise[_0xb8cd('0x7f')](_[_0xb8cd('0x4d')](_0x597e47,{'online':!![]}),function(_0x2b8052){return db['UserVoiceQueueRt'][_0xb8cd('0x7e')]({'membername':_0x2b8052[_0xb8cd('0x37')],'UserId':_0x2b8052['id'],'queue_name':_0x2f6c91['name'],'VoiceQueueId':_0x2f6c91['id'],'interface':_[_0xb8cd('0x82')](_0x2b8052['interface'])?util['format'](_0xb8cd('0x83'),_0x2b8052[_0xb8cd('0x37')]):_0x2b8052['interface'],'paused':_0x2b8052[_0xb8cd('0x78')]||![],'penalty':_0x2b8052[_0xb8cd('0x7a')]},{'transaction':_0x1e3a29});});})[_0xb8cd('0x28')](function(){_0x597e47[_0xb8cd('0x84')](function(_0xcab238){socket[_0xb8cd('0x85')](_0xb8cd('0x86'),{'UserId':_0xcab238['id'],'VoiceQueueId':_0x2f6c91['id']});});});});});}})['then'](respondWithStatusCode(_0x4635,null))[_0xb8cd('0x53')](handleError(_0x4635,null));};exports[_0xb8cd('0x87')]=function(_0x207910,_0x118296,_0x2d6757){return db['Team']['findAll']({'where':{'id':_0x207910[_0xb8cd('0x3f')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb8cd('0x75')],'as':_0xb8cd('0x76'),'attributes':['id'],'raw':!![]}]})[_0xb8cd('0x28')](handleEntityNotFound(_0x118296,null))[_0xb8cd('0x28')](function(_0x179a20){var _0x100a33=_[_0xb8cd('0x2e')](_0x179a20,'id');var _0xd0c49e=[];var _0x1982c6=[];var _0x4f6aeb=squel[_0xb8cd('0x88')]();_0x4f6aeb['field'](_0xb8cd('0x89'))[_0xb8cd('0x8a')]('team_has_voice_queues','tq')[_0xb8cd('0x8b')](_0xb8cd('0x8c'),'ut',_0xb8cd('0x8d'))[_0xb8cd('0x49')](_0xb8cd('0x8e'),_0x207910['params']['id']);for(var _0x514a65=0x0;_0x514a65<_0x179a20[_0xb8cd('0x44')];_0x514a65+=0x1){let _0x49ec8d=_0x179a20[_0x514a65];for(var _0x1fb878=0x0;_0x1fb878<_0x49ec8d[_0xb8cd('0x76')]['length'];_0x1fb878+=0x1){let _0x33c16a=_0x49ec8d['Agents'][_0x1fb878];var _0x3c41e1=_0x4f6aeb['clone']();_0x3c41e1['where'](_0xb8cd('0x8f'),_0x33c16a['id']);_0x1982c6[_0xb8cd('0x90')](db[_0xb8cd('0x7b')][_0xb8cd('0x3f')](_0x3c41e1[_0xb8cd('0x91')](),{'type':db['sequelize'][_0xb8cd('0x92')]['SELECT']})[_0xb8cd('0x28')](function(_0x1a8ef1){if(_0x1a8ef1['length']===0x1){return _0x33c16a['id'];}else{var _0x35136f=_[_0xb8cd('0x93')](_[_0xb8cd('0x2e')](_0x1a8ef1,_0xb8cd('0x94')),function(_0x3fbbdd){return _[_0xb8cd('0x30')](_0x100a33,_0x3fbbdd);});if(_0x35136f){return _0x33c16a['id'];}}}));}}return BPromise[_0xb8cd('0x95')](_0x1982c6)[_0xb8cd('0x28')](function(_0x11a163){_0xd0c49e=_(_0xd0c49e)[_0xb8cd('0x96')](_0x11a163)[_0xb8cd('0x97')]()['value']();return db[_0xb8cd('0x3a')][_0xb8cd('0x32')]({'where':{'id':_0x207910[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](function(_0x1eee42){return db[_0xb8cd('0x7b')][_0xb8cd('0x7c')](function(_0x3619b9){return _0x1eee42[_0xb8cd('0x87')](_0x207910[_0xb8cd('0x3f')][_0xb8cd('0x98')],{'transaction':_0x3619b9})[_0xb8cd('0x28')](function(){if(!_[_0xb8cd('0x99')](_0xd0c49e)){return _0x1eee42['removeAgents'](_0xd0c49e,{'transaction':_0x3619b9})['then'](function(){return db[_0xb8cd('0x9a')][_0xb8cd('0x29')]({'where':{'VoiceQueueId':_0x207910[_0xb8cd('0x55')]['id'],'UserId':_0xd0c49e},'transaction':_0x3619b9});});}})['then'](function(){_0xd0c49e[_0xb8cd('0x84')](function(_0x21d95e){socket[_0xb8cd('0x85')](_0xb8cd('0x9b'),{'UserId':_0x21d95e,'VoiceQueueId':_0x1eee42['id']});});});});});});})[_0xb8cd('0x28')](respondWithStatusCode(_0x118296,null))[_0xb8cd('0x53')](handleError(_0x118296,null));};exports['addAgents']=function(_0x6a48d4,_0x4938b3,_0x32bb2d){var _0x57350b,_0x2c393c;return db[_0xb8cd('0x3a')][_0xb8cd('0x32')]({'where':{'id':_0x6a48d4[_0xb8cd('0x55')]['id']}})['then'](handleEntityNotFound(_0x4938b3,null))[_0xb8cd('0x28')](function(_0x65e820){if(_0x65e820){_0x2c393c=_0x65e820;return _0x65e820[_0xb8cd('0x9c')](_0x6a48d4[_0xb8cd('0x57')]['ids'],_[_0xb8cd('0x62')](_0x6a48d4[_0xb8cd('0x57')],[_0xb8cd('0x98'),'id'])||{})[_0xb8cd('0x9d')](function(_0x3a81c1){for(var _0x20c8b2=0x0;_0x20c8b2<_0x6a48d4['body']['ids'][_0xb8cd('0x44')];_0x20c8b2+=0x1){socket[_0xb8cd('0x85')]('userVoiceQueue:save',{'UserId':_0x6a48d4['body'][_0xb8cd('0x98')][_0x20c8b2],'VoiceQueueId':_0x6a48d4['params']['id']});}return _0x3a81c1;});}})[_0xb8cd('0x28')](function(_0xb8a5e){_0x57350b=_0xb8a5e||[];if(_0x2c393c){return db[_0xb8cd('0x75')][_0xb8cd('0x51')]({'where':{'id':_0x6a48d4[_0xb8cd('0x57')][_0xb8cd('0x98')]},'attributes':['id',_0xb8cd('0x37'),_0xb8cd('0x77'),'voicePause','interface'],'raw':!![]});}})['then'](function(_0x4d0f78){if(!_[_0xb8cd('0x99')](_0x4d0f78)){var _0x11747d=[];for(var _0x2bd525=0x0;_0x2bd525<_0x4d0f78['length'];_0x2bd525++){if(_0x4d0f78[_0x2bd525][_0xb8cd('0x77')]){_0x11747d[_0xb8cd('0x90')](db[_0xb8cd('0x9a')]['upsert']({'membername':_0x4d0f78[_0x2bd525][_0xb8cd('0x37')],'UserId':_0x4d0f78[_0x2bd525]['id'],'queue_name':_0x2c393c[_0xb8cd('0x37')],'VoiceQueueId':_0x2c393c['id'],'interface':_[_0xb8cd('0x82')](_0x4d0f78[_0x2bd525][_0xb8cd('0x9e')])?util[_0xb8cd('0x9f')](_0xb8cd('0x83'),_0x4d0f78[_0x2bd525][_0xb8cd('0x37')]):_0x4d0f78[_0x2bd525]['interface'],'paused':_0x4d0f78[_0x2bd525]['voicePause']||![],'penalty':_0x6a48d4['body'][_0xb8cd('0x7a')]||0x0}));}}return BPromise[_0xb8cd('0x95')](_0x11747d);}})['then'](function(){return _0x57350b;})['then'](respondWithResult(_0x4938b3,null))['catch'](handleError(_0x4938b3,null));};exports['removeAgents']=function(_0x223651,_0x4faa96,_0x21ebaa){return db[_0xb8cd('0x3a')][_0xb8cd('0x32')]({'where':{'id':_0x223651[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x4faa96,null))[_0xb8cd('0x28')](function(_0x48f7c2){if(_0x48f7c2){return _0x48f7c2[_0xb8cd('0xa0')](_0x223651[_0xb8cd('0x3f')]['ids'])[_0xb8cd('0x28')](function(){if(_[_0xb8cd('0xa1')](_0x223651[_0xb8cd('0x3f')][_0xb8cd('0x98')])){for(var _0x319ce6=0x0;_0x319ce6<_0x223651[_0xb8cd('0x3f')][_0xb8cd('0x98')]['length'];_0x319ce6+=0x1){socket[_0xb8cd('0x85')](_0xb8cd('0x9b'),{'UserId':Number(_0x223651[_0xb8cd('0x3f')]['ids'][_0x319ce6]),'VoiceQueueId':Number(_0x223651[_0xb8cd('0x55')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x223651['query'][_0xb8cd('0x98')]),'VoiceQueueId':Number(_0x223651[_0xb8cd('0x55')]['id'])});}});}})[_0xb8cd('0x28')](function(_0x32601a){return db[_0xb8cd('0x9a')][_0xb8cd('0x29')]({'where':{'VoiceQueueId':_0x223651[_0xb8cd('0x55')]['id'],'UserId':_0x223651[_0xb8cd('0x3f')][_0xb8cd('0x98')]}})[_0xb8cd('0x28')](function(){return _0x32601a;});})[_0xb8cd('0x28')](respondWithStatusCode(_0x4faa96,null))[_0xb8cd('0x53')](handleError(_0x4faa96,null));};exports['getAgents']=function(_0x4d4738,_0x5a89a9,_0x37f6b5){var _0x1d8b9f={};var _0xb796f5={};var _0xc3ca0a;var _0x533b0a;return db[_0xb8cd('0x3a')][_0xb8cd('0x68')]({'where':{'id':_0x4d4738['params']['id']}})['then'](handleEntityNotFound(_0x5a89a9,null))['then'](function(_0x23c1e9){if(_0x23c1e9){_0xc3ca0a=_0x23c1e9;_0xb796f5[_0xb8cd('0x3d')]=_['keys'](db[_0xb8cd('0x75')][_0xb8cd('0x56')]);_0xb796f5[_0xb8cd('0x3f')]=_['keys'](_0x4d4738['query']);_0xb796f5[_0xb8cd('0x40')]=_['intersection'](_0xb796f5[_0xb8cd('0x3d')],_0xb796f5[_0xb8cd('0x3f')]);_0x1d8b9f[_0xb8cd('0x43')]=_[_0xb8cd('0x41')](_0xb796f5[_0xb8cd('0x3d')],qs[_0xb8cd('0x42')](_0x4d4738[_0xb8cd('0x3f')][_0xb8cd('0x42')]));_0x1d8b9f[_0xb8cd('0x43')]=_0x1d8b9f[_0xb8cd('0x43')][_0xb8cd('0x44')]?_0x1d8b9f[_0xb8cd('0x43')]:_0xb796f5['model'];_0x1d8b9f[_0xb8cd('0x47')]=qs[_0xb8cd('0x48')](_0x4d4738['query'][_0xb8cd('0x48')]);_0x1d8b9f[_0xb8cd('0x49')]=qs[_0xb8cd('0x40')](_[_0xb8cd('0x4a')](_0x4d4738['query'],_0xb796f5[_0xb8cd('0x40')]));if(_0x4d4738[_0xb8cd('0x3f')][_0xb8cd('0x4d')]){_0x1d8b9f[_0xb8cd('0x49')]=_[_0xb8cd('0x4b')](_0x1d8b9f[_0xb8cd('0x49')],{'$or':_[_0xb8cd('0x2e')](_0x1d8b9f[_0xb8cd('0x43')],function(_0x322e16){var _0x4bc323={};_0x4bc323[_0x322e16]={'$like':'%'+_0x4d4738[_0xb8cd('0x3f')]['filter']+'%'};return _0x4bc323;})});}_0x1d8b9f=_['merge']({},_0x1d8b9f,_0x4d4738[_0xb8cd('0x4e')]);return _0xc3ca0a['getAgents'](_0x1d8b9f);}})[_0xb8cd('0x28')](function(_0xfdcc8f){if(_0xfdcc8f){_0x533b0a=_0xfdcc8f[_0xb8cd('0x44')];if(!_0x4d4738['query'][_0xb8cd('0x45')]('nolimit')){_0x1d8b9f[_0xb8cd('0x22')]=qs['limit'](_0x4d4738['query']['limit']);_0x1d8b9f[_0xb8cd('0x20')]=qs[_0xb8cd('0x20')](_0x4d4738[_0xb8cd('0x3f')][_0xb8cd('0x20')]);}return _0xc3ca0a[_0xb8cd('0xa2')](_0x1d8b9f);}})['then'](function(_0x2d6815){if(_0x2d6815){return _0x2d6815?{'count':_0x533b0a,'rows':_0x2d6815}:null;}})[_0xb8cd('0x28')](respondWithResult(_0x5a89a9,null))[_0xb8cd('0x53')](handleError(_0x5a89a9,null));};exports[_0xb8cd('0xa3')]=function(_0xad7abd,_0xd00658,_0x51f825){var _0x4f5676={};var _0x5dd8e5={};var _0x36c452;var _0x32f356;return db[_0xb8cd('0x3a')][_0xb8cd('0x68')]({'where':{'id':_0xad7abd[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0xd00658,null))[_0xb8cd('0x28')](function(_0x52a09d){if(_0x52a09d){_0x36c452=_0x52a09d;_0x5dd8e5[_0xb8cd('0x3d')]=_[_0xb8cd('0x3e')](db[_0xb8cd('0x9a')][_0xb8cd('0x56')]);_0x5dd8e5[_0xb8cd('0x3f')]=_[_0xb8cd('0x3e')](_0xad7abd['query']);_0x5dd8e5[_0xb8cd('0x40')]=_[_0xb8cd('0x41')](_0x5dd8e5[_0xb8cd('0x3d')],_0x5dd8e5['query']);_0x4f5676[_0xb8cd('0x43')]=_[_0xb8cd('0x41')](_0x5dd8e5['model'],qs[_0xb8cd('0x42')](_0xad7abd[_0xb8cd('0x3f')]['fields']));_0x4f5676['attributes']=_0x4f5676['attributes']['length']?_0x4f5676[_0xb8cd('0x43')]:_0x5dd8e5[_0xb8cd('0x3d')];_0x4f5676[_0xb8cd('0x47')]=qs[_0xb8cd('0x48')](_0xad7abd[_0xb8cd('0x3f')][_0xb8cd('0x48')]);_0x4f5676['where']=qs['filters'](_[_0xb8cd('0x4a')](_0xad7abd[_0xb8cd('0x3f')],_0x5dd8e5[_0xb8cd('0x40')]));if(_0xad7abd[_0xb8cd('0x3f')][_0xb8cd('0x4d')]){_0x4f5676[_0xb8cd('0x49')]=_[_0xb8cd('0x4b')](_0x4f5676[_0xb8cd('0x49')],{'$or':_[_0xb8cd('0x2e')](_0x4f5676['attributes'],function(_0x57dc6b){var _0x10199c={};_0x10199c[_0x57dc6b]={'$like':'%'+_0xad7abd['query'][_0xb8cd('0x4d')]+'%'};return _0x10199c;})});}_0x4f5676=_['merge']({},_0x4f5676,_0xad7abd[_0xb8cd('0x4e')]);return _0x36c452['getMembers'](_0x4f5676);}})[_0xb8cd('0x28')](function(_0x50e148){if(_0x50e148){_0x32f356=_0x50e148['length'];if(!_0xad7abd[_0xb8cd('0x3f')][_0xb8cd('0x45')](_0xb8cd('0x46'))){_0x4f5676[_0xb8cd('0x22')]=qs['limit'](_0xad7abd[_0xb8cd('0x3f')][_0xb8cd('0x22')]);_0x4f5676[_0xb8cd('0x20')]=qs[_0xb8cd('0x20')](_0xad7abd[_0xb8cd('0x3f')][_0xb8cd('0x20')]);}return _0x36c452[_0xb8cd('0xa3')](_0x4f5676);}})['then'](function(_0x137e57){return _0x137e57?{'count':_0x32f356,'rows':_0x137e57}:null;})['then'](respondWithResult(_0xd00658,null))[_0xb8cd('0x53')](handleError(_0xd00658,null));};exports[_0xb8cd('0xa4')]=function(_0x3ab6a1,_0x1c6d77,_0x3e3e3a){var _0x2a9810={};var _0x513089={};var _0x1236ca;var _0x5b19fb;return db['VoiceQueue'][_0xb8cd('0x68')]({'where':{'id':_0x3ab6a1[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x1c6d77,null))[_0xb8cd('0x28')](function(_0x17949a){if(_0x17949a){_0x1236ca=_0x17949a;_0x513089['model']=_[_0xb8cd('0x3e')](db[_0xb8cd('0xa5')]['rawAttributes']);_0x513089[_0xb8cd('0x3f')]=_['keys'](_0x3ab6a1[_0xb8cd('0x3f')]);_0x513089['filters']=_['intersection'](_0x513089['model'],_0x513089[_0xb8cd('0x3f')]);_0x2a9810['attributes']=_['intersection'](_0x513089['model'],qs[_0xb8cd('0x42')](_0x3ab6a1[_0xb8cd('0x3f')]['fields']));_0x2a9810[_0xb8cd('0x43')]=_0x2a9810['attributes'][_0xb8cd('0x44')]?_0x2a9810[_0xb8cd('0x43')]:_0x513089[_0xb8cd('0x3d')];_0x2a9810[_0xb8cd('0x47')]=qs[_0xb8cd('0x48')](_0x3ab6a1[_0xb8cd('0x3f')][_0xb8cd('0x48')]);_0x2a9810[_0xb8cd('0x49')]=qs['filters'](_['pick'](_0x3ab6a1['query'],_0x513089[_0xb8cd('0x40')]));if(_0x3ab6a1[_0xb8cd('0x3f')][_0xb8cd('0x4d')]){_0x2a9810['where']=_['merge'](_0x2a9810[_0xb8cd('0x49')],{'$or':_[_0xb8cd('0x2e')](_0x2a9810[_0xb8cd('0x43')],function(_0x1cbc0f){var _0x3fcef6={};_0x3fcef6[_0x1cbc0f]={'$like':'%'+_0x3ab6a1[_0xb8cd('0x3f')][_0xb8cd('0x4d')]+'%'};return _0x3fcef6;})});}_0x2a9810=_[_0xb8cd('0x4b')]({},_0x2a9810,_0x3ab6a1[_0xb8cd('0x4e')]);return _0x1236ca['getLists'](_0x2a9810);}})[_0xb8cd('0x28')](function(_0x21f658){if(_0x21f658){_0x5b19fb=_0x21f658[_0xb8cd('0x44')];if(!_0x3ab6a1[_0xb8cd('0x3f')][_0xb8cd('0x45')](_0xb8cd('0x46'))){_0x2a9810[_0xb8cd('0x22')]=qs['limit'](_0x3ab6a1['query'][_0xb8cd('0x22')]);_0x2a9810[_0xb8cd('0x20')]=qs[_0xb8cd('0x20')](_0x3ab6a1['query'][_0xb8cd('0x20')]);}return _0x1236ca[_0xb8cd('0xa4')](_0x2a9810);}})['then'](function(_0x4125bf){if(_0x4125bf){return _0x4125bf?{'count':_0x5b19fb,'rows':_0x4125bf}:null;}})[_0xb8cd('0x28')](respondWithResult(_0x1c6d77,null))[_0xb8cd('0x53')](handleError(_0x1c6d77,null));};exports[_0xb8cd('0xa6')]=function(_0x3c1da4,_0x25f31b,_0x389c0e){var _0x34a47a,_0xb4c28a;return db['VoiceQueue'][_0xb8cd('0x32')]({'where':{'id':_0x3c1da4[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x25f31b,null))['then'](function(_0x14029a){if(_0x14029a){_0xb4c28a=_0x14029a;return _0x14029a['addLists'](_0x3c1da4[_0xb8cd('0x57')][_0xb8cd('0x98')],_['omit'](_0x3c1da4['body'],[_0xb8cd('0x98'),'id'])||{});}return null;})['spread'](function(_0x107689){var _0x16ebf5;_0x34a47a=_0x107689||[];var _0x213f73=[];if(_0x107689){for(var _0x367bff=0x0;_0x367bff<_0x107689[_0xb8cd('0x44')];_0x367bff+=0x1){var _0x51a7c4=_0x107689[_0x367bff]['get']({'plain':!![]});_0xb4c28a[_0xb8cd('0xa7')]=_0x3c1da4['body']['dialCheckDuplicateType']?_0x3c1da4['body'][_0xb8cd('0xa7')]:_0xb4c28a[_0xb8cd('0xa7')];switch(_0xb4c28a['dialCheckDuplicateType']){case _0xb8cd('0xa8'):_0x16ebf5=squel[_0xb8cd('0xa9')]()[_0xb8cd('0xaa')](_0xb8cd('0xab'))[_0xb8cd('0xac')](['phone','scheduledAt',_0xb8cd('0xad'),_0xb8cd('0xae'),_0xb8cd('0x6a'),_0xb8cd('0x63'),'updatedAt'],squel[_0xb8cd('0x88')]()[_0xb8cd('0xaf')](_0xb8cd('0xb0'),_0xb8cd('0xb0'))['field']('NOW()',_0xb8cd('0xb1'))[_0xb8cd('0xaf')]('id',_0xb8cd('0xad'))[_0xb8cd('0xaf')](_0x51a7c4[_0xb8cd('0xb2')][_0xb8cd('0x91')](),_0xb8cd('0xae'))['field'](_0x3c1da4[_0xb8cd('0x55')]['id'][_0xb8cd('0x91')](),_0xb8cd('0x6a'))[_0xb8cd('0xaf')](_0xb8cd('0xb3'),_0xb8cd('0x63'))[_0xb8cd('0xaf')]('NOW()','updatedAt')[_0xb8cd('0x8a')](_0xb8cd('0xb4'))[_0xb8cd('0x49')](_0xb8cd('0xb5'))[_0xb8cd('0x49')](_0xb8cd('0xb6'),_0x51a7c4[_0xb8cd('0xb2')][_0xb8cd('0x91')]())[_0xb8cd('0x49')](_0xb8cd('0xb7'))[_0xb8cd('0x49')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb8cd('0x88')]()['field'](_0xb8cd('0xb8'))[_0xb8cd('0x8a')](_0xb8cd('0xb9'))['where'](_0xb8cd('0x8e'),_0x3c1da4[_0xb8cd('0x55')]['id'][_0xb8cd('0x91')]()))[_0xb8cd('0x49')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xb8cd('0xaf')]('COALESCE(phone,\x27\x27)')['from'](_0xb8cd('0xab'))['where'](_0xb8cd('0x8e'),_0x3c1da4[_0xb8cd('0x55')]['id'][_0xb8cd('0x91')]())))[_0xb8cd('0x91')]();break;case'onlyIfOpen':_0x16ebf5=squel['insert']()['into'](_0xb8cd('0xab'))['fromQuery']([_0xb8cd('0xb0'),_0xb8cd('0xb1'),'ContactId',_0xb8cd('0xae'),_0xb8cd('0x6a'),_0xb8cd('0x63'),_0xb8cd('0x64')],squel[_0xb8cd('0x88')]()[_0xb8cd('0xaf')](_0xb8cd('0xb0'),_0xb8cd('0xb0'))['field'](_0xb8cd('0xb3'),_0xb8cd('0xb1'))[_0xb8cd('0xaf')]('id',_0xb8cd('0xad'))[_0xb8cd('0xaf')](_0x51a7c4[_0xb8cd('0xb2')][_0xb8cd('0x91')](),_0xb8cd('0xae'))[_0xb8cd('0xaf')](_0x3c1da4['params']['id'][_0xb8cd('0x91')](),'VoiceQueueId')[_0xb8cd('0xaf')]('NOW()',_0xb8cd('0x63'))[_0xb8cd('0xaf')](_0xb8cd('0xb3'),_0xb8cd('0x64'))[_0xb8cd('0x8a')](_0xb8cd('0xb4'))[_0xb8cd('0x49')](_0xb8cd('0xb5'))[_0xb8cd('0x49')](_0xb8cd('0xb6'),_0x51a7c4[_0xb8cd('0xb2')][_0xb8cd('0x91')]())[_0xb8cd('0x49')](_0xb8cd('0xb7'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xb8cd('0x88')]()[_0xb8cd('0xaf')](_0xb8cd('0xba'))[_0xb8cd('0x8a')](_0xb8cd('0xab'))[_0xb8cd('0x49')](_0xb8cd('0x8e'),_0x3c1da4[_0xb8cd('0x55')]['id'][_0xb8cd('0x91')]())))[_0xb8cd('0x91')]();break;default:_0x16ebf5=squel[_0xb8cd('0xa9')]()['into']('cm_hopper')['fromQuery']([_0xb8cd('0xb0'),_0xb8cd('0xb1'),'ContactId',_0xb8cd('0xae'),_0xb8cd('0x6a'),'createdAt',_0xb8cd('0x64')],squel[_0xb8cd('0x88')]()[_0xb8cd('0xaf')](_0xb8cd('0xb0'),_0xb8cd('0xb0'))[_0xb8cd('0xaf')](_0xb8cd('0xb3'),_0xb8cd('0xb1'))[_0xb8cd('0xaf')]('id','ContactId')['field'](_0x51a7c4[_0xb8cd('0xb2')][_0xb8cd('0x91')](),_0xb8cd('0xae'))[_0xb8cd('0xaf')](_0x3c1da4[_0xb8cd('0x55')]['id'][_0xb8cd('0x91')](),'VoiceQueueId')['field']('NOW()',_0xb8cd('0x63'))[_0xb8cd('0xaf')](_0xb8cd('0xb3'),'updatedAt')[_0xb8cd('0x8a')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')['where'](_0xb8cd('0xb6'),_0x51a7c4['CmListId'][_0xb8cd('0x91')]())[_0xb8cd('0x49')](_0xb8cd('0xb7')))[_0xb8cd('0x91')]();}_0x213f73['push'](db[_0xb8cd('0x7b')][_0xb8cd('0x3f')](_0x16ebf5));}return BPromise[_0xb8cd('0x95')](_0x213f73);}})[_0xb8cd('0x28')](function(){return _0x34a47a;})[_0xb8cd('0x28')](respondWithResult(_0x25f31b,null))[_0xb8cd('0x53')](handleError(_0x25f31b,null));};exports['removeLists']=function(_0x98921,_0x5cc947,_0x2ba1c0){return db[_0xb8cd('0x3a')][_0xb8cd('0x32')]({'where':{'id':_0x98921[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x5cc947,null))['then'](function(_0x336b12){if(_0x336b12){return _0x336b12[_0xb8cd('0xbb')](_0x98921[_0xb8cd('0x3f')][_0xb8cd('0x98')]);}})[_0xb8cd('0x28')](function(_0x693f21){if(_0x693f21){return db[_0xb8cd('0x69')]['destroy']({'where':{'ListId':_0x98921[_0xb8cd('0x3f')][_0xb8cd('0x98')],'VoiceQueueId':_0x98921[_0xb8cd('0x55')]['id']}})['then'](function(){return _0x693f21;});}})[_0xb8cd('0x28')](respondWithStatusCode(_0x5cc947,null))[_0xb8cd('0x53')](handleError(_0x5cc947,null));};exports[_0xb8cd('0xbc')]=function(_0x38baa4,_0x408290,_0x10a654){var _0x72eecd={};var _0xa421d7={};var _0x19c3c4;var _0xb0f6df;return db[_0xb8cd('0x3a')][_0xb8cd('0x68')]({'where':{'id':_0x38baa4['params']['id']}})['then'](handleEntityNotFound(_0x408290,null))['then'](function(_0x23d134){if(_0x23d134){_0x19c3c4=_0x23d134;_0xa421d7[_0xb8cd('0x3d')]=_[_0xb8cd('0x3e')](db[_0xb8cd('0xa5')][_0xb8cd('0x56')]);_0xa421d7[_0xb8cd('0x3f')]=_[_0xb8cd('0x3e')](_0x38baa4[_0xb8cd('0x3f')]);_0xa421d7[_0xb8cd('0x40')]=_[_0xb8cd('0x41')](_0xa421d7['model'],_0xa421d7[_0xb8cd('0x3f')]);_0x72eecd[_0xb8cd('0x43')]=_[_0xb8cd('0x41')](_0xa421d7['model'],qs['fields'](_0x38baa4[_0xb8cd('0x3f')][_0xb8cd('0x42')]));_0x72eecd['attributes']=_0x72eecd[_0xb8cd('0x43')]['length']?_0x72eecd[_0xb8cd('0x43')]:_0xa421d7[_0xb8cd('0x3d')];_0x72eecd['order']=qs[_0xb8cd('0x48')](_0x38baa4[_0xb8cd('0x3f')][_0xb8cd('0x48')]);_0x72eecd['where']=qs[_0xb8cd('0x40')](_[_0xb8cd('0x4a')](_0x38baa4[_0xb8cd('0x3f')],_0xa421d7[_0xb8cd('0x40')]));if(_0x38baa4[_0xb8cd('0x3f')][_0xb8cd('0x4d')]){_0x72eecd['where']=_[_0xb8cd('0x4b')](_0x72eecd[_0xb8cd('0x49')],{'$or':_['map'](_0x72eecd[_0xb8cd('0x43')],function(_0x502799){var _0x44b261={};_0x44b261[_0x502799]={'$like':'%'+_0x38baa4[_0xb8cd('0x3f')][_0xb8cd('0x4d')]+'%'};return _0x44b261;})});}_0x72eecd=_[_0xb8cd('0x4b')]({},_0x72eecd,_0x38baa4[_0xb8cd('0x4e')]);return _0x19c3c4[_0xb8cd('0xbc')](_0x72eecd);}})[_0xb8cd('0x28')](function(_0x40a7f7){if(_0x40a7f7){_0xb0f6df=_0x40a7f7[_0xb8cd('0x44')];if(!_0x38baa4['query'][_0xb8cd('0x45')](_0xb8cd('0x46'))){_0x72eecd[_0xb8cd('0x22')]=qs[_0xb8cd('0x22')](_0x38baa4[_0xb8cd('0x3f')][_0xb8cd('0x22')]);_0x72eecd['offset']=qs[_0xb8cd('0x20')](_0x38baa4[_0xb8cd('0x3f')]['offset']);}return _0x19c3c4[_0xb8cd('0xbc')](_0x72eecd);}})['then'](function(_0x49038a){if(_0x49038a){return _0x49038a?{'count':_0xb0f6df,'rows':_0x49038a}:null;}})[_0xb8cd('0x28')](respondWithResult(_0x408290,null))[_0xb8cd('0x53')](handleError(_0x408290,null));};exports[_0xb8cd('0xbd')]=function(_0x5bd312,_0x50953b,_0x1aab47){var _0x6710,_0x1a21e7;return db[_0xb8cd('0x3a')][_0xb8cd('0x32')]({'where':{'id':_0x5bd312[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x50953b,null))[_0xb8cd('0x28')](function(_0x45a513){if(_0x45a513){_0x1a21e7=_0x45a513;return _0x45a513[_0xb8cd('0xbd')](_0x5bd312[_0xb8cd('0x57')][_0xb8cd('0x98')],_[_0xb8cd('0x62')](_0x5bd312[_0xb8cd('0x57')],['ids','id'])||{});}return null;})[_0xb8cd('0x9d')](function(_0x14f85e){var _0x4aabe5;_0x6710=_0x14f85e||[];var _0x2e1371=[];if(_0x14f85e){for(var _0xeaa2e0=0x0;_0xeaa2e0<_0x14f85e[_0xb8cd('0x44')];_0xeaa2e0+=0x1){var _0x104120=_0x14f85e[_0xeaa2e0][_0xb8cd('0x2a')]({'plain':!![]});_0x4aabe5=squel[_0xb8cd('0xa9')]()[_0xb8cd('0xaa')](_0xb8cd('0xbe'))[_0xb8cd('0xac')]([_0xb8cd('0xb0'),_0xb8cd('0xad'),_0xb8cd('0xae'),_0xb8cd('0x6a'),_0xb8cd('0x63'),'updatedAt'],squel[_0xb8cd('0x88')]()[_0xb8cd('0xaf')](_0xb8cd('0xb0'),_0xb8cd('0xb0'))['field']('id',_0xb8cd('0xad'))[_0xb8cd('0xaf')](_0x104120[_0xb8cd('0xb2')][_0xb8cd('0x91')](),'ListId')['field'](_0x5bd312[_0xb8cd('0x55')]['id'][_0xb8cd('0x91')](),_0xb8cd('0x6a'))[_0xb8cd('0xaf')]('NOW()',_0xb8cd('0x63'))[_0xb8cd('0xaf')](_0xb8cd('0xb3'),_0xb8cd('0x64'))['from'](_0xb8cd('0xb4'))[_0xb8cd('0x49')](_0xb8cd('0xb5'))[_0xb8cd('0x49')](_0xb8cd('0xb6'),_0x104120[_0xb8cd('0xb2')][_0xb8cd('0x91')]())[_0xb8cd('0x49')](_0xb8cd('0xb7')))[_0xb8cd('0x91')]();_0x2e1371[_0xb8cd('0x90')](db[_0xb8cd('0x7b')]['query'](_0x4aabe5));}return BPromise['all'](_0x2e1371);}})['then'](function(){return _0x6710;})[_0xb8cd('0x28')](respondWithResult(_0x50953b,null))['catch'](handleError(_0x50953b,null));};exports[_0xb8cd('0xbf')]=function(_0x4186e8,_0x53e3a3,_0x2ed1a6){return db[_0xb8cd('0x3a')][_0xb8cd('0x32')]({'where':{'id':_0x4186e8[_0xb8cd('0x55')]['id']}})[_0xb8cd('0x28')](handleEntityNotFound(_0x53e3a3,null))[_0xb8cd('0x28')](function(_0x57422f){if(_0x57422f){return _0x57422f['removeBlackLists'](_0x4186e8['query'][_0xb8cd('0x98')]);}})['then'](function(_0x26ef7b){if(_0x26ef7b){return db['CmHopperBlack'][_0xb8cd('0x29')]({'where':{'ListId':_0x4186e8[_0xb8cd('0x3f')][_0xb8cd('0x98')],'VoiceQueueId':_0x4186e8[_0xb8cd('0x55')]['id']}})['then'](function(){return _0x26ef7b;});}})[_0xb8cd('0x28')](respondWithStatusCode(_0x53e3a3,null))['catch'](handleError(_0x53e3a3,null));};
\ No newline at end of file