Built motion from commit (unavailable).|2.5.4
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index 0b7f4b2..c2e1c8e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xfb5d=['userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','role','inbound','params','CmHopper','getHopperHistories','findOne','CmHopperHistory','order','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','upsert','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','ids','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','online','all','getAgents','getMembers','getLists','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','select','NOW()','ContactId','CmListId','toString','ListId','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','removeLists','getBlackLists','CmList','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','end','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','sendStatus','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','options','VoiceQueue','includeAll','include','findAll','rows','catch','intersection','create','body','user','UserProfileSection'];(function(_0x581f83,_0x5bcc35){var _0x138460=function(_0x20e2b1){while(--_0x20e2b1){_0x581f83['push'](_0x581f83['shift']());}};_0x138460(++_0x5bcc35);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfb5d[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0xdfb5('0x0'));var emlformat=require(_0xdfb5('0x1'));var rimraf=require(_0xdfb5('0x2'));var zipdir=require(_0xdfb5('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdfb5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdfb5('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xdfb5('0x6'));var squel=require(_0xdfb5('0x7'));var crypto=require(_0xdfb5('0x8'));var jsforce=require('jsforce');var deskjs=require(_0xdfb5('0x9'));var toCsv=require(_0xdfb5('0xa'));var querystring=require(_0xdfb5('0xb'));var Papa=require(_0xdfb5('0xc'));var Redis=require(_0xdfb5('0xd'));var authService=require(_0xdfb5('0xe'));var qs=require(_0xdfb5('0xf'));var as=require(_0xdfb5('0x10'));var hardwareService=require(_0xdfb5('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xdfb5('0x12'));var config=require(_0xdfb5('0x13'));var db=require(_0xdfb5('0x14'))['db'];config[_0xdfb5('0x15')]=_[_0xdfb5('0x16')](config['redis'],{'host':_0xdfb5('0x17'),'port':0x18eb});var socket=require(_0xdfb5('0x18'))(new Redis(config['redis']));require(_0xdfb5('0x19'))[_0xdfb5('0x1a')](socket);function respondWithStatusCode(_0x44c4a3,_0x11adb7){_0x11adb7=_0x11adb7||0xcc;return function(_0x130672){if(_0x130672){return _0x44c4a3['sendStatus'](_0x11adb7);}return _0x44c4a3['status'](_0x11adb7)[_0xdfb5('0x1b')]();};}function respondWithResult(_0x4e863d,_0xbd0bd6){_0xbd0bd6=_0xbd0bd6||0xc8;return function(_0x39fbe2){if(_0x39fbe2){return _0x4e863d[_0xdfb5('0x1c')](_0xbd0bd6)[_0xdfb5('0x1d')](_0x39fbe2);}};}function respondWithFilteredResult(_0x1708cf,_0x35b052){return function(_0x403a7e){if(_0x403a7e){var _0x54fa59=_0x403a7e[_0xdfb5('0x1e')],_0x125d46=_0x35b052[_0xdfb5('0x1f')],_0x29576a=_0x35b052['offset']+_0x35b052[_0xdfb5('0x20')],_0xaf0d5f;if(_0x29576a>=_0x54fa59){_0x29576a=_0x54fa59;_0xaf0d5f=0xc8;}else{_0xaf0d5f=0xce;}_0x1708cf[_0xdfb5('0x1c')](_0xaf0d5f);return _0x1708cf['set'](_0xdfb5('0x21'),_0x125d46+'-'+_0x29576a+'/'+_0x54fa59)['json'](_0x403a7e);}return null;};}function patchUpdates(_0x3a0908){return function(_0x2cae3b){try{jsonpatch[_0xdfb5('0x22')](_0x2cae3b,_0x3a0908,!![]);}catch(_0x38d67c){return BPromise['reject'](_0x38d67c);}return _0x2cae3b[_0xdfb5('0x23')]();};}function saveUpdates(_0x2fbf03,_0xe08d19){return function(_0x4a672d){if(_0x4a672d){return _0x4a672d[_0xdfb5('0x24')](_0x2fbf03)[_0xdfb5('0x25')](function(_0x401b08){return _0x401b08;});}return null;};}function removeEntity(_0x495c34,_0x51784c){return function(_0x5a39bb){if(_0x5a39bb){return _0x5a39bb[_0xdfb5('0x26')]()[_0xdfb5('0x25')](function(){var _0x29b38e=_0x5a39bb[_0xdfb5('0x27')]({'plain':!![]});var _0x5cc41c=[{'name':_0xdfb5('0x28'),'value':'inbound','ignore':![]},{'name':_0xdfb5('0x29'),'value':_0xdfb5('0x2a'),'ignore':![]}];var _0x53667d=_(_0x5cc41c)[_0xdfb5('0x2b')](_0xdfb5('0x2c'))[_0xdfb5('0x2d')]('value')[_0xdfb5('0x2e')]();if(_['includes'](_0x53667d,_0x29b38e[_0xdfb5('0x2f')])){return;}var _0x2ecd76=_[_0xdfb5('0x30')](_0x5cc41c,[_0xdfb5('0x2e'),_0x29b38e[_0xdfb5('0x2f')]])[_0xdfb5('0x31')];return db[_0xdfb5('0x32')][_0xdfb5('0x26')]({'where':{'type':_0x2ecd76,'resourceId':_0x29b38e['id']}})[_0xdfb5('0x25')](function(){return _0x5a39bb;});})['then'](function(){_0x495c34[_0xdfb5('0x1c')](0xcc)[_0xdfb5('0x1b')]();});}};}function handleEntityNotFound(_0x213bdb,_0x1b7931){return function(_0x39a0e7){if(!_0x39a0e7){_0x213bdb[_0xdfb5('0x33')](0x194);}return _0x39a0e7;};}function handleError(_0x479990,_0x15e3b7){_0x15e3b7=_0x15e3b7||0x1f4;return function(_0x49f49f){logger[_0xdfb5('0x34')](_0x49f49f[_0xdfb5('0x35')]);if(_0x49f49f[_0xdfb5('0x31')]){delete _0x49f49f[_0xdfb5('0x31')];}_0x479990[_0xdfb5('0x1c')](_0x15e3b7)[_0xdfb5('0x36')](_0x49f49f);};}exports[_0xdfb5('0x37')]=function(_0x2820ee,_0x81cafe){var _0x27aa25={},_0x4e2ad1={},_0x1be65c={'count':0x0,'rows':[]};var _0x1dbb98=_[_0xdfb5('0x2d')](db['VoiceQueue'][_0xdfb5('0x38')],function(_0x1dda32){return{'name':_0x1dda32[_0xdfb5('0x39')],'type':_0x1dda32[_0xdfb5('0x2f')][_0xdfb5('0x3a')]};});_0x4e2ad1[_0xdfb5('0x3b')]=_[_0xdfb5('0x2d')](_0x1dbb98,_0xdfb5('0x31'));_0x4e2ad1[_0xdfb5('0x3c')]=_[_0xdfb5('0x3d')](_0x2820ee[_0xdfb5('0x3c')]);_0x4e2ad1[_0xdfb5('0x3e')]=_['intersection'](_0x4e2ad1[_0xdfb5('0x3b')],_0x4e2ad1['query']);_0x27aa25[_0xdfb5('0x3f')]=_['intersection'](_0x4e2ad1[_0xdfb5('0x3b')],qs[_0xdfb5('0x40')](_0x2820ee[_0xdfb5('0x3c')][_0xdfb5('0x40')]));_0x27aa25[_0xdfb5('0x3f')]=_0x27aa25[_0xdfb5('0x3f')][_0xdfb5('0x41')]?_0x27aa25['attributes']:_0x4e2ad1[_0xdfb5('0x3b')];if(!_0x2820ee[_0xdfb5('0x3c')][_0xdfb5('0x42')](_0xdfb5('0x43'))){_0x27aa25[_0xdfb5('0x20')]=qs[_0xdfb5('0x20')](_0x2820ee[_0xdfb5('0x3c')]['limit']);_0x27aa25[_0xdfb5('0x1f')]=qs[_0xdfb5('0x1f')](_0x2820ee['query'][_0xdfb5('0x1f')]);}_0x27aa25['order']=qs[_0xdfb5('0x44')](_0x2820ee['query'][_0xdfb5('0x44')]);_0x27aa25[_0xdfb5('0x45')]=qs[_0xdfb5('0x3e')](_[_0xdfb5('0x46')](_0x2820ee[_0xdfb5('0x3c')],_0x4e2ad1[_0xdfb5('0x3e')]));if(_0x2820ee[_0xdfb5('0x3c')][_0xdfb5('0x2b')]){_0x27aa25['where']=_[_0xdfb5('0x47')](_0x27aa25[_0xdfb5('0x45')],{'$or':_['map'](_0x1dbb98,function(_0x43adbf){if(_0x43adbf['type']!=='VIRTUAL'){var _0x333412={};_0x333412[_0x43adbf[_0xdfb5('0x31')]]={'$like':'%'+_0x2820ee[_0xdfb5('0x3c')][_0xdfb5('0x2b')]+'%'};return _0x333412;}})});}_0x27aa25=_['merge']({},_0x27aa25,_0x2820ee[_0xdfb5('0x48')]);var _0x1d65e6={'where':_0x27aa25[_0xdfb5('0x45')]};return db[_0xdfb5('0x49')][_0xdfb5('0x1e')](_0x1d65e6)[_0xdfb5('0x25')](function(_0x45f465){_0x1be65c[_0xdfb5('0x1e')]=_0x45f465;if(_0x2820ee['query'][_0xdfb5('0x4a')]){_0x27aa25[_0xdfb5('0x4b')]=[{'all':!![]}];}return db[_0xdfb5('0x49')][_0xdfb5('0x4c')](_0x27aa25);})[_0xdfb5('0x25')](function(_0x35a73d){_0x1be65c[_0xdfb5('0x4d')]=_0x35a73d;return _0x1be65c;})[_0xdfb5('0x25')](respondWithFilteredResult(_0x81cafe,_0x27aa25))[_0xdfb5('0x4e')](handleError(_0x81cafe,null));};exports['show']=function(_0x131631,_0x19ab95){var _0x377fa4={'raw':![],'where':{'id':_0x131631['params']['id']}},_0x39fddb={};_0x39fddb['model']=_[_0xdfb5('0x3d')](db[_0xdfb5('0x49')]['rawAttributes']);_0x39fddb[_0xdfb5('0x3c')]=_['keys'](_0x131631['query']);_0x39fddb[_0xdfb5('0x3e')]=_[_0xdfb5('0x4f')](_0x39fddb[_0xdfb5('0x3b')],_0x39fddb['query']);_0x377fa4[_0xdfb5('0x3f')]=_[_0xdfb5('0x4f')](_0x39fddb[_0xdfb5('0x3b')],qs[_0xdfb5('0x40')](_0x131631[_0xdfb5('0x3c')][_0xdfb5('0x40')]));_0x377fa4[_0xdfb5('0x3f')]=_0x377fa4[_0xdfb5('0x3f')]['length']?_0x377fa4['attributes']:_0x39fddb[_0xdfb5('0x3b')];if(_0x131631['query'][_0xdfb5('0x4a')]){_0x377fa4[_0xdfb5('0x4b')]=[{'all':!![]}];}_0x377fa4=_[_0xdfb5('0x47')]({},_0x377fa4,_0x131631['options']);return db['VoiceQueue'][_0xdfb5('0x30')](_0x377fa4)[_0xdfb5('0x25')](handleEntityNotFound(_0x19ab95,null))[_0xdfb5('0x25')](respondWithResult(_0x19ab95,null))[_0xdfb5('0x4e')](handleError(_0x19ab95,null));};exports[_0xdfb5('0x50')]=function(_0x12c3d1,_0x570d3e){return db[_0xdfb5('0x49')]['create'](_0x12c3d1[_0xdfb5('0x51')],{})[_0xdfb5('0x25')](function(_0x5673f0){var _0x363f43=_0x12c3d1[_0xdfb5('0x52')]['get']({'plain':!![]});if(!_0x363f43)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x363f43['role']===_0xdfb5('0x52')){var _0x470276=_0x5673f0[_0xdfb5('0x27')]({'plain':!![]});var _0x20b290=[{'name':_0xdfb5('0x28'),'value':'inbound'},{'name':_0xdfb5('0x29'),'value':'outbound'}];var _0x1b61dc=_[_0xdfb5('0x30')](_0x20b290,['value',_0x470276[_0xdfb5('0x2f')]])['name'];return db[_0xdfb5('0x53')]['find']({'where':{'name':_0x1b61dc,'userProfileId':_0x363f43[_0xdfb5('0x54')]},'raw':!![]})[_0xdfb5('0x25')](function(_0x22062b){if(_0x22062b&&_0x22062b[_0xdfb5('0x55')]===0x0){return db[_0xdfb5('0x32')][_0xdfb5('0x50')]({'name':_0x470276[_0xdfb5('0x31')],'resourceId':_0x470276['id'],'type':_0x22062b[_0xdfb5('0x31')],'sectionId':_0x22062b['id']},{})[_0xdfb5('0x25')](function(){return _0x5673f0;});}else{return _0x5673f0;}})[_0xdfb5('0x4e')](function(_0x48c3b3){logger[_0xdfb5('0x34')](_0xdfb5('0x56'),_0x48c3b3);throw _0x48c3b3;});}return _0x5673f0;})[_0xdfb5('0x25')](respondWithResult(_0x570d3e,0xc9))['catch'](handleError(_0x570d3e,null));};exports[_0xdfb5('0x57')]=function(_0x3a039c,_0x5c7894){var _0x74fdcd={'where':{'id':_0x3a039c['params']['id']}},_0x2227ad={};_0x2227ad[_0xdfb5('0x3b')]=_[_0xdfb5('0x3d')](db['VoiceQueue'][_0xdfb5('0x38')]);_0x74fdcd['attributes']=_[_0xdfb5('0x4f')](_0x2227ad['model'],qs['fields'](_0x3a039c['query']['fields']));_0x74fdcd[_0xdfb5('0x3f')]=_0x74fdcd[_0xdfb5('0x3f')][_0xdfb5('0x41')]?_0x74fdcd[_0xdfb5('0x3f')]:_0x2227ad[_0xdfb5('0x3b')];if(_0x3a039c[_0xdfb5('0x3c')][_0xdfb5('0x4a')]){_0x74fdcd[_0xdfb5('0x4b')]=[{'all':!![]}];}_0x74fdcd=_[_0xdfb5('0x47')]({},_0x74fdcd,_0x3a039c[_0xdfb5('0x48')]);return db[_0xdfb5('0x49')][_0xdfb5('0x30')](_0x74fdcd)[_0xdfb5('0x25')](handleEntityNotFound(_0x5c7894,null))[_0xdfb5('0x25')](function(_0x590706){if(_0x590706){var _0x4b9d95=_0x590706['get']({'plain':!![]});_0x4b9d95=qs['omit'](_0x4b9d95,['id',_0xdfb5('0x58'),_0xdfb5('0x59')]);_0x3a039c[_0xdfb5('0x51')]=_[_0xdfb5('0x5a')](_0x3a039c[_0xdfb5('0x51')],['id',_0xdfb5('0x58'),_0xdfb5('0x59')]);return db['VoiceQueue']['create'](_[_0xdfb5('0x47')](_0x4b9d95,_0x3a039c[_0xdfb5('0x51')]),{'include':_0x3a039c[_0xdfb5('0x3c')][_0xdfb5('0x4a')]?[{'all':!![]}]:undefined})['then'](function(_0x4b1dd5){var _0x267142=_0x3a039c[_0xdfb5('0x52')]['get']({'plain':!![]});if(!_0x267142)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x267142[_0xdfb5('0x5b')]===_0xdfb5('0x52')){var _0x20446c=_0x4b1dd5['get']({'plain':!![]});var _0x4e6b36=[{'name':_0xdfb5('0x28'),'value':_0xdfb5('0x5c')},{'name':_0xdfb5('0x29'),'value':'outbound'}];var _0x533d36=_[_0xdfb5('0x30')](_0x4e6b36,[_0xdfb5('0x2e'),_0x20446c[_0xdfb5('0x2f')]])['name'];return db['UserProfileSection'][_0xdfb5('0x30')]({'where':{'name':_0x533d36,'userProfileId':_0x267142[_0xdfb5('0x54')]},'raw':!![]})[_0xdfb5('0x25')](function(_0x48e947){if(_0x48e947&&_0x48e947[_0xdfb5('0x55')]===0x0){return db[_0xdfb5('0x32')][_0xdfb5('0x50')]({'name':_0x20446c[_0xdfb5('0x31')],'resourceId':_0x20446c['id'],'type':_0x48e947[_0xdfb5('0x31')],'sectionId':_0x48e947['id']},{})[_0xdfb5('0x25')](function(){return _0x4b1dd5;});}else{return _0x4b1dd5;}})[_0xdfb5('0x4e')](function(_0x3ad536){logger[_0xdfb5('0x34')](_0xdfb5('0x56'),_0x3ad536);throw _0x3ad536;});}return _0x4b1dd5;});}})[_0xdfb5('0x25')](respondWithResult(_0x5c7894,0xc9))[_0xdfb5('0x4e')](handleError(_0x5c7894,null));};exports[_0xdfb5('0x24')]=function(_0x26c7b9,_0x47063e){if(_0x26c7b9['body']['id']){delete _0x26c7b9[_0xdfb5('0x51')]['id'];}return db[_0xdfb5('0x49')][_0xdfb5('0x30')]({'where':{'id':_0x26c7b9[_0xdfb5('0x5d')]['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x47063e,null))['then'](saveUpdates(_0x26c7b9[_0xdfb5('0x51')],null))[_0xdfb5('0x25')](respondWithResult(_0x47063e,null))['catch'](handleError(_0x47063e,null));};exports[_0xdfb5('0x26')]=function(_0x2ac2e7,_0x42781e){return db[_0xdfb5('0x49')][_0xdfb5('0x30')]({'where':{'id':_0x2ac2e7['params']['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x42781e,null))[_0xdfb5('0x25')](removeEntity(_0x42781e,null))[_0xdfb5('0x4e')](handleError(_0x42781e,null));};exports['getHoppers']=function(_0x37703b,_0x523eb7,_0x334607){var _0x1798d5={'raw':![],'where':{}};var _0x318977={};var _0x43f1b7={'count':0x0,'rows':[]};return db[_0xdfb5('0x49')]['findOne']({'where':{'id':_0x37703b['params']['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x523eb7,null))[_0xdfb5('0x25')](function(_0x254794){if(_0x254794){_0x318977[_0xdfb5('0x3b')]=_[_0xdfb5('0x3d')](db[_0xdfb5('0x5e')]['rawAttributes']);_0x318977[_0xdfb5('0x3c')]=_[_0xdfb5('0x3d')](_0x37703b[_0xdfb5('0x3c')]);_0x318977['filters']=_[_0xdfb5('0x4f')](_0x318977[_0xdfb5('0x3b')],_0x318977['query']);_0x1798d5[_0xdfb5('0x3f')]=_['intersection'](_0x318977['model'],qs[_0xdfb5('0x40')](_0x37703b[_0xdfb5('0x3c')][_0xdfb5('0x40')]));_0x1798d5['attributes']=_0x1798d5[_0xdfb5('0x3f')][_0xdfb5('0x41')]?_0x1798d5[_0xdfb5('0x3f')]:_0x318977[_0xdfb5('0x3b')];if(!_0x37703b['query'][_0xdfb5('0x42')](_0xdfb5('0x43'))){_0x1798d5[_0xdfb5('0x20')]=qs['limit'](_0x37703b[_0xdfb5('0x3c')][_0xdfb5('0x20')]);_0x1798d5[_0xdfb5('0x1f')]=qs[_0xdfb5('0x1f')](_0x37703b[_0xdfb5('0x3c')][_0xdfb5('0x1f')]);}_0x1798d5['order']=qs['sort'](_0x37703b[_0xdfb5('0x3c')][_0xdfb5('0x44')]);_0x1798d5[_0xdfb5('0x45')]=qs[_0xdfb5('0x3e')](_[_0xdfb5('0x46')](_0x37703b['query'],_0x318977[_0xdfb5('0x3e')]));_0x1798d5['where']['VoiceQueueId']=_0x254794['id'];if(_0x37703b[_0xdfb5('0x3c')]['filter']){_0x1798d5[_0xdfb5('0x45')]=_['merge'](_0x1798d5[_0xdfb5('0x45')],{'$or':_[_0xdfb5('0x2d')](_0x1798d5[_0xdfb5('0x3f')],function(_0xb1d086){var _0x337915={};_0x337915[_0xb1d086]={'$like':'%'+_0x37703b['query'][_0xdfb5('0x2b')]+'%'};return _0x337915;})});}_0x1798d5=_[_0xdfb5('0x47')]({},_0x1798d5,_0x37703b[_0xdfb5('0x48')]);return db['CmHopper'][_0xdfb5('0x1e')]({'where':_0x1798d5[_0xdfb5('0x45')]})[_0xdfb5('0x25')](function(_0x5663cb){_0x43f1b7['count']=_0x5663cb;if(_0x37703b[_0xdfb5('0x3c')][_0xdfb5('0x4a')]){_0x1798d5[_0xdfb5('0x4b')]=[{'all':!![]}];}return db[_0xdfb5('0x5e')][_0xdfb5('0x4c')](_0x1798d5);})[_0xdfb5('0x25')](function(_0x3e0688){_0x43f1b7[_0xdfb5('0x4d')]=_0x3e0688;return _0x43f1b7;});}})[_0xdfb5('0x25')](respondWithFilteredResult(_0x523eb7,_0x1798d5))[_0xdfb5('0x4e')](handleError(_0x523eb7,null));};exports[_0xdfb5('0x5f')]=function(_0x26ef91,_0x1fa9dd,_0x52590a){var _0x25674a={'raw':!![],'where':{}};var _0x1d5f2d={};var _0x39aed4={'count':0x0,'rows':[]};return db[_0xdfb5('0x49')][_0xdfb5('0x60')]({'where':{'id':_0x26ef91[_0xdfb5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x1fa9dd,null))[_0xdfb5('0x25')](function(_0x3754b9){if(_0x3754b9){_0x1d5f2d[_0xdfb5('0x3b')]=_[_0xdfb5('0x3d')](db[_0xdfb5('0x61')][_0xdfb5('0x38')]);_0x1d5f2d[_0xdfb5('0x3c')]=_[_0xdfb5('0x3d')](_0x26ef91[_0xdfb5('0x3c')]);_0x1d5f2d['filters']=_[_0xdfb5('0x4f')](_0x1d5f2d[_0xdfb5('0x3b')],_0x1d5f2d[_0xdfb5('0x3c')]);_0x25674a[_0xdfb5('0x3f')]=_[_0xdfb5('0x4f')](_0x1d5f2d[_0xdfb5('0x3b')],qs['fields'](_0x26ef91[_0xdfb5('0x3c')][_0xdfb5('0x40')]));_0x25674a['attributes']=_0x25674a[_0xdfb5('0x3f')][_0xdfb5('0x41')]?_0x25674a[_0xdfb5('0x3f')]:_0x1d5f2d[_0xdfb5('0x3b')];if(!_0x26ef91[_0xdfb5('0x3c')][_0xdfb5('0x42')]('nolimit')){_0x25674a['limit']=qs[_0xdfb5('0x20')](_0x26ef91[_0xdfb5('0x3c')]['limit']);_0x25674a[_0xdfb5('0x1f')]=qs['offset'](_0x26ef91[_0xdfb5('0x3c')][_0xdfb5('0x1f')]);}_0x25674a[_0xdfb5('0x62')]=qs['sort'](_0x26ef91[_0xdfb5('0x3c')][_0xdfb5('0x44')]);_0x25674a['where']=qs[_0xdfb5('0x3e')](_[_0xdfb5('0x46')](_0x26ef91[_0xdfb5('0x3c')],_0x1d5f2d['filters']));_0x25674a[_0xdfb5('0x45')][_0xdfb5('0x63')]=_0x3754b9['id'];if(_0x26ef91['query']['filter']){_0x25674a[_0xdfb5('0x45')]=_[_0xdfb5('0x47')](_0x25674a[_0xdfb5('0x45')],{'$or':_['map'](_0x25674a[_0xdfb5('0x3f')],function(_0x22137c){var _0x21c620={};_0x21c620[_0x22137c]={'$like':'%'+_0x26ef91[_0xdfb5('0x3c')][_0xdfb5('0x2b')]+'%'};return _0x21c620;})});}_0x25674a=_[_0xdfb5('0x47')]({},_0x25674a,_0x26ef91[_0xdfb5('0x48')]);return db[_0xdfb5('0x61')][_0xdfb5('0x1e')]({'where':_0x25674a['where']})['then'](function(_0x148d4c){_0x39aed4[_0xdfb5('0x1e')]=_0x148d4c;if(_0x26ef91[_0xdfb5('0x3c')][_0xdfb5('0x4a')]){_0x25674a[_0xdfb5('0x4b')]=[{'all':!![]}];}return db[_0xdfb5('0x61')]['findAll'](_0x25674a);})[_0xdfb5('0x25')](function(_0x104b8a){_0x39aed4[_0xdfb5('0x4d')]=_0x104b8a;return _0x39aed4;});}})[_0xdfb5('0x25')](respondWithFilteredResult(_0x1fa9dd,_0x25674a))[_0xdfb5('0x4e')](handleError(_0x1fa9dd,null));};exports[_0xdfb5('0x64')]=function(_0x3a03e5,_0x5b975c,_0x532640){var _0x188fc4={'raw':!![],'where':{}};var _0x1c0386={};var _0x495c94={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3a03e5[_0xdfb5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5b975c,null))[_0xdfb5('0x25')](function(_0x4a9c3b){if(_0x4a9c3b){_0x1c0386[_0xdfb5('0x3b')]=_[_0xdfb5('0x3d')](db[_0xdfb5('0x65')][_0xdfb5('0x38')]);_0x1c0386[_0xdfb5('0x3c')]=_[_0xdfb5('0x3d')](_0x3a03e5[_0xdfb5('0x3c')]);_0x1c0386[_0xdfb5('0x3e')]=_[_0xdfb5('0x4f')](_0x1c0386[_0xdfb5('0x3b')],_0x1c0386[_0xdfb5('0x3c')]);_0x188fc4[_0xdfb5('0x3f')]=_[_0xdfb5('0x4f')](_0x1c0386[_0xdfb5('0x3b')],qs[_0xdfb5('0x40')](_0x3a03e5[_0xdfb5('0x3c')]['fields']));_0x188fc4[_0xdfb5('0x3f')]=_0x188fc4['attributes'][_0xdfb5('0x41')]?_0x188fc4[_0xdfb5('0x3f')]:_0x1c0386[_0xdfb5('0x3b')];if(!_0x3a03e5[_0xdfb5('0x3c')][_0xdfb5('0x42')](_0xdfb5('0x43'))){_0x188fc4[_0xdfb5('0x20')]=qs[_0xdfb5('0x20')](_0x3a03e5[_0xdfb5('0x3c')][_0xdfb5('0x20')]);_0x188fc4[_0xdfb5('0x1f')]=qs[_0xdfb5('0x1f')](_0x3a03e5[_0xdfb5('0x3c')][_0xdfb5('0x1f')]);}_0x188fc4['order']=qs[_0xdfb5('0x44')](_0x3a03e5[_0xdfb5('0x3c')][_0xdfb5('0x44')]);_0x188fc4[_0xdfb5('0x45')]=qs['filters'](_['pick'](_0x3a03e5[_0xdfb5('0x3c')],_0x1c0386['filters']));_0x188fc4[_0xdfb5('0x45')][_0xdfb5('0x63')]=_0x4a9c3b['id'];if(_0x3a03e5[_0xdfb5('0x3c')]['filter']){_0x188fc4[_0xdfb5('0x45')]=_[_0xdfb5('0x47')](_0x188fc4[_0xdfb5('0x45')],{'$or':_[_0xdfb5('0x2d')](_0x188fc4[_0xdfb5('0x3f')],function(_0x5850ae){var _0x734a51={};_0x734a51[_0x5850ae]={'$like':'%'+_0x3a03e5[_0xdfb5('0x3c')][_0xdfb5('0x2b')]+'%'};return _0x734a51;})});}_0x188fc4=_[_0xdfb5('0x47')]({},_0x188fc4,_0x3a03e5[_0xdfb5('0x48')]);return db[_0xdfb5('0x65')][_0xdfb5('0x1e')]({'where':_0x188fc4['where']})[_0xdfb5('0x25')](function(_0x30c896){_0x495c94[_0xdfb5('0x1e')]=_0x30c896;if(_0x3a03e5[_0xdfb5('0x3c')][_0xdfb5('0x4a')]){_0x188fc4[_0xdfb5('0x4b')]=[{'all':!![]}];}return db[_0xdfb5('0x65')][_0xdfb5('0x4c')](_0x188fc4);})['then'](function(_0x190710){_0x495c94[_0xdfb5('0x4d')]=_0x190710;return _0x495c94;});}})['then'](respondWithFilteredResult(_0x5b975c,_0x188fc4))[_0xdfb5('0x4e')](handleError(_0x5b975c,null));};exports[_0xdfb5('0x66')]=function(_0x5f25b7,_0x59281d,_0xc4886a){var _0x53ad3f={'raw':!![],'where':{}};var _0x3b6e54={};var _0x4469f6={'count':0x0,'rows':[]};return db[_0xdfb5('0x49')][_0xdfb5('0x60')]({'where':{'id':_0x5f25b7[_0xdfb5('0x5d')]['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x59281d,null))[_0xdfb5('0x25')](function(_0x35322c){if(_0x35322c){_0x3b6e54['model']=_['keys'](db[_0xdfb5('0x67')][_0xdfb5('0x38')]);_0x3b6e54['query']=_['keys'](_0x5f25b7['query']);_0x3b6e54['filters']=_[_0xdfb5('0x4f')](_0x3b6e54['model'],_0x3b6e54[_0xdfb5('0x3c')]);_0x53ad3f['attributes']=_[_0xdfb5('0x4f')](_0x3b6e54[_0xdfb5('0x3b')],qs[_0xdfb5('0x40')](_0x5f25b7['query'][_0xdfb5('0x40')]));_0x53ad3f[_0xdfb5('0x3f')]=_0x53ad3f[_0xdfb5('0x3f')]['length']?_0x53ad3f[_0xdfb5('0x3f')]:_0x3b6e54['model'];if(!_0x5f25b7[_0xdfb5('0x3c')][_0xdfb5('0x42')]('nolimit')){_0x53ad3f['limit']=qs[_0xdfb5('0x20')](_0x5f25b7[_0xdfb5('0x3c')][_0xdfb5('0x20')]);_0x53ad3f[_0xdfb5('0x1f')]=qs['offset'](_0x5f25b7[_0xdfb5('0x3c')]['offset']);}_0x53ad3f['order']=qs['sort'](_0x5f25b7[_0xdfb5('0x3c')]['sort']);_0x53ad3f[_0xdfb5('0x45')]=qs['filters'](_[_0xdfb5('0x46')](_0x5f25b7[_0xdfb5('0x3c')],_0x3b6e54[_0xdfb5('0x3e')]));_0x53ad3f[_0xdfb5('0x45')][_0xdfb5('0x63')]=_0x35322c['id'];if(_0x5f25b7[_0xdfb5('0x3c')]['filter']){_0x53ad3f[_0xdfb5('0x45')]=_['merge'](_0x53ad3f[_0xdfb5('0x45')],{'$or':_[_0xdfb5('0x2d')](_0x53ad3f[_0xdfb5('0x3f')],function(_0x393d57){var _0x1f5df0={};_0x1f5df0[_0x393d57]={'$like':'%'+_0x5f25b7[_0xdfb5('0x3c')][_0xdfb5('0x2b')]+'%'};return _0x1f5df0;})});}_0x53ad3f=_[_0xdfb5('0x47')]({},_0x53ad3f,_0x5f25b7[_0xdfb5('0x48')]);return db['CmHopperBlack']['count']({'where':_0x53ad3f[_0xdfb5('0x45')]})[_0xdfb5('0x25')](function(_0x2d4529){_0x4469f6[_0xdfb5('0x1e')]=_0x2d4529;if(_0x5f25b7[_0xdfb5('0x3c')][_0xdfb5('0x4a')]){_0x53ad3f['include']=[{'all':!![]}];}return db['CmHopperBlack'][_0xdfb5('0x4c')](_0x53ad3f);})['then'](function(_0x5e7a08){_0x4469f6[_0xdfb5('0x4d')]=_0x5e7a08;return _0x4469f6;});}})['then'](respondWithFilteredResult(_0x59281d,_0x53ad3f))[_0xdfb5('0x4e')](handleError(_0x59281d,null));};exports[_0xdfb5('0x68')]=function(_0xeb6487,_0x5d4c21,_0x2e109a){var _0x7e0c03={};var _0x771781={};var _0x4a7d72;var _0x5c3cd9;return db['VoiceQueue'][_0xdfb5('0x60')]({'where':{'id':_0xeb6487[_0xdfb5('0x5d')]['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x5d4c21,null))[_0xdfb5('0x25')](function(_0x1c85c9){if(_0x1c85c9){_0x4a7d72=_0x1c85c9;_0x771781[_0xdfb5('0x3b')]=_[_0xdfb5('0x3d')](db[_0xdfb5('0x69')][_0xdfb5('0x38')]);_0x771781[_0xdfb5('0x3c')]=_[_0xdfb5('0x3d')](_0xeb6487[_0xdfb5('0x3c')]);_0x771781['filters']=_[_0xdfb5('0x4f')](_0x771781[_0xdfb5('0x3b')],_0x771781[_0xdfb5('0x3c')]);_0x7e0c03[_0xdfb5('0x3f')]=_[_0xdfb5('0x4f')](_0x771781[_0xdfb5('0x3b')],qs['fields'](_0xeb6487[_0xdfb5('0x3c')][_0xdfb5('0x40')]));_0x7e0c03['attributes']=_0x7e0c03[_0xdfb5('0x3f')][_0xdfb5('0x41')]?_0x7e0c03[_0xdfb5('0x3f')]:_0x771781['model'];_0x7e0c03[_0xdfb5('0x62')]=qs[_0xdfb5('0x44')](_0xeb6487[_0xdfb5('0x3c')]['sort']);_0x7e0c03['where']=qs[_0xdfb5('0x3e')](_[_0xdfb5('0x46')](_0xeb6487['query'],_0x771781['filters']));if(_0xeb6487[_0xdfb5('0x3c')]['filter']){_0x7e0c03['where']=_[_0xdfb5('0x47')](_0x7e0c03['where'],{'$or':_[_0xdfb5('0x2d')](_0x7e0c03[_0xdfb5('0x3f')],function(_0x21ec8f){var _0x569a30={};_0x569a30[_0x21ec8f]={'$like':'%'+_0xeb6487[_0xdfb5('0x3c')][_0xdfb5('0x2b')]+'%'};return _0x569a30;})});}_0x7e0c03=_['merge']({},_0x7e0c03,_0xeb6487[_0xdfb5('0x48')]);return _0x4a7d72[_0xdfb5('0x68')](_0x7e0c03);}})[_0xdfb5('0x25')](function(_0x3233b1){if(_0x3233b1){_0x5c3cd9=_0x3233b1['length'];if(!_0xeb6487[_0xdfb5('0x3c')][_0xdfb5('0x42')](_0xdfb5('0x43'))){_0x7e0c03[_0xdfb5('0x20')]=qs[_0xdfb5('0x20')](_0xeb6487[_0xdfb5('0x3c')][_0xdfb5('0x20')]);_0x7e0c03[_0xdfb5('0x1f')]=qs['offset'](_0xeb6487['query'][_0xdfb5('0x1f')]);}return _0x4a7d72['getTeams'](_0x7e0c03);}})[_0xdfb5('0x25')](function(_0x8f1679){if(_0x8f1679){return _0x8f1679?{'count':_0x5c3cd9,'rows':_0x8f1679}:null;}})[_0xdfb5('0x25')](respondWithResult(_0x5d4c21,null))['catch'](handleError(_0x5d4c21,null));};exports[_0xdfb5('0x6a')]=function(_0x5b2d4e,_0x3c6030,_0x3de259){var _0xe84e4f=_0x5b2d4e[_0xdfb5('0x51')][_0xdfb5('0x6b')];var _0x2bfa46=_[_0xdfb5('0x2d')](_0xe84e4f,'id');return db[_0xdfb5('0x69')][_0xdfb5('0x4c')]({'where':{'id':_0x2bfa46},'attributes':['id'],'include':[{'model':db[_0xdfb5('0x6c')],'as':_0xdfb5('0x6d'),'attributes':['id','name','online','voicePause',_0xdfb5('0x6e')],'raw':!![]}]})[_0xdfb5('0x25')](function(_0x121500){if(_0x121500){var _0x5ef433=_[_0xdfb5('0x6f')](_0x121500,function(_0x240d04){var _0x14c2d1=_0x240d04[_0xdfb5('0x27')]({'plain':!![]});_0x14c2d1[_0xdfb5('0x6d')][_0xdfb5('0x70')](function(_0x1bd31){_0x1bd31[_0xdfb5('0x71')]=_['find'](_0xe84e4f,{'id':_0x14c2d1['id']})['penalty'];});return _0x14c2d1[_0xdfb5('0x6d')];});return db[_0xdfb5('0x49')][_0xdfb5('0x30')]({'where':{'id':_0x5b2d4e['params']['id']}})['then'](function(_0xb1418b){return db[_0xdfb5('0x72')][_0xdfb5('0x73')](function(_0x559072){return _0xb1418b[_0xdfb5('0x6a')](_0x2bfa46,{'transaction':_0x559072})[_0xdfb5('0x25')](function(){return BPromise[_0xdfb5('0x74')](_0x5ef433,function(_0x39da56){return db[_0xdfb5('0x75')][_0xdfb5('0x76')]({'where':{'UserId':_0x39da56['id'],'VoiceQueueId':_0x5b2d4e['params']['id']},'defaults':{'penalty':_0x39da56[_0xdfb5('0x71')]},'transaction':_0x559072});});})[_0xdfb5('0x25')](function(){return BPromise['each'](_['filter'](_0x5ef433,{'online':!![]}),function(_0x366992){return db['UserVoiceQueueRt'][_0xdfb5('0x77')]({'membername':_0x366992[_0xdfb5('0x31')],'UserId':_0x366992['id'],'queue_name':_0xb1418b[_0xdfb5('0x31')],'VoiceQueueId':_0xb1418b['id'],'interface':_[_0xdfb5('0x78')](_0x366992[_0xdfb5('0x6e')])?util[_0xdfb5('0x79')](_0xdfb5('0x7a'),_0x366992['name']):_0x366992[_0xdfb5('0x6e')],'paused':_0x366992[_0xdfb5('0x7b')]||![],'penalty':_0x366992[_0xdfb5('0x71')]},{'transaction':_0x559072});});})[_0xdfb5('0x25')](function(){_0x5ef433['forEach'](function(_0x1a6da5){socket[_0xdfb5('0x7c')](_0xdfb5('0x7d'),{'UserId':_0x1a6da5['id'],'VoiceQueueId':_0xb1418b['id']});});});});});}})['then'](respondWithStatusCode(_0x3c6030,null))[_0xdfb5('0x4e')](handleError(_0x3c6030,null));};exports['removeTeams']=function(_0x2962d5,_0x4e90d1,_0xb975c3){return db[_0xdfb5('0x69')][_0xdfb5('0x4c')]({'where':{'id':_0x2962d5['query'][_0xdfb5('0x7e')]},'attributes':['id'],'include':[{'model':db[_0xdfb5('0x6c')],'as':_0xdfb5('0x6d'),'attributes':['id'],'raw':!![]}]})[_0xdfb5('0x25')](handleEntityNotFound(_0x4e90d1,null))[_0xdfb5('0x25')](function(_0xfb5c8e){var _0x58ce18=_[_0xdfb5('0x2d')](_0xfb5c8e,'id');var _0x195aa3=[];var _0x582f43=[];var _0x1d172c=squel['select']();_0x1d172c[_0xdfb5('0x7f')](_0xdfb5('0x80'))['from']('team_has_voice_queues','tq')[_0xdfb5('0x81')](_0xdfb5('0x82'),'ut',_0xdfb5('0x83'))[_0xdfb5('0x45')]('VoiceQueueId\x20=\x20?',_0x2962d5[_0xdfb5('0x5d')]['id']);for(var _0x907cc9=0x0;_0x907cc9<_0xfb5c8e['length'];_0x907cc9+=0x1){let _0x104b94=_0xfb5c8e[_0x907cc9];for(var _0x1e29d0=0x0;_0x1e29d0<_0x104b94['Agents']['length'];_0x1e29d0+=0x1){let _0x461e80=_0x104b94[_0xdfb5('0x6d')][_0x1e29d0];var _0x6425d9=_0x1d172c[_0xdfb5('0x57')]();_0x6425d9[_0xdfb5('0x45')](_0xdfb5('0x84'),_0x461e80['id']);_0x582f43[_0xdfb5('0x85')](db[_0xdfb5('0x72')][_0xdfb5('0x3c')](_0x6425d9['toString'](),{'type':db[_0xdfb5('0x72')][_0xdfb5('0x86')][_0xdfb5('0x87')]})['then'](function(_0x4104e2){if(_0x4104e2[_0xdfb5('0x41')]===0x1){return _0x461e80['id'];}else{var _0x62dba3=_[_0xdfb5('0x88')](_[_0xdfb5('0x2d')](_0x4104e2,_0xdfb5('0x89')),function(_0x2972df){return _[_0xdfb5('0x8a')](_0x58ce18,_0x2972df);});if(_0x62dba3){return _0x461e80['id'];}}}));}}return BPromise['all'](_0x582f43)[_0xdfb5('0x25')](function(_0x2e010a){_0x195aa3=_(_0x195aa3)[_0xdfb5('0x8b')](_0x2e010a)[_0xdfb5('0x8c')]()[_0xdfb5('0x2e')]();return db['VoiceQueue'][_0xdfb5('0x30')]({'where':{'id':_0x2962d5[_0xdfb5('0x5d')]['id']}})[_0xdfb5('0x25')](function(_0x48f8e0){return db[_0xdfb5('0x72')]['transaction'](function(_0x24296c){return _0x48f8e0['removeTeams'](_0x2962d5['query']['ids'],{'transaction':_0x24296c})[_0xdfb5('0x25')](function(){if(!_[_0xdfb5('0x8d')](_0x195aa3)){return _0x48f8e0[_0xdfb5('0x8e')](_0x195aa3,{'transaction':_0x24296c})[_0xdfb5('0x25')](function(){return db[_0xdfb5('0x8f')][_0xdfb5('0x26')]({'where':{'VoiceQueueId':_0x2962d5[_0xdfb5('0x5d')]['id'],'UserId':_0x195aa3},'transaction':_0x24296c});});}})['then'](function(){_0x195aa3[_0xdfb5('0x70')](function(_0x346e2f){socket[_0xdfb5('0x7c')](_0xdfb5('0x90'),{'UserId':_0x346e2f,'VoiceQueueId':_0x48f8e0['id']});});});});});});})[_0xdfb5('0x25')](respondWithStatusCode(_0x4e90d1,null))[_0xdfb5('0x4e')](handleError(_0x4e90d1,null));};exports[_0xdfb5('0x91')]=function(_0x3f5939,_0x161125,_0x3ab8b3){var _0x3df0b2,_0xaf328e;return db[_0xdfb5('0x49')]['find']({'where':{'id':_0x3f5939['params']['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x161125,null))[_0xdfb5('0x25')](function(_0x14285b){if(_0x14285b){_0xaf328e=_0x14285b;return _0x14285b[_0xdfb5('0x91')](_0x3f5939[_0xdfb5('0x51')][_0xdfb5('0x7e')],_[_0xdfb5('0x5a')](_0x3f5939['body'],[_0xdfb5('0x7e'),'id'])||{})['spread'](function(_0x94d5f2){for(var _0x45f909=0x0;_0x45f909<_0x3f5939[_0xdfb5('0x51')]['ids'][_0xdfb5('0x41')];_0x45f909+=0x1){socket[_0xdfb5('0x7c')](_0xdfb5('0x7d'),{'UserId':_0x3f5939[_0xdfb5('0x51')]['ids'][_0x45f909],'VoiceQueueId':_0x3f5939['params']['id']});}return _0x94d5f2;});}})[_0xdfb5('0x25')](function(_0xa11dfa){_0x3df0b2=_0xa11dfa||[];if(_0xaf328e){return db[_0xdfb5('0x6c')][_0xdfb5('0x4c')]({'where':{'id':_0x3f5939[_0xdfb5('0x51')]['ids']},'attributes':['id',_0xdfb5('0x31'),_0xdfb5('0x92'),_0xdfb5('0x7b'),_0xdfb5('0x6e')],'raw':!![]});}})[_0xdfb5('0x25')](function(_0x5a171a){if(!_[_0xdfb5('0x8d')](_0x5a171a)){var _0x25832c=[];for(var _0x1e5eb8=0x0;_0x1e5eb8<_0x5a171a[_0xdfb5('0x41')];_0x1e5eb8++){if(_0x5a171a[_0x1e5eb8][_0xdfb5('0x92')]){_0x25832c[_0xdfb5('0x85')](db[_0xdfb5('0x8f')][_0xdfb5('0x77')]({'membername':_0x5a171a[_0x1e5eb8]['name'],'UserId':_0x5a171a[_0x1e5eb8]['id'],'queue_name':_0xaf328e[_0xdfb5('0x31')],'VoiceQueueId':_0xaf328e['id'],'interface':_[_0xdfb5('0x78')](_0x5a171a[_0x1e5eb8][_0xdfb5('0x6e')])?util[_0xdfb5('0x79')](_0xdfb5('0x7a'),_0x5a171a[_0x1e5eb8][_0xdfb5('0x31')]):_0x5a171a[_0x1e5eb8][_0xdfb5('0x6e')],'paused':_0x5a171a[_0x1e5eb8][_0xdfb5('0x7b')]||![],'penalty':_0x3f5939[_0xdfb5('0x51')][_0xdfb5('0x71')]||0x0}));}}return BPromise[_0xdfb5('0x93')](_0x25832c);}})['then'](function(){return _0x3df0b2;})[_0xdfb5('0x25')](respondWithResult(_0x161125,null))['catch'](handleError(_0x161125,null));};exports[_0xdfb5('0x8e')]=function(_0x362d54,_0x376956,_0xb87ae3){return db[_0xdfb5('0x49')][_0xdfb5('0x30')]({'where':{'id':_0x362d54[_0xdfb5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x376956,null))[_0xdfb5('0x25')](function(_0x5012c4){if(_0x5012c4){return _0x5012c4[_0xdfb5('0x8e')](_0x362d54[_0xdfb5('0x3c')]['ids'])[_0xdfb5('0x25')](function(){if(_['isArray'](_0x362d54[_0xdfb5('0x3c')][_0xdfb5('0x7e')])){for(var _0x456de8=0x0;_0x456de8<_0x362d54[_0xdfb5('0x3c')][_0xdfb5('0x7e')][_0xdfb5('0x41')];_0x456de8+=0x1){socket[_0xdfb5('0x7c')](_0xdfb5('0x90'),{'UserId':Number(_0x362d54[_0xdfb5('0x3c')][_0xdfb5('0x7e')][_0x456de8]),'VoiceQueueId':Number(_0x362d54[_0xdfb5('0x5d')]['id'])});}}else{socket[_0xdfb5('0x7c')](_0xdfb5('0x90'),{'UserId':Number(_0x362d54['query']['ids']),'VoiceQueueId':Number(_0x362d54[_0xdfb5('0x5d')]['id'])});}});}})['then'](function(_0x1353da){return db[_0xdfb5('0x8f')][_0xdfb5('0x26')]({'where':{'VoiceQueueId':_0x362d54['params']['id'],'UserId':_0x362d54['query'][_0xdfb5('0x7e')]}})['then'](function(){return _0x1353da;});})[_0xdfb5('0x25')](respondWithStatusCode(_0x376956,null))[_0xdfb5('0x4e')](handleError(_0x376956,null));};exports['getAgents']=function(_0x5a8eb4,_0x288fd8,_0x3b0de4){var _0x204660={};var _0x1a5af3={};var _0x2730ed;var _0x5b9e99;return db[_0xdfb5('0x49')]['findOne']({'where':{'id':_0x5a8eb4[_0xdfb5('0x5d')]['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x288fd8,null))[_0xdfb5('0x25')](function(_0x5515fd){if(_0x5515fd){_0x2730ed=_0x5515fd;_0x1a5af3['model']=_[_0xdfb5('0x3d')](db[_0xdfb5('0x6c')]['rawAttributes']);_0x1a5af3[_0xdfb5('0x3c')]=_['keys'](_0x5a8eb4[_0xdfb5('0x3c')]);_0x1a5af3[_0xdfb5('0x3e')]=_[_0xdfb5('0x4f')](_0x1a5af3[_0xdfb5('0x3b')],_0x1a5af3[_0xdfb5('0x3c')]);_0x204660[_0xdfb5('0x3f')]=_[_0xdfb5('0x4f')](_0x1a5af3['model'],qs[_0xdfb5('0x40')](_0x5a8eb4[_0xdfb5('0x3c')][_0xdfb5('0x40')]));_0x204660[_0xdfb5('0x3f')]=_0x204660[_0xdfb5('0x3f')]['length']?_0x204660[_0xdfb5('0x3f')]:_0x1a5af3['model'];_0x204660[_0xdfb5('0x62')]=qs['sort'](_0x5a8eb4[_0xdfb5('0x3c')]['sort']);_0x204660[_0xdfb5('0x45')]=qs[_0xdfb5('0x3e')](_[_0xdfb5('0x46')](_0x5a8eb4[_0xdfb5('0x3c')],_0x1a5af3[_0xdfb5('0x3e')]));if(_0x5a8eb4[_0xdfb5('0x3c')]['filter']){_0x204660[_0xdfb5('0x45')]=_[_0xdfb5('0x47')](_0x204660[_0xdfb5('0x45')],{'$or':_[_0xdfb5('0x2d')](_0x204660[_0xdfb5('0x3f')],function(_0x2ef0c1){var _0xc5e94e={};_0xc5e94e[_0x2ef0c1]={'$like':'%'+_0x5a8eb4[_0xdfb5('0x3c')][_0xdfb5('0x2b')]+'%'};return _0xc5e94e;})});}_0x204660=_[_0xdfb5('0x47')]({},_0x204660,_0x5a8eb4['options']);return _0x2730ed[_0xdfb5('0x94')](_0x204660);}})[_0xdfb5('0x25')](function(_0x50850b){if(_0x50850b){_0x5b9e99=_0x50850b[_0xdfb5('0x41')];if(!_0x5a8eb4[_0xdfb5('0x3c')][_0xdfb5('0x42')](_0xdfb5('0x43'))){_0x204660['limit']=qs['limit'](_0x5a8eb4[_0xdfb5('0x3c')]['limit']);_0x204660['offset']=qs[_0xdfb5('0x1f')](_0x5a8eb4['query'][_0xdfb5('0x1f')]);}return _0x2730ed['getAgents'](_0x204660);}})[_0xdfb5('0x25')](function(_0xecd03c){if(_0xecd03c){return _0xecd03c?{'count':_0x5b9e99,'rows':_0xecd03c}:null;}})[_0xdfb5('0x25')](respondWithResult(_0x288fd8,null))[_0xdfb5('0x4e')](handleError(_0x288fd8,null));};exports[_0xdfb5('0x95')]=function(_0x538f5e,_0x1eb686,_0x49a879){var _0x4a7247={};var _0x449cfc={};var _0x766299;var _0x1bded6;return db[_0xdfb5('0x49')][_0xdfb5('0x60')]({'where':{'id':_0x538f5e['params']['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x1eb686,null))[_0xdfb5('0x25')](function(_0x58a977){if(_0x58a977){_0x766299=_0x58a977;_0x449cfc[_0xdfb5('0x3b')]=_[_0xdfb5('0x3d')](db['UserVoiceQueueRt']['rawAttributes']);_0x449cfc['query']=_[_0xdfb5('0x3d')](_0x538f5e[_0xdfb5('0x3c')]);_0x449cfc['filters']=_[_0xdfb5('0x4f')](_0x449cfc[_0xdfb5('0x3b')],_0x449cfc['query']);_0x4a7247[_0xdfb5('0x3f')]=_[_0xdfb5('0x4f')](_0x449cfc[_0xdfb5('0x3b')],qs[_0xdfb5('0x40')](_0x538f5e['query'][_0xdfb5('0x40')]));_0x4a7247[_0xdfb5('0x3f')]=_0x4a7247['attributes'][_0xdfb5('0x41')]?_0x4a7247[_0xdfb5('0x3f')]:_0x449cfc[_0xdfb5('0x3b')];_0x4a7247[_0xdfb5('0x62')]=qs[_0xdfb5('0x44')](_0x538f5e[_0xdfb5('0x3c')]['sort']);_0x4a7247[_0xdfb5('0x45')]=qs[_0xdfb5('0x3e')](_[_0xdfb5('0x46')](_0x538f5e['query'],_0x449cfc['filters']));if(_0x538f5e[_0xdfb5('0x3c')][_0xdfb5('0x2b')]){_0x4a7247[_0xdfb5('0x45')]=_[_0xdfb5('0x47')](_0x4a7247[_0xdfb5('0x45')],{'$or':_[_0xdfb5('0x2d')](_0x4a7247['attributes'],function(_0x3901cc){var _0x3b5d0a={};_0x3b5d0a[_0x3901cc]={'$like':'%'+_0x538f5e[_0xdfb5('0x3c')]['filter']+'%'};return _0x3b5d0a;})});}_0x4a7247=_[_0xdfb5('0x47')]({},_0x4a7247,_0x538f5e[_0xdfb5('0x48')]);return _0x766299[_0xdfb5('0x95')](_0x4a7247);}})[_0xdfb5('0x25')](function(_0x5713f3){if(_0x5713f3){_0x1bded6=_0x5713f3['length'];if(!_0x538f5e['query']['hasOwnProperty'](_0xdfb5('0x43'))){_0x4a7247[_0xdfb5('0x20')]=qs['limit'](_0x538f5e[_0xdfb5('0x3c')]['limit']);_0x4a7247['offset']=qs[_0xdfb5('0x1f')](_0x538f5e[_0xdfb5('0x3c')][_0xdfb5('0x1f')]);}return _0x766299['getMembers'](_0x4a7247);}})[_0xdfb5('0x25')](function(_0x1e7ed3){return _0x1e7ed3?{'count':_0x1bded6,'rows':_0x1e7ed3}:null;})[_0xdfb5('0x25')](respondWithResult(_0x1eb686,null))[_0xdfb5('0x4e')](handleError(_0x1eb686,null));};exports[_0xdfb5('0x96')]=function(_0x703a63,_0x3350f3,_0x1f0593){var _0x27232b={};var _0x999c65={};var _0x3b61f2;var _0x555a33;return db[_0xdfb5('0x49')][_0xdfb5('0x60')]({'where':{'id':_0x703a63[_0xdfb5('0x5d')]['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x3350f3,null))[_0xdfb5('0x25')](function(_0x98099a){if(_0x98099a){_0x3b61f2=_0x98099a;_0x999c65[_0xdfb5('0x3b')]=_[_0xdfb5('0x3d')](db['CmList'][_0xdfb5('0x38')]);_0x999c65[_0xdfb5('0x3c')]=_[_0xdfb5('0x3d')](_0x703a63[_0xdfb5('0x3c')]);_0x999c65[_0xdfb5('0x3e')]=_[_0xdfb5('0x4f')](_0x999c65['model'],_0x999c65[_0xdfb5('0x3c')]);_0x27232b['attributes']=_[_0xdfb5('0x4f')](_0x999c65[_0xdfb5('0x3b')],qs[_0xdfb5('0x40')](_0x703a63[_0xdfb5('0x3c')][_0xdfb5('0x40')]));_0x27232b[_0xdfb5('0x3f')]=_0x27232b['attributes'][_0xdfb5('0x41')]?_0x27232b[_0xdfb5('0x3f')]:_0x999c65[_0xdfb5('0x3b')];_0x27232b['order']=qs[_0xdfb5('0x44')](_0x703a63['query'][_0xdfb5('0x44')]);_0x27232b[_0xdfb5('0x45')]=qs[_0xdfb5('0x3e')](_['pick'](_0x703a63[_0xdfb5('0x3c')],_0x999c65[_0xdfb5('0x3e')]));if(_0x703a63[_0xdfb5('0x3c')][_0xdfb5('0x2b')]){_0x27232b[_0xdfb5('0x45')]=_[_0xdfb5('0x47')](_0x27232b[_0xdfb5('0x45')],{'$or':_[_0xdfb5('0x2d')](_0x27232b['attributes'],function(_0x494779){var _0x5254ed={};_0x5254ed[_0x494779]={'$like':'%'+_0x703a63[_0xdfb5('0x3c')]['filter']+'%'};return _0x5254ed;})});}_0x27232b=_[_0xdfb5('0x47')]({},_0x27232b,_0x703a63[_0xdfb5('0x48')]);return _0x3b61f2[_0xdfb5('0x96')](_0x27232b);}})[_0xdfb5('0x25')](function(_0x217c6d){if(_0x217c6d){_0x555a33=_0x217c6d[_0xdfb5('0x41')];if(!_0x703a63[_0xdfb5('0x3c')][_0xdfb5('0x42')]('nolimit')){_0x27232b[_0xdfb5('0x20')]=qs['limit'](_0x703a63[_0xdfb5('0x3c')][_0xdfb5('0x20')]);_0x27232b[_0xdfb5('0x1f')]=qs[_0xdfb5('0x1f')](_0x703a63[_0xdfb5('0x3c')][_0xdfb5('0x1f')]);}return _0x3b61f2['getLists'](_0x27232b);}})[_0xdfb5('0x25')](function(_0x227988){if(_0x227988){return _0x227988?{'count':_0x555a33,'rows':_0x227988}:null;}})['then'](respondWithResult(_0x3350f3,null))[_0xdfb5('0x4e')](handleError(_0x3350f3,null));};exports[_0xdfb5('0x97')]=function(_0x388125,_0x313006,_0xa7bb39){var _0x422c78,_0x448bc0;return db[_0xdfb5('0x49')][_0xdfb5('0x30')]({'where':{'id':_0x388125[_0xdfb5('0x5d')]['id']}})['then'](handleEntityNotFound(_0x313006,null))[_0xdfb5('0x25')](function(_0x540747){if(_0x540747){_0x448bc0=_0x540747;return _0x540747[_0xdfb5('0x97')](_0x388125[_0xdfb5('0x51')][_0xdfb5('0x7e')],_[_0xdfb5('0x5a')](_0x388125['body'],[_0xdfb5('0x7e'),'id'])||{});}return null;})[_0xdfb5('0x98')](function(_0x14bf0e){var _0x2be1da;_0x422c78=_0x14bf0e||[];var _0x3f32a2=[];if(_0x14bf0e){for(var _0x3cadda=0x0;_0x3cadda<_0x14bf0e[_0xdfb5('0x41')];_0x3cadda+=0x1){var _0x3ca5cf=_0x14bf0e[_0x3cadda][_0xdfb5('0x27')]({'plain':!![]});_0x448bc0['dialCheckDuplicateType']=_0x388125[_0xdfb5('0x51')]['dialCheckDuplicateType']?_0x388125[_0xdfb5('0x51')][_0xdfb5('0x99')]:_0x448bc0['dialCheckDuplicateType'];switch(_0x448bc0[_0xdfb5('0x99')]){case _0xdfb5('0x9a'):_0x2be1da=squel[_0xdfb5('0x9b')]()[_0xdfb5('0x9c')](_0xdfb5('0x9d'))[_0xdfb5('0x9e')]([_0xdfb5('0x9f'),_0xdfb5('0xa0'),'ContactId','ListId',_0xdfb5('0x63'),_0xdfb5('0x58'),_0xdfb5('0x59')],squel[_0xdfb5('0xa1')]()[_0xdfb5('0x7f')]('phone','phone')[_0xdfb5('0x7f')](_0xdfb5('0xa2'),_0xdfb5('0xa0'))[_0xdfb5('0x7f')]('id',_0xdfb5('0xa3'))['field'](_0x3ca5cf[_0xdfb5('0xa4')][_0xdfb5('0xa5')](),_0xdfb5('0xa6'))[_0xdfb5('0x7f')](_0x388125[_0xdfb5('0x5d')]['id'][_0xdfb5('0xa5')](),_0xdfb5('0x63'))[_0xdfb5('0x7f')]('NOW()',_0xdfb5('0x58'))[_0xdfb5('0x7f')](_0xdfb5('0xa2'),_0xdfb5('0x59'))[_0xdfb5('0xa7')]('cm_contacts')['where'](_0xdfb5('0xa8'))[_0xdfb5('0x45')](_0xdfb5('0xa9'),_0x3ca5cf[_0xdfb5('0xa4')]['toString']())['where'](_0xdfb5('0xaa'))[_0xdfb5('0x45')](_0xdfb5('0xab'),squel[_0xdfb5('0xa1')]()[_0xdfb5('0x7f')](_0xdfb5('0xac'))[_0xdfb5('0xa7')](_0xdfb5('0xad'))[_0xdfb5('0x45')](_0xdfb5('0xae'),_0x388125[_0xdfb5('0x5d')]['id'][_0xdfb5('0xa5')]()))[_0xdfb5('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdfb5('0xa1')]()['field'](_0xdfb5('0xaf'))[_0xdfb5('0xa7')](_0xdfb5('0x9d'))[_0xdfb5('0x45')](_0xdfb5('0xae'),_0x388125['params']['id'][_0xdfb5('0xa5')]())))[_0xdfb5('0xa5')]();break;case _0xdfb5('0xb0'):_0x2be1da=squel[_0xdfb5('0x9b')]()[_0xdfb5('0x9c')]('cm_hopper')['fromQuery']([_0xdfb5('0x9f'),_0xdfb5('0xa0'),_0xdfb5('0xa3'),_0xdfb5('0xa6'),_0xdfb5('0x63'),_0xdfb5('0x58'),_0xdfb5('0x59')],squel[_0xdfb5('0xa1')]()['field'](_0xdfb5('0x9f'),_0xdfb5('0x9f'))[_0xdfb5('0x7f')](_0xdfb5('0xa2'),_0xdfb5('0xa0'))[_0xdfb5('0x7f')]('id',_0xdfb5('0xa3'))[_0xdfb5('0x7f')](_0x3ca5cf[_0xdfb5('0xa4')][_0xdfb5('0xa5')](),_0xdfb5('0xa6'))['field'](_0x388125['params']['id'][_0xdfb5('0xa5')](),_0xdfb5('0x63'))[_0xdfb5('0x7f')](_0xdfb5('0xa2'),_0xdfb5('0x58'))[_0xdfb5('0x7f')](_0xdfb5('0xa2'),'updatedAt')['from'](_0xdfb5('0xb1'))[_0xdfb5('0x45')](_0xdfb5('0xa8'))['where'](_0xdfb5('0xa9'),_0x3ca5cf['CmListId'][_0xdfb5('0xa5')]())['where'](_0xdfb5('0xaa'))[_0xdfb5('0x45')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdfb5('0xa1')]()[_0xdfb5('0x7f')](_0xdfb5('0xaf'))['from']('cm_hopper')[_0xdfb5('0x45')]('VoiceQueueId\x20=\x20?',_0x388125[_0xdfb5('0x5d')]['id']['toString']())))[_0xdfb5('0xa5')]();break;default:_0x2be1da=squel[_0xdfb5('0x9b')]()[_0xdfb5('0x9c')](_0xdfb5('0x9d'))['fromQuery']([_0xdfb5('0x9f'),_0xdfb5('0xa0'),_0xdfb5('0xa3'),_0xdfb5('0xa6'),_0xdfb5('0x63'),'createdAt',_0xdfb5('0x59')],squel['select']()[_0xdfb5('0x7f')]('phone','phone')['field'](_0xdfb5('0xa2'),'scheduledAt')[_0xdfb5('0x7f')]('id',_0xdfb5('0xa3'))[_0xdfb5('0x7f')](_0x3ca5cf[_0xdfb5('0xa4')][_0xdfb5('0xa5')](),_0xdfb5('0xa6'))['field'](_0x388125['params']['id'][_0xdfb5('0xa5')](),_0xdfb5('0x63'))[_0xdfb5('0x7f')](_0xdfb5('0xa2'),'createdAt')[_0xdfb5('0x7f')](_0xdfb5('0xa2'),_0xdfb5('0x59'))['from'](_0xdfb5('0xb1'))[_0xdfb5('0x45')]('deletedAt\x20IS\x20NULL')['where'](_0xdfb5('0xa9'),_0x3ca5cf[_0xdfb5('0xa4')]['toString']())[_0xdfb5('0x45')](_0xdfb5('0xaa')))[_0xdfb5('0xa5')]();}_0x3f32a2[_0xdfb5('0x85')](db[_0xdfb5('0x72')][_0xdfb5('0x3c')](_0x2be1da));}return BPromise['all'](_0x3f32a2);}})[_0xdfb5('0x25')](function(){return _0x422c78;})[_0xdfb5('0x25')](respondWithResult(_0x313006,null))[_0xdfb5('0x4e')](handleError(_0x313006,null));};exports['removeLists']=function(_0x38dde1,_0x77f312,_0x15ab3f){return db[_0xdfb5('0x49')][_0xdfb5('0x30')]({'where':{'id':_0x38dde1['params']['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x77f312,null))[_0xdfb5('0x25')](function(_0xd9a878){if(_0xd9a878){return _0xd9a878[_0xdfb5('0xb2')](_0x38dde1[_0xdfb5('0x3c')][_0xdfb5('0x7e')]);}})['then'](function(_0x2b59d5){if(_0x2b59d5){return db['CmHopper']['destroy']({'where':{'ListId':_0x38dde1[_0xdfb5('0x3c')][_0xdfb5('0x7e')],'VoiceQueueId':_0x38dde1[_0xdfb5('0x5d')]['id']}})['then'](function(){return _0x2b59d5;});}})[_0xdfb5('0x25')](respondWithStatusCode(_0x77f312,null))[_0xdfb5('0x4e')](handleError(_0x77f312,null));};exports[_0xdfb5('0xb3')]=function(_0x43d1f2,_0x2649ea,_0x54d780){var _0x26302d={};var _0x530c7e={};var _0x4e01ef;var _0x131cd4;return db[_0xdfb5('0x49')][_0xdfb5('0x60')]({'where':{'id':_0x43d1f2[_0xdfb5('0x5d')]['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x2649ea,null))[_0xdfb5('0x25')](function(_0x4ce34b){if(_0x4ce34b){_0x4e01ef=_0x4ce34b;_0x530c7e[_0xdfb5('0x3b')]=_[_0xdfb5('0x3d')](db[_0xdfb5('0xb4')][_0xdfb5('0x38')]);_0x530c7e['query']=_[_0xdfb5('0x3d')](_0x43d1f2[_0xdfb5('0x3c')]);_0x530c7e[_0xdfb5('0x3e')]=_['intersection'](_0x530c7e[_0xdfb5('0x3b')],_0x530c7e[_0xdfb5('0x3c')]);_0x26302d['attributes']=_[_0xdfb5('0x4f')](_0x530c7e[_0xdfb5('0x3b')],qs['fields'](_0x43d1f2[_0xdfb5('0x3c')][_0xdfb5('0x40')]));_0x26302d['attributes']=_0x26302d['attributes'][_0xdfb5('0x41')]?_0x26302d[_0xdfb5('0x3f')]:_0x530c7e[_0xdfb5('0x3b')];_0x26302d[_0xdfb5('0x62')]=qs[_0xdfb5('0x44')](_0x43d1f2[_0xdfb5('0x3c')][_0xdfb5('0x44')]);_0x26302d[_0xdfb5('0x45')]=qs[_0xdfb5('0x3e')](_[_0xdfb5('0x46')](_0x43d1f2[_0xdfb5('0x3c')],_0x530c7e[_0xdfb5('0x3e')]));if(_0x43d1f2['query']['filter']){_0x26302d[_0xdfb5('0x45')]=_[_0xdfb5('0x47')](_0x26302d['where'],{'$or':_[_0xdfb5('0x2d')](_0x26302d[_0xdfb5('0x3f')],function(_0x2daf5c){var _0x1708d7={};_0x1708d7[_0x2daf5c]={'$like':'%'+_0x43d1f2[_0xdfb5('0x3c')][_0xdfb5('0x2b')]+'%'};return _0x1708d7;})});}_0x26302d=_[_0xdfb5('0x47')]({},_0x26302d,_0x43d1f2[_0xdfb5('0x48')]);return _0x4e01ef[_0xdfb5('0xb3')](_0x26302d);}})[_0xdfb5('0x25')](function(_0x2b22da){if(_0x2b22da){_0x131cd4=_0x2b22da[_0xdfb5('0x41')];if(!_0x43d1f2['query'][_0xdfb5('0x42')](_0xdfb5('0x43'))){_0x26302d['limit']=qs[_0xdfb5('0x20')](_0x43d1f2[_0xdfb5('0x3c')][_0xdfb5('0x20')]);_0x26302d['offset']=qs['offset'](_0x43d1f2[_0xdfb5('0x3c')][_0xdfb5('0x1f')]);}return _0x4e01ef[_0xdfb5('0xb3')](_0x26302d);}})[_0xdfb5('0x25')](function(_0x4fce3d){if(_0x4fce3d){return _0x4fce3d?{'count':_0x131cd4,'rows':_0x4fce3d}:null;}})[_0xdfb5('0x25')](respondWithResult(_0x2649ea,null))[_0xdfb5('0x4e')](handleError(_0x2649ea,null));};exports[_0xdfb5('0xb5')]=function(_0x3df967,_0x2900d2,_0x3a9a4f){var _0x5e7dba,_0x40a277;return db['VoiceQueue']['find']({'where':{'id':_0x3df967['params']['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x2900d2,null))[_0xdfb5('0x25')](function(_0x499fdb){if(_0x499fdb){_0x40a277=_0x499fdb;return _0x499fdb[_0xdfb5('0xb5')](_0x3df967[_0xdfb5('0x51')]['ids'],_['omit'](_0x3df967['body'],[_0xdfb5('0x7e'),'id'])||{});}return null;})['spread'](function(_0xd11aba){var _0x2edd62;_0x5e7dba=_0xd11aba||[];var _0x13848d=[];if(_0xd11aba){for(var _0x265f33=0x0;_0x265f33<_0xd11aba['length'];_0x265f33+=0x1){var _0x40998d=_0xd11aba[_0x265f33][_0xdfb5('0x27')]({'plain':!![]});_0x2edd62=squel['insert']()[_0xdfb5('0x9c')]('cm_hopper_black')['fromQuery']([_0xdfb5('0x9f'),_0xdfb5('0xa3'),_0xdfb5('0xa6'),_0xdfb5('0x63'),_0xdfb5('0x58'),_0xdfb5('0x59')],squel[_0xdfb5('0xa1')]()[_0xdfb5('0x7f')]('phone',_0xdfb5('0x9f'))['field']('id',_0xdfb5('0xa3'))['field'](_0x40998d['CmListId'][_0xdfb5('0xa5')](),_0xdfb5('0xa6'))['field'](_0x3df967['params']['id'][_0xdfb5('0xa5')](),'VoiceQueueId')[_0xdfb5('0x7f')](_0xdfb5('0xa2'),'createdAt')[_0xdfb5('0x7f')](_0xdfb5('0xa2'),_0xdfb5('0x59'))['from'](_0xdfb5('0xb1'))[_0xdfb5('0x45')](_0xdfb5('0xa8'))[_0xdfb5('0x45')](_0xdfb5('0xa9'),_0x40998d['CmListId'][_0xdfb5('0xa5')]())[_0xdfb5('0x45')](_0xdfb5('0xaa')))[_0xdfb5('0xa5')]();_0x13848d[_0xdfb5('0x85')](db[_0xdfb5('0x72')]['query'](_0x2edd62));}return BPromise[_0xdfb5('0x93')](_0x13848d);}})[_0xdfb5('0x25')](function(){return _0x5e7dba;})[_0xdfb5('0x25')](respondWithResult(_0x2900d2,null))[_0xdfb5('0x4e')](handleError(_0x2900d2,null));};exports[_0xdfb5('0xb6')]=function(_0x5e8784,_0x1c430d,_0x2da7db){return db[_0xdfb5('0x49')][_0xdfb5('0x30')]({'where':{'id':_0x5e8784[_0xdfb5('0x5d')]['id']}})[_0xdfb5('0x25')](handleEntityNotFound(_0x1c430d,null))[_0xdfb5('0x25')](function(_0x56f85a){if(_0x56f85a){return _0x56f85a['removeBlackLists'](_0x5e8784[_0xdfb5('0x3c')]['ids']);}})['then'](function(_0x43f7a3){if(_0x43f7a3){return db[_0xdfb5('0x67')]['destroy']({'where':{'ListId':_0x5e8784['query'][_0xdfb5('0x7e')],'VoiceQueueId':_0x5e8784[_0xdfb5('0x5d')]['id']}})[_0xdfb5('0x25')](function(){return _0x43f7a3;});}})[_0xdfb5('0x25')](respondWithStatusCode(_0x1c430d,null))[_0xdfb5('0x4e')](handleError(_0x1c430d,null));};
\ No newline at end of file
+var _0x5402=['params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','options','omit','createdAt','updatedAt','autoAssociation','update','getHoppers','findOne','CmHopper','nolimit','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','pick','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','Agents','online','interface','flatMap','forEach','penalty','sequelize','transaction','UserVoiceQueue','UserVoiceQueueRt','isNil','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','every','TeamId','includes','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','upsert','getAgents','getMembers','getLists','CmList','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','NOW()','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','limit','Content-Range','reject','save','then','destroy','get','inbound','QueueCampaigns','outbound','filter','value','type','find','name','UserProfileResource','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','merge','map','VIRTUAL','count','include','VoiceQueue','findAll','show'];(function(_0x1de104,_0x5d7701){var _0x351a5f=function(_0x4baaff){while(--_0x4baaff){_0x1de104['push'](_0x1de104['shift']());}};_0x351a5f(++_0x5d7701);}(_0x5402,0x121));var _0x2540=function(_0x36b1e7,_0x151468){_0x36b1e7=_0x36b1e7-0x0;var _0x395eb3=_0x5402[_0x36b1e7];return _0x395eb3;};'use strict';var pdf=require(_0x2540('0x0'));var emlformat=require(_0x2540('0x1'));var rimraf=require(_0x2540('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2540('0x3'));var rp=require(_0x2540('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2540('0x5'));var path=require(_0x2540('0x6'));var sox=require(_0x2540('0x7'));var csv=require(_0x2540('0x8'));var ejs=require(_0x2540('0x9'));var fs=require('fs');var _=require(_0x2540('0xa'));var squel=require(_0x2540('0xb'));var crypto=require(_0x2540('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2540('0xd'));var toCsv=require(_0x2540('0x8'));var querystring=require(_0x2540('0xe'));var Papa=require(_0x2540('0xf'));var Redis=require(_0x2540('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2540('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2540('0x12'));var logger=require(_0x2540('0x13'))(_0x2540('0x14'));var utils=require('../../config/utils');var config=require(_0x2540('0x15'));var db=require(_0x2540('0x16'))['db'];config[_0x2540('0x17')]=_[_0x2540('0x18')](config[_0x2540('0x17')],{'host':_0x2540('0x19'),'port':0x18eb});var socket=require(_0x2540('0x1a'))(new Redis(config['redis']));require(_0x2540('0x1b'))[_0x2540('0x1c')](socket);function respondWithStatusCode(_0x4586fb,_0x925dfa){_0x925dfa=_0x925dfa||0xcc;return function(_0x87615f){if(_0x87615f){return _0x4586fb[_0x2540('0x1d')](_0x925dfa);}return _0x4586fb[_0x2540('0x1e')](_0x925dfa)[_0x2540('0x1f')]();};}function respondWithResult(_0x131b0f,_0x47f436){_0x47f436=_0x47f436||0xc8;return function(_0x5aa7df){if(_0x5aa7df){return _0x131b0f['status'](_0x47f436)[_0x2540('0x20')](_0x5aa7df);}};}function respondWithFilteredResult(_0x4f04ce,_0x4bb89b){return function(_0x3b2e4e){if(_0x3b2e4e){var _0x2882b9=_0x3b2e4e['count'],_0x52899a=_0x4bb89b[_0x2540('0x21')],_0x2c361a=_0x4bb89b['offset']+_0x4bb89b[_0x2540('0x22')],_0x426c0a;if(_0x2c361a>=_0x2882b9){_0x2c361a=_0x2882b9;_0x426c0a=0xc8;}else{_0x426c0a=0xce;}_0x4f04ce[_0x2540('0x1e')](_0x426c0a);return _0x4f04ce['set'](_0x2540('0x23'),_0x52899a+'-'+_0x2c361a+'/'+_0x2882b9)['json'](_0x3b2e4e);}return null;};}function patchUpdates(_0x3c2a18){return function(_0x143b81){try{jsonpatch['apply'](_0x143b81,_0x3c2a18,!![]);}catch(_0x292ab4){return BPromise[_0x2540('0x24')](_0x292ab4);}return _0x143b81[_0x2540('0x25')]();};}function saveUpdates(_0x1d253e,_0x522c44){return function(_0x1651c9){if(_0x1651c9){return _0x1651c9['update'](_0x1d253e)[_0x2540('0x26')](function(_0x308112){return _0x308112;});}return null;};}function removeEntity(_0x5653ba,_0x4e928a){return function(_0x1347ea){if(_0x1347ea){return _0x1347ea[_0x2540('0x27')]()[_0x2540('0x26')](function(){var _0x5d46ae=_0x1347ea[_0x2540('0x28')]({'plain':!![]});var _0x1de7ca=[{'name':'VoiceQueues','value':_0x2540('0x29'),'ignore':![]},{'name':_0x2540('0x2a'),'value':_0x2540('0x2b'),'ignore':![]}];var _0x4dd6ee=_(_0x1de7ca)[_0x2540('0x2c')]('ignore')['map'](_0x2540('0x2d'))['value']();if(_['includes'](_0x4dd6ee,_0x5d46ae[_0x2540('0x2e')])){return;}var _0x39e22c=_[_0x2540('0x2f')](_0x1de7ca,[_0x2540('0x2d'),_0x5d46ae[_0x2540('0x2e')]])[_0x2540('0x30')];return db[_0x2540('0x31')][_0x2540('0x27')]({'where':{'type':_0x39e22c,'resourceId':_0x5d46ae['id']}})[_0x2540('0x26')](function(){return _0x1347ea;});})[_0x2540('0x26')](function(){_0x5653ba[_0x2540('0x1e')](0xcc)[_0x2540('0x1f')]();});}};}function handleEntityNotFound(_0x36197d,_0x54aa9c){return function(_0x4b4abb){if(!_0x4b4abb){_0x36197d['sendStatus'](0x194);}return _0x4b4abb;};}function handleError(_0x593537,_0x46b680){_0x46b680=_0x46b680||0x1f4;return function(_0xaf3965){logger[_0x2540('0x32')](_0xaf3965[_0x2540('0x33')]);if(_0xaf3965[_0x2540('0x30')]){delete _0xaf3965['name'];}_0x593537['status'](_0x46b680)[_0x2540('0x34')](_0xaf3965);};}exports[_0x2540('0x35')]=function(_0x1ac323,_0x18e149){var _0x3276e2={},_0x308810={},_0x5a05c7={'count':0x0,'rows':[]};var _0x1cec2d=_['map'](db['VoiceQueue'][_0x2540('0x36')],function(_0x3f3d1b){return{'name':_0x3f3d1b[_0x2540('0x37')],'type':_0x3f3d1b[_0x2540('0x2e')][_0x2540('0x38')]};});_0x308810[_0x2540('0x39')]=_['map'](_0x1cec2d,'name');_0x308810[_0x2540('0x3a')]=_[_0x2540('0x3b')](_0x1ac323['query']);_0x308810[_0x2540('0x3c')]=_[_0x2540('0x3d')](_0x308810[_0x2540('0x39')],_0x308810[_0x2540('0x3a')]);_0x3276e2['attributes']=_['intersection'](_0x308810[_0x2540('0x39')],qs['fields'](_0x1ac323[_0x2540('0x3a')][_0x2540('0x3e')]));_0x3276e2[_0x2540('0x3f')]=_0x3276e2[_0x2540('0x3f')][_0x2540('0x40')]?_0x3276e2['attributes']:_0x308810['model'];if(!_0x1ac323[_0x2540('0x3a')][_0x2540('0x41')]('nolimit')){_0x3276e2[_0x2540('0x22')]=qs[_0x2540('0x22')](_0x1ac323[_0x2540('0x3a')][_0x2540('0x22')]);_0x3276e2[_0x2540('0x21')]=qs['offset'](_0x1ac323[_0x2540('0x3a')][_0x2540('0x21')]);}_0x3276e2[_0x2540('0x42')]=qs[_0x2540('0x43')](_0x1ac323[_0x2540('0x3a')][_0x2540('0x43')]);_0x3276e2[_0x2540('0x44')]=qs['filters'](_['pick'](_0x1ac323[_0x2540('0x3a')],_0x308810[_0x2540('0x3c')]),_0x1cec2d);if(_0x1ac323['query'][_0x2540('0x2c')]){_0x3276e2['where']=_[_0x2540('0x45')](_0x3276e2[_0x2540('0x44')],{'$or':_[_0x2540('0x46')](_0x1cec2d,function(_0xc23ef2){if(_0xc23ef2[_0x2540('0x2e')]!==_0x2540('0x47')){var _0x2bc6b1={};_0x2bc6b1[_0xc23ef2['name']]={'$like':'%'+_0x1ac323[_0x2540('0x3a')]['filter']+'%'};return _0x2bc6b1;}})});}_0x3276e2=_[_0x2540('0x45')]({},_0x3276e2,_0x1ac323['options']);var _0x47cc5b={'where':_0x3276e2[_0x2540('0x44')]};return db['VoiceQueue'][_0x2540('0x48')](_0x47cc5b)['then'](function(_0x130ce4){_0x5a05c7['count']=_0x130ce4;if(_0x1ac323[_0x2540('0x3a')]['includeAll']){_0x3276e2[_0x2540('0x49')]=[{'all':!![]}];}return db[_0x2540('0x4a')][_0x2540('0x4b')](_0x3276e2);})[_0x2540('0x26')](function(_0x2ee2fb){_0x5a05c7['rows']=_0x2ee2fb;return _0x5a05c7;})[_0x2540('0x26')](respondWithFilteredResult(_0x18e149,_0x3276e2))['catch'](handleError(_0x18e149,null));};exports[_0x2540('0x4c')]=function(_0x190b3d,_0x12036c){var _0x20737b={'raw':![],'where':{'id':_0x190b3d[_0x2540('0x4d')]['id']}},_0x2e0d1f={};_0x2e0d1f[_0x2540('0x39')]=_[_0x2540('0x3b')](db[_0x2540('0x4a')][_0x2540('0x36')]);_0x2e0d1f['query']=_['keys'](_0x190b3d[_0x2540('0x3a')]);_0x2e0d1f['filters']=_[_0x2540('0x3d')](_0x2e0d1f['model'],_0x2e0d1f[_0x2540('0x3a')]);_0x20737b[_0x2540('0x3f')]=_[_0x2540('0x3d')](_0x2e0d1f[_0x2540('0x39')],qs['fields'](_0x190b3d[_0x2540('0x3a')]['fields']));_0x20737b['attributes']=_0x20737b[_0x2540('0x3f')][_0x2540('0x40')]?_0x20737b['attributes']:_0x2e0d1f[_0x2540('0x39')];if(_0x190b3d[_0x2540('0x3a')]['includeAll']){_0x20737b[_0x2540('0x49')]=[{'all':!![]}];}_0x20737b=_[_0x2540('0x45')]({},_0x20737b,_0x190b3d['options']);return db[_0x2540('0x4a')][_0x2540('0x2f')](_0x20737b)[_0x2540('0x26')](handleEntityNotFound(_0x12036c,null))[_0x2540('0x26')](respondWithResult(_0x12036c,null))[_0x2540('0x4e')](handleError(_0x12036c,null));};exports[_0x2540('0x4f')]=function(_0x3259c6,_0x37ca19){return db[_0x2540('0x4a')][_0x2540('0x4f')](_0x3259c6[_0x2540('0x50')],{})['then'](function(_0x92456d){var _0x6ca2ea=_0x3259c6[_0x2540('0x51')][_0x2540('0x28')]({'plain':!![]});if(!_0x6ca2ea)throw new Error(_0x2540('0x52'));if(_0x6ca2ea[_0x2540('0x53')]===_0x2540('0x51')){var _0x292dec=_0x92456d[_0x2540('0x28')]({'plain':!![]});var _0xfd7957=[{'name':_0x2540('0x54'),'value':_0x2540('0x29')},{'name':_0x2540('0x2a'),'value':'outbound'}];var _0x26ab69=_[_0x2540('0x2f')](_0xfd7957,['value',_0x292dec['type']])['name'];return db[_0x2540('0x55')][_0x2540('0x2f')]({'where':{'name':_0x26ab69,'userProfileId':_0x6ca2ea[_0x2540('0x56')]},'raw':!![]})[_0x2540('0x26')](function(_0x5ab177){if(_0x5ab177&&_0x5ab177['autoAssociation']===0x0){return db[_0x2540('0x31')][_0x2540('0x4f')]({'name':_0x292dec['name'],'resourceId':_0x292dec['id'],'type':_0x5ab177['name'],'sectionId':_0x5ab177['id']},{})['then'](function(){return _0x92456d;});}else{return _0x92456d;}})['catch'](function(_0x567763){logger[_0x2540('0x32')](_0x2540('0x57'),_0x567763);throw _0x567763;});}return _0x92456d;})[_0x2540('0x26')](respondWithResult(_0x37ca19,0xc9))[_0x2540('0x4e')](handleError(_0x37ca19,null));};exports[_0x2540('0x58')]=function(_0x5bb842,_0x42b0f0){var _0x5287a6={'where':{'id':_0x5bb842[_0x2540('0x4d')]['id']}},_0x80083d={};_0x80083d[_0x2540('0x39')]=_[_0x2540('0x3b')](db['VoiceQueue'][_0x2540('0x36')]);_0x5287a6[_0x2540('0x3f')]=_[_0x2540('0x3d')](_0x80083d[_0x2540('0x39')],qs['fields'](_0x5bb842['query'][_0x2540('0x3e')]));_0x5287a6[_0x2540('0x3f')]=_0x5287a6[_0x2540('0x3f')][_0x2540('0x40')]?_0x5287a6[_0x2540('0x3f')]:_0x80083d[_0x2540('0x39')];if(_0x5bb842[_0x2540('0x3a')][_0x2540('0x59')]){_0x5287a6[_0x2540('0x49')]=[{'all':!![]}];}_0x5287a6=_[_0x2540('0x45')]({},_0x5287a6,_0x5bb842[_0x2540('0x5a')]);return db[_0x2540('0x4a')]['find'](_0x5287a6)[_0x2540('0x26')](handleEntityNotFound(_0x42b0f0,null))['then'](function(_0x1205e6){if(_0x1205e6){var _0x383ca6=_0x1205e6[_0x2540('0x28')]({'plain':!![]});_0x383ca6=qs[_0x2540('0x5b')](_0x383ca6,['id',_0x2540('0x5c'),_0x2540('0x5d')]);_0x5bb842[_0x2540('0x50')]=_[_0x2540('0x5b')](_0x5bb842[_0x2540('0x50')],['id','createdAt',_0x2540('0x5d')]);return db[_0x2540('0x4a')]['create'](_[_0x2540('0x45')](_0x383ca6,_0x5bb842[_0x2540('0x50')]),{'include':_0x5bb842[_0x2540('0x3a')][_0x2540('0x59')]?[{'all':!![]}]:undefined})[_0x2540('0x26')](function(_0x4cdf58){var _0x32cfc5=_0x5bb842[_0x2540('0x51')][_0x2540('0x28')]({'plain':!![]});if(!_0x32cfc5)throw new Error(_0x2540('0x52'));if(_0x32cfc5[_0x2540('0x53')]===_0x2540('0x51')){var _0x5ac77e=_0x4cdf58['get']({'plain':!![]});var _0x529985=[{'name':_0x2540('0x54'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x2540('0x2b')}];var _0xaf213=_['find'](_0x529985,[_0x2540('0x2d'),_0x5ac77e[_0x2540('0x2e')]])[_0x2540('0x30')];return db[_0x2540('0x55')][_0x2540('0x2f')]({'where':{'name':_0xaf213,'userProfileId':_0x32cfc5[_0x2540('0x56')]},'raw':!![]})[_0x2540('0x26')](function(_0x257b68){if(_0x257b68&&_0x257b68[_0x2540('0x5e')]===0x0){return db[_0x2540('0x31')]['create']({'name':_0x5ac77e[_0x2540('0x30')],'resourceId':_0x5ac77e['id'],'type':_0x257b68[_0x2540('0x30')],'sectionId':_0x257b68['id']},{})[_0x2540('0x26')](function(){return _0x4cdf58;});}else{return _0x4cdf58;}})[_0x2540('0x4e')](function(_0x1c45a7){logger[_0x2540('0x32')](_0x2540('0x57'),_0x1c45a7);throw _0x1c45a7;});}return _0x4cdf58;});}})[_0x2540('0x26')](respondWithResult(_0x42b0f0,0xc9))[_0x2540('0x4e')](handleError(_0x42b0f0,null));};exports[_0x2540('0x5f')]=function(_0x653bfd,_0xbd81cf){if(_0x653bfd['body']['id']){delete _0x653bfd[_0x2540('0x50')]['id'];}return db[_0x2540('0x4a')][_0x2540('0x2f')]({'where':{'id':_0x653bfd[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0xbd81cf,null))[_0x2540('0x26')](saveUpdates(_0x653bfd['body'],null))[_0x2540('0x26')](respondWithResult(_0xbd81cf,null))[_0x2540('0x4e')](handleError(_0xbd81cf,null));};exports[_0x2540('0x27')]=function(_0x10f588,_0x2fcee9){return db[_0x2540('0x4a')][_0x2540('0x2f')]({'where':{'id':_0x10f588[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x2fcee9,null))['then'](removeEntity(_0x2fcee9,null))[_0x2540('0x4e')](handleError(_0x2fcee9,null));};exports[_0x2540('0x60')]=function(_0x26aa3b,_0x388c78,_0x1c3601){var _0x4dcef0={'raw':![],'where':{}};var _0x1eb59f={};var _0x353337={'count':0x0,'rows':[]};return db[_0x2540('0x4a')][_0x2540('0x61')]({'where':{'id':_0x26aa3b[_0x2540('0x4d')]['id']}})['then'](handleEntityNotFound(_0x388c78,null))[_0x2540('0x26')](function(_0x12d95c){if(_0x12d95c){_0x1eb59f[_0x2540('0x39')]=_['keys'](db[_0x2540('0x62')][_0x2540('0x36')]);_0x1eb59f['query']=_['keys'](_0x26aa3b[_0x2540('0x3a')]);_0x1eb59f[_0x2540('0x3c')]=_[_0x2540('0x3d')](_0x1eb59f[_0x2540('0x39')],_0x1eb59f[_0x2540('0x3a')]);_0x4dcef0['attributes']=_[_0x2540('0x3d')](_0x1eb59f[_0x2540('0x39')],qs[_0x2540('0x3e')](_0x26aa3b[_0x2540('0x3a')]['fields']));_0x4dcef0['attributes']=_0x4dcef0[_0x2540('0x3f')]['length']?_0x4dcef0['attributes']:_0x1eb59f[_0x2540('0x39')];if(!_0x26aa3b[_0x2540('0x3a')][_0x2540('0x41')](_0x2540('0x63'))){_0x4dcef0[_0x2540('0x22')]=qs[_0x2540('0x22')](_0x26aa3b[_0x2540('0x3a')][_0x2540('0x22')]);_0x4dcef0[_0x2540('0x21')]=qs['offset'](_0x26aa3b[_0x2540('0x3a')][_0x2540('0x21')]);}_0x4dcef0['order']=qs[_0x2540('0x43')](_0x26aa3b[_0x2540('0x3a')]['sort']);_0x4dcef0[_0x2540('0x44')]=qs['filters'](_['pick'](_0x26aa3b[_0x2540('0x3a')],_0x1eb59f['filters']));_0x4dcef0['where'][_0x2540('0x64')]=_0x12d95c['id'];if(_0x26aa3b[_0x2540('0x3a')][_0x2540('0x2c')]){_0x4dcef0[_0x2540('0x44')]=_[_0x2540('0x45')](_0x4dcef0[_0x2540('0x44')],{'$or':_['map'](_0x4dcef0[_0x2540('0x3f')],function(_0x3d89be){var _0x2677ab={};_0x2677ab[_0x3d89be]={'$like':'%'+_0x26aa3b['query'][_0x2540('0x2c')]+'%'};return _0x2677ab;})});}_0x4dcef0=_[_0x2540('0x45')]({},_0x4dcef0,_0x26aa3b[_0x2540('0x5a')]);return db['CmHopper'][_0x2540('0x48')]({'where':_0x4dcef0[_0x2540('0x44')]})[_0x2540('0x26')](function(_0x3e4372){_0x353337[_0x2540('0x48')]=_0x3e4372;if(_0x26aa3b[_0x2540('0x3a')][_0x2540('0x59')]){_0x4dcef0[_0x2540('0x49')]=[{'all':!![]}];}return db[_0x2540('0x62')][_0x2540('0x4b')](_0x4dcef0);})[_0x2540('0x26')](function(_0x449318){_0x353337[_0x2540('0x65')]=_0x449318;return _0x353337;});}})[_0x2540('0x26')](respondWithFilteredResult(_0x388c78,_0x4dcef0))[_0x2540('0x4e')](handleError(_0x388c78,null));};exports[_0x2540('0x66')]=function(_0x389ee1,_0x2daa49,_0x302f7b){var _0xa81981={'raw':!![],'where':{}};var _0x5203e2={};var _0x424289={'count':0x0,'rows':[]};return db[_0x2540('0x4a')][_0x2540('0x61')]({'where':{'id':_0x389ee1['params']['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x2daa49,null))[_0x2540('0x26')](function(_0x2bdc89){if(_0x2bdc89){_0x5203e2[_0x2540('0x39')]=_['keys'](db[_0x2540('0x67')][_0x2540('0x36')]);_0x5203e2[_0x2540('0x3a')]=_[_0x2540('0x3b')](_0x389ee1['query']);_0x5203e2['filters']=_[_0x2540('0x3d')](_0x5203e2[_0x2540('0x39')],_0x5203e2[_0x2540('0x3a')]);_0xa81981[_0x2540('0x3f')]=_[_0x2540('0x3d')](_0x5203e2[_0x2540('0x39')],qs[_0x2540('0x3e')](_0x389ee1[_0x2540('0x3a')][_0x2540('0x3e')]));_0xa81981[_0x2540('0x3f')]=_0xa81981['attributes'][_0x2540('0x40')]?_0xa81981[_0x2540('0x3f')]:_0x5203e2[_0x2540('0x39')];if(!_0x389ee1[_0x2540('0x3a')]['hasOwnProperty'](_0x2540('0x63'))){_0xa81981['limit']=qs[_0x2540('0x22')](_0x389ee1['query'][_0x2540('0x22')]);_0xa81981[_0x2540('0x21')]=qs[_0x2540('0x21')](_0x389ee1['query'][_0x2540('0x21')]);}_0xa81981[_0x2540('0x42')]=qs[_0x2540('0x43')](_0x389ee1['query'][_0x2540('0x43')]);_0xa81981[_0x2540('0x44')]=qs['filters'](_[_0x2540('0x68')](_0x389ee1[_0x2540('0x3a')],_0x5203e2[_0x2540('0x3c')]));_0xa81981[_0x2540('0x44')]['VoiceQueueId']=_0x2bdc89['id'];if(_0x389ee1['query']['filter']){_0xa81981['where']=_[_0x2540('0x45')](_0xa81981[_0x2540('0x44')],{'$or':_[_0x2540('0x46')](_0xa81981[_0x2540('0x3f')],function(_0x5555e8){var _0x27c4a4={};_0x27c4a4[_0x5555e8]={'$like':'%'+_0x389ee1[_0x2540('0x3a')][_0x2540('0x2c')]+'%'};return _0x27c4a4;})});}_0xa81981=_[_0x2540('0x45')]({},_0xa81981,_0x389ee1['options']);return db[_0x2540('0x67')]['count']({'where':_0xa81981['where']})[_0x2540('0x26')](function(_0x370212){_0x424289[_0x2540('0x48')]=_0x370212;if(_0x389ee1['query'][_0x2540('0x59')]){_0xa81981[_0x2540('0x49')]=[{'all':!![]}];}return db[_0x2540('0x67')][_0x2540('0x4b')](_0xa81981);})[_0x2540('0x26')](function(_0x216395){_0x424289['rows']=_0x216395;return _0x424289;});}})[_0x2540('0x26')](respondWithFilteredResult(_0x2daa49,_0xa81981))[_0x2540('0x4e')](handleError(_0x2daa49,null));};exports[_0x2540('0x69')]=function(_0x5e74c0,_0x110394,_0x1f0f04){var _0x3719ca={'raw':!![],'where':{}};var _0x41f6e6={};var _0x1bb688={'count':0x0,'rows':[]};return db[_0x2540('0x4a')][_0x2540('0x61')]({'where':{'id':_0x5e74c0[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x110394,null))[_0x2540('0x26')](function(_0x433640){if(_0x433640){_0x41f6e6[_0x2540('0x39')]=_['keys'](db[_0x2540('0x6a')][_0x2540('0x36')]);_0x41f6e6[_0x2540('0x3a')]=_[_0x2540('0x3b')](_0x5e74c0[_0x2540('0x3a')]);_0x41f6e6[_0x2540('0x3c')]=_[_0x2540('0x3d')](_0x41f6e6['model'],_0x41f6e6['query']);_0x3719ca[_0x2540('0x3f')]=_['intersection'](_0x41f6e6[_0x2540('0x39')],qs[_0x2540('0x3e')](_0x5e74c0[_0x2540('0x3a')][_0x2540('0x3e')]));_0x3719ca['attributes']=_0x3719ca['attributes'][_0x2540('0x40')]?_0x3719ca[_0x2540('0x3f')]:_0x41f6e6[_0x2540('0x39')];if(!_0x5e74c0['query'][_0x2540('0x41')](_0x2540('0x63'))){_0x3719ca[_0x2540('0x22')]=qs[_0x2540('0x22')](_0x5e74c0['query']['limit']);_0x3719ca[_0x2540('0x21')]=qs[_0x2540('0x21')](_0x5e74c0[_0x2540('0x3a')][_0x2540('0x21')]);}_0x3719ca['order']=qs[_0x2540('0x43')](_0x5e74c0[_0x2540('0x3a')][_0x2540('0x43')]);_0x3719ca[_0x2540('0x44')]=qs[_0x2540('0x3c')](_['pick'](_0x5e74c0[_0x2540('0x3a')],_0x41f6e6[_0x2540('0x3c')]));_0x3719ca[_0x2540('0x44')]['VoiceQueueId']=_0x433640['id'];if(_0x5e74c0[_0x2540('0x3a')][_0x2540('0x2c')]){_0x3719ca[_0x2540('0x44')]=_[_0x2540('0x45')](_0x3719ca['where'],{'$or':_[_0x2540('0x46')](_0x3719ca[_0x2540('0x3f')],function(_0x1dc870){var _0x810954={};_0x810954[_0x1dc870]={'$like':'%'+_0x5e74c0[_0x2540('0x3a')][_0x2540('0x2c')]+'%'};return _0x810954;})});}_0x3719ca=_[_0x2540('0x45')]({},_0x3719ca,_0x5e74c0[_0x2540('0x5a')]);return db[_0x2540('0x6a')][_0x2540('0x48')]({'where':_0x3719ca['where']})[_0x2540('0x26')](function(_0x42dfe0){_0x1bb688[_0x2540('0x48')]=_0x42dfe0;if(_0x5e74c0[_0x2540('0x3a')][_0x2540('0x59')]){_0x3719ca[_0x2540('0x49')]=[{'all':!![]}];}return db[_0x2540('0x6a')][_0x2540('0x4b')](_0x3719ca);})[_0x2540('0x26')](function(_0x5bb553){_0x1bb688[_0x2540('0x65')]=_0x5bb553;return _0x1bb688;});}})[_0x2540('0x26')](respondWithFilteredResult(_0x110394,_0x3719ca))[_0x2540('0x4e')](handleError(_0x110394,null));};exports[_0x2540('0x6b')]=function(_0x40b525,_0x12124b,_0x48d2d7){var _0x1a91f0={'raw':!![],'where':{}};var _0x33743e={};var _0x46d222={'count':0x0,'rows':[]};return db[_0x2540('0x4a')][_0x2540('0x61')]({'where':{'id':_0x40b525[_0x2540('0x4d')]['id']}})['then'](handleEntityNotFound(_0x12124b,null))[_0x2540('0x26')](function(_0x52a988){if(_0x52a988){_0x33743e['model']=_[_0x2540('0x3b')](db[_0x2540('0x6c')][_0x2540('0x36')]);_0x33743e[_0x2540('0x3a')]=_['keys'](_0x40b525[_0x2540('0x3a')]);_0x33743e[_0x2540('0x3c')]=_['intersection'](_0x33743e[_0x2540('0x39')],_0x33743e['query']);_0x1a91f0[_0x2540('0x3f')]=_[_0x2540('0x3d')](_0x33743e['model'],qs[_0x2540('0x3e')](_0x40b525[_0x2540('0x3a')][_0x2540('0x3e')]));_0x1a91f0['attributes']=_0x1a91f0[_0x2540('0x3f')][_0x2540('0x40')]?_0x1a91f0[_0x2540('0x3f')]:_0x33743e[_0x2540('0x39')];if(!_0x40b525['query'][_0x2540('0x41')](_0x2540('0x63'))){_0x1a91f0[_0x2540('0x22')]=qs[_0x2540('0x22')](_0x40b525[_0x2540('0x3a')][_0x2540('0x22')]);_0x1a91f0['offset']=qs[_0x2540('0x21')](_0x40b525[_0x2540('0x3a')]['offset']);}_0x1a91f0[_0x2540('0x42')]=qs[_0x2540('0x43')](_0x40b525[_0x2540('0x3a')]['sort']);_0x1a91f0[_0x2540('0x44')]=qs[_0x2540('0x3c')](_[_0x2540('0x68')](_0x40b525[_0x2540('0x3a')],_0x33743e[_0x2540('0x3c')]));_0x1a91f0['where'][_0x2540('0x64')]=_0x52a988['id'];if(_0x40b525[_0x2540('0x3a')][_0x2540('0x2c')]){_0x1a91f0['where']=_['merge'](_0x1a91f0['where'],{'$or':_[_0x2540('0x46')](_0x1a91f0[_0x2540('0x3f')],function(_0x13d9ba){var _0x383b5d={};_0x383b5d[_0x13d9ba]={'$like':'%'+_0x40b525['query'][_0x2540('0x2c')]+'%'};return _0x383b5d;})});}_0x1a91f0=_[_0x2540('0x45')]({},_0x1a91f0,_0x40b525['options']);return db[_0x2540('0x6c')]['count']({'where':_0x1a91f0[_0x2540('0x44')]})['then'](function(_0x3f7d58){_0x46d222[_0x2540('0x48')]=_0x3f7d58;if(_0x40b525[_0x2540('0x3a')][_0x2540('0x59')]){_0x1a91f0[_0x2540('0x49')]=[{'all':!![]}];}return db[_0x2540('0x6c')][_0x2540('0x4b')](_0x1a91f0);})[_0x2540('0x26')](function(_0x42ca4c){_0x46d222[_0x2540('0x65')]=_0x42ca4c;return _0x46d222;});}})[_0x2540('0x26')](respondWithFilteredResult(_0x12124b,_0x1a91f0))[_0x2540('0x4e')](handleError(_0x12124b,null));};exports[_0x2540('0x6d')]=function(_0x3dc87a,_0x349f87,_0x1405a4){var _0x55f5b2={};var _0x1305d9={};var _0x5b2c1c;var _0x4af313;return db['VoiceQueue'][_0x2540('0x61')]({'where':{'id':_0x3dc87a[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x349f87,null))[_0x2540('0x26')](function(_0x539118){if(_0x539118){_0x5b2c1c=_0x539118;_0x1305d9[_0x2540('0x39')]=_[_0x2540('0x3b')](db[_0x2540('0x6e')][_0x2540('0x36')]);_0x1305d9[_0x2540('0x3a')]=_[_0x2540('0x3b')](_0x3dc87a[_0x2540('0x3a')]);_0x1305d9[_0x2540('0x3c')]=_[_0x2540('0x3d')](_0x1305d9[_0x2540('0x39')],_0x1305d9[_0x2540('0x3a')]);_0x55f5b2[_0x2540('0x3f')]=_['intersection'](_0x1305d9[_0x2540('0x39')],qs['fields'](_0x3dc87a[_0x2540('0x3a')][_0x2540('0x3e')]));_0x55f5b2[_0x2540('0x3f')]=_0x55f5b2[_0x2540('0x3f')][_0x2540('0x40')]?_0x55f5b2['attributes']:_0x1305d9[_0x2540('0x39')];_0x55f5b2['order']=qs[_0x2540('0x43')](_0x3dc87a['query'][_0x2540('0x43')]);_0x55f5b2[_0x2540('0x44')]=qs[_0x2540('0x3c')](_['pick'](_0x3dc87a['query'],_0x1305d9[_0x2540('0x3c')]));if(_0x3dc87a[_0x2540('0x3a')]['filter']){_0x55f5b2[_0x2540('0x44')]=_[_0x2540('0x45')](_0x55f5b2['where'],{'$or':_[_0x2540('0x46')](_0x55f5b2['attributes'],function(_0x278449){var _0x2a53c6={};_0x2a53c6[_0x278449]={'$like':'%'+_0x3dc87a[_0x2540('0x3a')]['filter']+'%'};return _0x2a53c6;})});}_0x55f5b2=_[_0x2540('0x45')]({},_0x55f5b2,_0x3dc87a[_0x2540('0x5a')]);return _0x5b2c1c[_0x2540('0x6d')](_0x55f5b2);}})[_0x2540('0x26')](function(_0x174eef){if(_0x174eef){_0x4af313=_0x174eef['length'];if(!_0x3dc87a['query'][_0x2540('0x41')](_0x2540('0x63'))){_0x55f5b2[_0x2540('0x22')]=qs[_0x2540('0x22')](_0x3dc87a[_0x2540('0x3a')][_0x2540('0x22')]);_0x55f5b2[_0x2540('0x21')]=qs[_0x2540('0x21')](_0x3dc87a[_0x2540('0x3a')][_0x2540('0x21')]);}return _0x5b2c1c[_0x2540('0x6d')](_0x55f5b2);}})[_0x2540('0x26')](function(_0x4732f7){if(_0x4732f7){return _0x4732f7?{'count':_0x4af313,'rows':_0x4732f7}:null;}})[_0x2540('0x26')](respondWithResult(_0x349f87,null))[_0x2540('0x4e')](handleError(_0x349f87,null));};exports[_0x2540('0x6f')]=function(_0x2332ce,_0xb05fa9,_0x4fcd52){var _0x34de7f=_0x2332ce[_0x2540('0x50')][_0x2540('0x70')];var _0x4cc02c=_[_0x2540('0x46')](_0x34de7f,'id');return db[_0x2540('0x6e')][_0x2540('0x4b')]({'where':{'id':_0x4cc02c},'attributes':['id'],'include':[{'model':db[_0x2540('0x71')],'as':_0x2540('0x72'),'attributes':['id',_0x2540('0x30'),_0x2540('0x73'),'voicePause',_0x2540('0x74')],'raw':!![]}]})[_0x2540('0x26')](function(_0x4c073f){if(_0x4c073f){var _0x305e49=_[_0x2540('0x75')](_0x4c073f,function(_0x4851fb){var _0x22eff8=_0x4851fb[_0x2540('0x28')]({'plain':!![]});_0x22eff8[_0x2540('0x72')][_0x2540('0x76')](function(_0x6af71e){_0x6af71e[_0x2540('0x77')]=_['find'](_0x34de7f,{'id':_0x22eff8['id']})[_0x2540('0x77')];});return _0x22eff8['Agents'];});return db[_0x2540('0x4a')][_0x2540('0x2f')]({'where':{'id':_0x2332ce['params']['id']}})[_0x2540('0x26')](function(_0x1d820f){return db[_0x2540('0x78')][_0x2540('0x79')](function(_0x3d3c40){return _0x1d820f[_0x2540('0x6f')](_0x4cc02c,{'transaction':_0x3d3c40})[_0x2540('0x26')](function(){return BPromise['each'](_0x305e49,function(_0x4dee2b){return db[_0x2540('0x7a')]['findOrCreate']({'where':{'UserId':_0x4dee2b['id'],'VoiceQueueId':_0x2332ce[_0x2540('0x4d')]['id']},'defaults':{'penalty':_0x4dee2b[_0x2540('0x77')]},'transaction':_0x3d3c40});});})['then'](function(){return BPromise['each'](_[_0x2540('0x2c')](_0x305e49,{'online':!![]}),function(_0x5b6ff0){return db[_0x2540('0x7b')]['upsert']({'membername':_0x5b6ff0[_0x2540('0x30')],'UserId':_0x5b6ff0['id'],'queue_name':_0x1d820f['name'],'VoiceQueueId':_0x1d820f['id'],'interface':_[_0x2540('0x7c')](_0x5b6ff0['interface'])?util[_0x2540('0x7d')](_0x2540('0x7e'),_0x5b6ff0['name']):_0x5b6ff0['interface'],'paused':_0x5b6ff0[_0x2540('0x7f')]||![],'penalty':_0x5b6ff0[_0x2540('0x77')]},{'transaction':_0x3d3c40});});})[_0x2540('0x26')](function(){_0x305e49[_0x2540('0x76')](function(_0x197e27){socket[_0x2540('0x80')](_0x2540('0x81'),{'UserId':_0x197e27['id'],'VoiceQueueId':_0x1d820f['id']});});});});});}})[_0x2540('0x26')](respondWithStatusCode(_0xb05fa9,null))[_0x2540('0x4e')](handleError(_0xb05fa9,null));};exports[_0x2540('0x82')]=function(_0xa59d82,_0x4005ab,_0x1b6f0c){return db['Team'][_0x2540('0x4b')]({'where':{'id':_0xa59d82[_0x2540('0x3a')][_0x2540('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2540('0x72'),'attributes':['id'],'raw':!![]}]})[_0x2540('0x26')](handleEntityNotFound(_0x4005ab,null))['then'](function(_0x3c6724){var _0x4dc3f4=_[_0x2540('0x46')](_0x3c6724,'id');var _0x4f96e3=[];var _0x1a4bb8=[];var _0x415c3a=squel[_0x2540('0x84')]();_0x415c3a[_0x2540('0x85')](_0x2540('0x86'))[_0x2540('0x87')](_0x2540('0x88'),'tq')['join']('user_has_teams','ut',_0x2540('0x89'))[_0x2540('0x44')](_0x2540('0x8a'),_0xa59d82[_0x2540('0x4d')]['id']);for(var _0x40f3a8=0x0;_0x40f3a8<_0x3c6724[_0x2540('0x40')];_0x40f3a8+=0x1){let _0x5b45b0=_0x3c6724[_0x40f3a8];for(var _0x46d3f=0x0;_0x46d3f<_0x5b45b0[_0x2540('0x72')][_0x2540('0x40')];_0x46d3f+=0x1){let _0x1ee3d5=_0x5b45b0[_0x2540('0x72')][_0x46d3f];var _0x5383b0=_0x415c3a[_0x2540('0x58')]();_0x5383b0[_0x2540('0x44')](_0x2540('0x8b'),_0x1ee3d5['id']);_0x1a4bb8[_0x2540('0x8c')](db[_0x2540('0x78')][_0x2540('0x3a')](_0x5383b0[_0x2540('0x8d')](),{'type':db[_0x2540('0x78')]['QueryTypes']['SELECT']})[_0x2540('0x26')](function(_0x3995ec){if(_0x3995ec[_0x2540('0x40')]===0x1){return _0x1ee3d5['id'];}else{var _0x27fd12=_[_0x2540('0x8e')](_['map'](_0x3995ec,_0x2540('0x8f')),function(_0xaec1b){return _[_0x2540('0x90')](_0x4dc3f4,_0xaec1b);});if(_0x27fd12){return _0x1ee3d5['id'];}}}));}}return BPromise[_0x2540('0x91')](_0x1a4bb8)['then'](function(_0x513bc7){_0x4f96e3=_(_0x4f96e3)[_0x2540('0x92')](_0x513bc7)[_0x2540('0x93')]()[_0x2540('0x2d')]();return db[_0x2540('0x4a')][_0x2540('0x2f')]({'where':{'id':_0xa59d82['params']['id']}})[_0x2540('0x26')](function(_0x15ac95){return db[_0x2540('0x78')]['transaction'](function(_0x43534c){return _0x15ac95[_0x2540('0x82')](_0xa59d82[_0x2540('0x3a')][_0x2540('0x83')],{'transaction':_0x43534c})[_0x2540('0x26')](function(){if(!_[_0x2540('0x94')](_0x4f96e3)){return _0x15ac95[_0x2540('0x95')](_0x4f96e3,{'transaction':_0x43534c})[_0x2540('0x26')](function(){return db[_0x2540('0x7b')]['destroy']({'where':{'VoiceQueueId':_0xa59d82['params']['id'],'UserId':_0x4f96e3},'transaction':_0x43534c});});}})[_0x2540('0x26')](function(){_0x4f96e3[_0x2540('0x76')](function(_0x6e9e87){socket[_0x2540('0x80')](_0x2540('0x96'),{'UserId':_0x6e9e87,'VoiceQueueId':_0x15ac95['id']});});});});});});})[_0x2540('0x26')](respondWithStatusCode(_0x4005ab,null))[_0x2540('0x4e')](handleError(_0x4005ab,null));};exports[_0x2540('0x97')]=function(_0x193776,_0x40725e,_0x2e770b){var _0x2f7c74,_0x4f3de8;return db[_0x2540('0x4a')][_0x2540('0x2f')]({'where':{'id':_0x193776[_0x2540('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40725e,null))[_0x2540('0x26')](function(_0x3df89b){if(_0x3df89b){_0x4f3de8=_0x3df89b;return _0x3df89b['addAgents'](_0x193776[_0x2540('0x50')][_0x2540('0x83')],_[_0x2540('0x5b')](_0x193776['body'],[_0x2540('0x83'),'id'])||{})[_0x2540('0x98')](function(_0x37b2c2){for(var _0x2d2641=0x0;_0x2d2641<_0x193776['body'][_0x2540('0x83')][_0x2540('0x40')];_0x2d2641+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x193776[_0x2540('0x50')][_0x2540('0x83')][_0x2d2641],'VoiceQueueId':_0x193776['params']['id']});}return _0x37b2c2;});}})['then'](function(_0x3e28c2){_0x2f7c74=_0x3e28c2||[];if(_0x4f3de8){return db[_0x2540('0x71')]['findAll']({'where':{'id':_0x193776['body']['ids']},'attributes':['id','name',_0x2540('0x73'),_0x2540('0x7f'),'interface'],'raw':!![]});}})['then'](function(_0x2ce0ee){if(!_[_0x2540('0x94')](_0x2ce0ee)){var _0x238b6f=[];for(var _0x127839=0x0;_0x127839<_0x2ce0ee[_0x2540('0x40')];_0x127839++){if(_0x2ce0ee[_0x127839][_0x2540('0x73')]){_0x238b6f['push'](db[_0x2540('0x7b')][_0x2540('0x99')]({'membername':_0x2ce0ee[_0x127839][_0x2540('0x30')],'UserId':_0x2ce0ee[_0x127839]['id'],'queue_name':_0x4f3de8[_0x2540('0x30')],'VoiceQueueId':_0x4f3de8['id'],'interface':_['isNil'](_0x2ce0ee[_0x127839][_0x2540('0x74')])?util[_0x2540('0x7d')](_0x2540('0x7e'),_0x2ce0ee[_0x127839][_0x2540('0x30')]):_0x2ce0ee[_0x127839][_0x2540('0x74')],'paused':_0x2ce0ee[_0x127839]['voicePause']||![],'penalty':_0x193776['body'][_0x2540('0x77')]||0x0}));}}return BPromise[_0x2540('0x91')](_0x238b6f);}})['then'](function(){return _0x2f7c74;})['then'](respondWithResult(_0x40725e,null))['catch'](handleError(_0x40725e,null));};exports[_0x2540('0x95')]=function(_0x4af3ce,_0x230e03,_0x184d0e){return db['VoiceQueue'][_0x2540('0x2f')]({'where':{'id':_0x4af3ce[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x230e03,null))[_0x2540('0x26')](function(_0x15d4f6){if(_0x15d4f6){return _0x15d4f6['removeAgents'](_0x4af3ce[_0x2540('0x3a')][_0x2540('0x83')])['then'](function(){if(_['isArray'](_0x4af3ce[_0x2540('0x3a')][_0x2540('0x83')])){for(var _0x1a9eec=0x0;_0x1a9eec<_0x4af3ce[_0x2540('0x3a')][_0x2540('0x83')]['length'];_0x1a9eec+=0x1){socket['emit'](_0x2540('0x96'),{'UserId':Number(_0x4af3ce[_0x2540('0x3a')]['ids'][_0x1a9eec]),'VoiceQueueId':Number(_0x4af3ce[_0x2540('0x4d')]['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x4af3ce[_0x2540('0x3a')]['ids']),'VoiceQueueId':Number(_0x4af3ce[_0x2540('0x4d')]['id'])});}});}})[_0x2540('0x26')](function(_0x4f62e0){return db[_0x2540('0x7b')][_0x2540('0x27')]({'where':{'VoiceQueueId':_0x4af3ce['params']['id'],'UserId':_0x4af3ce[_0x2540('0x3a')][_0x2540('0x83')]}})[_0x2540('0x26')](function(){return _0x4f62e0;});})[_0x2540('0x26')](respondWithStatusCode(_0x230e03,null))[_0x2540('0x4e')](handleError(_0x230e03,null));};exports['getAgents']=function(_0x19bdf3,_0x2a453a,_0x227b00){var _0x5de7e5={};var _0x364192={};var _0x3adb4c;var _0x558a6f;return db[_0x2540('0x4a')][_0x2540('0x61')]({'where':{'id':_0x19bdf3[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x2a453a,null))[_0x2540('0x26')](function(_0x158c4d){if(_0x158c4d){_0x3adb4c=_0x158c4d;_0x364192['model']=_[_0x2540('0x3b')](db[_0x2540('0x71')]['rawAttributes']);_0x364192[_0x2540('0x3a')]=_[_0x2540('0x3b')](_0x19bdf3[_0x2540('0x3a')]);_0x364192[_0x2540('0x3c')]=_[_0x2540('0x3d')](_0x364192[_0x2540('0x39')],_0x364192[_0x2540('0x3a')]);_0x5de7e5[_0x2540('0x3f')]=_[_0x2540('0x3d')](_0x364192[_0x2540('0x39')],qs[_0x2540('0x3e')](_0x19bdf3[_0x2540('0x3a')]['fields']));_0x5de7e5[_0x2540('0x3f')]=_0x5de7e5[_0x2540('0x3f')][_0x2540('0x40')]?_0x5de7e5[_0x2540('0x3f')]:_0x364192[_0x2540('0x39')];_0x5de7e5[_0x2540('0x42')]=qs['sort'](_0x19bdf3['query'][_0x2540('0x43')]);_0x5de7e5['where']=qs[_0x2540('0x3c')](_[_0x2540('0x68')](_0x19bdf3[_0x2540('0x3a')],_0x364192[_0x2540('0x3c')]));if(_0x19bdf3[_0x2540('0x3a')]['filter']){_0x5de7e5[_0x2540('0x44')]=_[_0x2540('0x45')](_0x5de7e5[_0x2540('0x44')],{'$or':_[_0x2540('0x46')](_0x5de7e5[_0x2540('0x3f')],function(_0x19798d){var _0x20d9aa={};_0x20d9aa[_0x19798d]={'$like':'%'+_0x19bdf3[_0x2540('0x3a')][_0x2540('0x2c')]+'%'};return _0x20d9aa;})});}_0x5de7e5=_[_0x2540('0x45')]({},_0x5de7e5,_0x19bdf3[_0x2540('0x5a')]);return _0x3adb4c[_0x2540('0x9a')](_0x5de7e5);}})[_0x2540('0x26')](function(_0x1c8e54){if(_0x1c8e54){_0x558a6f=_0x1c8e54[_0x2540('0x40')];if(!_0x19bdf3[_0x2540('0x3a')][_0x2540('0x41')]('nolimit')){_0x5de7e5[_0x2540('0x22')]=qs['limit'](_0x19bdf3['query']['limit']);_0x5de7e5[_0x2540('0x21')]=qs[_0x2540('0x21')](_0x19bdf3['query'][_0x2540('0x21')]);}return _0x3adb4c['getAgents'](_0x5de7e5);}})[_0x2540('0x26')](function(_0x5f50c1){if(_0x5f50c1){return _0x5f50c1?{'count':_0x558a6f,'rows':_0x5f50c1}:null;}})[_0x2540('0x26')](respondWithResult(_0x2a453a,null))['catch'](handleError(_0x2a453a,null));};exports['getMembers']=function(_0x116151,_0x2ed977,_0x4079cd){var _0x2d66ae={};var _0x41f572={};var _0x1892f9;var _0xaf3ebd;return db[_0x2540('0x4a')][_0x2540('0x61')]({'where':{'id':_0x116151[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x2ed977,null))['then'](function(_0x5e6e9c){if(_0x5e6e9c){_0x1892f9=_0x5e6e9c;_0x41f572['model']=_[_0x2540('0x3b')](db['UserVoiceQueueRt'][_0x2540('0x36')]);_0x41f572[_0x2540('0x3a')]=_[_0x2540('0x3b')](_0x116151[_0x2540('0x3a')]);_0x41f572[_0x2540('0x3c')]=_[_0x2540('0x3d')](_0x41f572[_0x2540('0x39')],_0x41f572['query']);_0x2d66ae[_0x2540('0x3f')]=_[_0x2540('0x3d')](_0x41f572[_0x2540('0x39')],qs[_0x2540('0x3e')](_0x116151['query'][_0x2540('0x3e')]));_0x2d66ae[_0x2540('0x3f')]=_0x2d66ae[_0x2540('0x3f')]['length']?_0x2d66ae[_0x2540('0x3f')]:_0x41f572[_0x2540('0x39')];_0x2d66ae[_0x2540('0x42')]=qs[_0x2540('0x43')](_0x116151[_0x2540('0x3a')][_0x2540('0x43')]);_0x2d66ae[_0x2540('0x44')]=qs['filters'](_['pick'](_0x116151[_0x2540('0x3a')],_0x41f572[_0x2540('0x3c')]));if(_0x116151['query'][_0x2540('0x2c')]){_0x2d66ae[_0x2540('0x44')]=_[_0x2540('0x45')](_0x2d66ae[_0x2540('0x44')],{'$or':_[_0x2540('0x46')](_0x2d66ae[_0x2540('0x3f')],function(_0x130e86){var _0x426729={};_0x426729[_0x130e86]={'$like':'%'+_0x116151[_0x2540('0x3a')][_0x2540('0x2c')]+'%'};return _0x426729;})});}_0x2d66ae=_[_0x2540('0x45')]({},_0x2d66ae,_0x116151['options']);return _0x1892f9[_0x2540('0x9b')](_0x2d66ae);}})['then'](function(_0x56c0fd){if(_0x56c0fd){_0xaf3ebd=_0x56c0fd['length'];if(!_0x116151[_0x2540('0x3a')]['hasOwnProperty'](_0x2540('0x63'))){_0x2d66ae[_0x2540('0x22')]=qs[_0x2540('0x22')](_0x116151[_0x2540('0x3a')][_0x2540('0x22')]);_0x2d66ae[_0x2540('0x21')]=qs[_0x2540('0x21')](_0x116151[_0x2540('0x3a')]['offset']);}return _0x1892f9[_0x2540('0x9b')](_0x2d66ae);}})[_0x2540('0x26')](function(_0x3b53f8){return _0x3b53f8?{'count':_0xaf3ebd,'rows':_0x3b53f8}:null;})[_0x2540('0x26')](respondWithResult(_0x2ed977,null))[_0x2540('0x4e')](handleError(_0x2ed977,null));};exports[_0x2540('0x9c')]=function(_0xa9aec,_0xa6fdb7,_0x26c6b6){var _0x2417de={};var _0x23d889={};var _0x4e5874;var _0xe12cb6;return db[_0x2540('0x4a')][_0x2540('0x61')]({'where':{'id':_0xa9aec['params']['id']}})[_0x2540('0x26')](handleEntityNotFound(_0xa6fdb7,null))['then'](function(_0xdd9378){if(_0xdd9378){_0x4e5874=_0xdd9378;_0x23d889['model']=_[_0x2540('0x3b')](db[_0x2540('0x9d')]['rawAttributes']);_0x23d889[_0x2540('0x3a')]=_[_0x2540('0x3b')](_0xa9aec[_0x2540('0x3a')]);_0x23d889['filters']=_['intersection'](_0x23d889['model'],_0x23d889[_0x2540('0x3a')]);_0x2417de[_0x2540('0x3f')]=_[_0x2540('0x3d')](_0x23d889[_0x2540('0x39')],qs[_0x2540('0x3e')](_0xa9aec[_0x2540('0x3a')][_0x2540('0x3e')]));_0x2417de[_0x2540('0x3f')]=_0x2417de['attributes'][_0x2540('0x40')]?_0x2417de[_0x2540('0x3f')]:_0x23d889[_0x2540('0x39')];_0x2417de[_0x2540('0x42')]=qs[_0x2540('0x43')](_0xa9aec[_0x2540('0x3a')][_0x2540('0x43')]);_0x2417de[_0x2540('0x44')]=qs[_0x2540('0x3c')](_[_0x2540('0x68')](_0xa9aec[_0x2540('0x3a')],_0x23d889[_0x2540('0x3c')]));if(_0xa9aec[_0x2540('0x3a')][_0x2540('0x2c')]){_0x2417de[_0x2540('0x44')]=_['merge'](_0x2417de[_0x2540('0x44')],{'$or':_[_0x2540('0x46')](_0x2417de[_0x2540('0x3f')],function(_0x30ab39){var _0x72a31a={};_0x72a31a[_0x30ab39]={'$like':'%'+_0xa9aec[_0x2540('0x3a')][_0x2540('0x2c')]+'%'};return _0x72a31a;})});}_0x2417de=_[_0x2540('0x45')]({},_0x2417de,_0xa9aec[_0x2540('0x5a')]);return _0x4e5874[_0x2540('0x9c')](_0x2417de);}})[_0x2540('0x26')](function(_0x2e6560){if(_0x2e6560){_0xe12cb6=_0x2e6560[_0x2540('0x40')];if(!_0xa9aec['query'][_0x2540('0x41')](_0x2540('0x63'))){_0x2417de[_0x2540('0x22')]=qs['limit'](_0xa9aec['query']['limit']);_0x2417de[_0x2540('0x21')]=qs['offset'](_0xa9aec[_0x2540('0x3a')][_0x2540('0x21')]);}return _0x4e5874[_0x2540('0x9c')](_0x2417de);}})[_0x2540('0x26')](function(_0x314db7){if(_0x314db7){return _0x314db7?{'count':_0xe12cb6,'rows':_0x314db7}:null;}})[_0x2540('0x26')](respondWithResult(_0xa6fdb7,null))[_0x2540('0x4e')](handleError(_0xa6fdb7,null));};exports['addLists']=function(_0x2c0ada,_0x4059b5,_0x215af5){var _0x436e0f,_0x54dbe9;return db[_0x2540('0x4a')]['find']({'where':{'id':_0x2c0ada[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x4059b5,null))[_0x2540('0x26')](function(_0x486ef8){if(_0x486ef8){_0x54dbe9=_0x486ef8;return _0x486ef8['addLists'](_0x2c0ada[_0x2540('0x50')][_0x2540('0x83')],_[_0x2540('0x5b')](_0x2c0ada['body'],[_0x2540('0x83'),'id'])||{});}return null;})['spread'](function(_0x545c5b){var _0x27b64c;_0x436e0f=_0x545c5b||[];var _0x330b44=[];if(_0x545c5b){for(var _0x265084=0x0;_0x265084<_0x545c5b[_0x2540('0x40')];_0x265084+=0x1){var _0xfb2627=_0x545c5b[_0x265084][_0x2540('0x28')]({'plain':!![]});_0x54dbe9[_0x2540('0x9e')]=_0x2c0ada[_0x2540('0x50')]['dialCheckDuplicateType']?_0x2c0ada[_0x2540('0x50')][_0x2540('0x9e')]:_0x54dbe9[_0x2540('0x9e')];switch(_0x54dbe9[_0x2540('0x9e')]){case _0x2540('0x9f'):_0x27b64c=squel[_0x2540('0xa0')]()[_0x2540('0xa1')](_0x2540('0xa2'))[_0x2540('0xa3')]([_0x2540('0xa4'),_0x2540('0xa5'),_0x2540('0xa6'),_0x2540('0xa7'),_0x2540('0x64'),_0x2540('0x5c'),_0x2540('0x5d')],squel[_0x2540('0x84')]()[_0x2540('0x85')](_0x2540('0xa4'),'phone')[_0x2540('0x85')](_0x2540('0xa8'),_0x2540('0xa5'))[_0x2540('0x85')]('id','ContactId')[_0x2540('0x85')](_0xfb2627[_0x2540('0xa9')][_0x2540('0x8d')](),_0x2540('0xa7'))[_0x2540('0x85')](_0x2c0ada[_0x2540('0x4d')]['id'][_0x2540('0x8d')](),_0x2540('0x64'))['field'](_0x2540('0xa8'),'createdAt')[_0x2540('0x85')](_0x2540('0xa8'),_0x2540('0x5d'))[_0x2540('0x87')](_0x2540('0xaa'))[_0x2540('0x44')](_0x2540('0xab'))[_0x2540('0x44')](_0x2540('0xac'),_0xfb2627[_0x2540('0xa9')][_0x2540('0x8d')]())[_0x2540('0x44')](_0x2540('0xad'))[_0x2540('0x44')](_0x2540('0xae'),squel['select']()['field'](_0x2540('0xaf'))['from'](_0x2540('0xb0'))[_0x2540('0x44')]('VoiceQueueId\x20=\x20?',_0x2c0ada['params']['id'][_0x2540('0x8d')]()))['where'](_0x2540('0xae'),squel[_0x2540('0x84')]()[_0x2540('0x85')](_0x2540('0xb1'))[_0x2540('0x87')]('cm_hopper')[_0x2540('0x44')](_0x2540('0x8a'),_0x2c0ada[_0x2540('0x4d')]['id']['toString']())))[_0x2540('0x8d')]();break;case _0x2540('0xb2'):_0x27b64c=squel['insert']()[_0x2540('0xa1')](_0x2540('0xa2'))[_0x2540('0xa3')](['phone',_0x2540('0xa5'),_0x2540('0xa6'),_0x2540('0xa7'),_0x2540('0x64'),_0x2540('0x5c'),'updatedAt'],squel[_0x2540('0x84')]()[_0x2540('0x85')](_0x2540('0xa4'),_0x2540('0xa4'))[_0x2540('0x85')]('NOW()',_0x2540('0xa5'))[_0x2540('0x85')]('id',_0x2540('0xa6'))['field'](_0xfb2627[_0x2540('0xa9')][_0x2540('0x8d')](),_0x2540('0xa7'))[_0x2540('0x85')](_0x2c0ada[_0x2540('0x4d')]['id'][_0x2540('0x8d')](),_0x2540('0x64'))['field'](_0x2540('0xa8'),_0x2540('0x5c'))[_0x2540('0x85')](_0x2540('0xa8'),_0x2540('0x5d'))[_0x2540('0x87')](_0x2540('0xaa'))[_0x2540('0x44')](_0x2540('0xab'))[_0x2540('0x44')](_0x2540('0xac'),_0xfb2627[_0x2540('0xa9')][_0x2540('0x8d')]())[_0x2540('0x44')](_0x2540('0xad'))[_0x2540('0x44')](_0x2540('0xae'),squel[_0x2540('0x84')]()[_0x2540('0x85')]('COALESCE(phone,\x27\x27)')[_0x2540('0x87')]('cm_hopper')[_0x2540('0x44')]('VoiceQueueId\x20=\x20?',_0x2c0ada[_0x2540('0x4d')]['id'][_0x2540('0x8d')]())))['toString']();break;default:_0x27b64c=squel[_0x2540('0xa0')]()[_0x2540('0xa1')]('cm_hopper')[_0x2540('0xa3')](['phone',_0x2540('0xa5'),_0x2540('0xa6'),_0x2540('0xa7'),_0x2540('0x64'),_0x2540('0x5c'),_0x2540('0x5d')],squel[_0x2540('0x84')]()[_0x2540('0x85')](_0x2540('0xa4'),_0x2540('0xa4'))['field'](_0x2540('0xa8'),_0x2540('0xa5'))[_0x2540('0x85')]('id',_0x2540('0xa6'))['field'](_0xfb2627[_0x2540('0xa9')][_0x2540('0x8d')](),_0x2540('0xa7'))[_0x2540('0x85')](_0x2c0ada[_0x2540('0x4d')]['id'][_0x2540('0x8d')](),_0x2540('0x64'))[_0x2540('0x85')](_0x2540('0xa8'),_0x2540('0x5c'))['field']('NOW()',_0x2540('0x5d'))['from'](_0x2540('0xaa'))[_0x2540('0x44')]('deletedAt\x20IS\x20NULL')[_0x2540('0x44')](_0x2540('0xac'),_0xfb2627[_0x2540('0xa9')]['toString']())[_0x2540('0x44')](_0x2540('0xad')))[_0x2540('0x8d')]();}_0x330b44['push'](db[_0x2540('0x78')][_0x2540('0x3a')](_0x27b64c));}return BPromise['all'](_0x330b44);}})[_0x2540('0x26')](function(){return _0x436e0f;})[_0x2540('0x26')](respondWithResult(_0x4059b5,null))[_0x2540('0x4e')](handleError(_0x4059b5,null));};exports['removeLists']=function(_0x252716,_0x37c07b,_0x366dde){return db[_0x2540('0x4a')][_0x2540('0x2f')]({'where':{'id':_0x252716[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x37c07b,null))[_0x2540('0x26')](function(_0x2e0cbf){if(_0x2e0cbf){return _0x2e0cbf['removeLists'](_0x252716[_0x2540('0x3a')][_0x2540('0x83')]);}})[_0x2540('0x26')](function(_0x4364eb){if(_0x4364eb){return db[_0x2540('0x62')][_0x2540('0x27')]({'where':{'ListId':_0x252716[_0x2540('0x3a')][_0x2540('0x83')],'VoiceQueueId':_0x252716[_0x2540('0x4d')]['id']}})['then'](function(){return _0x4364eb;});}})[_0x2540('0x26')](respondWithStatusCode(_0x37c07b,null))[_0x2540('0x4e')](handleError(_0x37c07b,null));};exports[_0x2540('0xb3')]=function(_0x3959a0,_0x3c79e5,_0x317245){var _0x2bc414={};var _0x2e70d9={};var _0x2a96fa;var _0x43107c;return db[_0x2540('0x4a')][_0x2540('0x61')]({'where':{'id':_0x3959a0[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x3c79e5,null))[_0x2540('0x26')](function(_0x4bfbda){if(_0x4bfbda){_0x2a96fa=_0x4bfbda;_0x2e70d9[_0x2540('0x39')]=_[_0x2540('0x3b')](db[_0x2540('0x9d')][_0x2540('0x36')]);_0x2e70d9[_0x2540('0x3a')]=_[_0x2540('0x3b')](_0x3959a0[_0x2540('0x3a')]);_0x2e70d9[_0x2540('0x3c')]=_['intersection'](_0x2e70d9[_0x2540('0x39')],_0x2e70d9[_0x2540('0x3a')]);_0x2bc414[_0x2540('0x3f')]=_['intersection'](_0x2e70d9[_0x2540('0x39')],qs[_0x2540('0x3e')](_0x3959a0[_0x2540('0x3a')][_0x2540('0x3e')]));_0x2bc414[_0x2540('0x3f')]=_0x2bc414[_0x2540('0x3f')][_0x2540('0x40')]?_0x2bc414[_0x2540('0x3f')]:_0x2e70d9[_0x2540('0x39')];_0x2bc414[_0x2540('0x42')]=qs[_0x2540('0x43')](_0x3959a0[_0x2540('0x3a')]['sort']);_0x2bc414[_0x2540('0x44')]=qs[_0x2540('0x3c')](_[_0x2540('0x68')](_0x3959a0[_0x2540('0x3a')],_0x2e70d9[_0x2540('0x3c')]));if(_0x3959a0['query'][_0x2540('0x2c')]){_0x2bc414[_0x2540('0x44')]=_['merge'](_0x2bc414['where'],{'$or':_['map'](_0x2bc414[_0x2540('0x3f')],function(_0x2988b2){var _0x35b970={};_0x35b970[_0x2988b2]={'$like':'%'+_0x3959a0[_0x2540('0x3a')][_0x2540('0x2c')]+'%'};return _0x35b970;})});}_0x2bc414=_['merge']({},_0x2bc414,_0x3959a0['options']);return _0x2a96fa[_0x2540('0xb3')](_0x2bc414);}})[_0x2540('0x26')](function(_0x5c7963){if(_0x5c7963){_0x43107c=_0x5c7963[_0x2540('0x40')];if(!_0x3959a0[_0x2540('0x3a')][_0x2540('0x41')](_0x2540('0x63'))){_0x2bc414['limit']=qs['limit'](_0x3959a0[_0x2540('0x3a')]['limit']);_0x2bc414[_0x2540('0x21')]=qs[_0x2540('0x21')](_0x3959a0['query'][_0x2540('0x21')]);}return _0x2a96fa[_0x2540('0xb3')](_0x2bc414);}})[_0x2540('0x26')](function(_0x20d5e8){if(_0x20d5e8){return _0x20d5e8?{'count':_0x43107c,'rows':_0x20d5e8}:null;}})[_0x2540('0x26')](respondWithResult(_0x3c79e5,null))[_0x2540('0x4e')](handleError(_0x3c79e5,null));};exports['addBlackLists']=function(_0xe90833,_0x399a72,_0x137439){var _0x7ed000,_0xa1e82;return db[_0x2540('0x4a')][_0x2540('0x2f')]({'where':{'id':_0xe90833[_0x2540('0x4d')]['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x399a72,null))[_0x2540('0x26')](function(_0x3c6309){if(_0x3c6309){_0xa1e82=_0x3c6309;return _0x3c6309[_0x2540('0xb4')](_0xe90833[_0x2540('0x50')][_0x2540('0x83')],_['omit'](_0xe90833[_0x2540('0x50')],[_0x2540('0x83'),'id'])||{});}return null;})['spread'](function(_0x28dd70){var _0x5eabd5;_0x7ed000=_0x28dd70||[];var _0x195122=[];if(_0x28dd70){for(var _0x13dddc=0x0;_0x13dddc<_0x28dd70['length'];_0x13dddc+=0x1){var _0x2702d6=_0x28dd70[_0x13dddc]['get']({'plain':!![]});_0x5eabd5=squel['insert']()[_0x2540('0xa1')](_0x2540('0xb5'))[_0x2540('0xa3')](['phone',_0x2540('0xa6'),_0x2540('0xa7'),_0x2540('0x64'),_0x2540('0x5c'),'updatedAt'],squel[_0x2540('0x84')]()[_0x2540('0x85')](_0x2540('0xa4'),_0x2540('0xa4'))[_0x2540('0x85')]('id',_0x2540('0xa6'))[_0x2540('0x85')](_0x2702d6[_0x2540('0xa9')][_0x2540('0x8d')](),'ListId')[_0x2540('0x85')](_0xe90833['params']['id'][_0x2540('0x8d')](),_0x2540('0x64'))[_0x2540('0x85')](_0x2540('0xa8'),'createdAt')['field'](_0x2540('0xa8'),_0x2540('0x5d'))['from']('cm_contacts')[_0x2540('0x44')](_0x2540('0xab'))[_0x2540('0x44')](_0x2540('0xac'),_0x2702d6[_0x2540('0xa9')][_0x2540('0x8d')]())[_0x2540('0x44')]('phone\x20IS\x20NOT\x20NULL'))[_0x2540('0x8d')]();_0x195122[_0x2540('0x8c')](db[_0x2540('0x78')][_0x2540('0x3a')](_0x5eabd5));}return BPromise[_0x2540('0x91')](_0x195122);}})['then'](function(){return _0x7ed000;})[_0x2540('0x26')](respondWithResult(_0x399a72,null))['catch'](handleError(_0x399a72,null));};exports[_0x2540('0xb6')]=function(_0x22b340,_0x521d1b,_0x2d51ba){return db[_0x2540('0x4a')][_0x2540('0x2f')]({'where':{'id':_0x22b340['params']['id']}})[_0x2540('0x26')](handleEntityNotFound(_0x521d1b,null))[_0x2540('0x26')](function(_0x3a685c){if(_0x3a685c){return _0x3a685c['removeBlackLists'](_0x22b340[_0x2540('0x3a')][_0x2540('0x83')]);}})['then'](function(_0x22ed41){if(_0x22ed41){return db[_0x2540('0x6c')][_0x2540('0x27')]({'where':{'ListId':_0x22b340[_0x2540('0x3a')][_0x2540('0x83')],'VoiceQueueId':_0x22b340[_0x2540('0x4d')]['id']}})['then'](function(){return _0x22ed41;});}})[_0x2540('0x26')](respondWithStatusCode(_0x521d1b,null))[_0x2540('0x4e')](handleError(_0x521d1b,null));};
\ No newline at end of file