Built motion from commit (unavailable).|2.4.4
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index 2315741..283adfe 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xf570=['redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoiceQueues','outbound','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','send','index','VoiceQueue','rawAttributes','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','key','VIRTUAL','field','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','role','inbound','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','addTeams','findOrCreate','each','upsert','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','from','join','user_has_teams','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','isEmpty','removeAgents','UserVoiceQueueRt','userVoiceQueue:remove','addAgents','ids','spread','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','select','phone','NOW()','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','VoiceQueueId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','deletedAt\x20IS\x20NULL','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment'];(function(_0x401134,_0x35d034){var _0x519255=function(_0x3ebcca){while(--_0x3ebcca){_0x401134['push'](_0x401134['shift']());}};_0x519255(++_0x35d034);}(_0xf570,0xa1));var _0x0f57=function(_0x16f4c1,_0x32f248){_0x16f4c1=_0x16f4c1-0x0;var _0x56ce12=_0xf570[_0x16f4c1];return _0x56ce12;};'use strict';var pdf=require(_0x0f57('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x0f57('0x1'));var zipdir=require(_0x0f57('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0f57('0x3'));var moment=require(_0x0f57('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0f57('0x5'));var util=require('util');var path=require(_0x0f57('0x6'));var sox=require(_0x0f57('0x7'));var csv=require(_0x0f57('0x8'));var ejs=require(_0x0f57('0x9'));var fs=require('fs');var _=require(_0x0f57('0xa'));var squel=require(_0x0f57('0xb'));var crypto=require(_0x0f57('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0f57('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0f57('0xe'));var Papa=require(_0x0f57('0xf'));var Redis=require(_0x0f57('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0f57('0x11'));var hardwareService=require(_0x0f57('0x12'));var logger=require(_0x0f57('0x13'))(_0x0f57('0x14'));var utils=require('../../config/utils');var config=require(_0x0f57('0x15'));var db=require('../../mysqldb')['db'];config[_0x0f57('0x16')]=_[_0x0f57('0x17')](config[_0x0f57('0x16')],{'host':_0x0f57('0x18'),'port':0x18eb});var socket=require(_0x0f57('0x19'))(new Redis(config[_0x0f57('0x16')]));require(_0x0f57('0x1a'))[_0x0f57('0x1b')](socket);function respondWithStatusCode(_0x2b60f5,_0x481d71){_0x481d71=_0x481d71||0xcc;return function(_0x437453){if(_0x437453){return _0x2b60f5[_0x0f57('0x1c')](_0x481d71);}return _0x2b60f5[_0x0f57('0x1d')](_0x481d71)[_0x0f57('0x1e')]();};}function respondWithResult(_0x2a90a1,_0x257b9d){_0x257b9d=_0x257b9d||0xc8;return function(_0x1751d3){if(_0x1751d3){return _0x2a90a1[_0x0f57('0x1d')](_0x257b9d)[_0x0f57('0x1f')](_0x1751d3);}};}function respondWithFilteredResult(_0x3a26cd,_0x21293c){return function(_0x53d793){if(_0x53d793){var _0x290d7a=_0x53d793[_0x0f57('0x20')],_0x49635c=_0x21293c[_0x0f57('0x21')],_0x23c9fe=_0x21293c['offset']+_0x21293c[_0x0f57('0x22')],_0x258890;if(_0x23c9fe>=_0x290d7a){_0x23c9fe=_0x290d7a;_0x258890=0xc8;}else{_0x258890=0xce;}_0x3a26cd[_0x0f57('0x1d')](_0x258890);return _0x3a26cd[_0x0f57('0x23')](_0x0f57('0x24'),_0x49635c+'-'+_0x23c9fe+'/'+_0x290d7a)[_0x0f57('0x1f')](_0x53d793);}return null;};}function patchUpdates(_0x2c8f59){return function(_0x5c62e3){try{jsonpatch['apply'](_0x5c62e3,_0x2c8f59,!![]);}catch(_0x25e665){return BPromise[_0x0f57('0x25')](_0x25e665);}return _0x5c62e3[_0x0f57('0x26')]();};}function saveUpdates(_0x4a38ed,_0x334076){return function(_0x11da41){if(_0x11da41){return _0x11da41[_0x0f57('0x27')](_0x4a38ed)[_0x0f57('0x28')](function(_0x2e8f1b){return _0x2e8f1b;});}return null;};}function removeEntity(_0x41cc17,_0x391ea8){return function(_0x19061b){if(_0x19061b){return _0x19061b[_0x0f57('0x29')]()[_0x0f57('0x28')](function(){var _0x1450fd=_0x19061b[_0x0f57('0x2a')]({'plain':!![]});var _0x3ed5af=[{'name':_0x0f57('0x2b'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':_0x0f57('0x2c'),'ignore':![]}];var _0x52f0bd=_(_0x3ed5af)[_0x0f57('0x2d')](_0x0f57('0x2e'))[_0x0f57('0x2f')](_0x0f57('0x30'))[_0x0f57('0x30')]();if(_[_0x0f57('0x31')](_0x52f0bd,_0x1450fd[_0x0f57('0x32')])){return;}var _0x26cd59=_[_0x0f57('0x33')](_0x3ed5af,[_0x0f57('0x30'),_0x1450fd['type']])[_0x0f57('0x34')];return db[_0x0f57('0x35')][_0x0f57('0x29')]({'where':{'type':_0x26cd59,'resourceId':_0x1450fd['id']}})[_0x0f57('0x28')](function(){return _0x19061b;});})['then'](function(){_0x41cc17['status'](0xcc)[_0x0f57('0x1e')]();});}};}function handleEntityNotFound(_0x4fee2f,_0x5cdfc5){return function(_0x5aa32d){if(!_0x5aa32d){_0x4fee2f['sendStatus'](0x194);}return _0x5aa32d;};}function handleError(_0x44f0ed,_0xd759cf){_0xd759cf=_0xd759cf||0x1f4;return function(_0xabb41c){logger['error'](_0xabb41c[_0x0f57('0x36')]);if(_0xabb41c['name']){delete _0xabb41c[_0x0f57('0x34')];}_0x44f0ed[_0x0f57('0x1d')](_0xd759cf)[_0x0f57('0x37')](_0xabb41c);};}exports[_0x0f57('0x38')]=function(_0x1fc75b,_0x5b65f7){var _0x190985={},_0x5793e1={},_0x23873d={'count':0x0,'rows':[]};var _0x560eec=db[_0x0f57('0x39')][_0x0f57('0x3a')];_0x5793e1[_0x0f57('0x3b')]=_[_0x0f57('0x3c')](_0x560eec);_0x5793e1['query']=_[_0x0f57('0x3c')](_0x1fc75b[_0x0f57('0x3d')]);_0x5793e1[_0x0f57('0x3e')]=_[_0x0f57('0x3f')](_0x5793e1[_0x0f57('0x3b')],_0x5793e1['query']);_0x190985[_0x0f57('0x40')]=_[_0x0f57('0x3f')](_0x5793e1[_0x0f57('0x3b')],qs[_0x0f57('0x41')](_0x1fc75b[_0x0f57('0x3d')][_0x0f57('0x41')]));_0x190985[_0x0f57('0x40')]=_0x190985[_0x0f57('0x40')][_0x0f57('0x42')]?_0x190985[_0x0f57('0x40')]:_0x5793e1[_0x0f57('0x3b')];if(!_0x1fc75b[_0x0f57('0x3d')][_0x0f57('0x43')](_0x0f57('0x44'))){_0x190985[_0x0f57('0x22')]=qs[_0x0f57('0x22')](_0x1fc75b[_0x0f57('0x3d')][_0x0f57('0x22')]);_0x190985['offset']=qs[_0x0f57('0x21')](_0x1fc75b[_0x0f57('0x3d')][_0x0f57('0x21')]);}_0x190985[_0x0f57('0x45')]=qs[_0x0f57('0x46')](_0x1fc75b[_0x0f57('0x3d')]['sort']);_0x190985[_0x0f57('0x47')]=qs[_0x0f57('0x3e')](_[_0x0f57('0x48')](_0x1fc75b[_0x0f57('0x3d')],_0x5793e1[_0x0f57('0x3e')]));if(_0x1fc75b[_0x0f57('0x3d')][_0x0f57('0x2d')]){_0x190985[_0x0f57('0x47')]=_[_0x0f57('0x49')](_0x190985[_0x0f57('0x47')],{'$or':_[_0x0f57('0x2f')](_0x560eec,function(_0x936f9b){if(_0x936f9b[_0x0f57('0x32')][_0x0f57('0x4a')]!==_0x0f57('0x4b')){var _0x4cf959={};_0x4cf959[_0x936f9b[_0x0f57('0x4c')]]={'$like':'%'+_0x1fc75b[_0x0f57('0x3d')][_0x0f57('0x2d')]+'%'};return _0x4cf959;}})});}_0x190985=_[_0x0f57('0x49')]({},_0x190985,_0x1fc75b[_0x0f57('0x4d')]);var _0x170c7c={'where':_0x190985['where']};return db[_0x0f57('0x39')]['count'](_0x170c7c)['then'](function(_0x1e37c3){_0x23873d[_0x0f57('0x20')]=_0x1e37c3;if(_0x1fc75b[_0x0f57('0x3d')][_0x0f57('0x4e')]){_0x190985[_0x0f57('0x4f')]=[{'all':!![]}];}return db[_0x0f57('0x39')][_0x0f57('0x50')](_0x190985);})['then'](function(_0x349fd5){_0x23873d[_0x0f57('0x51')]=_0x349fd5;return _0x23873d;})[_0x0f57('0x28')](respondWithFilteredResult(_0x5b65f7,_0x190985))[_0x0f57('0x52')](handleError(_0x5b65f7,null));};exports[_0x0f57('0x53')]=function(_0x1fe23b,_0x738b39){var _0x525d09={'raw':![],'where':{'id':_0x1fe23b[_0x0f57('0x54')]['id']}},_0x534b69={};_0x534b69[_0x0f57('0x3b')]=_[_0x0f57('0x3c')](db[_0x0f57('0x39')][_0x0f57('0x3a')]);_0x534b69['query']=_[_0x0f57('0x3c')](_0x1fe23b[_0x0f57('0x3d')]);_0x534b69['filters']=_[_0x0f57('0x3f')](_0x534b69[_0x0f57('0x3b')],_0x534b69[_0x0f57('0x3d')]);_0x525d09[_0x0f57('0x40')]=_[_0x0f57('0x3f')](_0x534b69[_0x0f57('0x3b')],qs[_0x0f57('0x41')](_0x1fe23b[_0x0f57('0x3d')]['fields']));_0x525d09[_0x0f57('0x40')]=_0x525d09[_0x0f57('0x40')]['length']?_0x525d09[_0x0f57('0x40')]:_0x534b69[_0x0f57('0x3b')];if(_0x1fe23b[_0x0f57('0x3d')][_0x0f57('0x4e')]){_0x525d09[_0x0f57('0x4f')]=[{'all':!![]}];}_0x525d09=_[_0x0f57('0x49')]({},_0x525d09,_0x1fe23b[_0x0f57('0x4d')]);return db['VoiceQueue'][_0x0f57('0x33')](_0x525d09)['then'](handleEntityNotFound(_0x738b39,null))[_0x0f57('0x28')](respondWithResult(_0x738b39,null))[_0x0f57('0x52')](handleError(_0x738b39,null));};exports[_0x0f57('0x55')]=function(_0x3f71a2,_0x508034){return db[_0x0f57('0x39')][_0x0f57('0x55')](_0x3f71a2[_0x0f57('0x56')],{})[_0x0f57('0x28')](function(_0x21e499){var _0x30a3ea=_0x3f71a2[_0x0f57('0x57')][_0x0f57('0x2a')]({'plain':!![]});if(!_0x30a3ea)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x30a3ea[_0x0f57('0x58')]===_0x0f57('0x57')){var _0xd0880b=_0x21e499[_0x0f57('0x2a')]({'plain':!![]});var _0x525e26=[{'name':_0x0f57('0x2b'),'value':_0x0f57('0x59')},{'name':_0x0f57('0x5a'),'value':_0x0f57('0x2c')}];var _0x4ff82c=_[_0x0f57('0x33')](_0x525e26,['value',_0xd0880b[_0x0f57('0x32')]])[_0x0f57('0x34')];return db[_0x0f57('0x5b')][_0x0f57('0x33')]({'where':{'name':_0x4ff82c,'userProfileId':_0x30a3ea[_0x0f57('0x5c')]},'raw':!![]})[_0x0f57('0x28')](function(_0x15b2d4){if(_0x15b2d4&&_0x15b2d4[_0x0f57('0x5d')]===0x0){return db[_0x0f57('0x35')][_0x0f57('0x55')]({'name':_0xd0880b[_0x0f57('0x34')],'resourceId':_0xd0880b['id'],'type':_0x15b2d4[_0x0f57('0x34')],'sectionId':_0x15b2d4['id']},{})[_0x0f57('0x28')](function(){return _0x21e499;});}else{return _0x21e499;}})[_0x0f57('0x52')](function(_0x244a4a){logger[_0x0f57('0x5e')](_0x0f57('0x5f'),_0x244a4a);throw _0x244a4a;});}return _0x21e499;})[_0x0f57('0x28')](respondWithResult(_0x508034,0xc9))[_0x0f57('0x52')](handleError(_0x508034,null));};exports[_0x0f57('0x60')]=function(_0x4efb0a,_0x5d6494){var _0x36a725={'raw':![],'where':{'id':_0x4efb0a[_0x0f57('0x54')]['id']}},_0xe9b2e1={};_0xe9b2e1[_0x0f57('0x3b')]=_['keys'](db[_0x0f57('0x39')][_0x0f57('0x3a')]);_0x36a725['attributes']=_[_0x0f57('0x3f')](_0xe9b2e1[_0x0f57('0x3b')],qs['fields'](_0x4efb0a[_0x0f57('0x3d')]['fields']));_0x36a725[_0x0f57('0x40')]=_0x36a725[_0x0f57('0x40')]['length']?_0x36a725[_0x0f57('0x40')]:_0xe9b2e1[_0x0f57('0x3b')];if(_0x4efb0a['query'][_0x0f57('0x4e')]){_0x36a725[_0x0f57('0x4f')]=[{'all':!![]}];}_0x36a725=_[_0x0f57('0x49')]({},_0x36a725,_0x4efb0a[_0x0f57('0x4d')]);return db['VoiceQueue']['find'](_0x36a725)[_0x0f57('0x28')](handleEntityNotFound(_0x5d6494,null))[_0x0f57('0x28')](function(_0xfc500e){if(_0xfc500e){var _0x43bca6=_0xfc500e['get']({'plain':!![]});_0x43bca6=qs[_0x0f57('0x61')](_0x43bca6,['id','createdAt',_0x0f57('0x62')]);_0x4efb0a['body']=_[_0x0f57('0x61')](_0x4efb0a[_0x0f57('0x56')],['id',_0x0f57('0x63'),_0x0f57('0x62')]);return db[_0x0f57('0x39')][_0x0f57('0x55')](_[_0x0f57('0x49')](_0x43bca6,_0x4efb0a['body']),{'include':_0x4efb0a['query'][_0x0f57('0x4e')]?[{'all':!![]}]:undefined})[_0x0f57('0x28')](function(_0x389482){var _0x517fe7=_0x4efb0a['user'][_0x0f57('0x2a')]({'plain':!![]});if(!_0x517fe7)throw new Error(_0x0f57('0x64'));if(_0x517fe7[_0x0f57('0x58')]===_0x0f57('0x57')){var _0x11bd97=_0x389482[_0x0f57('0x2a')]({'plain':!![]});var _0x1832f6=[{'name':_0x0f57('0x2b'),'value':_0x0f57('0x59')},{'name':'QueueCampaigns','value':'outbound'}];var _0x1caa80=_['find'](_0x1832f6,[_0x0f57('0x30'),_0x11bd97[_0x0f57('0x32')]])[_0x0f57('0x34')];return db['UserProfileSection']['find']({'where':{'name':_0x1caa80,'userProfileId':_0x517fe7[_0x0f57('0x5c')]},'raw':!![]})[_0x0f57('0x28')](function(_0x1a8c8e){if(_0x1a8c8e&&_0x1a8c8e[_0x0f57('0x5d')]===0x0){return db[_0x0f57('0x35')]['create']({'name':_0x11bd97[_0x0f57('0x34')],'resourceId':_0x11bd97['id'],'type':_0x1a8c8e[_0x0f57('0x34')],'sectionId':_0x1a8c8e['id']},{})[_0x0f57('0x28')](function(){return _0x389482;});}else{return _0x389482;}})['catch'](function(_0x443527){logger[_0x0f57('0x5e')](_0x0f57('0x5f'),_0x443527);throw _0x443527;});}return _0x389482;});}})[_0x0f57('0x28')](respondWithResult(_0x5d6494,0xc9))[_0x0f57('0x52')](handleError(_0x5d6494,null));};exports['update']=function(_0x26e4c1,_0x27dae4){if(_0x26e4c1['body']['id']){delete _0x26e4c1['body']['id'];}return db['VoiceQueue'][_0x0f57('0x33')]({'where':{'id':_0x26e4c1[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x27dae4,null))[_0x0f57('0x28')](saveUpdates(_0x26e4c1[_0x0f57('0x56')],null))[_0x0f57('0x28')](respondWithResult(_0x27dae4,null))[_0x0f57('0x52')](handleError(_0x27dae4,null));};exports['destroy']=function(_0x41d874,_0x371f33){return db['VoiceQueue'][_0x0f57('0x33')]({'where':{'id':_0x41d874[_0x0f57('0x54')]['id']}})['then'](handleEntityNotFound(_0x371f33,null))[_0x0f57('0x28')](removeEntity(_0x371f33,null))[_0x0f57('0x52')](handleError(_0x371f33,null));};exports[_0x0f57('0x65')]=function(_0x3059cd,_0x43789d,_0x3e1754){var _0x5d81bb={'raw':![],'where':{}};var _0x6c4b7c={};var _0x26756c={'count':0x0,'rows':[]};return db[_0x0f57('0x39')][_0x0f57('0x66')]({'where':{'id':_0x3059cd[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x43789d,null))['then'](function(_0x14f0b2){if(_0x14f0b2){_0x6c4b7c[_0x0f57('0x3b')]=_[_0x0f57('0x3c')](db[_0x0f57('0x67')][_0x0f57('0x3a')]);_0x6c4b7c[_0x0f57('0x3d')]=_[_0x0f57('0x3c')](_0x3059cd[_0x0f57('0x3d')]);_0x6c4b7c[_0x0f57('0x3e')]=_[_0x0f57('0x3f')](_0x6c4b7c[_0x0f57('0x3b')],_0x6c4b7c[_0x0f57('0x3d')]);_0x5d81bb[_0x0f57('0x40')]=_[_0x0f57('0x3f')](_0x6c4b7c['model'],qs['fields'](_0x3059cd['query']['fields']));_0x5d81bb[_0x0f57('0x40')]=_0x5d81bb[_0x0f57('0x40')][_0x0f57('0x42')]?_0x5d81bb[_0x0f57('0x40')]:_0x6c4b7c[_0x0f57('0x3b')];if(!_0x3059cd[_0x0f57('0x3d')]['hasOwnProperty'](_0x0f57('0x44'))){_0x5d81bb[_0x0f57('0x22')]=qs[_0x0f57('0x22')](_0x3059cd[_0x0f57('0x3d')]['limit']);_0x5d81bb[_0x0f57('0x21')]=qs[_0x0f57('0x21')](_0x3059cd['query'][_0x0f57('0x21')]);}_0x5d81bb[_0x0f57('0x45')]=qs[_0x0f57('0x46')](_0x3059cd['query'][_0x0f57('0x46')]);_0x5d81bb['where']=qs['filters'](_[_0x0f57('0x48')](_0x3059cd[_0x0f57('0x3d')],_0x6c4b7c['filters']));_0x5d81bb[_0x0f57('0x47')][_0x0f57('0x68')]=_0x14f0b2['id'];if(_0x3059cd[_0x0f57('0x3d')]['filter']){_0x5d81bb[_0x0f57('0x47')]=_['merge'](_0x5d81bb[_0x0f57('0x47')],{'$or':_[_0x0f57('0x2f')](_0x5d81bb['attributes'],function(_0x5cba49){var _0x43a1f1={};_0x43a1f1[_0x5cba49]={'$like':'%'+_0x3059cd[_0x0f57('0x3d')][_0x0f57('0x2d')]+'%'};return _0x43a1f1;})});}_0x5d81bb=_[_0x0f57('0x49')]({},_0x5d81bb,_0x3059cd[_0x0f57('0x4d')]);return db[_0x0f57('0x67')][_0x0f57('0x20')]({'where':_0x5d81bb['where']})[_0x0f57('0x28')](function(_0x539f81){_0x26756c['count']=_0x539f81;if(_0x3059cd[_0x0f57('0x3d')][_0x0f57('0x4e')]){_0x5d81bb[_0x0f57('0x4f')]=[{'all':!![]}];}return db['CmHopper'][_0x0f57('0x50')](_0x5d81bb);})[_0x0f57('0x28')](function(_0x26793a){_0x26756c['rows']=_0x26793a;return _0x26756c;});}})[_0x0f57('0x28')](respondWithFilteredResult(_0x43789d,_0x5d81bb))[_0x0f57('0x52')](handleError(_0x43789d,null));};exports[_0x0f57('0x69')]=function(_0x2c1f01,_0x1b4e09,_0x2f3de9){var _0x2b3915={'raw':!![],'where':{}};var _0x1791b3={};var _0x3323d9={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x0f57('0x66')]({'where':{'id':_0x2c1f01[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x1b4e09,null))[_0x0f57('0x28')](function(_0x31c8e5){if(_0x31c8e5){_0x1791b3['model']=_[_0x0f57('0x3c')](db[_0x0f57('0x6a')][_0x0f57('0x3a')]);_0x1791b3[_0x0f57('0x3d')]=_[_0x0f57('0x3c')](_0x2c1f01[_0x0f57('0x3d')]);_0x1791b3[_0x0f57('0x3e')]=_[_0x0f57('0x3f')](_0x1791b3[_0x0f57('0x3b')],_0x1791b3[_0x0f57('0x3d')]);_0x2b3915[_0x0f57('0x40')]=_['intersection'](_0x1791b3[_0x0f57('0x3b')],qs[_0x0f57('0x41')](_0x2c1f01[_0x0f57('0x3d')][_0x0f57('0x41')]));_0x2b3915[_0x0f57('0x40')]=_0x2b3915[_0x0f57('0x40')][_0x0f57('0x42')]?_0x2b3915[_0x0f57('0x40')]:_0x1791b3[_0x0f57('0x3b')];if(!_0x2c1f01[_0x0f57('0x3d')]['hasOwnProperty'](_0x0f57('0x44'))){_0x2b3915[_0x0f57('0x22')]=qs['limit'](_0x2c1f01[_0x0f57('0x3d')][_0x0f57('0x22')]);_0x2b3915[_0x0f57('0x21')]=qs['offset'](_0x2c1f01[_0x0f57('0x3d')][_0x0f57('0x21')]);}_0x2b3915[_0x0f57('0x45')]=qs[_0x0f57('0x46')](_0x2c1f01[_0x0f57('0x3d')][_0x0f57('0x46')]);_0x2b3915[_0x0f57('0x47')]=qs[_0x0f57('0x3e')](_[_0x0f57('0x48')](_0x2c1f01['query'],_0x1791b3[_0x0f57('0x3e')]));_0x2b3915[_0x0f57('0x47')]['VoiceQueueId']=_0x31c8e5['id'];if(_0x2c1f01['query']['filter']){_0x2b3915[_0x0f57('0x47')]=_[_0x0f57('0x49')](_0x2b3915[_0x0f57('0x47')],{'$or':_[_0x0f57('0x2f')](_0x2b3915['attributes'],function(_0x34a097){var _0x174bb3={};_0x174bb3[_0x34a097]={'$like':'%'+_0x2c1f01[_0x0f57('0x3d')][_0x0f57('0x2d')]+'%'};return _0x174bb3;})});}_0x2b3915=_[_0x0f57('0x49')]({},_0x2b3915,_0x2c1f01[_0x0f57('0x4d')]);return db[_0x0f57('0x6a')]['count']({'where':_0x2b3915[_0x0f57('0x47')]})[_0x0f57('0x28')](function(_0x390299){_0x3323d9[_0x0f57('0x20')]=_0x390299;if(_0x2c1f01[_0x0f57('0x3d')][_0x0f57('0x4e')]){_0x2b3915['include']=[{'all':!![]}];}return db[_0x0f57('0x6a')][_0x0f57('0x50')](_0x2b3915);})['then'](function(_0x5c8dbd){_0x3323d9[_0x0f57('0x51')]=_0x5c8dbd;return _0x3323d9;});}})[_0x0f57('0x28')](respondWithFilteredResult(_0x1b4e09,_0x2b3915))[_0x0f57('0x52')](handleError(_0x1b4e09,null));};exports[_0x0f57('0x6b')]=function(_0x6deb61,_0x3d0f7b,_0x2532e6){var _0x580efc={'raw':!![],'where':{}};var _0x3e9325={};var _0x12c416={'count':0x0,'rows':[]};return db[_0x0f57('0x39')][_0x0f57('0x66')]({'where':{'id':_0x6deb61[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x3d0f7b,null))['then'](function(_0x12fc32){if(_0x12fc32){_0x3e9325['model']=_[_0x0f57('0x3c')](db[_0x0f57('0x6c')][_0x0f57('0x3a')]);_0x3e9325[_0x0f57('0x3d')]=_[_0x0f57('0x3c')](_0x6deb61[_0x0f57('0x3d')]);_0x3e9325[_0x0f57('0x3e')]=_[_0x0f57('0x3f')](_0x3e9325[_0x0f57('0x3b')],_0x3e9325['query']);_0x580efc['attributes']=_[_0x0f57('0x3f')](_0x3e9325[_0x0f57('0x3b')],qs['fields'](_0x6deb61[_0x0f57('0x3d')][_0x0f57('0x41')]));_0x580efc[_0x0f57('0x40')]=_0x580efc[_0x0f57('0x40')][_0x0f57('0x42')]?_0x580efc[_0x0f57('0x40')]:_0x3e9325[_0x0f57('0x3b')];if(!_0x6deb61[_0x0f57('0x3d')][_0x0f57('0x43')](_0x0f57('0x44'))){_0x580efc['limit']=qs[_0x0f57('0x22')](_0x6deb61[_0x0f57('0x3d')][_0x0f57('0x22')]);_0x580efc[_0x0f57('0x21')]=qs[_0x0f57('0x21')](_0x6deb61[_0x0f57('0x3d')][_0x0f57('0x21')]);}_0x580efc[_0x0f57('0x45')]=qs[_0x0f57('0x46')](_0x6deb61[_0x0f57('0x3d')][_0x0f57('0x46')]);_0x580efc[_0x0f57('0x47')]=qs[_0x0f57('0x3e')](_[_0x0f57('0x48')](_0x6deb61[_0x0f57('0x3d')],_0x3e9325[_0x0f57('0x3e')]));_0x580efc[_0x0f57('0x47')][_0x0f57('0x68')]=_0x12fc32['id'];if(_0x6deb61[_0x0f57('0x3d')]['filter']){_0x580efc[_0x0f57('0x47')]=_[_0x0f57('0x49')](_0x580efc[_0x0f57('0x47')],{'$or':_[_0x0f57('0x2f')](_0x580efc[_0x0f57('0x40')],function(_0x5166c3){var _0x2549f3={};_0x2549f3[_0x5166c3]={'$like':'%'+_0x6deb61['query'][_0x0f57('0x2d')]+'%'};return _0x2549f3;})});}_0x580efc=_['merge']({},_0x580efc,_0x6deb61[_0x0f57('0x4d')]);return db[_0x0f57('0x6c')]['count']({'where':_0x580efc[_0x0f57('0x47')]})[_0x0f57('0x28')](function(_0x22b361){_0x12c416[_0x0f57('0x20')]=_0x22b361;if(_0x6deb61['query'][_0x0f57('0x4e')]){_0x580efc['include']=[{'all':!![]}];}return db[_0x0f57('0x6c')][_0x0f57('0x50')](_0x580efc);})[_0x0f57('0x28')](function(_0x5d2094){_0x12c416[_0x0f57('0x51')]=_0x5d2094;return _0x12c416;});}})['then'](respondWithFilteredResult(_0x3d0f7b,_0x580efc))['catch'](handleError(_0x3d0f7b,null));};exports[_0x0f57('0x6d')]=function(_0x501486,_0x21a15e,_0xd56515){var _0x4ff296={'raw':!![],'where':{}};var _0x5de5da={};var _0x1aa201={'count':0x0,'rows':[]};return db[_0x0f57('0x39')][_0x0f57('0x66')]({'where':{'id':_0x501486['params']['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x21a15e,null))[_0x0f57('0x28')](function(_0x479fd2){if(_0x479fd2){_0x5de5da[_0x0f57('0x3b')]=_['keys'](db[_0x0f57('0x6e')][_0x0f57('0x3a')]);_0x5de5da[_0x0f57('0x3d')]=_[_0x0f57('0x3c')](_0x501486[_0x0f57('0x3d')]);_0x5de5da[_0x0f57('0x3e')]=_[_0x0f57('0x3f')](_0x5de5da[_0x0f57('0x3b')],_0x5de5da[_0x0f57('0x3d')]);_0x4ff296[_0x0f57('0x40')]=_[_0x0f57('0x3f')](_0x5de5da[_0x0f57('0x3b')],qs[_0x0f57('0x41')](_0x501486['query'][_0x0f57('0x41')]));_0x4ff296[_0x0f57('0x40')]=_0x4ff296[_0x0f57('0x40')][_0x0f57('0x42')]?_0x4ff296[_0x0f57('0x40')]:_0x5de5da['model'];if(!_0x501486[_0x0f57('0x3d')][_0x0f57('0x43')](_0x0f57('0x44'))){_0x4ff296[_0x0f57('0x22')]=qs['limit'](_0x501486['query'][_0x0f57('0x22')]);_0x4ff296[_0x0f57('0x21')]=qs['offset'](_0x501486[_0x0f57('0x3d')][_0x0f57('0x21')]);}_0x4ff296[_0x0f57('0x45')]=qs[_0x0f57('0x46')](_0x501486[_0x0f57('0x3d')][_0x0f57('0x46')]);_0x4ff296[_0x0f57('0x47')]=qs[_0x0f57('0x3e')](_[_0x0f57('0x48')](_0x501486['query'],_0x5de5da[_0x0f57('0x3e')]));_0x4ff296['where'][_0x0f57('0x68')]=_0x479fd2['id'];if(_0x501486[_0x0f57('0x3d')][_0x0f57('0x2d')]){_0x4ff296[_0x0f57('0x47')]=_[_0x0f57('0x49')](_0x4ff296[_0x0f57('0x47')],{'$or':_[_0x0f57('0x2f')](_0x4ff296[_0x0f57('0x40')],function(_0x55b61e){var _0x3072a7={};_0x3072a7[_0x55b61e]={'$like':'%'+_0x501486[_0x0f57('0x3d')][_0x0f57('0x2d')]+'%'};return _0x3072a7;})});}_0x4ff296=_[_0x0f57('0x49')]({},_0x4ff296,_0x501486['options']);return db[_0x0f57('0x6e')][_0x0f57('0x20')]({'where':_0x4ff296[_0x0f57('0x47')]})['then'](function(_0x3f0f6e){_0x1aa201['count']=_0x3f0f6e;if(_0x501486[_0x0f57('0x3d')][_0x0f57('0x4e')]){_0x4ff296[_0x0f57('0x4f')]=[{'all':!![]}];}return db[_0x0f57('0x6e')][_0x0f57('0x50')](_0x4ff296);})[_0x0f57('0x28')](function(_0x910a58){_0x1aa201['rows']=_0x910a58;return _0x1aa201;});}})[_0x0f57('0x28')](respondWithFilteredResult(_0x21a15e,_0x4ff296))[_0x0f57('0x52')](handleError(_0x21a15e,null));};exports[_0x0f57('0x6f')]=function(_0x40725b,_0x1c02af,_0x563308){var _0x49aa75={};var _0x444ea5={};var _0x321761;var _0x4d7051;return db['VoiceQueue']['findOne']({'where':{'id':_0x40725b[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x1c02af,null))[_0x0f57('0x28')](function(_0x10cab3){if(_0x10cab3){_0x321761=_0x10cab3;_0x444ea5[_0x0f57('0x3b')]=_['keys'](db[_0x0f57('0x70')][_0x0f57('0x3a')]);_0x444ea5['query']=_['keys'](_0x40725b['query']);_0x444ea5[_0x0f57('0x3e')]=_[_0x0f57('0x3f')](_0x444ea5[_0x0f57('0x3b')],_0x444ea5[_0x0f57('0x3d')]);_0x49aa75[_0x0f57('0x40')]=_[_0x0f57('0x3f')](_0x444ea5['model'],qs[_0x0f57('0x41')](_0x40725b['query'][_0x0f57('0x41')]));_0x49aa75['attributes']=_0x49aa75[_0x0f57('0x40')][_0x0f57('0x42')]?_0x49aa75['attributes']:_0x444ea5[_0x0f57('0x3b')];_0x49aa75[_0x0f57('0x45')]=qs[_0x0f57('0x46')](_0x40725b['query']['sort']);_0x49aa75[_0x0f57('0x47')]=qs[_0x0f57('0x3e')](_[_0x0f57('0x48')](_0x40725b[_0x0f57('0x3d')],_0x444ea5[_0x0f57('0x3e')]));if(_0x40725b[_0x0f57('0x3d')]['filter']){_0x49aa75[_0x0f57('0x47')]=_[_0x0f57('0x49')](_0x49aa75[_0x0f57('0x47')],{'$or':_[_0x0f57('0x2f')](_0x49aa75[_0x0f57('0x40')],function(_0xdfc684){var _0x216209={};_0x216209[_0xdfc684]={'$like':'%'+_0x40725b['query'][_0x0f57('0x2d')]+'%'};return _0x216209;})});}_0x49aa75=_[_0x0f57('0x49')]({},_0x49aa75,_0x40725b[_0x0f57('0x4d')]);return _0x321761[_0x0f57('0x6f')](_0x49aa75);}})['then'](function(_0x3d48a8){if(_0x3d48a8){_0x4d7051=_0x3d48a8[_0x0f57('0x42')];if(!_0x40725b[_0x0f57('0x3d')][_0x0f57('0x43')](_0x0f57('0x44'))){_0x49aa75[_0x0f57('0x22')]=qs['limit'](_0x40725b[_0x0f57('0x3d')][_0x0f57('0x22')]);_0x49aa75['offset']=qs[_0x0f57('0x21')](_0x40725b[_0x0f57('0x3d')][_0x0f57('0x21')]);}return _0x321761[_0x0f57('0x6f')](_0x49aa75);}})[_0x0f57('0x28')](function(_0x37afc4){if(_0x37afc4){return _0x37afc4?{'count':_0x4d7051,'rows':_0x37afc4}:null;}})[_0x0f57('0x28')](respondWithResult(_0x1c02af,null))[_0x0f57('0x52')](handleError(_0x1c02af,null));};exports['addTeams']=function(_0x30545f,_0x1a682f,_0x47a061){var _0x2ed76e=_0x30545f[_0x0f57('0x56')]['teams'];return db['Team'][_0x0f57('0x50')]({'where':{'id':_[_0x0f57('0x2f')](_0x2ed76e,'id')},'attributes':['id'],'include':[{'model':db[_0x0f57('0x71')],'as':_0x0f57('0x72'),'attributes':['id','name',_0x0f57('0x73'),_0x0f57('0x74'),_0x0f57('0x75')],'raw':!![]}]})[_0x0f57('0x28')](function(_0xad32aa){if(_0xad32aa){var _0x2f3aec=_[_0x0f57('0x76')](_0xad32aa,function(_0x10712d){var _0x521624=_0x10712d[_0x0f57('0x2a')]({'plain':!![]});_0x521624[_0x0f57('0x72')][_0x0f57('0x77')](function(_0x2a67d5){_0x2a67d5[_0x0f57('0x78')]=_[_0x0f57('0x33')](_0x2ed76e,{'id':_0x521624['id']})[_0x0f57('0x78')];});return _0x521624[_0x0f57('0x72')];});return db[_0x0f57('0x39')][_0x0f57('0x33')]({'where':{'id':_0x30545f[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](function(_0x48011d){return db[_0x0f57('0x79')]['transaction'](function(_0x381a20){return _0x48011d[_0x0f57('0x7a')](_['map'](_0x2ed76e,'id'),{'transaction':_0x381a20})['then'](function(){return BPromise['each'](_0x2f3aec,function(_0x19fc68){return db['UserVoiceQueue'][_0x0f57('0x7b')]({'where':{'UserId':_0x19fc68['id'],'VoiceQueueId':_0x30545f[_0x0f57('0x54')]['id']},'defaults':{'penalty':_0x19fc68['penalty']},'transaction':_0x381a20});});})['then'](function(){return BPromise[_0x0f57('0x7c')](_[_0x0f57('0x2d')](_0x2f3aec,{'online':!![]}),function(_0x2d26d9){return db['UserVoiceQueueRt'][_0x0f57('0x7d')]({'membername':_0x2d26d9['name'],'UserId':_0x2d26d9['id'],'queue_name':_0x48011d[_0x0f57('0x34')],'VoiceQueueId':_0x48011d['id'],'interface':_[_0x0f57('0x7e')](_0x2d26d9[_0x0f57('0x75')])?util[_0x0f57('0x7f')](_0x0f57('0x80'),_0x2d26d9[_0x0f57('0x34')]):_0x2d26d9['interface'],'paused':_0x2d26d9[_0x0f57('0x74')]||![],'penalty':_0x2d26d9[_0x0f57('0x78')]},{'transaction':_0x381a20});});})[_0x0f57('0x28')](function(){_0x2f3aec[_0x0f57('0x77')](function(_0x154ff9){socket[_0x0f57('0x81')](_0x0f57('0x82'),{'UserId':_0x154ff9['id'],'VoiceQueueId':_0x48011d['id']});});});});});}})[_0x0f57('0x28')](respondWithStatusCode(_0x1a682f,null))[_0x0f57('0x52')](handleError(_0x1a682f,null));};exports[_0x0f57('0x83')]=function(_0x3feabe,_0x1d122e,_0x4df37f){return db[_0x0f57('0x70')]['findAll']({'where':{'id':_0x3feabe[_0x0f57('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x0f57('0x72'),'attributes':['id'],'raw':!![]}]})[_0x0f57('0x28')](handleEntityNotFound(_0x1d122e,null))[_0x0f57('0x28')](function(_0xb32ce1){var _0x394fd2=_[_0x0f57('0x2f')](_0xb32ce1,'id');var _0x37830f=[];var _0x55c01c=[];var _0x46102c=squel['select']();_0x46102c[_0x0f57('0x4c')]('tq.TeamId')[_0x0f57('0x84')]('team_has_voice_queues','tq')[_0x0f57('0x85')](_0x0f57('0x86'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0f57('0x47')]('VoiceQueueId\x20=\x20?',_0x3feabe['params']['id']);for(var _0x38c888=0x0;_0x38c888<_0xb32ce1[_0x0f57('0x42')];_0x38c888+=0x1){let _0x30a5b9=_0xb32ce1[_0x38c888];for(var _0x2b4dd3=0x0;_0x2b4dd3<_0x30a5b9[_0x0f57('0x72')][_0x0f57('0x42')];_0x2b4dd3+=0x1){let _0x1ecb9d=_0x30a5b9[_0x0f57('0x72')][_0x2b4dd3];var _0xcd6d47=_0x46102c['clone']();_0xcd6d47[_0x0f57('0x47')](_0x0f57('0x87'),_0x1ecb9d['id']);_0x55c01c[_0x0f57('0x88')](db[_0x0f57('0x79')]['query'](_0xcd6d47[_0x0f57('0x89')](),{'type':db['sequelize'][_0x0f57('0x8a')][_0x0f57('0x8b')]})[_0x0f57('0x28')](function(_0x293628){if(_0x293628[_0x0f57('0x42')]===0x1){return _0x1ecb9d['id'];}else{var _0x331ca2=_[_0x0f57('0x8c')](_[_0x0f57('0x2f')](_0x293628,_0x0f57('0x8d')),function(_0x400983){return _[_0x0f57('0x31')](_0x394fd2,_0x400983);});if(_0x331ca2){return _0x1ecb9d['id'];}}}));}}return BPromise[_0x0f57('0x8e')](_0x55c01c)[_0x0f57('0x28')](function(_0x46e13e){_0x37830f=_(_0x37830f)[_0x0f57('0x8f')](_0x46e13e)[_0x0f57('0x90')]()[_0x0f57('0x30')]();return db[_0x0f57('0x39')][_0x0f57('0x33')]({'where':{'id':_0x3feabe[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](function(_0x5a69e7){return db['sequelize'][_0x0f57('0x91')](function(_0x28dbd4){return _0x5a69e7['removeTeams'](_0x3feabe[_0x0f57('0x3d')]['ids'],{'transaction':_0x28dbd4})['then'](function(){if(!_[_0x0f57('0x92')](_0x37830f)){return _0x5a69e7[_0x0f57('0x93')](_0x37830f,{'transaction':_0x28dbd4})[_0x0f57('0x28')](function(){return db[_0x0f57('0x94')][_0x0f57('0x29')]({'where':{'VoiceQueueId':_0x3feabe['params']['id'],'UserId':_0x37830f},'transaction':_0x28dbd4});});}})[_0x0f57('0x28')](function(){_0x37830f['forEach'](function(_0x2155d5){socket[_0x0f57('0x81')](_0x0f57('0x95'),{'UserId':_0x2155d5,'VoiceQueueId':_0x5a69e7['id']});});});});});});})[_0x0f57('0x28')](respondWithStatusCode(_0x1d122e,null))['catch'](handleError(_0x1d122e,null));};exports[_0x0f57('0x96')]=function(_0x53dd09,_0x353e88,_0x2389ff){var _0x4e3d17,_0x2086d7;return db[_0x0f57('0x39')][_0x0f57('0x33')]({'where':{'id':_0x53dd09[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x353e88,null))['then'](function(_0x5d8116){if(_0x5d8116){_0x2086d7=_0x5d8116;return _0x5d8116[_0x0f57('0x96')](_0x53dd09['body'][_0x0f57('0x97')],_['omit'](_0x53dd09[_0x0f57('0x56')],[_0x0f57('0x97'),'id'])||{})[_0x0f57('0x98')](function(_0x1ca6a9){for(var _0x2734a7=0x0;_0x2734a7<_0x53dd09['body'][_0x0f57('0x97')]['length'];_0x2734a7+=0x1){socket[_0x0f57('0x81')](_0x0f57('0x82'),{'UserId':_0x53dd09[_0x0f57('0x56')][_0x0f57('0x97')][_0x2734a7],'VoiceQueueId':_0x53dd09[_0x0f57('0x54')]['id']});}return _0x1ca6a9;});}})[_0x0f57('0x28')](function(_0x5383d0){_0x4e3d17=_0x5383d0||[];if(_0x2086d7){return db[_0x0f57('0x71')][_0x0f57('0x50')]({'where':{'id':_0x53dd09[_0x0f57('0x56')][_0x0f57('0x97')]},'attributes':['id',_0x0f57('0x34'),'online',_0x0f57('0x74'),_0x0f57('0x75')],'raw':!![]});}})[_0x0f57('0x28')](function(_0x5c3e9a){if(!_[_0x0f57('0x92')](_0x5c3e9a)){var _0x42d41b=[];for(var _0x4c2a2d=0x0;_0x4c2a2d<_0x5c3e9a[_0x0f57('0x42')];_0x4c2a2d++){if(_0x5c3e9a[_0x4c2a2d][_0x0f57('0x73')]){_0x42d41b[_0x0f57('0x88')](db[_0x0f57('0x94')][_0x0f57('0x7d')]({'membername':_0x5c3e9a[_0x4c2a2d]['name'],'UserId':_0x5c3e9a[_0x4c2a2d]['id'],'queue_name':_0x2086d7[_0x0f57('0x34')],'VoiceQueueId':_0x2086d7['id'],'interface':_[_0x0f57('0x7e')](_0x5c3e9a[_0x4c2a2d][_0x0f57('0x75')])?util[_0x0f57('0x7f')]('SIP/%s',_0x5c3e9a[_0x4c2a2d]['name']):_0x5c3e9a[_0x4c2a2d][_0x0f57('0x75')],'paused':_0x5c3e9a[_0x4c2a2d][_0x0f57('0x74')]||![],'penalty':_0x53dd09[_0x0f57('0x56')][_0x0f57('0x78')]||0x0}));}}return BPromise[_0x0f57('0x8e')](_0x42d41b);}})[_0x0f57('0x28')](function(){return _0x4e3d17;})['then'](respondWithResult(_0x353e88,null))[_0x0f57('0x52')](handleError(_0x353e88,null));};exports['removeAgents']=function(_0x1566f7,_0x2a4728,_0x54e1ad){return db[_0x0f57('0x39')][_0x0f57('0x33')]({'where':{'id':_0x1566f7[_0x0f57('0x54')]['id']}})['then'](handleEntityNotFound(_0x2a4728,null))[_0x0f57('0x28')](function(_0x2b94a9){if(_0x2b94a9){return _0x2b94a9['removeAgents'](_0x1566f7[_0x0f57('0x3d')]['ids'])[_0x0f57('0x28')](function(){if(_['isArray'](_0x1566f7[_0x0f57('0x3d')][_0x0f57('0x97')])){for(var _0x1e67fb=0x0;_0x1e67fb<_0x1566f7[_0x0f57('0x3d')]['ids'][_0x0f57('0x42')];_0x1e67fb+=0x1){socket[_0x0f57('0x81')](_0x0f57('0x95'),{'UserId':Number(_0x1566f7[_0x0f57('0x3d')][_0x0f57('0x97')][_0x1e67fb]),'VoiceQueueId':Number(_0x1566f7['params']['id'])});}}else{socket[_0x0f57('0x81')](_0x0f57('0x95'),{'UserId':Number(_0x1566f7[_0x0f57('0x3d')][_0x0f57('0x97')]),'VoiceQueueId':Number(_0x1566f7[_0x0f57('0x54')]['id'])});}});}})[_0x0f57('0x28')](function(_0xa3e163){return db[_0x0f57('0x94')][_0x0f57('0x29')]({'where':{'VoiceQueueId':_0x1566f7[_0x0f57('0x54')]['id'],'UserId':_0x1566f7[_0x0f57('0x3d')][_0x0f57('0x97')]}})[_0x0f57('0x28')](function(){return _0xa3e163;});})[_0x0f57('0x28')](respondWithStatusCode(_0x2a4728,null))[_0x0f57('0x52')](handleError(_0x2a4728,null));};exports[_0x0f57('0x99')]=function(_0x38868a,_0x4f0356,_0x364dfe){var _0x5d1414={};var _0x3a6f39={};var _0x1af5cc;var _0x203bdf;return db[_0x0f57('0x39')][_0x0f57('0x66')]({'where':{'id':_0x38868a[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x4f0356,null))['then'](function(_0x55db3a){if(_0x55db3a){_0x1af5cc=_0x55db3a;_0x3a6f39[_0x0f57('0x3b')]=_[_0x0f57('0x3c')](db[_0x0f57('0x71')][_0x0f57('0x3a')]);_0x3a6f39[_0x0f57('0x3d')]=_['keys'](_0x38868a[_0x0f57('0x3d')]);_0x3a6f39[_0x0f57('0x3e')]=_[_0x0f57('0x3f')](_0x3a6f39[_0x0f57('0x3b')],_0x3a6f39[_0x0f57('0x3d')]);_0x5d1414['attributes']=_[_0x0f57('0x3f')](_0x3a6f39[_0x0f57('0x3b')],qs[_0x0f57('0x41')](_0x38868a[_0x0f57('0x3d')][_0x0f57('0x41')]));_0x5d1414[_0x0f57('0x40')]=_0x5d1414['attributes'][_0x0f57('0x42')]?_0x5d1414['attributes']:_0x3a6f39[_0x0f57('0x3b')];_0x5d1414[_0x0f57('0x45')]=qs[_0x0f57('0x46')](_0x38868a[_0x0f57('0x3d')]['sort']);_0x5d1414[_0x0f57('0x47')]=qs['filters'](_[_0x0f57('0x48')](_0x38868a[_0x0f57('0x3d')],_0x3a6f39[_0x0f57('0x3e')]));if(_0x38868a['query'][_0x0f57('0x2d')]){_0x5d1414[_0x0f57('0x47')]=_[_0x0f57('0x49')](_0x5d1414[_0x0f57('0x47')],{'$or':_[_0x0f57('0x2f')](_0x5d1414[_0x0f57('0x40')],function(_0x3948e1){var _0x397c8b={};_0x397c8b[_0x3948e1]={'$like':'%'+_0x38868a[_0x0f57('0x3d')][_0x0f57('0x2d')]+'%'};return _0x397c8b;})});}_0x5d1414=_[_0x0f57('0x49')]({},_0x5d1414,_0x38868a[_0x0f57('0x4d')]);return _0x1af5cc[_0x0f57('0x99')](_0x5d1414);}})[_0x0f57('0x28')](function(_0x3bda6f){if(_0x3bda6f){_0x203bdf=_0x3bda6f['length'];if(!_0x38868a['query'][_0x0f57('0x43')](_0x0f57('0x44'))){_0x5d1414[_0x0f57('0x22')]=qs[_0x0f57('0x22')](_0x38868a[_0x0f57('0x3d')]['limit']);_0x5d1414[_0x0f57('0x21')]=qs[_0x0f57('0x21')](_0x38868a[_0x0f57('0x3d')][_0x0f57('0x21')]);}return _0x1af5cc[_0x0f57('0x99')](_0x5d1414);}})[_0x0f57('0x28')](function(_0x416390){if(_0x416390){return _0x416390?{'count':_0x203bdf,'rows':_0x416390}:null;}})[_0x0f57('0x28')](respondWithResult(_0x4f0356,null))[_0x0f57('0x52')](handleError(_0x4f0356,null));};exports[_0x0f57('0x9a')]=function(_0x1f0e7b,_0x27a9ce,_0x4b4ab6){var _0x2ef4d7={};var _0xa60c4c={};var _0x5b48df;var _0x133651;return db['VoiceQueue'][_0x0f57('0x66')]({'where':{'id':_0x1f0e7b[_0x0f57('0x54')]['id']}})['then'](handleEntityNotFound(_0x27a9ce,null))[_0x0f57('0x28')](function(_0x167463){if(_0x167463){_0x5b48df=_0x167463;_0xa60c4c[_0x0f57('0x3b')]=_['keys'](db[_0x0f57('0x94')]['rawAttributes']);_0xa60c4c[_0x0f57('0x3d')]=_[_0x0f57('0x3c')](_0x1f0e7b[_0x0f57('0x3d')]);_0xa60c4c[_0x0f57('0x3e')]=_[_0x0f57('0x3f')](_0xa60c4c['model'],_0xa60c4c[_0x0f57('0x3d')]);_0x2ef4d7[_0x0f57('0x40')]=_[_0x0f57('0x3f')](_0xa60c4c['model'],qs[_0x0f57('0x41')](_0x1f0e7b[_0x0f57('0x3d')]['fields']));_0x2ef4d7['attributes']=_0x2ef4d7[_0x0f57('0x40')]['length']?_0x2ef4d7['attributes']:_0xa60c4c[_0x0f57('0x3b')];_0x2ef4d7['order']=qs[_0x0f57('0x46')](_0x1f0e7b[_0x0f57('0x3d')][_0x0f57('0x46')]);_0x2ef4d7[_0x0f57('0x47')]=qs['filters'](_[_0x0f57('0x48')](_0x1f0e7b['query'],_0xa60c4c['filters']));if(_0x1f0e7b['query']['filter']){_0x2ef4d7[_0x0f57('0x47')]=_[_0x0f57('0x49')](_0x2ef4d7[_0x0f57('0x47')],{'$or':_[_0x0f57('0x2f')](_0x2ef4d7['attributes'],function(_0x493fc4){var _0x3bc1b5={};_0x3bc1b5[_0x493fc4]={'$like':'%'+_0x1f0e7b['query'][_0x0f57('0x2d')]+'%'};return _0x3bc1b5;})});}_0x2ef4d7=_[_0x0f57('0x49')]({},_0x2ef4d7,_0x1f0e7b[_0x0f57('0x4d')]);return _0x5b48df['getMembers'](_0x2ef4d7);}})[_0x0f57('0x28')](function(_0x472820){if(_0x472820){_0x133651=_0x472820[_0x0f57('0x42')];if(!_0x1f0e7b[_0x0f57('0x3d')][_0x0f57('0x43')](_0x0f57('0x44'))){_0x2ef4d7[_0x0f57('0x22')]=qs['limit'](_0x1f0e7b['query'][_0x0f57('0x22')]);_0x2ef4d7[_0x0f57('0x21')]=qs[_0x0f57('0x21')](_0x1f0e7b[_0x0f57('0x3d')]['offset']);}return _0x5b48df[_0x0f57('0x9a')](_0x2ef4d7);}})[_0x0f57('0x28')](function(_0x8eda6c){return _0x8eda6c?{'count':_0x133651,'rows':_0x8eda6c}:null;})[_0x0f57('0x28')](respondWithResult(_0x27a9ce,null))[_0x0f57('0x52')](handleError(_0x27a9ce,null));};exports[_0x0f57('0x9b')]=function(_0x9a0efb,_0x27d9ba,_0x19d173){var _0x15425b={};var _0x2b93e2={};var _0x53087c;var _0x440e01;return db[_0x0f57('0x39')][_0x0f57('0x66')]({'where':{'id':_0x9a0efb[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x27d9ba,null))[_0x0f57('0x28')](function(_0x594fc2){if(_0x594fc2){_0x53087c=_0x594fc2;_0x2b93e2[_0x0f57('0x3b')]=_[_0x0f57('0x3c')](db[_0x0f57('0x9c')]['rawAttributes']);_0x2b93e2[_0x0f57('0x3d')]=_['keys'](_0x9a0efb[_0x0f57('0x3d')]);_0x2b93e2[_0x0f57('0x3e')]=_['intersection'](_0x2b93e2[_0x0f57('0x3b')],_0x2b93e2[_0x0f57('0x3d')]);_0x15425b[_0x0f57('0x40')]=_[_0x0f57('0x3f')](_0x2b93e2['model'],qs[_0x0f57('0x41')](_0x9a0efb[_0x0f57('0x3d')][_0x0f57('0x41')]));_0x15425b[_0x0f57('0x40')]=_0x15425b[_0x0f57('0x40')][_0x0f57('0x42')]?_0x15425b[_0x0f57('0x40')]:_0x2b93e2['model'];_0x15425b[_0x0f57('0x45')]=qs[_0x0f57('0x46')](_0x9a0efb[_0x0f57('0x3d')][_0x0f57('0x46')]);_0x15425b['where']=qs[_0x0f57('0x3e')](_['pick'](_0x9a0efb[_0x0f57('0x3d')],_0x2b93e2[_0x0f57('0x3e')]));if(_0x9a0efb[_0x0f57('0x3d')][_0x0f57('0x2d')]){_0x15425b[_0x0f57('0x47')]=_[_0x0f57('0x49')](_0x15425b[_0x0f57('0x47')],{'$or':_[_0x0f57('0x2f')](_0x15425b[_0x0f57('0x40')],function(_0x55df81){var _0x517485={};_0x517485[_0x55df81]={'$like':'%'+_0x9a0efb['query'][_0x0f57('0x2d')]+'%'};return _0x517485;})});}_0x15425b=_[_0x0f57('0x49')]({},_0x15425b,_0x9a0efb['options']);return _0x53087c[_0x0f57('0x9b')](_0x15425b);}})[_0x0f57('0x28')](function(_0x1d312f){if(_0x1d312f){_0x440e01=_0x1d312f[_0x0f57('0x42')];if(!_0x9a0efb[_0x0f57('0x3d')]['hasOwnProperty']('nolimit')){_0x15425b[_0x0f57('0x22')]=qs[_0x0f57('0x22')](_0x9a0efb[_0x0f57('0x3d')]['limit']);_0x15425b[_0x0f57('0x21')]=qs['offset'](_0x9a0efb[_0x0f57('0x3d')]['offset']);}return _0x53087c['getLists'](_0x15425b);}})[_0x0f57('0x28')](function(_0x28c92f){if(_0x28c92f){return _0x28c92f?{'count':_0x440e01,'rows':_0x28c92f}:null;}})[_0x0f57('0x28')](respondWithResult(_0x27d9ba,null))[_0x0f57('0x52')](handleError(_0x27d9ba,null));};exports[_0x0f57('0x9d')]=function(_0x53ffb4,_0x33373a,_0x14e523){var _0x53d132,_0x42e2f8;return db[_0x0f57('0x39')]['find']({'where':{'id':_0x53ffb4[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x33373a,null))[_0x0f57('0x28')](function(_0x1cdd6a){if(_0x1cdd6a){_0x42e2f8=_0x1cdd6a;return _0x1cdd6a['addLists'](_0x53ffb4[_0x0f57('0x56')]['ids'],_[_0x0f57('0x61')](_0x53ffb4[_0x0f57('0x56')],['ids','id'])||{});}return null;})[_0x0f57('0x98')](function(_0x1d85ad){var _0x3ee3d5;_0x53d132=_0x1d85ad||[];var _0x22220e=[];if(_0x1d85ad){for(var _0x198827=0x0;_0x198827<_0x1d85ad[_0x0f57('0x42')];_0x198827+=0x1){var _0x5bb3ed=_0x1d85ad[_0x198827][_0x0f57('0x2a')]({'plain':!![]});_0x42e2f8[_0x0f57('0x9e')]=_0x53ffb4[_0x0f57('0x56')][_0x0f57('0x9e')]?_0x53ffb4['body'][_0x0f57('0x9e')]:_0x42e2f8[_0x0f57('0x9e')];switch(_0x42e2f8[_0x0f57('0x9e')]){case _0x0f57('0x9f'):_0x3ee3d5=squel[_0x0f57('0xa0')]()[_0x0f57('0xa1')]('cm_hopper')[_0x0f57('0xa2')](['phone',_0x0f57('0xa3'),_0x0f57('0xa4'),_0x0f57('0xa5'),_0x0f57('0x68'),_0x0f57('0x63'),_0x0f57('0x62')],squel[_0x0f57('0xa6')]()[_0x0f57('0x4c')](_0x0f57('0xa7'),_0x0f57('0xa7'))[_0x0f57('0x4c')](_0x0f57('0xa8'),'scheduledAt')[_0x0f57('0x4c')]('id',_0x0f57('0xa4'))[_0x0f57('0x4c')](_0x5bb3ed[_0x0f57('0xa9')][_0x0f57('0x89')](),_0x0f57('0xa5'))[_0x0f57('0x4c')](_0x53ffb4[_0x0f57('0x54')]['id']['toString'](),_0x0f57('0x68'))[_0x0f57('0x4c')](_0x0f57('0xa8'),_0x0f57('0x63'))[_0x0f57('0x4c')](_0x0f57('0xa8'),_0x0f57('0x62'))['from'](_0x0f57('0xaa'))[_0x0f57('0x47')]('deletedAt\x20IS\x20NULL')[_0x0f57('0x47')](_0x0f57('0xab'),_0x5bb3ed[_0x0f57('0xa9')][_0x0f57('0x89')]())['where'](_0x0f57('0xac'))[_0x0f57('0x47')](_0x0f57('0xad'),squel['select']()['field'](_0x0f57('0xae'))[_0x0f57('0x84')]('cm_hopper_final')[_0x0f57('0x47')](_0x0f57('0xaf'),_0x53ffb4['params']['id'][_0x0f57('0x89')]()))[_0x0f57('0x47')](_0x0f57('0xad'),squel[_0x0f57('0xa6')]()['field'](_0x0f57('0xb0'))[_0x0f57('0x84')](_0x0f57('0xb1'))['where'](_0x0f57('0xaf'),_0x53ffb4[_0x0f57('0x54')]['id']['toString']())))[_0x0f57('0x89')]();break;case'onlyIfOpen':_0x3ee3d5=squel['insert']()[_0x0f57('0xa1')]('cm_hopper')[_0x0f57('0xa2')]([_0x0f57('0xa7'),_0x0f57('0xa3'),_0x0f57('0xa4'),_0x0f57('0xa5'),'VoiceQueueId',_0x0f57('0x63'),_0x0f57('0x62')],squel[_0x0f57('0xa6')]()[_0x0f57('0x4c')](_0x0f57('0xa7'),_0x0f57('0xa7'))[_0x0f57('0x4c')](_0x0f57('0xa8'),_0x0f57('0xa3'))[_0x0f57('0x4c')]('id',_0x0f57('0xa4'))[_0x0f57('0x4c')](_0x5bb3ed['CmListId'][_0x0f57('0x89')](),'ListId')['field'](_0x53ffb4[_0x0f57('0x54')]['id'][_0x0f57('0x89')](),'VoiceQueueId')['field'](_0x0f57('0xa8'),_0x0f57('0x63'))[_0x0f57('0x4c')](_0x0f57('0xa8'),_0x0f57('0x62'))[_0x0f57('0x84')](_0x0f57('0xaa'))['where'](_0x0f57('0xb2'))[_0x0f57('0x47')](_0x0f57('0xab'),_0x5bb3ed[_0x0f57('0xa9')][_0x0f57('0x89')]())[_0x0f57('0x47')](_0x0f57('0xac'))[_0x0f57('0x47')](_0x0f57('0xad'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0x0f57('0x84')](_0x0f57('0xb1'))[_0x0f57('0x47')]('VoiceQueueId\x20=\x20?',_0x53ffb4[_0x0f57('0x54')]['id'][_0x0f57('0x89')]())))[_0x0f57('0x89')]();break;default:_0x3ee3d5=squel[_0x0f57('0xa0')]()[_0x0f57('0xa1')]('cm_hopper')['fromQuery'](['phone',_0x0f57('0xa3'),_0x0f57('0xa4'),_0x0f57('0xa5'),_0x0f57('0x68'),_0x0f57('0x63'),_0x0f57('0x62')],squel[_0x0f57('0xa6')]()[_0x0f57('0x4c')]('phone','phone')[_0x0f57('0x4c')](_0x0f57('0xa8'),_0x0f57('0xa3'))[_0x0f57('0x4c')]('id',_0x0f57('0xa4'))[_0x0f57('0x4c')](_0x5bb3ed[_0x0f57('0xa9')]['toString'](),_0x0f57('0xa5'))['field'](_0x53ffb4[_0x0f57('0x54')]['id'][_0x0f57('0x89')](),_0x0f57('0x68'))[_0x0f57('0x4c')](_0x0f57('0xa8'),_0x0f57('0x63'))[_0x0f57('0x4c')](_0x0f57('0xa8'),_0x0f57('0x62'))[_0x0f57('0x84')](_0x0f57('0xaa'))[_0x0f57('0x47')](_0x0f57('0xb2'))[_0x0f57('0x47')](_0x0f57('0xab'),_0x5bb3ed[_0x0f57('0xa9')]['toString']())[_0x0f57('0x47')](_0x0f57('0xac')))['toString']();}_0x22220e[_0x0f57('0x88')](db[_0x0f57('0x79')][_0x0f57('0x3d')](_0x3ee3d5));}return BPromise[_0x0f57('0x8e')](_0x22220e);}})[_0x0f57('0x28')](function(){return _0x53d132;})[_0x0f57('0x28')](respondWithResult(_0x33373a,null))['catch'](handleError(_0x33373a,null));};exports['removeLists']=function(_0x1a5de5,_0x443e11,_0x26f0fb){return db[_0x0f57('0x39')][_0x0f57('0x33')]({'where':{'id':_0x1a5de5[_0x0f57('0x54')]['id']}})['then'](handleEntityNotFound(_0x443e11,null))['then'](function(_0x3442b2){if(_0x3442b2){return _0x3442b2['removeLists'](_0x1a5de5[_0x0f57('0x3d')][_0x0f57('0x97')]);}})[_0x0f57('0x28')](function(_0x786512){if(_0x786512){return db['CmHopper'][_0x0f57('0x29')]({'where':{'ListId':_0x1a5de5[_0x0f57('0x3d')][_0x0f57('0x97')],'VoiceQueueId':_0x1a5de5['params']['id']}})[_0x0f57('0x28')](function(){return _0x786512;});}})[_0x0f57('0x28')](respondWithStatusCode(_0x443e11,null))[_0x0f57('0x52')](handleError(_0x443e11,null));};exports[_0x0f57('0xb3')]=function(_0x278ce9,_0xdd09b4,_0x4167d1){var _0x2898f2={};var _0x157615={};var _0x472349;var _0x7062ba;return db[_0x0f57('0x39')][_0x0f57('0x66')]({'where':{'id':_0x278ce9[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0xdd09b4,null))['then'](function(_0x486bd0){if(_0x486bd0){_0x472349=_0x486bd0;_0x157615['model']=_[_0x0f57('0x3c')](db[_0x0f57('0x9c')][_0x0f57('0x3a')]);_0x157615['query']=_[_0x0f57('0x3c')](_0x278ce9[_0x0f57('0x3d')]);_0x157615[_0x0f57('0x3e')]=_['intersection'](_0x157615[_0x0f57('0x3b')],_0x157615[_0x0f57('0x3d')]);_0x2898f2[_0x0f57('0x40')]=_[_0x0f57('0x3f')](_0x157615[_0x0f57('0x3b')],qs[_0x0f57('0x41')](_0x278ce9['query'][_0x0f57('0x41')]));_0x2898f2['attributes']=_0x2898f2[_0x0f57('0x40')][_0x0f57('0x42')]?_0x2898f2[_0x0f57('0x40')]:_0x157615['model'];_0x2898f2[_0x0f57('0x45')]=qs[_0x0f57('0x46')](_0x278ce9[_0x0f57('0x3d')]['sort']);_0x2898f2[_0x0f57('0x47')]=qs[_0x0f57('0x3e')](_[_0x0f57('0x48')](_0x278ce9[_0x0f57('0x3d')],_0x157615[_0x0f57('0x3e')]));if(_0x278ce9[_0x0f57('0x3d')]['filter']){_0x2898f2[_0x0f57('0x47')]=_[_0x0f57('0x49')](_0x2898f2[_0x0f57('0x47')],{'$or':_['map'](_0x2898f2['attributes'],function(_0x2683fd){var _0x360e16={};_0x360e16[_0x2683fd]={'$like':'%'+_0x278ce9[_0x0f57('0x3d')][_0x0f57('0x2d')]+'%'};return _0x360e16;})});}_0x2898f2=_['merge']({},_0x2898f2,_0x278ce9[_0x0f57('0x4d')]);return _0x472349['getBlackLists'](_0x2898f2);}})[_0x0f57('0x28')](function(_0x483789){if(_0x483789){_0x7062ba=_0x483789[_0x0f57('0x42')];if(!_0x278ce9['query']['hasOwnProperty']('nolimit')){_0x2898f2[_0x0f57('0x22')]=qs[_0x0f57('0x22')](_0x278ce9['query'][_0x0f57('0x22')]);_0x2898f2['offset']=qs['offset'](_0x278ce9[_0x0f57('0x3d')][_0x0f57('0x21')]);}return _0x472349[_0x0f57('0xb3')](_0x2898f2);}})[_0x0f57('0x28')](function(_0x5b8f08){if(_0x5b8f08){return _0x5b8f08?{'count':_0x7062ba,'rows':_0x5b8f08}:null;}})['then'](respondWithResult(_0xdd09b4,null))[_0x0f57('0x52')](handleError(_0xdd09b4,null));};exports[_0x0f57('0xb4')]=function(_0x5aabbf,_0x42fb4b,_0x99bdf5){var _0x5d8b72,_0x343fcf;return db['VoiceQueue'][_0x0f57('0x33')]({'where':{'id':_0x5aabbf[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](handleEntityNotFound(_0x42fb4b,null))[_0x0f57('0x28')](function(_0x317ca3){if(_0x317ca3){_0x343fcf=_0x317ca3;return _0x317ca3[_0x0f57('0xb4')](_0x5aabbf[_0x0f57('0x56')][_0x0f57('0x97')],_[_0x0f57('0x61')](_0x5aabbf[_0x0f57('0x56')],[_0x0f57('0x97'),'id'])||{});}return null;})['spread'](function(_0x474592){var _0x57df35;_0x5d8b72=_0x474592||[];var _0x5de869=[];if(_0x474592){for(var _0x5232f1=0x0;_0x5232f1<_0x474592[_0x0f57('0x42')];_0x5232f1+=0x1){var _0x5dd759=_0x474592[_0x5232f1][_0x0f57('0x2a')]({'plain':!![]});_0x57df35=squel['insert']()[_0x0f57('0xa1')](_0x0f57('0xb5'))[_0x0f57('0xa2')](['phone',_0x0f57('0xa4'),_0x0f57('0xa5'),_0x0f57('0x68'),_0x0f57('0x63'),_0x0f57('0x62')],squel[_0x0f57('0xa6')]()[_0x0f57('0x4c')]('phone',_0x0f57('0xa7'))[_0x0f57('0x4c')]('id',_0x0f57('0xa4'))[_0x0f57('0x4c')](_0x5dd759['CmListId']['toString'](),_0x0f57('0xa5'))[_0x0f57('0x4c')](_0x5aabbf['params']['id'][_0x0f57('0x89')](),'VoiceQueueId')[_0x0f57('0x4c')](_0x0f57('0xa8'),_0x0f57('0x63'))[_0x0f57('0x4c')]('NOW()',_0x0f57('0x62'))['from'](_0x0f57('0xaa'))[_0x0f57('0x47')](_0x0f57('0xb2'))['where'](_0x0f57('0xab'),_0x5dd759[_0x0f57('0xa9')][_0x0f57('0x89')]())[_0x0f57('0x47')]('phone\x20IS\x20NOT\x20NULL'))[_0x0f57('0x89')]();_0x5de869[_0x0f57('0x88')](db[_0x0f57('0x79')][_0x0f57('0x3d')](_0x57df35));}return BPromise[_0x0f57('0x8e')](_0x5de869);}})[_0x0f57('0x28')](function(){return _0x5d8b72;})[_0x0f57('0x28')](respondWithResult(_0x42fb4b,null))[_0x0f57('0x52')](handleError(_0x42fb4b,null));};exports['removeBlackLists']=function(_0x114b7e,_0x528a34,_0x4c962a){return db[_0x0f57('0x39')]['find']({'where':{'id':_0x114b7e[_0x0f57('0x54')]['id']}})['then'](handleEntityNotFound(_0x528a34,null))[_0x0f57('0x28')](function(_0x5018fb){if(_0x5018fb){return _0x5018fb[_0x0f57('0xb6')](_0x114b7e[_0x0f57('0x3d')][_0x0f57('0x97')]);}})[_0x0f57('0x28')](function(_0x5b3701){if(_0x5b3701){return db['CmHopperBlack']['destroy']({'where':{'ListId':_0x114b7e[_0x0f57('0x3d')][_0x0f57('0x97')],'VoiceQueueId':_0x114b7e[_0x0f57('0x54')]['id']}})[_0x0f57('0x28')](function(){return _0x5b3701;});}})['then'](respondWithStatusCode(_0x528a34,null))[_0x0f57('0x52')](handleError(_0x528a34,null));};
\ No newline at end of file
+var _0x9d71=['nolimit','order','sort','where','merge','key','VIRTUAL','field','options','includeAll','include','rows','catch','show','params','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','VoiceQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','getHoppers','CmHopper','hasOwnProperty','pick','VoiceQueueId','findAll','getHopperHistories','CmHopperHistory','getHopperFinals','findOne','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','interface','flatMap','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','format','emit','userVoiceQueue:save','ids','tq.TeamId','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','TeamId','all','union','compact','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','online','isNil','SIP/%s','voicePause','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','select','NOW()','CmListId','from','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)','VoiceQueueId\x20=\x20?','onlyIfOpen','into','push','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','redis','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','get','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','error','stack','index','VoiceQueue','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length'];(function(_0x294ba7,_0x1e78b8){var _0x562d8c=function(_0x49e4cc){while(--_0x49e4cc){_0x294ba7['push'](_0x294ba7['shift']());}};_0x562d8c(++_0x1e78b8);}(_0x9d71,0x134));var _0x19d7=function(_0x35ba6d,_0x181887){_0x35ba6d=_0x35ba6d-0x0;var _0x30fb74=_0x9d71[_0x35ba6d];return _0x30fb74;};'use strict';var pdf=require(_0x19d7('0x0'));var emlformat=require(_0x19d7('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x19d7('0x2'));var jsonpatch=require(_0x19d7('0x3'));var rp=require(_0x19d7('0x4'));var moment=require(_0x19d7('0x5'));var BPromise=require(_0x19d7('0x6'));var Mustache=require(_0x19d7('0x7'));var util=require(_0x19d7('0x8'));var path=require(_0x19d7('0x9'));var sox=require(_0x19d7('0xa'));var csv=require(_0x19d7('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x19d7('0xc'));var squel=require(_0x19d7('0xd'));var crypto=require(_0x19d7('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x19d7('0xf'));var toCsv=require(_0x19d7('0xb'));var querystring=require(_0x19d7('0x10'));var Papa=require(_0x19d7('0x11'));var Redis=require('ioredis');var authService=require(_0x19d7('0x12'));var qs=require(_0x19d7('0x13'));var hardwareService=require(_0x19d7('0x14'));var logger=require('../../config/logger')(_0x19d7('0x15'));var utils=require('../../config/utils');var config=require(_0x19d7('0x16'));var db=require('../../mysqldb')['db'];config[_0x19d7('0x17')]=_['defaults'](config['redis'],{'host':_0x19d7('0x18'),'port':0x18eb});var socket=require(_0x19d7('0x19'))(new Redis(config['redis']));require(_0x19d7('0x1a'))[_0x19d7('0x1b')](socket);function respondWithStatusCode(_0x5f0ebf,_0x1b1a10){_0x1b1a10=_0x1b1a10||0xcc;return function(_0x381ab2){if(_0x381ab2){return _0x5f0ebf[_0x19d7('0x1c')](_0x1b1a10);}return _0x5f0ebf[_0x19d7('0x1d')](_0x1b1a10)[_0x19d7('0x1e')]();};}function respondWithResult(_0x3695a4,_0x39578a){_0x39578a=_0x39578a||0xc8;return function(_0x379ed1){if(_0x379ed1){return _0x3695a4[_0x19d7('0x1d')](_0x39578a)['json'](_0x379ed1);}};}function respondWithFilteredResult(_0x10cb6e,_0x22fa5c){return function(_0x5c0801){if(_0x5c0801){var _0x381763=_0x5c0801[_0x19d7('0x1f')],_0x289117=_0x22fa5c[_0x19d7('0x20')],_0x2632df=_0x22fa5c[_0x19d7('0x20')]+_0x22fa5c[_0x19d7('0x21')],_0x4bdd18;if(_0x2632df>=_0x381763){_0x2632df=_0x381763;_0x4bdd18=0xc8;}else{_0x4bdd18=0xce;}_0x10cb6e[_0x19d7('0x1d')](_0x4bdd18);return _0x10cb6e[_0x19d7('0x22')](_0x19d7('0x23'),_0x289117+'-'+_0x2632df+'/'+_0x381763)[_0x19d7('0x24')](_0x5c0801);}return null;};}function patchUpdates(_0x346211){return function(_0x4767fd){try{jsonpatch[_0x19d7('0x25')](_0x4767fd,_0x346211,!![]);}catch(_0x45298d){return BPromise[_0x19d7('0x26')](_0x45298d);}return _0x4767fd[_0x19d7('0x27')]();};}function saveUpdates(_0x2c058e,_0x1859ed){return function(_0x40113a){if(_0x40113a){return _0x40113a[_0x19d7('0x28')](_0x2c058e)[_0x19d7('0x29')](function(_0x5496cb){return _0x5496cb;});}return null;};}function removeEntity(_0xee0ee2,_0x23b357){return function(_0x53fb68){if(_0x53fb68){return _0x53fb68[_0x19d7('0x2a')]()[_0x19d7('0x29')](function(){var _0x1a6718=_0x53fb68[_0x19d7('0x2b')]({'plain':!![]});var _0x23daf4=[{'name':'VoiceQueues','value':_0x19d7('0x2c'),'ignore':![]},{'name':_0x19d7('0x2d'),'value':_0x19d7('0x2e'),'ignore':![]}];var _0x2d6838=_(_0x23daf4)[_0x19d7('0x2f')](_0x19d7('0x30'))[_0x19d7('0x31')](_0x19d7('0x32'))[_0x19d7('0x32')]();if(_['includes'](_0x2d6838,_0x1a6718[_0x19d7('0x33')])){return;}var _0x5ddf2d=_[_0x19d7('0x34')](_0x23daf4,['value',_0x1a6718[_0x19d7('0x33')]])[_0x19d7('0x35')];return db[_0x19d7('0x36')][_0x19d7('0x2a')]({'where':{'type':_0x5ddf2d,'resourceId':_0x1a6718['id']}})[_0x19d7('0x29')](function(){return _0x53fb68;});})[_0x19d7('0x29')](function(){_0xee0ee2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x26a107,_0x12c55c){return function(_0x49a5f4){if(!_0x49a5f4){_0x26a107['sendStatus'](0x194);}return _0x49a5f4;};}function handleError(_0x4b04ec,_0x6e2022){_0x6e2022=_0x6e2022||0x1f4;return function(_0x8834d7){logger[_0x19d7('0x37')](_0x8834d7[_0x19d7('0x38')]);if(_0x8834d7[_0x19d7('0x35')]){delete _0x8834d7[_0x19d7('0x35')];}_0x4b04ec[_0x19d7('0x1d')](_0x6e2022)['send'](_0x8834d7);};}exports[_0x19d7('0x39')]=function(_0x5dcf42,_0x1ae6bd){var _0x522d8d={},_0x58eaad={},_0x116e3a={'count':0x0,'rows':[]};var _0x5dbf1c=db[_0x19d7('0x3a')][_0x19d7('0x3b')];_0x58eaad[_0x19d7('0x3c')]=_[_0x19d7('0x3d')](_0x5dbf1c);_0x58eaad[_0x19d7('0x3e')]=_['keys'](_0x5dcf42[_0x19d7('0x3e')]);_0x58eaad[_0x19d7('0x3f')]=_[_0x19d7('0x40')](_0x58eaad['model'],_0x58eaad[_0x19d7('0x3e')]);_0x522d8d['attributes']=_[_0x19d7('0x40')](_0x58eaad[_0x19d7('0x3c')],qs[_0x19d7('0x41')](_0x5dcf42[_0x19d7('0x3e')]['fields']));_0x522d8d[_0x19d7('0x42')]=_0x522d8d[_0x19d7('0x42')][_0x19d7('0x43')]?_0x522d8d[_0x19d7('0x42')]:_0x58eaad['model'];if(!_0x5dcf42[_0x19d7('0x3e')]['hasOwnProperty'](_0x19d7('0x44'))){_0x522d8d[_0x19d7('0x21')]=qs['limit'](_0x5dcf42[_0x19d7('0x3e')]['limit']);_0x522d8d[_0x19d7('0x20')]=qs[_0x19d7('0x20')](_0x5dcf42[_0x19d7('0x3e')][_0x19d7('0x20')]);}_0x522d8d[_0x19d7('0x45')]=qs['sort'](_0x5dcf42[_0x19d7('0x3e')][_0x19d7('0x46')]);_0x522d8d[_0x19d7('0x47')]=qs[_0x19d7('0x3f')](_['pick'](_0x5dcf42['query'],_0x58eaad[_0x19d7('0x3f')]));if(_0x5dcf42[_0x19d7('0x3e')][_0x19d7('0x2f')]){_0x522d8d[_0x19d7('0x47')]=_[_0x19d7('0x48')](_0x522d8d[_0x19d7('0x47')],{'$or':_[_0x19d7('0x31')](_0x5dbf1c,function(_0x481e60){if(_0x481e60[_0x19d7('0x33')][_0x19d7('0x49')]!==_0x19d7('0x4a')){var _0x32238e={};_0x32238e[_0x481e60[_0x19d7('0x4b')]]={'$like':'%'+_0x5dcf42[_0x19d7('0x3e')][_0x19d7('0x2f')]+'%'};return _0x32238e;}})});}_0x522d8d=_['merge']({},_0x522d8d,_0x5dcf42[_0x19d7('0x4c')]);var _0xab0e6f={'where':_0x522d8d[_0x19d7('0x47')]};return db[_0x19d7('0x3a')][_0x19d7('0x1f')](_0xab0e6f)['then'](function(_0x1b94da){_0x116e3a[_0x19d7('0x1f')]=_0x1b94da;if(_0x5dcf42[_0x19d7('0x3e')][_0x19d7('0x4d')]){_0x522d8d[_0x19d7('0x4e')]=[{'all':!![]}];}return db['VoiceQueue']['findAll'](_0x522d8d);})['then'](function(_0x138ecb){_0x116e3a[_0x19d7('0x4f')]=_0x138ecb;return _0x116e3a;})['then'](respondWithFilteredResult(_0x1ae6bd,_0x522d8d))[_0x19d7('0x50')](handleError(_0x1ae6bd,null));};exports[_0x19d7('0x51')]=function(_0x53e392,_0x122c12){var _0x26a9c5={'raw':![],'where':{'id':_0x53e392[_0x19d7('0x52')]['id']}},_0x471978={};_0x471978['model']=_['keys'](db[_0x19d7('0x3a')]['rawAttributes']);_0x471978[_0x19d7('0x3e')]=_['keys'](_0x53e392[_0x19d7('0x3e')]);_0x471978['filters']=_[_0x19d7('0x40')](_0x471978[_0x19d7('0x3c')],_0x471978['query']);_0x26a9c5[_0x19d7('0x42')]=_[_0x19d7('0x40')](_0x471978[_0x19d7('0x3c')],qs['fields'](_0x53e392[_0x19d7('0x3e')][_0x19d7('0x41')]));_0x26a9c5[_0x19d7('0x42')]=_0x26a9c5[_0x19d7('0x42')][_0x19d7('0x43')]?_0x26a9c5[_0x19d7('0x42')]:_0x471978['model'];if(_0x53e392[_0x19d7('0x3e')][_0x19d7('0x4d')]){_0x26a9c5[_0x19d7('0x4e')]=[{'all':!![]}];}_0x26a9c5=_[_0x19d7('0x48')]({},_0x26a9c5,_0x53e392[_0x19d7('0x4c')]);return db[_0x19d7('0x3a')][_0x19d7('0x34')](_0x26a9c5)[_0x19d7('0x29')](handleEntityNotFound(_0x122c12,null))[_0x19d7('0x29')](respondWithResult(_0x122c12,null))[_0x19d7('0x50')](handleError(_0x122c12,null));};exports[_0x19d7('0x53')]=function(_0x19e9c2,_0x18786d){return db[_0x19d7('0x3a')][_0x19d7('0x53')](_0x19e9c2[_0x19d7('0x54')],{})[_0x19d7('0x29')](function(_0x80f2bc){var _0x5c1bd2=_0x19e9c2['user'][_0x19d7('0x2b')]({'plain':!![]});if(!_0x5c1bd2)throw new Error(_0x19d7('0x55'));if(_0x5c1bd2[_0x19d7('0x56')]===_0x19d7('0x57')){var _0x2d6646=_0x80f2bc['get']({'plain':!![]});var _0x3c2038=[{'name':_0x19d7('0x58'),'value':'inbound'},{'name':'QueueCampaigns','value':_0x19d7('0x2e')}];var _0x26e40b=_['find'](_0x3c2038,[_0x19d7('0x32'),_0x2d6646[_0x19d7('0x33')]])[_0x19d7('0x35')];return db[_0x19d7('0x59')]['find']({'where':{'name':_0x26e40b,'userProfileId':_0x5c1bd2[_0x19d7('0x5a')]},'raw':!![]})[_0x19d7('0x29')](function(_0x266185){if(_0x266185&&_0x266185[_0x19d7('0x5b')]===0x0){return db['UserProfileResource'][_0x19d7('0x53')]({'name':_0x2d6646[_0x19d7('0x35')],'resourceId':_0x2d6646['id'],'type':_0x266185[_0x19d7('0x35')],'sectionId':_0x266185['id']},{})[_0x19d7('0x29')](function(){return _0x80f2bc;});}else{return _0x80f2bc;}})[_0x19d7('0x50')](function(_0x291d98){logger[_0x19d7('0x37')](_0x19d7('0x5c'),_0x291d98);throw _0x291d98;});}return _0x80f2bc;})[_0x19d7('0x29')](respondWithResult(_0x18786d,0xc9))['catch'](handleError(_0x18786d,null));};exports['clone']=function(_0x52c562,_0x53ff0f){var _0x4509a0={'raw':![],'where':{'id':_0x52c562[_0x19d7('0x52')]['id']}},_0x1135b8={};_0x1135b8[_0x19d7('0x3c')]=_['keys'](db[_0x19d7('0x3a')][_0x19d7('0x3b')]);_0x4509a0['attributes']=_[_0x19d7('0x40')](_0x1135b8[_0x19d7('0x3c')],qs[_0x19d7('0x41')](_0x52c562[_0x19d7('0x3e')][_0x19d7('0x41')]));_0x4509a0[_0x19d7('0x42')]=_0x4509a0[_0x19d7('0x42')][_0x19d7('0x43')]?_0x4509a0['attributes']:_0x1135b8[_0x19d7('0x3c')];if(_0x52c562[_0x19d7('0x3e')][_0x19d7('0x4d')]){_0x4509a0['include']=[{'all':!![]}];}_0x4509a0=_['merge']({},_0x4509a0,_0x52c562[_0x19d7('0x4c')]);return db[_0x19d7('0x3a')][_0x19d7('0x34')](_0x4509a0)[_0x19d7('0x29')](handleEntityNotFound(_0x53ff0f,null))[_0x19d7('0x29')](function(_0x374869){if(_0x374869){var _0x423dab=_0x374869['get']({'plain':!![]});_0x423dab=qs[_0x19d7('0x5d')](_0x423dab,['id','createdAt',_0x19d7('0x5e')]);_0x52c562['body']=_[_0x19d7('0x5d')](_0x52c562['body'],['id','createdAt',_0x19d7('0x5e')]);return db['VoiceQueue'][_0x19d7('0x53')](_[_0x19d7('0x48')](_0x423dab,_0x52c562[_0x19d7('0x54')]),{'include':_0x52c562[_0x19d7('0x3e')][_0x19d7('0x4d')]?[{'all':!![]}]:undefined})['then'](function(_0x3d3470){var _0x9a5395=_0x52c562['user']['get']({'plain':!![]});if(!_0x9a5395)throw new Error(_0x19d7('0x55'));if(_0x9a5395[_0x19d7('0x56')]==='user'){var _0x439b81=_0x3d3470[_0x19d7('0x2b')]({'plain':!![]});var _0x4d1762=[{'name':_0x19d7('0x58'),'value':_0x19d7('0x2c')},{'name':_0x19d7('0x2d'),'value':_0x19d7('0x2e')}];var _0x1edf72=_[_0x19d7('0x34')](_0x4d1762,[_0x19d7('0x32'),_0x439b81[_0x19d7('0x33')]])['name'];return db[_0x19d7('0x59')][_0x19d7('0x34')]({'where':{'name':_0x1edf72,'userProfileId':_0x9a5395[_0x19d7('0x5a')]},'raw':!![]})[_0x19d7('0x29')](function(_0x462ba1){if(_0x462ba1&&_0x462ba1[_0x19d7('0x5b')]===0x0){return db[_0x19d7('0x36')]['create']({'name':_0x439b81['name'],'resourceId':_0x439b81['id'],'type':_0x462ba1['name'],'sectionId':_0x462ba1['id']},{})[_0x19d7('0x29')](function(){return _0x3d3470;});}else{return _0x3d3470;}})[_0x19d7('0x50')](function(_0xea8a2c){logger[_0x19d7('0x37')](_0x19d7('0x5c'),_0xea8a2c);throw _0xea8a2c;});}return _0x3d3470;});}})[_0x19d7('0x29')](respondWithResult(_0x53ff0f,0xc9))[_0x19d7('0x50')](handleError(_0x53ff0f,null));};exports[_0x19d7('0x28')]=function(_0x5de275,_0x236aec){if(_0x5de275['body']['id']){delete _0x5de275[_0x19d7('0x54')]['id'];}return db['VoiceQueue'][_0x19d7('0x34')]({'where':{'id':_0x5de275[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x236aec,null))[_0x19d7('0x29')](saveUpdates(_0x5de275[_0x19d7('0x54')],null))['then'](respondWithResult(_0x236aec,null))[_0x19d7('0x50')](handleError(_0x236aec,null));};exports['destroy']=function(_0x5965a8,_0x1bb6c7){return db[_0x19d7('0x3a')][_0x19d7('0x34')]({'where':{'id':_0x5965a8[_0x19d7('0x52')]['id']}})['then'](handleEntityNotFound(_0x1bb6c7,null))['then'](removeEntity(_0x1bb6c7,null))[_0x19d7('0x50')](handleError(_0x1bb6c7,null));};exports[_0x19d7('0x5f')]=function(_0x3d0386,_0x3b5eb9,_0x4385e2){var _0x851d3c={'raw':![],'where':{}};var _0x24df62={};var _0x3d7829={'count':0x0,'rows':[]};return db[_0x19d7('0x3a')]['findOne']({'where':{'id':_0x3d0386[_0x19d7('0x52')]['id']}})['then'](handleEntityNotFound(_0x3b5eb9,null))['then'](function(_0x465d61){if(_0x465d61){_0x24df62[_0x19d7('0x3c')]=_['keys'](db[_0x19d7('0x60')][_0x19d7('0x3b')]);_0x24df62[_0x19d7('0x3e')]=_[_0x19d7('0x3d')](_0x3d0386[_0x19d7('0x3e')]);_0x24df62['filters']=_[_0x19d7('0x40')](_0x24df62[_0x19d7('0x3c')],_0x24df62[_0x19d7('0x3e')]);_0x851d3c['attributes']=_['intersection'](_0x24df62[_0x19d7('0x3c')],qs[_0x19d7('0x41')](_0x3d0386['query'][_0x19d7('0x41')]));_0x851d3c[_0x19d7('0x42')]=_0x851d3c[_0x19d7('0x42')]['length']?_0x851d3c[_0x19d7('0x42')]:_0x24df62['model'];if(!_0x3d0386['query'][_0x19d7('0x61')](_0x19d7('0x44'))){_0x851d3c['limit']=qs['limit'](_0x3d0386[_0x19d7('0x3e')][_0x19d7('0x21')]);_0x851d3c[_0x19d7('0x20')]=qs[_0x19d7('0x20')](_0x3d0386['query'][_0x19d7('0x20')]);}_0x851d3c[_0x19d7('0x45')]=qs[_0x19d7('0x46')](_0x3d0386[_0x19d7('0x3e')]['sort']);_0x851d3c[_0x19d7('0x47')]=qs[_0x19d7('0x3f')](_[_0x19d7('0x62')](_0x3d0386['query'],_0x24df62[_0x19d7('0x3f')]));_0x851d3c[_0x19d7('0x47')][_0x19d7('0x63')]=_0x465d61['id'];if(_0x3d0386[_0x19d7('0x3e')][_0x19d7('0x2f')]){_0x851d3c['where']=_[_0x19d7('0x48')](_0x851d3c[_0x19d7('0x47')],{'$or':_[_0x19d7('0x31')](_0x851d3c['attributes'],function(_0x3a39c7){var _0xaff1d8={};_0xaff1d8[_0x3a39c7]={'$like':'%'+_0x3d0386[_0x19d7('0x3e')][_0x19d7('0x2f')]+'%'};return _0xaff1d8;})});}_0x851d3c=_[_0x19d7('0x48')]({},_0x851d3c,_0x3d0386['options']);return db[_0x19d7('0x60')][_0x19d7('0x1f')]({'where':_0x851d3c['where']})[_0x19d7('0x29')](function(_0x549b48){_0x3d7829['count']=_0x549b48;if(_0x3d0386[_0x19d7('0x3e')]['includeAll']){_0x851d3c[_0x19d7('0x4e')]=[{'all':!![]}];}return db[_0x19d7('0x60')][_0x19d7('0x64')](_0x851d3c);})[_0x19d7('0x29')](function(_0x590675){_0x3d7829[_0x19d7('0x4f')]=_0x590675;return _0x3d7829;});}})['then'](respondWithFilteredResult(_0x3b5eb9,_0x851d3c))[_0x19d7('0x50')](handleError(_0x3b5eb9,null));};exports[_0x19d7('0x65')]=function(_0x565897,_0xa9b587,_0xa5755e){var _0x694532={'raw':!![],'where':{}};var _0x53a754={};var _0x3f81ef={'count':0x0,'rows':[]};return db[_0x19d7('0x3a')]['findOne']({'where':{'id':_0x565897['params']['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0xa9b587,null))[_0x19d7('0x29')](function(_0x331396){if(_0x331396){_0x53a754[_0x19d7('0x3c')]=_[_0x19d7('0x3d')](db[_0x19d7('0x66')][_0x19d7('0x3b')]);_0x53a754[_0x19d7('0x3e')]=_[_0x19d7('0x3d')](_0x565897[_0x19d7('0x3e')]);_0x53a754['filters']=_['intersection'](_0x53a754[_0x19d7('0x3c')],_0x53a754[_0x19d7('0x3e')]);_0x694532[_0x19d7('0x42')]=_[_0x19d7('0x40')](_0x53a754[_0x19d7('0x3c')],qs[_0x19d7('0x41')](_0x565897[_0x19d7('0x3e')]['fields']));_0x694532[_0x19d7('0x42')]=_0x694532[_0x19d7('0x42')]['length']?_0x694532[_0x19d7('0x42')]:_0x53a754[_0x19d7('0x3c')];if(!_0x565897[_0x19d7('0x3e')]['hasOwnProperty']('nolimit')){_0x694532['limit']=qs['limit'](_0x565897[_0x19d7('0x3e')][_0x19d7('0x21')]);_0x694532[_0x19d7('0x20')]=qs[_0x19d7('0x20')](_0x565897['query'][_0x19d7('0x20')]);}_0x694532[_0x19d7('0x45')]=qs[_0x19d7('0x46')](_0x565897[_0x19d7('0x3e')][_0x19d7('0x46')]);_0x694532[_0x19d7('0x47')]=qs[_0x19d7('0x3f')](_[_0x19d7('0x62')](_0x565897[_0x19d7('0x3e')],_0x53a754[_0x19d7('0x3f')]));_0x694532[_0x19d7('0x47')][_0x19d7('0x63')]=_0x331396['id'];if(_0x565897[_0x19d7('0x3e')]['filter']){_0x694532[_0x19d7('0x47')]=_[_0x19d7('0x48')](_0x694532[_0x19d7('0x47')],{'$or':_['map'](_0x694532[_0x19d7('0x42')],function(_0x23aa9f){var _0x4310c0={};_0x4310c0[_0x23aa9f]={'$like':'%'+_0x565897['query'][_0x19d7('0x2f')]+'%'};return _0x4310c0;})});}_0x694532=_[_0x19d7('0x48')]({},_0x694532,_0x565897[_0x19d7('0x4c')]);return db[_0x19d7('0x66')][_0x19d7('0x1f')]({'where':_0x694532[_0x19d7('0x47')]})[_0x19d7('0x29')](function(_0x1ecaeb){_0x3f81ef['count']=_0x1ecaeb;if(_0x565897['query'][_0x19d7('0x4d')]){_0x694532[_0x19d7('0x4e')]=[{'all':!![]}];}return db[_0x19d7('0x66')]['findAll'](_0x694532);})[_0x19d7('0x29')](function(_0x4ed81f){_0x3f81ef[_0x19d7('0x4f')]=_0x4ed81f;return _0x3f81ef;});}})[_0x19d7('0x29')](respondWithFilteredResult(_0xa9b587,_0x694532))['catch'](handleError(_0xa9b587,null));};exports[_0x19d7('0x67')]=function(_0x5d6403,_0x4c758f,_0x1ada7c){var _0x1ec7e2={'raw':!![],'where':{}};var _0x1d0ec0={};var _0x41f159={'count':0x0,'rows':[]};return db[_0x19d7('0x3a')][_0x19d7('0x68')]({'where':{'id':_0x5d6403[_0x19d7('0x52')]['id']}})['then'](handleEntityNotFound(_0x4c758f,null))[_0x19d7('0x29')](function(_0x5e298e){if(_0x5e298e){_0x1d0ec0[_0x19d7('0x3c')]=_[_0x19d7('0x3d')](db[_0x19d7('0x69')][_0x19d7('0x3b')]);_0x1d0ec0[_0x19d7('0x3e')]=_[_0x19d7('0x3d')](_0x5d6403[_0x19d7('0x3e')]);_0x1d0ec0[_0x19d7('0x3f')]=_[_0x19d7('0x40')](_0x1d0ec0[_0x19d7('0x3c')],_0x1d0ec0[_0x19d7('0x3e')]);_0x1ec7e2[_0x19d7('0x42')]=_['intersection'](_0x1d0ec0[_0x19d7('0x3c')],qs['fields'](_0x5d6403[_0x19d7('0x3e')][_0x19d7('0x41')]));_0x1ec7e2[_0x19d7('0x42')]=_0x1ec7e2['attributes'][_0x19d7('0x43')]?_0x1ec7e2[_0x19d7('0x42')]:_0x1d0ec0['model'];if(!_0x5d6403[_0x19d7('0x3e')][_0x19d7('0x61')](_0x19d7('0x44'))){_0x1ec7e2['limit']=qs[_0x19d7('0x21')](_0x5d6403['query']['limit']);_0x1ec7e2[_0x19d7('0x20')]=qs['offset'](_0x5d6403[_0x19d7('0x3e')]['offset']);}_0x1ec7e2[_0x19d7('0x45')]=qs[_0x19d7('0x46')](_0x5d6403[_0x19d7('0x3e')][_0x19d7('0x46')]);_0x1ec7e2[_0x19d7('0x47')]=qs[_0x19d7('0x3f')](_[_0x19d7('0x62')](_0x5d6403[_0x19d7('0x3e')],_0x1d0ec0['filters']));_0x1ec7e2['where'][_0x19d7('0x63')]=_0x5e298e['id'];if(_0x5d6403[_0x19d7('0x3e')][_0x19d7('0x2f')]){_0x1ec7e2[_0x19d7('0x47')]=_[_0x19d7('0x48')](_0x1ec7e2['where'],{'$or':_[_0x19d7('0x31')](_0x1ec7e2['attributes'],function(_0x1a69cc){var _0x4533dc={};_0x4533dc[_0x1a69cc]={'$like':'%'+_0x5d6403[_0x19d7('0x3e')][_0x19d7('0x2f')]+'%'};return _0x4533dc;})});}_0x1ec7e2=_[_0x19d7('0x48')]({},_0x1ec7e2,_0x5d6403[_0x19d7('0x4c')]);return db[_0x19d7('0x69')][_0x19d7('0x1f')]({'where':_0x1ec7e2[_0x19d7('0x47')]})[_0x19d7('0x29')](function(_0x2344c5){_0x41f159[_0x19d7('0x1f')]=_0x2344c5;if(_0x5d6403['query'][_0x19d7('0x4d')]){_0x1ec7e2['include']=[{'all':!![]}];}return db[_0x19d7('0x69')][_0x19d7('0x64')](_0x1ec7e2);})[_0x19d7('0x29')](function(_0x423b98){_0x41f159[_0x19d7('0x4f')]=_0x423b98;return _0x41f159;});}})['then'](respondWithFilteredResult(_0x4c758f,_0x1ec7e2))[_0x19d7('0x50')](handleError(_0x4c758f,null));};exports[_0x19d7('0x6a')]=function(_0x15519f,_0x302634,_0x3748e1){var _0xecb00={'raw':!![],'where':{}};var _0x523f80={};var _0x2caf30={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x19d7('0x68')]({'where':{'id':_0x15519f['params']['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x302634,null))[_0x19d7('0x29')](function(_0x3e20c5){if(_0x3e20c5){_0x523f80[_0x19d7('0x3c')]=_[_0x19d7('0x3d')](db[_0x19d7('0x6b')][_0x19d7('0x3b')]);_0x523f80[_0x19d7('0x3e')]=_[_0x19d7('0x3d')](_0x15519f[_0x19d7('0x3e')]);_0x523f80['filters']=_[_0x19d7('0x40')](_0x523f80['model'],_0x523f80[_0x19d7('0x3e')]);_0xecb00[_0x19d7('0x42')]=_[_0x19d7('0x40')](_0x523f80[_0x19d7('0x3c')],qs[_0x19d7('0x41')](_0x15519f[_0x19d7('0x3e')][_0x19d7('0x41')]));_0xecb00['attributes']=_0xecb00[_0x19d7('0x42')][_0x19d7('0x43')]?_0xecb00[_0x19d7('0x42')]:_0x523f80['model'];if(!_0x15519f['query']['hasOwnProperty']('nolimit')){_0xecb00[_0x19d7('0x21')]=qs[_0x19d7('0x21')](_0x15519f[_0x19d7('0x3e')][_0x19d7('0x21')]);_0xecb00['offset']=qs[_0x19d7('0x20')](_0x15519f[_0x19d7('0x3e')][_0x19d7('0x20')]);}_0xecb00['order']=qs[_0x19d7('0x46')](_0x15519f[_0x19d7('0x3e')]['sort']);_0xecb00[_0x19d7('0x47')]=qs[_0x19d7('0x3f')](_[_0x19d7('0x62')](_0x15519f[_0x19d7('0x3e')],_0x523f80[_0x19d7('0x3f')]));_0xecb00[_0x19d7('0x47')][_0x19d7('0x63')]=_0x3e20c5['id'];if(_0x15519f[_0x19d7('0x3e')][_0x19d7('0x2f')]){_0xecb00[_0x19d7('0x47')]=_[_0x19d7('0x48')](_0xecb00['where'],{'$or':_[_0x19d7('0x31')](_0xecb00[_0x19d7('0x42')],function(_0x108acb){var _0x1c7c90={};_0x1c7c90[_0x108acb]={'$like':'%'+_0x15519f[_0x19d7('0x3e')][_0x19d7('0x2f')]+'%'};return _0x1c7c90;})});}_0xecb00=_[_0x19d7('0x48')]({},_0xecb00,_0x15519f[_0x19d7('0x4c')]);return db[_0x19d7('0x6b')][_0x19d7('0x1f')]({'where':_0xecb00[_0x19d7('0x47')]})[_0x19d7('0x29')](function(_0x175a94){_0x2caf30[_0x19d7('0x1f')]=_0x175a94;if(_0x15519f['query']['includeAll']){_0xecb00[_0x19d7('0x4e')]=[{'all':!![]}];}return db[_0x19d7('0x6b')][_0x19d7('0x64')](_0xecb00);})[_0x19d7('0x29')](function(_0x4649ee){_0x2caf30[_0x19d7('0x4f')]=_0x4649ee;return _0x2caf30;});}})['then'](respondWithFilteredResult(_0x302634,_0xecb00))[_0x19d7('0x50')](handleError(_0x302634,null));};exports[_0x19d7('0x6c')]=function(_0x1717a2,_0x3c742e,_0xfb256e){var _0x49eaa3={};var _0x1decd4={};var _0xbb4fe0;var _0x55285d;return db[_0x19d7('0x3a')]['findOne']({'where':{'id':_0x1717a2[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x3c742e,null))[_0x19d7('0x29')](function(_0x478a08){if(_0x478a08){_0xbb4fe0=_0x478a08;_0x1decd4['model']=_[_0x19d7('0x3d')](db['Team']['rawAttributes']);_0x1decd4[_0x19d7('0x3e')]=_[_0x19d7('0x3d')](_0x1717a2['query']);_0x1decd4[_0x19d7('0x3f')]=_['intersection'](_0x1decd4[_0x19d7('0x3c')],_0x1decd4[_0x19d7('0x3e')]);_0x49eaa3['attributes']=_[_0x19d7('0x40')](_0x1decd4['model'],qs['fields'](_0x1717a2[_0x19d7('0x3e')][_0x19d7('0x41')]));_0x49eaa3[_0x19d7('0x42')]=_0x49eaa3[_0x19d7('0x42')][_0x19d7('0x43')]?_0x49eaa3[_0x19d7('0x42')]:_0x1decd4['model'];_0x49eaa3[_0x19d7('0x45')]=qs[_0x19d7('0x46')](_0x1717a2[_0x19d7('0x3e')][_0x19d7('0x46')]);_0x49eaa3[_0x19d7('0x47')]=qs['filters'](_[_0x19d7('0x62')](_0x1717a2['query'],_0x1decd4[_0x19d7('0x3f')]));if(_0x1717a2[_0x19d7('0x3e')][_0x19d7('0x2f')]){_0x49eaa3['where']=_[_0x19d7('0x48')](_0x49eaa3[_0x19d7('0x47')],{'$or':_['map'](_0x49eaa3['attributes'],function(_0x22a241){var _0x5ef168={};_0x5ef168[_0x22a241]={'$like':'%'+_0x1717a2[_0x19d7('0x3e')][_0x19d7('0x2f')]+'%'};return _0x5ef168;})});}_0x49eaa3=_['merge']({},_0x49eaa3,_0x1717a2['options']);return _0xbb4fe0[_0x19d7('0x6c')](_0x49eaa3);}})['then'](function(_0x514f82){if(_0x514f82){_0x55285d=_0x514f82[_0x19d7('0x43')];if(!_0x1717a2['query'][_0x19d7('0x61')](_0x19d7('0x44'))){_0x49eaa3[_0x19d7('0x21')]=qs[_0x19d7('0x21')](_0x1717a2['query'][_0x19d7('0x21')]);_0x49eaa3['offset']=qs[_0x19d7('0x20')](_0x1717a2[_0x19d7('0x3e')][_0x19d7('0x20')]);}return _0xbb4fe0[_0x19d7('0x6c')](_0x49eaa3);}})[_0x19d7('0x29')](function(_0x41d1a4){if(_0x41d1a4){return _0x41d1a4?{'count':_0x55285d,'rows':_0x41d1a4}:null;}})[_0x19d7('0x29')](respondWithResult(_0x3c742e,null))[_0x19d7('0x50')](handleError(_0x3c742e,null));};exports[_0x19d7('0x6d')]=function(_0x61d5eb,_0x2226c2,_0x558a14){var _0x149d3a=_0x61d5eb['body'][_0x19d7('0x6e')];return db[_0x19d7('0x6f')][_0x19d7('0x64')]({'where':{'id':_[_0x19d7('0x31')](_0x149d3a,'id')},'attributes':['id'],'include':[{'model':db[_0x19d7('0x70')],'as':_0x19d7('0x71'),'attributes':['id',_0x19d7('0x35'),'online','voicePause',_0x19d7('0x72')],'raw':!![]}]})[_0x19d7('0x29')](function(_0x27c995){if(_0x27c995){var _0x14e8cb=_[_0x19d7('0x73')](_0x27c995,function(_0x4ace20){var _0x2f9af9=_0x4ace20['get']({'plain':!![]});_0x2f9af9[_0x19d7('0x71')][_0x19d7('0x74')](function(_0x1e406e){_0x1e406e[_0x19d7('0x75')]=_[_0x19d7('0x34')](_0x149d3a,{'id':_0x2f9af9['id']})[_0x19d7('0x75')];});return _0x2f9af9[_0x19d7('0x71')];});return db[_0x19d7('0x3a')][_0x19d7('0x34')]({'where':{'id':_0x61d5eb['params']['id']}})['then'](function(_0x24e3ce){return db[_0x19d7('0x76')][_0x19d7('0x77')](function(_0x18b557){return _0x24e3ce[_0x19d7('0x6d')](_[_0x19d7('0x31')](_0x149d3a,'id'),{'transaction':_0x18b557})[_0x19d7('0x29')](function(){return BPromise[_0x19d7('0x78')](_0x14e8cb,function(_0x1546cf){return db[_0x19d7('0x79')][_0x19d7('0x7a')]({'where':{'UserId':_0x1546cf['id'],'VoiceQueueId':_0x61d5eb[_0x19d7('0x52')]['id']},'defaults':{'penalty':_0x1546cf[_0x19d7('0x75')]},'transaction':_0x18b557});});})[_0x19d7('0x29')](function(){return BPromise['each'](_[_0x19d7('0x2f')](_0x14e8cb,{'online':!![]}),function(_0x2d0a6b){return db[_0x19d7('0x7b')][_0x19d7('0x7c')]({'membername':_0x2d0a6b[_0x19d7('0x35')],'UserId':_0x2d0a6b['id'],'queue_name':_0x24e3ce[_0x19d7('0x35')],'VoiceQueueId':_0x24e3ce['id'],'interface':_['isNil'](_0x2d0a6b['interface'])?util[_0x19d7('0x7d')]('SIP/%s',_0x2d0a6b['name']):_0x2d0a6b[_0x19d7('0x72')],'paused':_0x2d0a6b['voicePause']||![],'penalty':_0x2d0a6b['penalty']},{'transaction':_0x18b557});});})[_0x19d7('0x29')](function(){_0x14e8cb[_0x19d7('0x74')](function(_0x44275a){socket[_0x19d7('0x7e')](_0x19d7('0x7f'),{'UserId':_0x44275a['id'],'VoiceQueueId':_0x24e3ce['id']});});});});});}})[_0x19d7('0x29')](respondWithStatusCode(_0x2226c2,null))[_0x19d7('0x50')](handleError(_0x2226c2,null));};exports['removeTeams']=function(_0x2f063c,_0x3e22e0,_0x526a77){return db[_0x19d7('0x6f')][_0x19d7('0x64')]({'where':{'id':_0x2f063c[_0x19d7('0x3e')][_0x19d7('0x80')]},'attributes':['id'],'include':[{'model':db[_0x19d7('0x70')],'as':_0x19d7('0x71'),'attributes':['id'],'raw':!![]}]})[_0x19d7('0x29')](handleEntityNotFound(_0x3e22e0,null))['then'](function(_0x1a4948){var _0x5c4787=_[_0x19d7('0x31')](_0x1a4948,'id');var _0x2735bd=[];var _0x27afd7=[];var _0xb14eb1=squel['select']();_0xb14eb1[_0x19d7('0x4b')](_0x19d7('0x81'))['from'](_0x19d7('0x82'),'tq')[_0x19d7('0x83')](_0x19d7('0x84'),'ut',_0x19d7('0x85'))[_0x19d7('0x47')]('VoiceQueueId\x20=\x20?',_0x2f063c[_0x19d7('0x52')]['id']);for(var _0x37f58c=0x0;_0x37f58c<_0x1a4948[_0x19d7('0x43')];_0x37f58c+=0x1){let _0x3bf602=_0x1a4948[_0x37f58c];for(var _0x2b4f07=0x0;_0x2b4f07<_0x3bf602[_0x19d7('0x71')]['length'];_0x2b4f07+=0x1){let _0x58bf22=_0x3bf602['Agents'][_0x2b4f07];var _0x5e7b58=_0xb14eb1[_0x19d7('0x86')]();_0x5e7b58[_0x19d7('0x47')](_0x19d7('0x87'),_0x58bf22['id']);_0x27afd7['push'](db[_0x19d7('0x76')]['query'](_0x5e7b58[_0x19d7('0x88')](),{'type':db[_0x19d7('0x76')]['QueryTypes']['SELECT']})['then'](function(_0x3fe3db){if(_0x3fe3db['length']===0x1){return _0x58bf22['id'];}else{var _0x1fe9f0=_['every'](_['map'](_0x3fe3db,_0x19d7('0x89')),function(_0x1d43be){return _['includes'](_0x5c4787,_0x1d43be);});if(_0x1fe9f0){return _0x58bf22['id'];}}}));}}return BPromise[_0x19d7('0x8a')](_0x27afd7)['then'](function(_0x356b9d){_0x2735bd=_(_0x2735bd)[_0x19d7('0x8b')](_0x356b9d)[_0x19d7('0x8c')]()['value']();return db['VoiceQueue'][_0x19d7('0x34')]({'where':{'id':_0x2f063c['params']['id']}})[_0x19d7('0x29')](function(_0x46aae4){return db[_0x19d7('0x76')][_0x19d7('0x77')](function(_0x3f5bbb){return _0x46aae4[_0x19d7('0x8d')](_0x2f063c['query'][_0x19d7('0x80')],{'transaction':_0x3f5bbb})['then'](function(){if(!_[_0x19d7('0x8e')](_0x2735bd)){return _0x46aae4[_0x19d7('0x8f')](_0x2735bd,{'transaction':_0x3f5bbb})[_0x19d7('0x29')](function(){return db[_0x19d7('0x7b')]['destroy']({'where':{'VoiceQueueId':_0x2f063c['params']['id'],'UserId':_0x2735bd},'transaction':_0x3f5bbb});});}})[_0x19d7('0x29')](function(){_0x2735bd[_0x19d7('0x74')](function(_0xa19b94){socket[_0x19d7('0x7e')](_0x19d7('0x90'),{'UserId':_0xa19b94,'VoiceQueueId':_0x46aae4['id']});});});});});});})[_0x19d7('0x29')](respondWithStatusCode(_0x3e22e0,null))['catch'](handleError(_0x3e22e0,null));};exports[_0x19d7('0x91')]=function(_0x34fbbd,_0x268c15,_0x49f6bb){var _0x3eff53,_0x3d057c;return db[_0x19d7('0x3a')][_0x19d7('0x34')]({'where':{'id':_0x34fbbd[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x268c15,null))['then'](function(_0x29da81){if(_0x29da81){_0x3d057c=_0x29da81;return _0x29da81['addAgents'](_0x34fbbd[_0x19d7('0x54')][_0x19d7('0x80')],_['omit'](_0x34fbbd[_0x19d7('0x54')],['ids','id'])||{})['spread'](function(_0x1b86dd){for(var _0x4a9c39=0x0;_0x4a9c39<_0x34fbbd[_0x19d7('0x54')]['ids'][_0x19d7('0x43')];_0x4a9c39+=0x1){socket[_0x19d7('0x7e')]('userVoiceQueue:save',{'UserId':_0x34fbbd['body'][_0x19d7('0x80')][_0x4a9c39],'VoiceQueueId':_0x34fbbd[_0x19d7('0x52')]['id']});}return _0x1b86dd;});}})[_0x19d7('0x29')](function(_0x5f193e){_0x3eff53=_0x5f193e||[];if(_0x3d057c){return db['User']['findAll']({'where':{'id':_0x34fbbd[_0x19d7('0x54')][_0x19d7('0x80')]},'attributes':['id','name','online','voicePause',_0x19d7('0x72')],'raw':!![]});}})['then'](function(_0x1097a8){if(!_[_0x19d7('0x8e')](_0x1097a8)){var _0x821e1b=[];for(var _0x2762ea=0x0;_0x2762ea<_0x1097a8[_0x19d7('0x43')];_0x2762ea++){if(_0x1097a8[_0x2762ea][_0x19d7('0x92')]){_0x821e1b['push'](db[_0x19d7('0x7b')][_0x19d7('0x7c')]({'membername':_0x1097a8[_0x2762ea][_0x19d7('0x35')],'UserId':_0x1097a8[_0x2762ea]['id'],'queue_name':_0x3d057c[_0x19d7('0x35')],'VoiceQueueId':_0x3d057c['id'],'interface':_[_0x19d7('0x93')](_0x1097a8[_0x2762ea][_0x19d7('0x72')])?util[_0x19d7('0x7d')](_0x19d7('0x94'),_0x1097a8[_0x2762ea][_0x19d7('0x35')]):_0x1097a8[_0x2762ea][_0x19d7('0x72')],'paused':_0x1097a8[_0x2762ea][_0x19d7('0x95')]||![],'penalty':_0x34fbbd['body']['penalty']||0x0}));}}return BPromise[_0x19d7('0x8a')](_0x821e1b);}})[_0x19d7('0x29')](function(){return _0x3eff53;})[_0x19d7('0x29')](respondWithResult(_0x268c15,null))[_0x19d7('0x50')](handleError(_0x268c15,null));};exports['removeAgents']=function(_0xae7360,_0xcda030,_0x23dfb3){return db[_0x19d7('0x3a')][_0x19d7('0x34')]({'where':{'id':_0xae7360[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0xcda030,null))[_0x19d7('0x29')](function(_0x1fb635){if(_0x1fb635){return _0x1fb635[_0x19d7('0x8f')](_0xae7360[_0x19d7('0x3e')]['ids'])[_0x19d7('0x29')](function(){if(_[_0x19d7('0x96')](_0xae7360[_0x19d7('0x3e')]['ids'])){for(var _0x5a54ac=0x0;_0x5a54ac<_0xae7360[_0x19d7('0x3e')][_0x19d7('0x80')][_0x19d7('0x43')];_0x5a54ac+=0x1){socket['emit'](_0x19d7('0x90'),{'UserId':Number(_0xae7360[_0x19d7('0x3e')][_0x19d7('0x80')][_0x5a54ac]),'VoiceQueueId':Number(_0xae7360[_0x19d7('0x52')]['id'])});}}else{socket[_0x19d7('0x7e')](_0x19d7('0x90'),{'UserId':Number(_0xae7360['query']['ids']),'VoiceQueueId':Number(_0xae7360[_0x19d7('0x52')]['id'])});}});}})[_0x19d7('0x29')](function(_0x53b824){return db[_0x19d7('0x7b')][_0x19d7('0x2a')]({'where':{'VoiceQueueId':_0xae7360[_0x19d7('0x52')]['id'],'UserId':_0xae7360[_0x19d7('0x3e')][_0x19d7('0x80')]}})[_0x19d7('0x29')](function(){return _0x53b824;});})[_0x19d7('0x29')](respondWithStatusCode(_0xcda030,null))[_0x19d7('0x50')](handleError(_0xcda030,null));};exports[_0x19d7('0x97')]=function(_0x4d2b52,_0x10600b,_0xb3db5f){var _0x39d910={};var _0x5d9a45={};var _0x1d1911;var _0x4d3419;return db['VoiceQueue'][_0x19d7('0x68')]({'where':{'id':_0x4d2b52[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x10600b,null))[_0x19d7('0x29')](function(_0x34bcb5){if(_0x34bcb5){_0x1d1911=_0x34bcb5;_0x5d9a45[_0x19d7('0x3c')]=_[_0x19d7('0x3d')](db[_0x19d7('0x70')][_0x19d7('0x3b')]);_0x5d9a45['query']=_[_0x19d7('0x3d')](_0x4d2b52[_0x19d7('0x3e')]);_0x5d9a45[_0x19d7('0x3f')]=_['intersection'](_0x5d9a45[_0x19d7('0x3c')],_0x5d9a45['query']);_0x39d910['attributes']=_[_0x19d7('0x40')](_0x5d9a45[_0x19d7('0x3c')],qs[_0x19d7('0x41')](_0x4d2b52[_0x19d7('0x3e')]['fields']));_0x39d910[_0x19d7('0x42')]=_0x39d910[_0x19d7('0x42')][_0x19d7('0x43')]?_0x39d910[_0x19d7('0x42')]:_0x5d9a45[_0x19d7('0x3c')];_0x39d910[_0x19d7('0x45')]=qs[_0x19d7('0x46')](_0x4d2b52['query'][_0x19d7('0x46')]);_0x39d910[_0x19d7('0x47')]=qs[_0x19d7('0x3f')](_[_0x19d7('0x62')](_0x4d2b52[_0x19d7('0x3e')],_0x5d9a45['filters']));if(_0x4d2b52[_0x19d7('0x3e')][_0x19d7('0x2f')]){_0x39d910['where']=_[_0x19d7('0x48')](_0x39d910[_0x19d7('0x47')],{'$or':_[_0x19d7('0x31')](_0x39d910['attributes'],function(_0x3cff2e){var _0x23e0b1={};_0x23e0b1[_0x3cff2e]={'$like':'%'+_0x4d2b52[_0x19d7('0x3e')]['filter']+'%'};return _0x23e0b1;})});}_0x39d910=_[_0x19d7('0x48')]({},_0x39d910,_0x4d2b52['options']);return _0x1d1911[_0x19d7('0x97')](_0x39d910);}})['then'](function(_0x1183b5){if(_0x1183b5){_0x4d3419=_0x1183b5[_0x19d7('0x43')];if(!_0x4d2b52['query'][_0x19d7('0x61')](_0x19d7('0x44'))){_0x39d910[_0x19d7('0x21')]=qs['limit'](_0x4d2b52[_0x19d7('0x3e')][_0x19d7('0x21')]);_0x39d910[_0x19d7('0x20')]=qs['offset'](_0x4d2b52[_0x19d7('0x3e')][_0x19d7('0x20')]);}return _0x1d1911[_0x19d7('0x97')](_0x39d910);}})[_0x19d7('0x29')](function(_0x2b65fd){if(_0x2b65fd){return _0x2b65fd?{'count':_0x4d3419,'rows':_0x2b65fd}:null;}})['then'](respondWithResult(_0x10600b,null))[_0x19d7('0x50')](handleError(_0x10600b,null));};exports[_0x19d7('0x98')]=function(_0x5b9b8e,_0x963232,_0x139f39){var _0x5f22ca={};var _0x5ede51={};var _0x3237cc;var _0x328088;return db[_0x19d7('0x3a')][_0x19d7('0x68')]({'where':{'id':_0x5b9b8e[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x963232,null))[_0x19d7('0x29')](function(_0x2888e8){if(_0x2888e8){_0x3237cc=_0x2888e8;_0x5ede51[_0x19d7('0x3c')]=_[_0x19d7('0x3d')](db[_0x19d7('0x7b')][_0x19d7('0x3b')]);_0x5ede51['query']=_[_0x19d7('0x3d')](_0x5b9b8e[_0x19d7('0x3e')]);_0x5ede51[_0x19d7('0x3f')]=_['intersection'](_0x5ede51[_0x19d7('0x3c')],_0x5ede51[_0x19d7('0x3e')]);_0x5f22ca[_0x19d7('0x42')]=_[_0x19d7('0x40')](_0x5ede51[_0x19d7('0x3c')],qs[_0x19d7('0x41')](_0x5b9b8e[_0x19d7('0x3e')][_0x19d7('0x41')]));_0x5f22ca[_0x19d7('0x42')]=_0x5f22ca[_0x19d7('0x42')][_0x19d7('0x43')]?_0x5f22ca[_0x19d7('0x42')]:_0x5ede51[_0x19d7('0x3c')];_0x5f22ca[_0x19d7('0x45')]=qs[_0x19d7('0x46')](_0x5b9b8e[_0x19d7('0x3e')][_0x19d7('0x46')]);_0x5f22ca['where']=qs[_0x19d7('0x3f')](_[_0x19d7('0x62')](_0x5b9b8e[_0x19d7('0x3e')],_0x5ede51[_0x19d7('0x3f')]));if(_0x5b9b8e[_0x19d7('0x3e')][_0x19d7('0x2f')]){_0x5f22ca[_0x19d7('0x47')]=_[_0x19d7('0x48')](_0x5f22ca[_0x19d7('0x47')],{'$or':_[_0x19d7('0x31')](_0x5f22ca['attributes'],function(_0x5d25d0){var _0x4a474d={};_0x4a474d[_0x5d25d0]={'$like':'%'+_0x5b9b8e[_0x19d7('0x3e')][_0x19d7('0x2f')]+'%'};return _0x4a474d;})});}_0x5f22ca=_[_0x19d7('0x48')]({},_0x5f22ca,_0x5b9b8e[_0x19d7('0x4c')]);return _0x3237cc[_0x19d7('0x98')](_0x5f22ca);}})[_0x19d7('0x29')](function(_0x4a0014){if(_0x4a0014){_0x328088=_0x4a0014['length'];if(!_0x5b9b8e[_0x19d7('0x3e')][_0x19d7('0x61')](_0x19d7('0x44'))){_0x5f22ca['limit']=qs[_0x19d7('0x21')](_0x5b9b8e[_0x19d7('0x3e')]['limit']);_0x5f22ca[_0x19d7('0x20')]=qs[_0x19d7('0x20')](_0x5b9b8e[_0x19d7('0x3e')][_0x19d7('0x20')]);}return _0x3237cc[_0x19d7('0x98')](_0x5f22ca);}})[_0x19d7('0x29')](function(_0xcd5939){return _0xcd5939?{'count':_0x328088,'rows':_0xcd5939}:null;})['then'](respondWithResult(_0x963232,null))[_0x19d7('0x50')](handleError(_0x963232,null));};exports[_0x19d7('0x99')]=function(_0x16b9f7,_0x28202d,_0x79687a){var _0x2d65b6={};var _0x5b6874={};var _0x3eab03;var _0x5b2ec2;return db[_0x19d7('0x3a')][_0x19d7('0x68')]({'where':{'id':_0x16b9f7[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x28202d,null))[_0x19d7('0x29')](function(_0x9cdefb){if(_0x9cdefb){_0x3eab03=_0x9cdefb;_0x5b6874[_0x19d7('0x3c')]=_[_0x19d7('0x3d')](db[_0x19d7('0x9a')][_0x19d7('0x3b')]);_0x5b6874[_0x19d7('0x3e')]=_[_0x19d7('0x3d')](_0x16b9f7[_0x19d7('0x3e')]);_0x5b6874[_0x19d7('0x3f')]=_[_0x19d7('0x40')](_0x5b6874[_0x19d7('0x3c')],_0x5b6874[_0x19d7('0x3e')]);_0x2d65b6[_0x19d7('0x42')]=_[_0x19d7('0x40')](_0x5b6874[_0x19d7('0x3c')],qs['fields'](_0x16b9f7[_0x19d7('0x3e')][_0x19d7('0x41')]));_0x2d65b6['attributes']=_0x2d65b6[_0x19d7('0x42')]['length']?_0x2d65b6['attributes']:_0x5b6874[_0x19d7('0x3c')];_0x2d65b6[_0x19d7('0x45')]=qs[_0x19d7('0x46')](_0x16b9f7[_0x19d7('0x3e')][_0x19d7('0x46')]);_0x2d65b6['where']=qs[_0x19d7('0x3f')](_['pick'](_0x16b9f7[_0x19d7('0x3e')],_0x5b6874[_0x19d7('0x3f')]));if(_0x16b9f7[_0x19d7('0x3e')]['filter']){_0x2d65b6[_0x19d7('0x47')]=_[_0x19d7('0x48')](_0x2d65b6[_0x19d7('0x47')],{'$or':_[_0x19d7('0x31')](_0x2d65b6[_0x19d7('0x42')],function(_0x3edcb3){var _0x340a63={};_0x340a63[_0x3edcb3]={'$like':'%'+_0x16b9f7[_0x19d7('0x3e')]['filter']+'%'};return _0x340a63;})});}_0x2d65b6=_['merge']({},_0x2d65b6,_0x16b9f7['options']);return _0x3eab03[_0x19d7('0x99')](_0x2d65b6);}})[_0x19d7('0x29')](function(_0x441f3b){if(_0x441f3b){_0x5b2ec2=_0x441f3b[_0x19d7('0x43')];if(!_0x16b9f7['query']['hasOwnProperty']('nolimit')){_0x2d65b6[_0x19d7('0x21')]=qs[_0x19d7('0x21')](_0x16b9f7[_0x19d7('0x3e')][_0x19d7('0x21')]);_0x2d65b6[_0x19d7('0x20')]=qs[_0x19d7('0x20')](_0x16b9f7[_0x19d7('0x3e')][_0x19d7('0x20')]);}return _0x3eab03['getLists'](_0x2d65b6);}})[_0x19d7('0x29')](function(_0x48c080){if(_0x48c080){return _0x48c080?{'count':_0x5b2ec2,'rows':_0x48c080}:null;}})[_0x19d7('0x29')](respondWithResult(_0x28202d,null))['catch'](handleError(_0x28202d,null));};exports[_0x19d7('0x9b')]=function(_0x41e707,_0x2074f0,_0xa73786){var _0x1e5cb0,_0x3054d8;return db[_0x19d7('0x3a')][_0x19d7('0x34')]({'where':{'id':_0x41e707[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x2074f0,null))[_0x19d7('0x29')](function(_0x46c4d2){if(_0x46c4d2){_0x3054d8=_0x46c4d2;return _0x46c4d2[_0x19d7('0x9b')](_0x41e707[_0x19d7('0x54')][_0x19d7('0x80')],_['omit'](_0x41e707['body'],[_0x19d7('0x80'),'id'])||{});}return null;})[_0x19d7('0x9c')](function(_0x3f24a9){var _0x1e7cdc;_0x1e5cb0=_0x3f24a9||[];var _0x4d7983=[];if(_0x3f24a9){for(var _0x5e1be0=0x0;_0x5e1be0<_0x3f24a9[_0x19d7('0x43')];_0x5e1be0+=0x1){var _0x147ee9=_0x3f24a9[_0x5e1be0][_0x19d7('0x2b')]({'plain':!![]});_0x3054d8[_0x19d7('0x9d')]=_0x41e707[_0x19d7('0x54')][_0x19d7('0x9d')]?_0x41e707[_0x19d7('0x54')][_0x19d7('0x9d')]:_0x3054d8[_0x19d7('0x9d')];switch(_0x3054d8[_0x19d7('0x9d')]){case _0x19d7('0x9e'):_0x1e7cdc=squel[_0x19d7('0x9f')]()['into'](_0x19d7('0xa0'))[_0x19d7('0xa1')]([_0x19d7('0xa2'),_0x19d7('0xa3'),_0x19d7('0xa4'),_0x19d7('0xa5'),_0x19d7('0x63'),_0x19d7('0xa6'),_0x19d7('0x5e')],squel[_0x19d7('0xa7')]()[_0x19d7('0x4b')](_0x19d7('0xa2'),_0x19d7('0xa2'))[_0x19d7('0x4b')](_0x19d7('0xa8'),_0x19d7('0xa3'))[_0x19d7('0x4b')]('id',_0x19d7('0xa4'))[_0x19d7('0x4b')](_0x147ee9[_0x19d7('0xa9')][_0x19d7('0x88')](),_0x19d7('0xa5'))['field'](_0x41e707['params']['id'][_0x19d7('0x88')](),_0x19d7('0x63'))[_0x19d7('0x4b')](_0x19d7('0xa8'),_0x19d7('0xa6'))[_0x19d7('0x4b')]('NOW()',_0x19d7('0x5e'))[_0x19d7('0xaa')](_0x19d7('0xab'))['where'](_0x19d7('0xac'))[_0x19d7('0x47')](_0x19d7('0xad'),_0x147ee9[_0x19d7('0xa9')][_0x19d7('0x88')]())[_0x19d7('0x47')](_0x19d7('0xae'))['where'](_0x19d7('0xaf'),squel[_0x19d7('0xa7')]()[_0x19d7('0x4b')](_0x19d7('0xb0'))[_0x19d7('0xaa')](_0x19d7('0xb1'))['where']('VoiceQueueId\x20=\x20?',_0x41e707[_0x19d7('0x52')]['id']['toString']()))[_0x19d7('0x47')](_0x19d7('0xaf'),squel[_0x19d7('0xa7')]()[_0x19d7('0x4b')](_0x19d7('0xb2'))[_0x19d7('0xaa')](_0x19d7('0xa0'))[_0x19d7('0x47')](_0x19d7('0xb3'),_0x41e707[_0x19d7('0x52')]['id'][_0x19d7('0x88')]())))[_0x19d7('0x88')]();break;case _0x19d7('0xb4'):_0x1e7cdc=squel['insert']()[_0x19d7('0xb5')](_0x19d7('0xa0'))[_0x19d7('0xa1')](['phone',_0x19d7('0xa3'),_0x19d7('0xa4'),_0x19d7('0xa5'),'VoiceQueueId',_0x19d7('0xa6'),_0x19d7('0x5e')],squel[_0x19d7('0xa7')]()[_0x19d7('0x4b')]('phone','phone')[_0x19d7('0x4b')](_0x19d7('0xa8'),_0x19d7('0xa3'))[_0x19d7('0x4b')]('id',_0x19d7('0xa4'))[_0x19d7('0x4b')](_0x147ee9[_0x19d7('0xa9')]['toString'](),_0x19d7('0xa5'))[_0x19d7('0x4b')](_0x41e707[_0x19d7('0x52')]['id'][_0x19d7('0x88')](),_0x19d7('0x63'))[_0x19d7('0x4b')](_0x19d7('0xa8'),_0x19d7('0xa6'))[_0x19d7('0x4b')](_0x19d7('0xa8'),'updatedAt')[_0x19d7('0xaa')](_0x19d7('0xab'))[_0x19d7('0x47')](_0x19d7('0xac'))[_0x19d7('0x47')](_0x19d7('0xad'),_0x147ee9[_0x19d7('0xa9')]['toString']())['where'](_0x19d7('0xae'))[_0x19d7('0x47')](_0x19d7('0xaf'),squel['select']()[_0x19d7('0x4b')](_0x19d7('0xb2'))[_0x19d7('0xaa')](_0x19d7('0xa0'))[_0x19d7('0x47')]('VoiceQueueId\x20=\x20?',_0x41e707['params']['id'][_0x19d7('0x88')]())))[_0x19d7('0x88')]();break;default:_0x1e7cdc=squel['insert']()['into'](_0x19d7('0xa0'))[_0x19d7('0xa1')]([_0x19d7('0xa2'),_0x19d7('0xa3'),_0x19d7('0xa4'),_0x19d7('0xa5'),_0x19d7('0x63'),_0x19d7('0xa6'),_0x19d7('0x5e')],squel['select']()['field'](_0x19d7('0xa2'),_0x19d7('0xa2'))[_0x19d7('0x4b')](_0x19d7('0xa8'),'scheduledAt')[_0x19d7('0x4b')]('id',_0x19d7('0xa4'))[_0x19d7('0x4b')](_0x147ee9['CmListId'][_0x19d7('0x88')](),_0x19d7('0xa5'))['field'](_0x41e707[_0x19d7('0x52')]['id'][_0x19d7('0x88')](),_0x19d7('0x63'))['field'](_0x19d7('0xa8'),_0x19d7('0xa6'))['field'](_0x19d7('0xa8'),_0x19d7('0x5e'))[_0x19d7('0xaa')]('cm_contacts')[_0x19d7('0x47')]('deletedAt\x20IS\x20NULL')[_0x19d7('0x47')]('ListId\x20=\x20?',_0x147ee9[_0x19d7('0xa9')]['toString']())[_0x19d7('0x47')](_0x19d7('0xae')))['toString']();}_0x4d7983[_0x19d7('0xb6')](db[_0x19d7('0x76')][_0x19d7('0x3e')](_0x1e7cdc));}return BPromise[_0x19d7('0x8a')](_0x4d7983);}})[_0x19d7('0x29')](function(){return _0x1e5cb0;})[_0x19d7('0x29')](respondWithResult(_0x2074f0,null))['catch'](handleError(_0x2074f0,null));};exports[_0x19d7('0xb7')]=function(_0x1b781c,_0x31e44e,_0x27320a){return db[_0x19d7('0x3a')]['find']({'where':{'id':_0x1b781c[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x31e44e,null))[_0x19d7('0x29')](function(_0x441ebf){if(_0x441ebf){return _0x441ebf['removeLists'](_0x1b781c[_0x19d7('0x3e')][_0x19d7('0x80')]);}})[_0x19d7('0x29')](function(_0x4138da){if(_0x4138da){return db[_0x19d7('0x60')][_0x19d7('0x2a')]({'where':{'ListId':_0x1b781c[_0x19d7('0x3e')]['ids'],'VoiceQueueId':_0x1b781c[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](function(){return _0x4138da;});}})[_0x19d7('0x29')](respondWithStatusCode(_0x31e44e,null))[_0x19d7('0x50')](handleError(_0x31e44e,null));};exports[_0x19d7('0xb8')]=function(_0x48766,_0x403e74,_0xd9786a){var _0x39b61a={};var _0x2b0ec3={};var _0x233067;var _0x11bb1a;return db[_0x19d7('0x3a')]['findOne']({'where':{'id':_0x48766[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x403e74,null))[_0x19d7('0x29')](function(_0x2db6c2){if(_0x2db6c2){_0x233067=_0x2db6c2;_0x2b0ec3['model']=_[_0x19d7('0x3d')](db['CmList'][_0x19d7('0x3b')]);_0x2b0ec3[_0x19d7('0x3e')]=_['keys'](_0x48766[_0x19d7('0x3e')]);_0x2b0ec3['filters']=_[_0x19d7('0x40')](_0x2b0ec3[_0x19d7('0x3c')],_0x2b0ec3[_0x19d7('0x3e')]);_0x39b61a['attributes']=_['intersection'](_0x2b0ec3[_0x19d7('0x3c')],qs[_0x19d7('0x41')](_0x48766[_0x19d7('0x3e')][_0x19d7('0x41')]));_0x39b61a[_0x19d7('0x42')]=_0x39b61a['attributes']['length']?_0x39b61a['attributes']:_0x2b0ec3[_0x19d7('0x3c')];_0x39b61a[_0x19d7('0x45')]=qs['sort'](_0x48766[_0x19d7('0x3e')][_0x19d7('0x46')]);_0x39b61a[_0x19d7('0x47')]=qs[_0x19d7('0x3f')](_['pick'](_0x48766[_0x19d7('0x3e')],_0x2b0ec3[_0x19d7('0x3f')]));if(_0x48766[_0x19d7('0x3e')][_0x19d7('0x2f')]){_0x39b61a[_0x19d7('0x47')]=_[_0x19d7('0x48')](_0x39b61a[_0x19d7('0x47')],{'$or':_[_0x19d7('0x31')](_0x39b61a[_0x19d7('0x42')],function(_0x317d6d){var _0x472414={};_0x472414[_0x317d6d]={'$like':'%'+_0x48766[_0x19d7('0x3e')][_0x19d7('0x2f')]+'%'};return _0x472414;})});}_0x39b61a=_[_0x19d7('0x48')]({},_0x39b61a,_0x48766['options']);return _0x233067[_0x19d7('0xb8')](_0x39b61a);}})['then'](function(_0x1d4d8f){if(_0x1d4d8f){_0x11bb1a=_0x1d4d8f[_0x19d7('0x43')];if(!_0x48766[_0x19d7('0x3e')][_0x19d7('0x61')](_0x19d7('0x44'))){_0x39b61a['limit']=qs[_0x19d7('0x21')](_0x48766[_0x19d7('0x3e')][_0x19d7('0x21')]);_0x39b61a['offset']=qs[_0x19d7('0x20')](_0x48766['query'][_0x19d7('0x20')]);}return _0x233067['getBlackLists'](_0x39b61a);}})['then'](function(_0x34be94){if(_0x34be94){return _0x34be94?{'count':_0x11bb1a,'rows':_0x34be94}:null;}})[_0x19d7('0x29')](respondWithResult(_0x403e74,null))[_0x19d7('0x50')](handleError(_0x403e74,null));};exports['addBlackLists']=function(_0x2b48ee,_0x1367d1,_0x2c1b82){var _0x2939c9,_0x1ea335;return db['VoiceQueue'][_0x19d7('0x34')]({'where':{'id':_0x2b48ee['params']['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x1367d1,null))[_0x19d7('0x29')](function(_0x567281){if(_0x567281){_0x1ea335=_0x567281;return _0x567281[_0x19d7('0xb9')](_0x2b48ee['body']['ids'],_[_0x19d7('0x5d')](_0x2b48ee['body'],['ids','id'])||{});}return null;})[_0x19d7('0x9c')](function(_0x98fa87){var _0x3a1902;_0x2939c9=_0x98fa87||[];var _0x3f3a5f=[];if(_0x98fa87){for(var _0x3965a3=0x0;_0x3965a3<_0x98fa87[_0x19d7('0x43')];_0x3965a3+=0x1){var _0x49031c=_0x98fa87[_0x3965a3][_0x19d7('0x2b')]({'plain':!![]});_0x3a1902=squel[_0x19d7('0x9f')]()[_0x19d7('0xb5')](_0x19d7('0xba'))[_0x19d7('0xa1')](['phone',_0x19d7('0xa4'),_0x19d7('0xa5'),_0x19d7('0x63'),_0x19d7('0xa6'),_0x19d7('0x5e')],squel[_0x19d7('0xa7')]()['field'](_0x19d7('0xa2'),'phone')[_0x19d7('0x4b')]('id',_0x19d7('0xa4'))[_0x19d7('0x4b')](_0x49031c['CmListId'][_0x19d7('0x88')](),_0x19d7('0xa5'))[_0x19d7('0x4b')](_0x2b48ee[_0x19d7('0x52')]['id'][_0x19d7('0x88')](),'VoiceQueueId')['field']('NOW()',_0x19d7('0xa6'))['field'](_0x19d7('0xa8'),_0x19d7('0x5e'))[_0x19d7('0xaa')](_0x19d7('0xab'))[_0x19d7('0x47')](_0x19d7('0xac'))[_0x19d7('0x47')](_0x19d7('0xad'),_0x49031c[_0x19d7('0xa9')]['toString']())[_0x19d7('0x47')](_0x19d7('0xae')))[_0x19d7('0x88')]();_0x3f3a5f[_0x19d7('0xb6')](db[_0x19d7('0x76')]['query'](_0x3a1902));}return BPromise[_0x19d7('0x8a')](_0x3f3a5f);}})['then'](function(){return _0x2939c9;})[_0x19d7('0x29')](respondWithResult(_0x1367d1,null))[_0x19d7('0x50')](handleError(_0x1367d1,null));};exports[_0x19d7('0xbb')]=function(_0x322779,_0x2c25ec,_0x181f34){return db[_0x19d7('0x3a')][_0x19d7('0x34')]({'where':{'id':_0x322779['params']['id']}})[_0x19d7('0x29')](handleEntityNotFound(_0x2c25ec,null))['then'](function(_0x393467){if(_0x393467){return _0x393467[_0x19d7('0xbb')](_0x322779['query'][_0x19d7('0x80')]);}})[_0x19d7('0x29')](function(_0x4ae627){if(_0x4ae627){return db[_0x19d7('0x6b')]['destroy']({'where':{'ListId':_0x322779[_0x19d7('0x3e')][_0x19d7('0x80')],'VoiceQueueId':_0x322779[_0x19d7('0x52')]['id']}})[_0x19d7('0x29')](function(){return _0x4ae627;});}})[_0x19d7('0x29')](respondWithStatusCode(_0x2c25ec,null))['catch'](handleError(_0x2c25ec,null));};
\ No newline at end of file