Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index 57a5108..60e63c2 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2ebf=['to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','map','value','includes','type','name','error','stack','send','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','pick','filter','where','merge','VIRTUAL','includeAll','include','VoiceQueue','params','keys','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','omit','createdAt','updatedAt','getHoppers','findOne','sort','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','order','findAll','rows','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','each','findOrCreate','UserVoiceQueueRt','upsert','format','SIP/%s','emit','userVoiceQueue:save','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','union','compact','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','all','isArray','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','cm_hopper','fromQuery','phone','scheduledAt','ContactId','NOW()','CmListId','ListId','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','select','ListId\x20=\x20?','into','removeLists','getBlackLists','cm_hopper_black','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x2ebf,0x153));var _0xf2eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ebf[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2eb('0x0'));var zipdir=require(_0xf2eb('0x1'));var jsonpatch=require(_0xf2eb('0x2'));var rp=require(_0xf2eb('0x3'));var moment=require('moment');var BPromise=require(_0xf2eb('0x4'));var Mustache=require(_0xf2eb('0x5'));var util=require('util');var path=require(_0xf2eb('0x6'));var sox=require(_0xf2eb('0x7'));var csv=require('to-csv');var ejs=require(_0xf2eb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf2eb('0x9'));var crypto=require(_0xf2eb('0xa'));var jsforce=require(_0xf2eb('0xb'));var deskjs=require(_0xf2eb('0xc'));var toCsv=require(_0xf2eb('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf2eb('0xe'));var authService=require(_0xf2eb('0xf'));var qs=require(_0xf2eb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf2eb('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xf2eb('0x12'));var licenseUtil=require(_0xf2eb('0x13'));var db=require('../../mysqldb')['db'];config[_0xf2eb('0x14')]=_['defaults'](config['redis'],{'host':_0xf2eb('0x15'),'port':0x18eb});var socket=require(_0xf2eb('0x16'))(new Redis(config[_0xf2eb('0x14')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x5a9923,_0x2a7e79){_0x2a7e79=_0x2a7e79||0xcc;return function(_0x4f76cb){if(_0x4f76cb){return _0x5a9923[_0xf2eb('0x17')](_0x2a7e79);}return _0x5a9923[_0xf2eb('0x18')](_0x2a7e79)[_0xf2eb('0x19')]();};}function respondWithResult(_0x44f718,_0x47e24e){_0x47e24e=_0x47e24e||0xc8;return function(_0x2252b5){if(_0x2252b5){return _0x44f718[_0xf2eb('0x18')](_0x47e24e)['json'](_0x2252b5);}};}function respondWithFilteredResult(_0x3c5857,_0x581857){return function(_0x29dc76){if(_0x29dc76){var _0x56fd8d=typeof _0x581857[_0xf2eb('0x1a')]==='undefined'&&typeof _0x581857['limit']===_0xf2eb('0x1b');var _0x5e073f=_0x29dc76['count'];var _0x1609ee=_0x56fd8d?0x0:_0x581857[_0xf2eb('0x1a')];var _0x500f58=_0x56fd8d?_0x29dc76[_0xf2eb('0x1c')]:_0x581857[_0xf2eb('0x1a')]+_0x581857[_0xf2eb('0x1d')];var _0x4f83ec;if(_0x500f58>=_0x5e073f){_0x500f58=_0x5e073f;_0x4f83ec=0xc8;}else{_0x4f83ec=0xce;}_0x3c5857[_0xf2eb('0x18')](_0x4f83ec);return _0x3c5857[_0xf2eb('0x1e')]('Content-Range',_0x1609ee+'-'+_0x500f58+'/'+_0x5e073f)[_0xf2eb('0x1f')](_0x29dc76);}return null;};}function patchUpdates(_0x253e1a){return function(_0x472517){try{jsonpatch[_0xf2eb('0x20')](_0x472517,_0x253e1a,!![]);}catch(_0x33e785){return BPromise[_0xf2eb('0x21')](_0x33e785);}return _0x472517[_0xf2eb('0x22')]();};}function saveUpdates(_0x33e595,_0x4919b8){return function(_0x4ead05){if(_0x4ead05){return _0x4ead05[_0xf2eb('0x23')](_0x33e595)[_0xf2eb('0x24')](function(_0x4efc95){return _0x4efc95;});}return null;};}function removeEntity(_0x771623,_0x57f120){return function(_0x54b076){if(_0x54b076){return _0x54b076[_0xf2eb('0x25')]()[_0xf2eb('0x24')](function(){var _0x4d8359=_0x54b076[_0xf2eb('0x26')]({'plain':!![]});var _0x5dc675=[{'name':_0xf2eb('0x27'),'value':_0xf2eb('0x28'),'ignore':![]},{'name':_0xf2eb('0x29'),'value':_0xf2eb('0x2a'),'ignore':![]}];var _0x281d06=_(_0x5dc675)['filter']('ignore')[_0xf2eb('0x2b')](_0xf2eb('0x2c'))[_0xf2eb('0x2c')]();if(_[_0xf2eb('0x2d')](_0x281d06,_0x4d8359['type'])){return;}var _0x11a2e5=_['find'](_0x5dc675,[_0xf2eb('0x2c'),_0x4d8359[_0xf2eb('0x2e')]])[_0xf2eb('0x2f')];return db['UserProfileResource']['destroy']({'where':{'type':_0x11a2e5,'resourceId':_0x4d8359['id']}})['then'](function(){return _0x54b076;});})[_0xf2eb('0x24')](function(){_0x771623[_0xf2eb('0x18')](0xcc)[_0xf2eb('0x19')]();});}};}function handleEntityNotFound(_0x5de148,_0x12e26c){return function(_0x14cc25){if(!_0x14cc25){_0x5de148[_0xf2eb('0x17')](0x194);}return _0x14cc25;};}function handleError(_0x5694ba,_0x32c84b){_0x32c84b=_0x32c84b||0x1f4;return function(_0x598cc1){logger[_0xf2eb('0x30')](_0x598cc1[_0xf2eb('0x31')]);if(_0x598cc1[_0xf2eb('0x2f')]){delete _0x598cc1['name'];}_0x5694ba[_0xf2eb('0x18')](_0x32c84b)[_0xf2eb('0x32')](_0x598cc1);};}exports['index']=function(_0x20fdfc,_0x5d60c4){var _0x6bf346={},_0x2d1cf4={},_0x44a3ac={'count':0x0,'rows':[]};var _0x40156c=_[_0xf2eb('0x2b')](db['VoiceQueue'][_0xf2eb('0x33')],function(_0x5690b5){return{'name':_0x5690b5[_0xf2eb('0x34')],'type':_0x5690b5[_0xf2eb('0x2e')]['key']};});_0x2d1cf4[_0xf2eb('0x35')]=_[_0xf2eb('0x2b')](_0x40156c,_0xf2eb('0x2f'));_0x2d1cf4[_0xf2eb('0x36')]=_['keys'](_0x20fdfc[_0xf2eb('0x36')]);_0x2d1cf4[_0xf2eb('0x37')]=_[_0xf2eb('0x38')](_0x2d1cf4[_0xf2eb('0x35')],_0x2d1cf4[_0xf2eb('0x36')]);_0x6bf346[_0xf2eb('0x39')]=_[_0xf2eb('0x38')](_0x2d1cf4[_0xf2eb('0x35')],qs['fields'](_0x20fdfc[_0xf2eb('0x36')][_0xf2eb('0x3a')]));_0x6bf346[_0xf2eb('0x39')]=_0x6bf346[_0xf2eb('0x39')][_0xf2eb('0x3b')]?_0x6bf346['attributes']:_0x2d1cf4[_0xf2eb('0x35')];if(!_0x20fdfc[_0xf2eb('0x36')][_0xf2eb('0x3c')](_0xf2eb('0x3d'))){_0x6bf346[_0xf2eb('0x1d')]=qs[_0xf2eb('0x1d')](_0x20fdfc[_0xf2eb('0x36')][_0xf2eb('0x1d')]);_0x6bf346['offset']=qs['offset'](_0x20fdfc[_0xf2eb('0x36')]['offset']);}_0x6bf346['order']=qs['sort'](_0x20fdfc[_0xf2eb('0x36')]['sort']);_0x6bf346['where']=qs[_0xf2eb('0x37')](_[_0xf2eb('0x3e')](_0x20fdfc[_0xf2eb('0x36')],_0x2d1cf4[_0xf2eb('0x37')]),_0x40156c);if(_0x20fdfc[_0xf2eb('0x36')][_0xf2eb('0x3f')]){_0x6bf346[_0xf2eb('0x40')]=_[_0xf2eb('0x41')](_0x6bf346['where'],{'$or':_[_0xf2eb('0x2b')](_0x40156c,function(_0x1c7171){if(_0x1c7171[_0xf2eb('0x2e')]!==_0xf2eb('0x42')){var _0x351aa5={};_0x351aa5[_0x1c7171[_0xf2eb('0x2f')]]={'$like':'%'+_0x20fdfc['query'][_0xf2eb('0x3f')]+'%'};return _0x351aa5;}})});}_0x6bf346=_[_0xf2eb('0x41')]({},_0x6bf346,_0x20fdfc['options']);var _0xd713ac={'where':_0x6bf346[_0xf2eb('0x40')]};return db['VoiceQueue'][_0xf2eb('0x1c')](_0xd713ac)[_0xf2eb('0x24')](function(_0x578b3b){_0x44a3ac[_0xf2eb('0x1c')]=_0x578b3b;if(_0x20fdfc['query'][_0xf2eb('0x43')]){_0x6bf346[_0xf2eb('0x44')]=[{'all':!![]}];}return db[_0xf2eb('0x45')]['findAll'](_0x6bf346);})[_0xf2eb('0x24')](function(_0x55c10b){_0x44a3ac['rows']=_0x55c10b;return _0x44a3ac;})[_0xf2eb('0x24')](respondWithFilteredResult(_0x5d60c4,_0x6bf346))['catch'](handleError(_0x5d60c4,null));};exports['show']=function(_0x5448b1,_0x15e271){var _0x5a4312={'raw':![],'where':{'id':_0x5448b1[_0xf2eb('0x46')]['id']}},_0x3c5627={};_0x3c5627['model']=_[_0xf2eb('0x47')](db[_0xf2eb('0x45')][_0xf2eb('0x33')]);_0x3c5627[_0xf2eb('0x36')]=_[_0xf2eb('0x47')](_0x5448b1[_0xf2eb('0x36')]);_0x3c5627['filters']=_[_0xf2eb('0x38')](_0x3c5627['model'],_0x3c5627['query']);_0x5a4312[_0xf2eb('0x39')]=_[_0xf2eb('0x38')](_0x3c5627['model'],qs[_0xf2eb('0x3a')](_0x5448b1['query']['fields']));_0x5a4312['attributes']=_0x5a4312[_0xf2eb('0x39')]['length']?_0x5a4312[_0xf2eb('0x39')]:_0x3c5627[_0xf2eb('0x35')];if(_0x5448b1[_0xf2eb('0x36')][_0xf2eb('0x43')]){_0x5a4312[_0xf2eb('0x44')]=[{'all':!![]}];}_0x5a4312=_[_0xf2eb('0x41')]({},_0x5a4312,_0x5448b1[_0xf2eb('0x48')]);return db[_0xf2eb('0x45')]['find'](_0x5a4312)[_0xf2eb('0x24')](handleEntityNotFound(_0x15e271,null))[_0xf2eb('0x24')](respondWithResult(_0x15e271,null))['catch'](handleError(_0x15e271,null));};exports[_0xf2eb('0x49')]=function(_0x4c799d,_0x447c02){return db['VoiceQueue'][_0xf2eb('0x49')](_0x4c799d[_0xf2eb('0x4a')],{})[_0xf2eb('0x24')](function(_0x1684c0){var _0x584770=_0x4c799d[_0xf2eb('0x4b')][_0xf2eb('0x26')]({'plain':!![]});if(!_0x584770)throw new Error(_0xf2eb('0x4c'));if(_0x584770['role']===_0xf2eb('0x4b')){var _0x5d832e=_0x1684c0[_0xf2eb('0x26')]({'plain':!![]});var _0x36e4df=[{'name':'VoiceQueues','value':_0xf2eb('0x28')},{'name':_0xf2eb('0x29'),'value':_0xf2eb('0x2a')}];var _0x423685=_[_0xf2eb('0x4d')](_0x36e4df,[_0xf2eb('0x2c'),_0x5d832e[_0xf2eb('0x2e')]])[_0xf2eb('0x2f')];return db[_0xf2eb('0x4e')][_0xf2eb('0x4d')]({'where':{'name':_0x423685,'userProfileId':_0x584770['userProfileId']},'raw':!![]})['then'](function(_0x5f0ef5){if(_0x5f0ef5&&_0x5f0ef5[_0xf2eb('0x4f')]===0x0){return db['UserProfileResource'][_0xf2eb('0x49')]({'name':_0x5d832e[_0xf2eb('0x2f')],'resourceId':_0x5d832e['id'],'type':_0x5f0ef5[_0xf2eb('0x2f')],'sectionId':_0x5f0ef5['id']},{})[_0xf2eb('0x24')](function(){return _0x1684c0;});}else{return _0x1684c0;}})['catch'](function(_0x92a70c){logger[_0xf2eb('0x30')](_0xf2eb('0x50'),_0x92a70c);throw _0x92a70c;});}return _0x1684c0;})[_0xf2eb('0x24')](respondWithResult(_0x447c02,0xc9))[_0xf2eb('0x51')](handleError(_0x447c02,null));};exports['clone']=function(_0x1f5556,_0x2874cf){var _0x425ec0={'where':{'id':_0x1f5556['params']['id']}},_0x5032c6={};_0x5032c6[_0xf2eb('0x35')]=_[_0xf2eb('0x47')](db[_0xf2eb('0x45')][_0xf2eb('0x33')]);_0x425ec0['attributes']=_[_0xf2eb('0x38')](_0x5032c6[_0xf2eb('0x35')],qs[_0xf2eb('0x3a')](_0x1f5556['query'][_0xf2eb('0x3a')]));_0x425ec0[_0xf2eb('0x39')]=_0x425ec0[_0xf2eb('0x39')][_0xf2eb('0x3b')]?_0x425ec0[_0xf2eb('0x39')]:_0x5032c6[_0xf2eb('0x35')];if(_0x1f5556[_0xf2eb('0x36')]['includeAll']){_0x425ec0[_0xf2eb('0x44')]=[{'all':!![]}];}_0x425ec0=_[_0xf2eb('0x41')]({},_0x425ec0,_0x1f5556[_0xf2eb('0x48')]);return db['VoiceQueue'][_0xf2eb('0x4d')](_0x425ec0)[_0xf2eb('0x24')](handleEntityNotFound(_0x2874cf,null))[_0xf2eb('0x24')](function(_0x2ead71){if(_0x2ead71){var _0x500147=_0x2ead71[_0xf2eb('0x26')]({'plain':!![]});_0x500147=qs[_0xf2eb('0x52')](_0x500147,['id',_0xf2eb('0x53'),_0xf2eb('0x54')]);_0x1f5556[_0xf2eb('0x4a')]=_[_0xf2eb('0x52')](_0x1f5556[_0xf2eb('0x4a')],['id',_0xf2eb('0x53'),_0xf2eb('0x54')]);return db[_0xf2eb('0x45')][_0xf2eb('0x49')](_['merge'](_0x500147,_0x1f5556['body']),{'include':_0x1f5556[_0xf2eb('0x36')][_0xf2eb('0x43')]?[{'all':!![]}]:undefined})[_0xf2eb('0x24')](function(_0x200981){var _0x326a5d=_0x1f5556['user']['get']({'plain':!![]});if(!_0x326a5d)throw new Error(_0xf2eb('0x4c'));if(_0x326a5d['role']===_0xf2eb('0x4b')){var _0x4242a2=_0x200981[_0xf2eb('0x26')]({'plain':!![]});var _0x1551e4=[{'name':_0xf2eb('0x27'),'value':_0xf2eb('0x28')},{'name':_0xf2eb('0x29'),'value':_0xf2eb('0x2a')}];var _0x3273f2=_[_0xf2eb('0x4d')](_0x1551e4,['value',_0x4242a2[_0xf2eb('0x2e')]])[_0xf2eb('0x2f')];return db[_0xf2eb('0x4e')]['find']({'where':{'name':_0x3273f2,'userProfileId':_0x326a5d['userProfileId']},'raw':!![]})[_0xf2eb('0x24')](function(_0x328202){if(_0x328202&&_0x328202[_0xf2eb('0x4f')]===0x0){return db['UserProfileResource'][_0xf2eb('0x49')]({'name':_0x4242a2[_0xf2eb('0x2f')],'resourceId':_0x4242a2['id'],'type':_0x328202[_0xf2eb('0x2f')],'sectionId':_0x328202['id']},{})[_0xf2eb('0x24')](function(){return _0x200981;});}else{return _0x200981;}})[_0xf2eb('0x51')](function(_0x3a5afe){logger['error'](_0xf2eb('0x50'),_0x3a5afe);throw _0x3a5afe;});}return _0x200981;});}})[_0xf2eb('0x24')](respondWithResult(_0x2874cf,0xc9))[_0xf2eb('0x51')](handleError(_0x2874cf,null));};exports[_0xf2eb('0x23')]=function(_0x3361fc,_0x38273a){if(_0x3361fc['body']['id']){delete _0x3361fc['body']['id'];}return db[_0xf2eb('0x45')][_0xf2eb('0x4d')]({'where':{'id':_0x3361fc[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x38273a,null))[_0xf2eb('0x24')](saveUpdates(_0x3361fc['body'],null))[_0xf2eb('0x24')](respondWithResult(_0x38273a,null))[_0xf2eb('0x51')](handleError(_0x38273a,null));};exports[_0xf2eb('0x25')]=function(_0x2b2afc,_0x15e9e4){return db['VoiceQueue'][_0xf2eb('0x4d')]({'where':{'id':_0x2b2afc[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x15e9e4,null))[_0xf2eb('0x24')](removeEntity(_0x15e9e4,null))[_0xf2eb('0x51')](handleError(_0x15e9e4,null));};exports[_0xf2eb('0x55')]=function(_0x50c029,_0x421cd1,_0x42818f){var _0x1dfb71={'raw':![],'where':{}};var _0x9c43ad={};var _0x3c501e={'count':0x0,'rows':[]};return db[_0xf2eb('0x45')][_0xf2eb('0x56')]({'where':{'id':_0x50c029[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x421cd1,null))[_0xf2eb('0x24')](function(_0x2f5e66){if(_0x2f5e66){_0x9c43ad[_0xf2eb('0x35')]=_[_0xf2eb('0x47')](db['CmHopper'][_0xf2eb('0x33')]);_0x9c43ad[_0xf2eb('0x36')]=_[_0xf2eb('0x47')](_0x50c029[_0xf2eb('0x36')]);_0x9c43ad['filters']=_[_0xf2eb('0x38')](_0x9c43ad[_0xf2eb('0x35')],_0x9c43ad['query']);_0x1dfb71[_0xf2eb('0x39')]=_[_0xf2eb('0x38')](_0x9c43ad[_0xf2eb('0x35')],qs['fields'](_0x50c029[_0xf2eb('0x36')][_0xf2eb('0x3a')]));_0x1dfb71[_0xf2eb('0x39')]=_0x1dfb71[_0xf2eb('0x39')]['length']?_0x1dfb71[_0xf2eb('0x39')]:_0x9c43ad[_0xf2eb('0x35')];if(!_0x50c029[_0xf2eb('0x36')]['hasOwnProperty']('nolimit')){_0x1dfb71[_0xf2eb('0x1d')]=qs[_0xf2eb('0x1d')](_0x50c029['query']['limit']);_0x1dfb71[_0xf2eb('0x1a')]=qs[_0xf2eb('0x1a')](_0x50c029[_0xf2eb('0x36')]['offset']);}_0x1dfb71['order']=qs[_0xf2eb('0x57')](_0x50c029[_0xf2eb('0x36')]['sort']);_0x1dfb71['where']=qs[_0xf2eb('0x37')](_[_0xf2eb('0x3e')](_0x50c029[_0xf2eb('0x36')],_0x9c43ad[_0xf2eb('0x37')]));_0x1dfb71['where'][_0xf2eb('0x58')]=_0x2f5e66['id'];if(_0x50c029[_0xf2eb('0x36')][_0xf2eb('0x3f')]){_0x1dfb71[_0xf2eb('0x40')]=_[_0xf2eb('0x41')](_0x1dfb71['where'],{'$or':_[_0xf2eb('0x2b')](_0x1dfb71['attributes'],function(_0x1e5a7c){var _0x95414a={};_0x95414a[_0x1e5a7c]={'$like':'%'+_0x50c029[_0xf2eb('0x36')][_0xf2eb('0x3f')]+'%'};return _0x95414a;})});}_0x1dfb71=_['merge']({},_0x1dfb71,_0x50c029[_0xf2eb('0x48')]);return db[_0xf2eb('0x59')][_0xf2eb('0x1c')]({'where':_0x1dfb71[_0xf2eb('0x40')]})['then'](function(_0x1f2a23){_0x3c501e[_0xf2eb('0x1c')]=_0x1f2a23;if(_0x50c029['query'][_0xf2eb('0x43')]){_0x1dfb71[_0xf2eb('0x44')]=[{'all':!![]}];}return db[_0xf2eb('0x59')]['findAll'](_0x1dfb71);})[_0xf2eb('0x24')](function(_0xdd027d){_0x3c501e['rows']=_0xdd027d;return _0x3c501e;});}})[_0xf2eb('0x24')](respondWithFilteredResult(_0x421cd1,_0x1dfb71))['catch'](handleError(_0x421cd1,null));};exports[_0xf2eb('0x5a')]=function(_0x270131,_0x368397,_0xd06ca1){var _0x1a19eb={'raw':!![],'where':{}};var _0x442731={};var _0x144b8f={'count':0x0,'rows':[]};return db[_0xf2eb('0x45')][_0xf2eb('0x56')]({'where':{'id':_0x270131[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x368397,null))[_0xf2eb('0x24')](function(_0x560142){if(_0x560142){_0x442731[_0xf2eb('0x35')]=_[_0xf2eb('0x47')](db[_0xf2eb('0x5b')][_0xf2eb('0x33')]);_0x442731[_0xf2eb('0x36')]=_[_0xf2eb('0x47')](_0x270131[_0xf2eb('0x36')]);_0x442731[_0xf2eb('0x37')]=_[_0xf2eb('0x38')](_0x442731[_0xf2eb('0x35')],_0x442731[_0xf2eb('0x36')]);_0x1a19eb[_0xf2eb('0x39')]=_[_0xf2eb('0x38')](_0x442731[_0xf2eb('0x35')],qs[_0xf2eb('0x3a')](_0x270131[_0xf2eb('0x36')][_0xf2eb('0x3a')]));_0x1a19eb[_0xf2eb('0x39')]=_0x1a19eb['attributes'][_0xf2eb('0x3b')]?_0x1a19eb[_0xf2eb('0x39')]:_0x442731['model'];if(!_0x270131[_0xf2eb('0x36')][_0xf2eb('0x3c')](_0xf2eb('0x3d'))){_0x1a19eb[_0xf2eb('0x1d')]=qs[_0xf2eb('0x1d')](_0x270131[_0xf2eb('0x36')][_0xf2eb('0x1d')]);_0x1a19eb[_0xf2eb('0x1a')]=qs[_0xf2eb('0x1a')](_0x270131[_0xf2eb('0x36')][_0xf2eb('0x1a')]);}_0x1a19eb[_0xf2eb('0x5c')]=qs[_0xf2eb('0x57')](_0x270131[_0xf2eb('0x36')][_0xf2eb('0x57')]);_0x1a19eb[_0xf2eb('0x40')]=qs['filters'](_['pick'](_0x270131['query'],_0x442731[_0xf2eb('0x37')]));_0x1a19eb[_0xf2eb('0x40')]['VoiceQueueId']=_0x560142['id'];if(_0x270131[_0xf2eb('0x36')]['filter']){_0x1a19eb[_0xf2eb('0x40')]=_['merge'](_0x1a19eb[_0xf2eb('0x40')],{'$or':_[_0xf2eb('0x2b')](_0x1a19eb[_0xf2eb('0x39')],function(_0x4e90dd){var _0x26e15b={};_0x26e15b[_0x4e90dd]={'$like':'%'+_0x270131[_0xf2eb('0x36')]['filter']+'%'};return _0x26e15b;})});}_0x1a19eb=_['merge']({},_0x1a19eb,_0x270131[_0xf2eb('0x48')]);return db[_0xf2eb('0x5b')][_0xf2eb('0x1c')]({'where':_0x1a19eb[_0xf2eb('0x40')]})[_0xf2eb('0x24')](function(_0x155f7a){_0x144b8f[_0xf2eb('0x1c')]=_0x155f7a;if(_0x270131[_0xf2eb('0x36')][_0xf2eb('0x43')]){_0x1a19eb[_0xf2eb('0x44')]=[{'all':!![]}];}return db[_0xf2eb('0x5b')][_0xf2eb('0x5d')](_0x1a19eb);})[_0xf2eb('0x24')](function(_0x49c312){_0x144b8f[_0xf2eb('0x5e')]=_0x49c312;return _0x144b8f;});}})[_0xf2eb('0x24')](respondWithFilteredResult(_0x368397,_0x1a19eb))[_0xf2eb('0x51')](handleError(_0x368397,null));};exports[_0xf2eb('0x5f')]=function(_0x3e8be1,_0x41936e,_0x194491){var _0x5045a3={'raw':!![],'where':{}};var _0x525cd4={};var _0x2bfb5e={'count':0x0,'rows':[]};return db[_0xf2eb('0x45')][_0xf2eb('0x56')]({'where':{'id':_0x3e8be1[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x41936e,null))[_0xf2eb('0x24')](function(_0x4cb6b9){if(_0x4cb6b9){_0x525cd4[_0xf2eb('0x35')]=_[_0xf2eb('0x47')](db[_0xf2eb('0x60')][_0xf2eb('0x33')]);_0x525cd4[_0xf2eb('0x36')]=_['keys'](_0x3e8be1['query']);_0x525cd4[_0xf2eb('0x37')]=_[_0xf2eb('0x38')](_0x525cd4[_0xf2eb('0x35')],_0x525cd4[_0xf2eb('0x36')]);_0x5045a3[_0xf2eb('0x39')]=_[_0xf2eb('0x38')](_0x525cd4[_0xf2eb('0x35')],qs[_0xf2eb('0x3a')](_0x3e8be1[_0xf2eb('0x36')]['fields']));_0x5045a3['attributes']=_0x5045a3[_0xf2eb('0x39')]['length']?_0x5045a3['attributes']:_0x525cd4['model'];if(!_0x3e8be1['query'][_0xf2eb('0x3c')](_0xf2eb('0x3d'))){_0x5045a3[_0xf2eb('0x1d')]=qs[_0xf2eb('0x1d')](_0x3e8be1['query']['limit']);_0x5045a3['offset']=qs[_0xf2eb('0x1a')](_0x3e8be1[_0xf2eb('0x36')][_0xf2eb('0x1a')]);}_0x5045a3['order']=qs['sort'](_0x3e8be1['query'][_0xf2eb('0x57')]);_0x5045a3[_0xf2eb('0x40')]=qs[_0xf2eb('0x37')](_[_0xf2eb('0x3e')](_0x3e8be1[_0xf2eb('0x36')],_0x525cd4['filters']));_0x5045a3[_0xf2eb('0x40')][_0xf2eb('0x58')]=_0x4cb6b9['id'];if(_0x3e8be1['query'][_0xf2eb('0x3f')]){_0x5045a3[_0xf2eb('0x40')]=_[_0xf2eb('0x41')](_0x5045a3['where'],{'$or':_['map'](_0x5045a3[_0xf2eb('0x39')],function(_0x6a365f){var _0x2e86db={};_0x2e86db[_0x6a365f]={'$like':'%'+_0x3e8be1[_0xf2eb('0x36')][_0xf2eb('0x3f')]+'%'};return _0x2e86db;})});}_0x5045a3=_[_0xf2eb('0x41')]({},_0x5045a3,_0x3e8be1[_0xf2eb('0x48')]);return db[_0xf2eb('0x60')][_0xf2eb('0x1c')]({'where':_0x5045a3[_0xf2eb('0x40')]})['then'](function(_0x341be8){_0x2bfb5e[_0xf2eb('0x1c')]=_0x341be8;if(_0x3e8be1['query'][_0xf2eb('0x43')]){_0x5045a3['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xf2eb('0x5d')](_0x5045a3);})[_0xf2eb('0x24')](function(_0x2e1562){_0x2bfb5e[_0xf2eb('0x5e')]=_0x2e1562;return _0x2bfb5e;});}})[_0xf2eb('0x24')](respondWithFilteredResult(_0x41936e,_0x5045a3))[_0xf2eb('0x51')](handleError(_0x41936e,null));};exports[_0xf2eb('0x61')]=function(_0x57cf21,_0x58a951,_0x1af5fe){var _0xc84952={'raw':!![],'where':{}};var _0x3e4517={};var _0x4dc378={'count':0x0,'rows':[]};return db[_0xf2eb('0x45')][_0xf2eb('0x56')]({'where':{'id':_0x57cf21[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x58a951,null))[_0xf2eb('0x24')](function(_0x120eef){if(_0x120eef){_0x3e4517['model']=_['keys'](db[_0xf2eb('0x62')][_0xf2eb('0x33')]);_0x3e4517['query']=_[_0xf2eb('0x47')](_0x57cf21[_0xf2eb('0x36')]);_0x3e4517[_0xf2eb('0x37')]=_['intersection'](_0x3e4517['model'],_0x3e4517[_0xf2eb('0x36')]);_0xc84952[_0xf2eb('0x39')]=_[_0xf2eb('0x38')](_0x3e4517[_0xf2eb('0x35')],qs['fields'](_0x57cf21['query'][_0xf2eb('0x3a')]));_0xc84952['attributes']=_0xc84952['attributes']['length']?_0xc84952[_0xf2eb('0x39')]:_0x3e4517[_0xf2eb('0x35')];if(!_0x57cf21[_0xf2eb('0x36')]['hasOwnProperty'](_0xf2eb('0x3d'))){_0xc84952[_0xf2eb('0x1d')]=qs[_0xf2eb('0x1d')](_0x57cf21[_0xf2eb('0x36')][_0xf2eb('0x1d')]);_0xc84952[_0xf2eb('0x1a')]=qs[_0xf2eb('0x1a')](_0x57cf21[_0xf2eb('0x36')][_0xf2eb('0x1a')]);}_0xc84952[_0xf2eb('0x5c')]=qs[_0xf2eb('0x57')](_0x57cf21[_0xf2eb('0x36')]['sort']);_0xc84952[_0xf2eb('0x40')]=qs[_0xf2eb('0x37')](_[_0xf2eb('0x3e')](_0x57cf21[_0xf2eb('0x36')],_0x3e4517[_0xf2eb('0x37')]));_0xc84952[_0xf2eb('0x40')][_0xf2eb('0x58')]=_0x120eef['id'];if(_0x57cf21['query'][_0xf2eb('0x3f')]){_0xc84952[_0xf2eb('0x40')]=_[_0xf2eb('0x41')](_0xc84952['where'],{'$or':_[_0xf2eb('0x2b')](_0xc84952[_0xf2eb('0x39')],function(_0x40a420){var _0x3228d3={};_0x3228d3[_0x40a420]={'$like':'%'+_0x57cf21[_0xf2eb('0x36')][_0xf2eb('0x3f')]+'%'};return _0x3228d3;})});}_0xc84952=_[_0xf2eb('0x41')]({},_0xc84952,_0x57cf21[_0xf2eb('0x48')]);return db[_0xf2eb('0x62')]['count']({'where':_0xc84952[_0xf2eb('0x40')]})[_0xf2eb('0x24')](function(_0x87a350){_0x4dc378['count']=_0x87a350;if(_0x57cf21[_0xf2eb('0x36')]['includeAll']){_0xc84952[_0xf2eb('0x44')]=[{'all':!![]}];}return db[_0xf2eb('0x62')][_0xf2eb('0x5d')](_0xc84952);})[_0xf2eb('0x24')](function(_0x553054){_0x4dc378[_0xf2eb('0x5e')]=_0x553054;return _0x4dc378;});}})['then'](respondWithFilteredResult(_0x58a951,_0xc84952))[_0xf2eb('0x51')](handleError(_0x58a951,null));};exports[_0xf2eb('0x63')]=function(_0x49fc40,_0x252872,_0x18ebcc){var _0x57345a={};var _0x1d535b={};var _0x447435;var _0x353037;return db[_0xf2eb('0x45')]['findOne']({'where':{'id':_0x49fc40[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x252872,null))[_0xf2eb('0x24')](function(_0x3c2aba){if(_0x3c2aba){_0x447435=_0x3c2aba;_0x1d535b['model']=_['keys'](db['Team'][_0xf2eb('0x33')]);_0x1d535b[_0xf2eb('0x36')]=_[_0xf2eb('0x47')](_0x49fc40[_0xf2eb('0x36')]);_0x1d535b[_0xf2eb('0x37')]=_[_0xf2eb('0x38')](_0x1d535b[_0xf2eb('0x35')],_0x1d535b[_0xf2eb('0x36')]);_0x57345a[_0xf2eb('0x39')]=_[_0xf2eb('0x38')](_0x1d535b['model'],qs[_0xf2eb('0x3a')](_0x49fc40[_0xf2eb('0x36')]['fields']));_0x57345a[_0xf2eb('0x39')]=_0x57345a['attributes']['length']?_0x57345a[_0xf2eb('0x39')]:_0x1d535b[_0xf2eb('0x35')];_0x57345a['order']=qs[_0xf2eb('0x57')](_0x49fc40[_0xf2eb('0x36')][_0xf2eb('0x57')]);_0x57345a['where']=qs[_0xf2eb('0x37')](_['pick'](_0x49fc40[_0xf2eb('0x36')],_0x1d535b['filters']));if(_0x49fc40['query'][_0xf2eb('0x3f')]){_0x57345a[_0xf2eb('0x40')]=_[_0xf2eb('0x41')](_0x57345a[_0xf2eb('0x40')],{'$or':_['map'](_0x57345a[_0xf2eb('0x39')],function(_0xb1b96d){var _0x141af7={};_0x141af7[_0xb1b96d]={'$like':'%'+_0x49fc40['query'][_0xf2eb('0x3f')]+'%'};return _0x141af7;})});}_0x57345a=_['merge']({},_0x57345a,_0x49fc40[_0xf2eb('0x48')]);return _0x447435['getTeams'](_0x57345a);}})[_0xf2eb('0x24')](function(_0x1a2b94){if(_0x1a2b94){_0x353037=_0x1a2b94[_0xf2eb('0x3b')];if(!_0x49fc40[_0xf2eb('0x36')]['hasOwnProperty'](_0xf2eb('0x3d'))){_0x57345a['limit']=qs[_0xf2eb('0x1d')](_0x49fc40[_0xf2eb('0x36')]['limit']);_0x57345a[_0xf2eb('0x1a')]=qs[_0xf2eb('0x1a')](_0x49fc40[_0xf2eb('0x36')]['offset']);}return _0x447435['getTeams'](_0x57345a);}})[_0xf2eb('0x24')](function(_0x5f243a){if(_0x5f243a){return _0x5f243a?{'count':_0x353037,'rows':_0x5f243a}:null;}})[_0xf2eb('0x24')](respondWithResult(_0x252872,null))[_0xf2eb('0x51')](handleError(_0x252872,null));};exports['addTeams']=function(_0x31fba4,_0x2a983b,_0xfc446b){var _0x2c5dbe=_0x31fba4[_0xf2eb('0x4a')]['teams'];var _0x485db0=_[_0xf2eb('0x2b')](_0x2c5dbe,'id');return db[_0xf2eb('0x64')][_0xf2eb('0x5d')]({'where':{'id':_0x485db0},'attributes':['id'],'include':[{'model':db[_0xf2eb('0x65')],'as':_0xf2eb('0x66'),'attributes':['id','name',_0xf2eb('0x67'),_0xf2eb('0x68'),_0xf2eb('0x69')],'raw':!![]}]})[_0xf2eb('0x24')](function(_0x4a0846){if(_0x4a0846){var _0x34e749=_[_0xf2eb('0x6a')](_0x4a0846,function(_0x559f84){var _0xd2abe3=_0x559f84['get']({'plain':!![]});_0xd2abe3['Agents'][_0xf2eb('0x6b')](function(_0x5b6d35){_0x5b6d35[_0xf2eb('0x6c')]=_[_0xf2eb('0x4d')](_0x2c5dbe,{'id':_0xd2abe3['id']})[_0xf2eb('0x6c')];});return _0xd2abe3[_0xf2eb('0x66')];});return db[_0xf2eb('0x45')][_0xf2eb('0x4d')]({'where':{'id':_0x31fba4[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](function(_0x39f5c6){return db[_0xf2eb('0x6d')][_0xf2eb('0x6e')](function(_0x3626db){return _0x39f5c6[_0xf2eb('0x6f')](_0x485db0,{'transaction':_0x3626db})['then'](function(){return BPromise[_0xf2eb('0x70')](_0x2c5dbe,function(_0x123c4c){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x123c4c['id'],'VoiceQueueId':_0x31fba4[_0xf2eb('0x46')]['id'],'penalty':_0x123c4c[_0xf2eb('0x6c')]},{'transaction':_0x3626db});});})['then'](function(){return BPromise['each'](_0x34e749,function(_0x25e2c8){return db['UserVoiceQueue'][_0xf2eb('0x71')]({'where':{'UserId':_0x25e2c8['id'],'VoiceQueueId':_0x31fba4[_0xf2eb('0x46')]['id']},'defaults':{'penalty':_0x25e2c8[_0xf2eb('0x6c')]},'transaction':_0x3626db});});})[_0xf2eb('0x24')](function(){return BPromise[_0xf2eb('0x70')](_['filter'](_0x34e749,{'online':!![]}),function(_0x3968c1){return db[_0xf2eb('0x72')][_0xf2eb('0x73')]({'membername':_0x3968c1[_0xf2eb('0x2f')],'UserId':_0x3968c1['id'],'queue_name':_0x39f5c6[_0xf2eb('0x2f')],'VoiceQueueId':_0x39f5c6['id'],'interface':_['isNil'](_0x3968c1[_0xf2eb('0x69')])?util[_0xf2eb('0x74')](_0xf2eb('0x75'),_0x3968c1[_0xf2eb('0x2f')]):_0x3968c1[_0xf2eb('0x69')],'paused':_0x3968c1[_0xf2eb('0x68')]||![],'penalty':_0x3968c1['penalty']},{'transaction':_0x3626db});});})[_0xf2eb('0x24')](function(){_0x34e749[_0xf2eb('0x6b')](function(_0x4b752c){socket[_0xf2eb('0x76')](_0xf2eb('0x77'),{'UserId':_0x4b752c['id'],'VoiceQueueId':_0x39f5c6['id']});});});});});}})['then'](respondWithStatusCode(_0x2a983b,null))[_0xf2eb('0x51')](handleError(_0x2a983b,null));};exports['removeTeams']=function(_0x225835,_0x1c786f,_0x540756){return db[_0xf2eb('0x64')][_0xf2eb('0x5d')]({'where':{'id':_0x225835[_0xf2eb('0x36')][_0xf2eb('0x78')]},'attributes':['id'],'include':[{'model':db[_0xf2eb('0x65')],'as':_0xf2eb('0x66'),'attributes':['id'],'raw':!![]}]})[_0xf2eb('0x24')](handleEntityNotFound(_0x1c786f,null))[_0xf2eb('0x24')](function(_0x1e8f5a){var _0x2e371f=_[_0xf2eb('0x2b')](_0x1e8f5a,'id');var _0x30e814=[];var _0x255511=[];var _0x57ba72=squel['select']();_0x57ba72[_0xf2eb('0x79')](_0xf2eb('0x7a'))[_0xf2eb('0x7b')](_0xf2eb('0x7c'),'tq')[_0xf2eb('0x7d')](_0xf2eb('0x7e'),'ut',_0xf2eb('0x7f'))[_0xf2eb('0x40')](_0xf2eb('0x80'),_0x225835[_0xf2eb('0x46')]['id']);for(var _0x56b674=0x0;_0x56b674<_0x1e8f5a[_0xf2eb('0x3b')];_0x56b674+=0x1){let _0x42a08f=_0x1e8f5a[_0x56b674];for(var _0xa40cd3=0x0;_0xa40cd3<_0x42a08f[_0xf2eb('0x66')][_0xf2eb('0x3b')];_0xa40cd3+=0x1){let _0x533f64=_0x42a08f[_0xf2eb('0x66')][_0xa40cd3];var _0x28c4d6=_0x57ba72[_0xf2eb('0x81')]();_0x28c4d6[_0xf2eb('0x40')](_0xf2eb('0x82'),_0x533f64['id']);_0x255511[_0xf2eb('0x83')](db[_0xf2eb('0x6d')][_0xf2eb('0x36')](_0x28c4d6[_0xf2eb('0x84')](),{'type':db[_0xf2eb('0x6d')][_0xf2eb('0x85')][_0xf2eb('0x86')]})[_0xf2eb('0x24')](function(_0x536cf1){if(_0x536cf1[_0xf2eb('0x3b')]===0x1){return _0x533f64['id'];}else{var _0x5aa63e=_['every'](_[_0xf2eb('0x2b')](_0x536cf1,_0xf2eb('0x87')),function(_0x22b908){return _[_0xf2eb('0x2d')](_0x2e371f,_0x22b908);});if(_0x5aa63e){return _0x533f64['id'];}}}));}}return BPromise['all'](_0x255511)[_0xf2eb('0x24')](function(_0x4360b3){_0x30e814=_(_0x30e814)[_0xf2eb('0x88')](_0x4360b3)[_0xf2eb('0x89')]()[_0xf2eb('0x2c')]();return db[_0xf2eb('0x45')][_0xf2eb('0x4d')]({'where':{'id':_0x225835[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](function(_0xd7efd6){return db['sequelize'][_0xf2eb('0x6e')](function(_0x4c4c62){return _0xd7efd6[_0xf2eb('0x8a')](_0x225835[_0xf2eb('0x36')][_0xf2eb('0x78')],{'transaction':_0x4c4c62})[_0xf2eb('0x24')](function(){if(!_[_0xf2eb('0x8b')](_0x30e814)){return _0xd7efd6[_0xf2eb('0x8c')](_0x30e814,{'transaction':_0x4c4c62})['then'](function(){return db[_0xf2eb('0x72')][_0xf2eb('0x25')]({'where':{'VoiceQueueId':_0x225835[_0xf2eb('0x46')]['id'],'UserId':_0x30e814},'transaction':_0x4c4c62});});}})[_0xf2eb('0x24')](function(){_0x30e814[_0xf2eb('0x6b')](function(_0xd5aa94){socket[_0xf2eb('0x76')](_0xf2eb('0x8d'),{'UserId':_0xd5aa94,'VoiceQueueId':_0xd7efd6['id']});});});});});});})[_0xf2eb('0x24')](respondWithStatusCode(_0x1c786f,null))[_0xf2eb('0x51')](handleError(_0x1c786f,null));};exports[_0xf2eb('0x8e')]=function(_0x1f47ca,_0x3eb5e1,_0x340899){var _0xad16fe,_0x508ed9;return db['VoiceQueue'][_0xf2eb('0x4d')]({'where':{'id':_0x1f47ca[_0xf2eb('0x46')]['id']}})['then'](handleEntityNotFound(_0x3eb5e1,null))[_0xf2eb('0x24')](function(_0x2645c0){if(_0x2645c0){_0x508ed9=_0x2645c0;return _0x2645c0[_0xf2eb('0x8e')](_0x1f47ca[_0xf2eb('0x4a')][_0xf2eb('0x78')],_[_0xf2eb('0x52')](_0x1f47ca[_0xf2eb('0x4a')],[_0xf2eb('0x78'),'id'])||{})[_0xf2eb('0x8f')](function(_0x5456ce){for(var _0x3598ea=0x0;_0x3598ea<_0x1f47ca['body'][_0xf2eb('0x78')]['length'];_0x3598ea+=0x1){socket[_0xf2eb('0x76')](_0xf2eb('0x77'),{'UserId':Number(_0x1f47ca[_0xf2eb('0x4a')][_0xf2eb('0x78')][_0x3598ea]),'VoiceQueueId':Number(_0x1f47ca[_0xf2eb('0x46')]['id'])});}return _0x5456ce;});}})['then'](function(_0x2a16aa){_0xad16fe=_0x2a16aa||[];if(_0x508ed9){return db['User'][_0xf2eb('0x5d')]({'where':{'id':_0x1f47ca[_0xf2eb('0x4a')][_0xf2eb('0x78')]},'attributes':['id',_0xf2eb('0x2f'),_0xf2eb('0x67'),_0xf2eb('0x68'),'interface'],'raw':!![]});}})['then'](function(_0x360f48){if(!_[_0xf2eb('0x8b')](_0x360f48)){var _0x443e6c=[];for(var _0x27b811=0x0;_0x27b811<_0x360f48[_0xf2eb('0x3b')];_0x27b811++){if(_0x360f48[_0x27b811][_0xf2eb('0x67')]){_0x443e6c[_0xf2eb('0x83')](db[_0xf2eb('0x72')][_0xf2eb('0x73')]({'membername':_0x360f48[_0x27b811]['name'],'UserId':_0x360f48[_0x27b811]['id'],'queue_name':_0x508ed9[_0xf2eb('0x2f')],'VoiceQueueId':_0x508ed9['id'],'interface':_[_0xf2eb('0x90')](_0x360f48[_0x27b811][_0xf2eb('0x69')])?util[_0xf2eb('0x74')]('SIP/%s',_0x360f48[_0x27b811][_0xf2eb('0x2f')]):_0x360f48[_0x27b811]['interface'],'paused':_0x360f48[_0x27b811][_0xf2eb('0x68')]||![],'penalty':_0x1f47ca[_0xf2eb('0x4a')]['penalty']||0x0}));}}return BPromise[_0xf2eb('0x91')](_0x443e6c);}})[_0xf2eb('0x24')](function(){return _0xad16fe;})[_0xf2eb('0x24')](respondWithResult(_0x3eb5e1,null))['catch'](handleError(_0x3eb5e1,null));};exports[_0xf2eb('0x8c')]=function(_0x444e18,_0x46c17b,_0x2e039d){return db[_0xf2eb('0x45')][_0xf2eb('0x4d')]({'where':{'id':_0x444e18[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x46c17b,null))[_0xf2eb('0x24')](function(_0x3dd661){if(_0x3dd661){return _0x3dd661[_0xf2eb('0x8c')](_0x444e18['query'][_0xf2eb('0x78')])[_0xf2eb('0x24')](function(){if(_[_0xf2eb('0x92')](_0x444e18['query'][_0xf2eb('0x78')])){for(var _0x936e16=0x0;_0x936e16<_0x444e18[_0xf2eb('0x36')][_0xf2eb('0x78')]['length'];_0x936e16+=0x1){socket[_0xf2eb('0x76')](_0xf2eb('0x8d'),{'UserId':Number(_0x444e18[_0xf2eb('0x36')][_0xf2eb('0x78')][_0x936e16]),'VoiceQueueId':Number(_0x444e18[_0xf2eb('0x46')]['id'])});}}else{socket[_0xf2eb('0x76')](_0xf2eb('0x8d'),{'UserId':Number(_0x444e18[_0xf2eb('0x36')][_0xf2eb('0x78')]),'VoiceQueueId':Number(_0x444e18[_0xf2eb('0x46')]['id'])});}});}})[_0xf2eb('0x24')](function(_0x3350d1){return db[_0xf2eb('0x72')][_0xf2eb('0x25')]({'where':{'VoiceQueueId':_0x444e18[_0xf2eb('0x46')]['id'],'UserId':_0x444e18[_0xf2eb('0x36')][_0xf2eb('0x78')]}})[_0xf2eb('0x24')](function(){return _0x3350d1;});})[_0xf2eb('0x24')](respondWithStatusCode(_0x46c17b,null))['catch'](handleError(_0x46c17b,null));};exports['getAgents']=function(_0x416b0a,_0x23ecb2,_0x4cdc8e){var _0x33fa67={};var _0x727a1d={};var _0x2a458a;var _0x709a33;return db[_0xf2eb('0x45')][_0xf2eb('0x56')]({'where':{'id':_0x416b0a['params']['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x23ecb2,null))[_0xf2eb('0x24')](function(_0x199420){if(_0x199420){_0x2a458a=_0x199420;_0x727a1d['model']=_['keys'](db[_0xf2eb('0x65')][_0xf2eb('0x33')]);_0x727a1d['query']=_['keys'](_0x416b0a[_0xf2eb('0x36')]);_0x727a1d[_0xf2eb('0x37')]=_['intersection'](_0x727a1d['model'],_0x727a1d[_0xf2eb('0x36')]);_0x33fa67['attributes']=_[_0xf2eb('0x38')](_0x727a1d[_0xf2eb('0x35')],qs['fields'](_0x416b0a['query'][_0xf2eb('0x3a')]));_0x33fa67['attributes']=_0x33fa67[_0xf2eb('0x39')]['length']?_0x33fa67[_0xf2eb('0x39')]:_0x727a1d['model'];_0x33fa67[_0xf2eb('0x5c')]=qs[_0xf2eb('0x57')](_0x416b0a[_0xf2eb('0x36')][_0xf2eb('0x57')]);_0x33fa67[_0xf2eb('0x40')]=qs[_0xf2eb('0x37')](_[_0xf2eb('0x3e')](_0x416b0a[_0xf2eb('0x36')],_0x727a1d['filters']));if(_0x416b0a[_0xf2eb('0x36')][_0xf2eb('0x3f')]){_0x33fa67[_0xf2eb('0x40')]=_['merge'](_0x33fa67['where'],{'$or':_[_0xf2eb('0x2b')](_0x33fa67[_0xf2eb('0x39')],function(_0x55fd41){var _0x44cb74={};_0x44cb74[_0x55fd41]={'$like':'%'+_0x416b0a[_0xf2eb('0x36')][_0xf2eb('0x3f')]+'%'};return _0x44cb74;})});}_0x33fa67=_[_0xf2eb('0x41')]({},_0x33fa67,_0x416b0a[_0xf2eb('0x48')]);return _0x2a458a['getAgents'](_0x33fa67);}})[_0xf2eb('0x24')](function(_0x193ae9){if(_0x193ae9){_0x709a33=_0x193ae9[_0xf2eb('0x3b')];if(!_0x416b0a[_0xf2eb('0x36')][_0xf2eb('0x3c')](_0xf2eb('0x3d'))){_0x33fa67[_0xf2eb('0x1d')]=qs[_0xf2eb('0x1d')](_0x416b0a['query']['limit']);_0x33fa67['offset']=qs['offset'](_0x416b0a[_0xf2eb('0x36')][_0xf2eb('0x1a')]);}return _0x2a458a['getAgents'](_0x33fa67);}})[_0xf2eb('0x24')](function(_0x3e5933){if(_0x3e5933){return _0x3e5933?{'count':_0x709a33,'rows':_0x3e5933}:null;}})[_0xf2eb('0x24')](respondWithResult(_0x23ecb2,null))[_0xf2eb('0x51')](handleError(_0x23ecb2,null));};exports[_0xf2eb('0x93')]=function(_0x45c0d7,_0x3bd59b,_0x2a6acc){var _0x2fe0d7={};var _0x17769e={};var _0x502c27;var _0x54c22f;return db[_0xf2eb('0x45')][_0xf2eb('0x56')]({'where':{'id':_0x45c0d7[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x3bd59b,null))[_0xf2eb('0x24')](function(_0x3719b6){if(_0x3719b6){_0x502c27=_0x3719b6;_0x17769e[_0xf2eb('0x35')]=_[_0xf2eb('0x47')](db[_0xf2eb('0x72')][_0xf2eb('0x33')]);_0x17769e['query']=_[_0xf2eb('0x47')](_0x45c0d7['query']);_0x17769e[_0xf2eb('0x37')]=_[_0xf2eb('0x38')](_0x17769e[_0xf2eb('0x35')],_0x17769e[_0xf2eb('0x36')]);_0x2fe0d7[_0xf2eb('0x39')]=_[_0xf2eb('0x38')](_0x17769e[_0xf2eb('0x35')],qs[_0xf2eb('0x3a')](_0x45c0d7[_0xf2eb('0x36')][_0xf2eb('0x3a')]));_0x2fe0d7[_0xf2eb('0x39')]=_0x2fe0d7['attributes']['length']?_0x2fe0d7['attributes']:_0x17769e[_0xf2eb('0x35')];_0x2fe0d7[_0xf2eb('0x5c')]=qs[_0xf2eb('0x57')](_0x45c0d7[_0xf2eb('0x36')]['sort']);_0x2fe0d7[_0xf2eb('0x40')]=qs[_0xf2eb('0x37')](_[_0xf2eb('0x3e')](_0x45c0d7['query'],_0x17769e[_0xf2eb('0x37')]));if(_0x45c0d7['query'][_0xf2eb('0x3f')]){_0x2fe0d7[_0xf2eb('0x40')]=_[_0xf2eb('0x41')](_0x2fe0d7[_0xf2eb('0x40')],{'$or':_[_0xf2eb('0x2b')](_0x2fe0d7['attributes'],function(_0xadb126){var _0xa05917={};_0xa05917[_0xadb126]={'$like':'%'+_0x45c0d7['query']['filter']+'%'};return _0xa05917;})});}_0x2fe0d7=_[_0xf2eb('0x41')]({},_0x2fe0d7,_0x45c0d7[_0xf2eb('0x48')]);return _0x502c27['getMembers'](_0x2fe0d7);}})['then'](function(_0xf9d8ce){if(_0xf9d8ce){_0x54c22f=_0xf9d8ce[_0xf2eb('0x3b')];if(!_0x45c0d7[_0xf2eb('0x36')]['hasOwnProperty'](_0xf2eb('0x3d'))){_0x2fe0d7[_0xf2eb('0x1d')]=qs[_0xf2eb('0x1d')](_0x45c0d7['query'][_0xf2eb('0x1d')]);_0x2fe0d7[_0xf2eb('0x1a')]=qs[_0xf2eb('0x1a')](_0x45c0d7[_0xf2eb('0x36')][_0xf2eb('0x1a')]);}return _0x502c27['getMembers'](_0x2fe0d7);}})[_0xf2eb('0x24')](function(_0x420ac2){return _0x420ac2?{'count':_0x54c22f,'rows':_0x420ac2}:null;})['then'](respondWithResult(_0x3bd59b,null))[_0xf2eb('0x51')](handleError(_0x3bd59b,null));};exports[_0xf2eb('0x94')]=function(_0x2201f1,_0x4e9512,_0x3b98d6){var _0x2b9ee3={};var _0x19b8c7={};var _0x424086;var _0x2f340f;return db['VoiceQueue'][_0xf2eb('0x56')]({'where':{'id':_0x2201f1[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x4e9512,null))['then'](function(_0x208142){if(_0x208142){_0x424086=_0x208142;_0x19b8c7[_0xf2eb('0x35')]=_[_0xf2eb('0x47')](db[_0xf2eb('0x95')][_0xf2eb('0x33')]);_0x19b8c7['query']=_[_0xf2eb('0x47')](_0x2201f1[_0xf2eb('0x36')]);_0x19b8c7['filters']=_[_0xf2eb('0x38')](_0x19b8c7[_0xf2eb('0x35')],_0x19b8c7[_0xf2eb('0x36')]);_0x2b9ee3[_0xf2eb('0x39')]=_[_0xf2eb('0x38')](_0x19b8c7['model'],qs[_0xf2eb('0x3a')](_0x2201f1['query'][_0xf2eb('0x3a')]));_0x2b9ee3[_0xf2eb('0x39')]=_0x2b9ee3['attributes'][_0xf2eb('0x3b')]?_0x2b9ee3[_0xf2eb('0x39')]:_0x19b8c7[_0xf2eb('0x35')];_0x2b9ee3[_0xf2eb('0x5c')]=qs[_0xf2eb('0x57')](_0x2201f1[_0xf2eb('0x36')][_0xf2eb('0x57')]);_0x2b9ee3[_0xf2eb('0x40')]=qs[_0xf2eb('0x37')](_['pick'](_0x2201f1[_0xf2eb('0x36')],_0x19b8c7[_0xf2eb('0x37')]));if(_0x2201f1[_0xf2eb('0x36')]['filter']){_0x2b9ee3[_0xf2eb('0x40')]=_['merge'](_0x2b9ee3[_0xf2eb('0x40')],{'$or':_['map'](_0x2b9ee3['attributes'],function(_0x50cf22){var _0x581cb7={};_0x581cb7[_0x50cf22]={'$like':'%'+_0x2201f1[_0xf2eb('0x36')][_0xf2eb('0x3f')]+'%'};return _0x581cb7;})});}_0x2b9ee3=_[_0xf2eb('0x41')]({},_0x2b9ee3,_0x2201f1[_0xf2eb('0x48')]);return _0x424086[_0xf2eb('0x94')](_0x2b9ee3);}})[_0xf2eb('0x24')](function(_0x15100c){if(_0x15100c){_0x2f340f=_0x15100c[_0xf2eb('0x3b')];if(!_0x2201f1[_0xf2eb('0x36')]['hasOwnProperty']('nolimit')){_0x2b9ee3[_0xf2eb('0x1d')]=qs['limit'](_0x2201f1[_0xf2eb('0x36')][_0xf2eb('0x1d')]);_0x2b9ee3[_0xf2eb('0x1a')]=qs['offset'](_0x2201f1[_0xf2eb('0x36')]['offset']);}return _0x424086[_0xf2eb('0x94')](_0x2b9ee3);}})[_0xf2eb('0x24')](function(_0x304dea){if(_0x304dea){return _0x304dea?{'count':_0x2f340f,'rows':_0x304dea}:null;}})[_0xf2eb('0x24')](respondWithResult(_0x4e9512,null))[_0xf2eb('0x51')](handleError(_0x4e9512,null));};exports[_0xf2eb('0x96')]=function(_0x4d4b2d,_0x10a5f2,_0x1e1994){var _0x14fc47,_0x48ab6a;return db[_0xf2eb('0x45')][_0xf2eb('0x4d')]({'where':{'id':_0x4d4b2d[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x10a5f2,null))[_0xf2eb('0x24')](function(_0x47a5f8){if(_0x47a5f8){_0x48ab6a=_0x47a5f8;return _0x47a5f8[_0xf2eb('0x96')](_0x4d4b2d[_0xf2eb('0x4a')][_0xf2eb('0x78')],_[_0xf2eb('0x52')](_0x4d4b2d[_0xf2eb('0x4a')],['ids','id'])||{});}return null;})[_0xf2eb('0x8f')](function(_0x5df0b7){var _0x1a8c15;_0x14fc47=_0x5df0b7||[];var _0x6a7509=[];if(_0x5df0b7){for(var _0x16fd79=0x0;_0x16fd79<_0x5df0b7['length'];_0x16fd79+=0x1){var _0xc5dd6d=_0x5df0b7[_0x16fd79][_0xf2eb('0x26')]({'plain':!![]});_0x48ab6a['dialCheckDuplicateType']=_0x4d4b2d[_0xf2eb('0x4a')]['dialCheckDuplicateType']?_0x4d4b2d[_0xf2eb('0x4a')]['dialCheckDuplicateType']:_0x48ab6a[_0xf2eb('0x97')];switch(_0x48ab6a[_0xf2eb('0x97')]){case'always':_0x1a8c15=squel[_0xf2eb('0x98')]()['into'](_0xf2eb('0x99'))[_0xf2eb('0x9a')]([_0xf2eb('0x9b'),_0xf2eb('0x9c'),_0xf2eb('0x9d'),'ListId',_0xf2eb('0x58'),'createdAt',_0xf2eb('0x54')],squel['select']()['field'](_0xf2eb('0x9b'),_0xf2eb('0x9b'))[_0xf2eb('0x79')](_0xf2eb('0x9e'),_0xf2eb('0x9c'))[_0xf2eb('0x79')]('id',_0xf2eb('0x9d'))[_0xf2eb('0x79')](_0xc5dd6d[_0xf2eb('0x9f')][_0xf2eb('0x84')](),_0xf2eb('0xa0'))[_0xf2eb('0x79')](_0x4d4b2d[_0xf2eb('0x46')]['id'][_0xf2eb('0x84')](),_0xf2eb('0x58'))[_0xf2eb('0x79')](_0xf2eb('0x9e'),_0xf2eb('0x53'))[_0xf2eb('0x79')]('NOW()',_0xf2eb('0x54'))['from'](_0xf2eb('0xa1'))[_0xf2eb('0x40')](_0xf2eb('0xa2'))[_0xf2eb('0x40')]('ListId\x20=\x20?',_0xc5dd6d[_0xf2eb('0x9f')]['toString']())['where'](_0xf2eb('0xa3'))['where'](_0xf2eb('0xa4'),squel['select']()[_0xf2eb('0x79')](_0xf2eb('0xa5'))[_0xf2eb('0x7b')](_0xf2eb('0xa6'))['where'](_0xf2eb('0x80'),_0x4d4b2d[_0xf2eb('0x46')]['id']['toString']()))[_0xf2eb('0x40')](_0xf2eb('0xa4'),squel['select']()[_0xf2eb('0x79')](_0xf2eb('0xa7'))[_0xf2eb('0x7b')](_0xf2eb('0x99'))[_0xf2eb('0x40')](_0xf2eb('0x80'),_0x4d4b2d[_0xf2eb('0x46')]['id'][_0xf2eb('0x84')]())))[_0xf2eb('0x84')]();break;case _0xf2eb('0xa8'):_0x1a8c15=squel[_0xf2eb('0x98')]()['into']('cm_hopper')[_0xf2eb('0x9a')]([_0xf2eb('0x9b'),'scheduledAt',_0xf2eb('0x9d'),_0xf2eb('0xa0'),_0xf2eb('0x58'),_0xf2eb('0x53'),_0xf2eb('0x54')],squel[_0xf2eb('0xa9')]()['field']('phone',_0xf2eb('0x9b'))['field'](_0xf2eb('0x9e'),_0xf2eb('0x9c'))[_0xf2eb('0x79')]('id',_0xf2eb('0x9d'))['field'](_0xc5dd6d['CmListId'][_0xf2eb('0x84')](),'ListId')[_0xf2eb('0x79')](_0x4d4b2d[_0xf2eb('0x46')]['id'][_0xf2eb('0x84')](),'VoiceQueueId')[_0xf2eb('0x79')](_0xf2eb('0x9e'),_0xf2eb('0x53'))[_0xf2eb('0x79')](_0xf2eb('0x9e'),'updatedAt')[_0xf2eb('0x7b')](_0xf2eb('0xa1'))[_0xf2eb('0x40')](_0xf2eb('0xa2'))[_0xf2eb('0x40')](_0xf2eb('0xaa'),_0xc5dd6d[_0xf2eb('0x9f')][_0xf2eb('0x84')]())[_0xf2eb('0x40')](_0xf2eb('0xa3'))[_0xf2eb('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf2eb('0xa9')]()[_0xf2eb('0x79')]('COALESCE(phone,\x27\x27)')[_0xf2eb('0x7b')](_0xf2eb('0x99'))[_0xf2eb('0x40')](_0xf2eb('0x80'),_0x4d4b2d[_0xf2eb('0x46')]['id'][_0xf2eb('0x84')]())))[_0xf2eb('0x84')]();break;default:_0x1a8c15=squel[_0xf2eb('0x98')]()[_0xf2eb('0xab')]('cm_hopper')[_0xf2eb('0x9a')]([_0xf2eb('0x9b'),'scheduledAt',_0xf2eb('0x9d'),'ListId',_0xf2eb('0x58'),_0xf2eb('0x53'),'updatedAt'],squel[_0xf2eb('0xa9')]()[_0xf2eb('0x79')]('phone',_0xf2eb('0x9b'))[_0xf2eb('0x79')](_0xf2eb('0x9e'),'scheduledAt')[_0xf2eb('0x79')]('id',_0xf2eb('0x9d'))['field'](_0xc5dd6d[_0xf2eb('0x9f')][_0xf2eb('0x84')](),_0xf2eb('0xa0'))[_0xf2eb('0x79')](_0x4d4b2d[_0xf2eb('0x46')]['id'][_0xf2eb('0x84')](),'VoiceQueueId')[_0xf2eb('0x79')](_0xf2eb('0x9e'),_0xf2eb('0x53'))[_0xf2eb('0x79')](_0xf2eb('0x9e'),_0xf2eb('0x54'))[_0xf2eb('0x7b')](_0xf2eb('0xa1'))[_0xf2eb('0x40')](_0xf2eb('0xa2'))[_0xf2eb('0x40')]('ListId\x20=\x20?',_0xc5dd6d[_0xf2eb('0x9f')][_0xf2eb('0x84')]())[_0xf2eb('0x40')](_0xf2eb('0xa3')))[_0xf2eb('0x84')]();}_0x6a7509[_0xf2eb('0x83')](db[_0xf2eb('0x6d')][_0xf2eb('0x36')](_0x1a8c15));}return BPromise[_0xf2eb('0x91')](_0x6a7509);}})[_0xf2eb('0x24')](function(){return _0x14fc47;})[_0xf2eb('0x24')](respondWithResult(_0x10a5f2,null))[_0xf2eb('0x51')](handleError(_0x10a5f2,null));};exports[_0xf2eb('0xac')]=function(_0xa900ab,_0x551b14,_0xad834){return db[_0xf2eb('0x45')][_0xf2eb('0x4d')]({'where':{'id':_0xa900ab['params']['id']}})['then'](handleEntityNotFound(_0x551b14,null))['then'](function(_0x45e492){if(_0x45e492){return _0x45e492[_0xf2eb('0xac')](_0xa900ab[_0xf2eb('0x36')][_0xf2eb('0x78')]);}})[_0xf2eb('0x24')](function(_0x48b7d8){if(_0x48b7d8){return db['CmHopper']['destroy']({'where':{'ListId':_0xa900ab[_0xf2eb('0x36')][_0xf2eb('0x78')],'VoiceQueueId':_0xa900ab[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](function(){return _0x48b7d8;});}})['then'](respondWithStatusCode(_0x551b14,null))['catch'](handleError(_0x551b14,null));};exports[_0xf2eb('0xad')]=function(_0x1e489b,_0x164c46,_0x48c2ee){var _0x19b38f={};var _0x490bb1={};var _0x324411;var _0x1fa147;return db[_0xf2eb('0x45')]['findOne']({'where':{'id':_0x1e489b[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x164c46,null))[_0xf2eb('0x24')](function(_0xe010ae){if(_0xe010ae){_0x324411=_0xe010ae;_0x490bb1[_0xf2eb('0x35')]=_[_0xf2eb('0x47')](db[_0xf2eb('0x95')][_0xf2eb('0x33')]);_0x490bb1[_0xf2eb('0x36')]=_[_0xf2eb('0x47')](_0x1e489b[_0xf2eb('0x36')]);_0x490bb1[_0xf2eb('0x37')]=_[_0xf2eb('0x38')](_0x490bb1[_0xf2eb('0x35')],_0x490bb1[_0xf2eb('0x36')]);_0x19b38f[_0xf2eb('0x39')]=_[_0xf2eb('0x38')](_0x490bb1[_0xf2eb('0x35')],qs[_0xf2eb('0x3a')](_0x1e489b['query'][_0xf2eb('0x3a')]));_0x19b38f[_0xf2eb('0x39')]=_0x19b38f[_0xf2eb('0x39')][_0xf2eb('0x3b')]?_0x19b38f['attributes']:_0x490bb1['model'];_0x19b38f['order']=qs[_0xf2eb('0x57')](_0x1e489b[_0xf2eb('0x36')]['sort']);_0x19b38f[_0xf2eb('0x40')]=qs[_0xf2eb('0x37')](_['pick'](_0x1e489b[_0xf2eb('0x36')],_0x490bb1[_0xf2eb('0x37')]));if(_0x1e489b[_0xf2eb('0x36')][_0xf2eb('0x3f')]){_0x19b38f['where']=_[_0xf2eb('0x41')](_0x19b38f[_0xf2eb('0x40')],{'$or':_[_0xf2eb('0x2b')](_0x19b38f[_0xf2eb('0x39')],function(_0x37d3ac){var _0x5dffe3={};_0x5dffe3[_0x37d3ac]={'$like':'%'+_0x1e489b[_0xf2eb('0x36')][_0xf2eb('0x3f')]+'%'};return _0x5dffe3;})});}_0x19b38f=_[_0xf2eb('0x41')]({},_0x19b38f,_0x1e489b[_0xf2eb('0x48')]);return _0x324411[_0xf2eb('0xad')](_0x19b38f);}})[_0xf2eb('0x24')](function(_0x525da2){if(_0x525da2){_0x1fa147=_0x525da2[_0xf2eb('0x3b')];if(!_0x1e489b[_0xf2eb('0x36')][_0xf2eb('0x3c')]('nolimit')){_0x19b38f[_0xf2eb('0x1d')]=qs['limit'](_0x1e489b[_0xf2eb('0x36')][_0xf2eb('0x1d')]);_0x19b38f[_0xf2eb('0x1a')]=qs['offset'](_0x1e489b['query'][_0xf2eb('0x1a')]);}return _0x324411[_0xf2eb('0xad')](_0x19b38f);}})[_0xf2eb('0x24')](function(_0x4d2d0d){if(_0x4d2d0d){return _0x4d2d0d?{'count':_0x1fa147,'rows':_0x4d2d0d}:null;}})[_0xf2eb('0x24')](respondWithResult(_0x164c46,null))[_0xf2eb('0x51')](handleError(_0x164c46,null));};exports['addBlackLists']=function(_0x5c0f2c,_0x590172,_0x357b46){var _0xd63e45,_0x200cbc;return db[_0xf2eb('0x45')][_0xf2eb('0x4d')]({'where':{'id':_0x5c0f2c[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x590172,null))[_0xf2eb('0x24')](function(_0x1f0618){if(_0x1f0618){_0x200cbc=_0x1f0618;return _0x1f0618['addBlackLists'](_0x5c0f2c[_0xf2eb('0x4a')][_0xf2eb('0x78')],_[_0xf2eb('0x52')](_0x5c0f2c[_0xf2eb('0x4a')],['ids','id'])||{});}return null;})[_0xf2eb('0x8f')](function(_0x2831c3){var _0x26a322;_0xd63e45=_0x2831c3||[];var _0x1d8d9e=[];if(_0x2831c3){for(var _0x2deda8=0x0;_0x2deda8<_0x2831c3[_0xf2eb('0x3b')];_0x2deda8+=0x1){var _0x28f300=_0x2831c3[_0x2deda8][_0xf2eb('0x26')]({'plain':!![]});_0x26a322=squel['insert']()['into'](_0xf2eb('0xae'))[_0xf2eb('0x9a')]([_0xf2eb('0x9b'),'ContactId',_0xf2eb('0xa0'),_0xf2eb('0x58'),'createdAt',_0xf2eb('0x54')],squel['select']()[_0xf2eb('0x79')](_0xf2eb('0x9b'),_0xf2eb('0x9b'))['field']('id',_0xf2eb('0x9d'))['field'](_0x28f300['CmListId'][_0xf2eb('0x84')](),_0xf2eb('0xa0'))[_0xf2eb('0x79')](_0x5c0f2c[_0xf2eb('0x46')]['id'][_0xf2eb('0x84')](),_0xf2eb('0x58'))[_0xf2eb('0x79')](_0xf2eb('0x9e'),_0xf2eb('0x53'))[_0xf2eb('0x79')](_0xf2eb('0x9e'),_0xf2eb('0x54'))[_0xf2eb('0x7b')]('cm_contacts')[_0xf2eb('0x40')]('deletedAt\x20IS\x20NULL')[_0xf2eb('0x40')](_0xf2eb('0xaa'),_0x28f300['CmListId'][_0xf2eb('0x84')]())[_0xf2eb('0x40')](_0xf2eb('0xa3')))['toString']();_0x1d8d9e[_0xf2eb('0x83')](db[_0xf2eb('0x6d')][_0xf2eb('0x36')](_0x26a322));}return BPromise[_0xf2eb('0x91')](_0x1d8d9e);}})['then'](function(){return _0xd63e45;})[_0xf2eb('0x24')](respondWithResult(_0x590172,null))['catch'](handleError(_0x590172,null));};exports[_0xf2eb('0xaf')]=function(_0x1ba838,_0x2c04a5,_0xfe73ac){return db['VoiceQueue'][_0xf2eb('0x4d')]({'where':{'id':_0x1ba838[_0xf2eb('0x46')]['id']}})[_0xf2eb('0x24')](handleEntityNotFound(_0x2c04a5,null))['then'](function(_0x4057de){if(_0x4057de){return _0x4057de[_0xf2eb('0xaf')](_0x1ba838['query']['ids']);}})[_0xf2eb('0x24')](function(_0x214c3b){if(_0x214c3b){return db[_0xf2eb('0x62')]['destroy']({'where':{'ListId':_0x1ba838[_0xf2eb('0x36')][_0xf2eb('0x78')],'VoiceQueueId':_0x1ba838['params']['id']}})[_0xf2eb('0x24')](function(){return _0x214c3b;});}})[_0xf2eb('0x24')](respondWithStatusCode(_0x2c04a5,null))[_0xf2eb('0x51')](handleError(_0x2c04a5,null));};
\ No newline at end of file
+var _0x00bb=['query','filters','intersection','attributes','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','QueueCampaigns','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getHoppers','hasOwnProperty','nolimit','sort','VoiceQueueId','CmHopper','includeAll','findAll','CmHopperHistory','order','pick','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','online','voicePause','interface','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueue','UserVoiceQueueRt','SIP/%s','emit','userVoiceQueue:save','ids','User','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','onlyIfOpen','push','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','then','destroy','get','inbound','outbound','filter','ignore','value','includes','type','find','name','UserProfileResource','error','stack','send','index','map','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','rows','catch','show','params','model','keys'];(function(_0x457b74,_0xecd07a){var _0x38e079=function(_0x405da9){while(--_0x405da9){_0x457b74['push'](_0x457b74['shift']());}};_0x38e079(++_0xecd07a);}(_0x00bb,0x1d8));var _0xb00b=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x00bb[_0x56482c];return _0x5aae7a;};'use strict';var moment=require(_0xb00b('0x0'));var BPromise=require(_0xb00b('0x1'));var util=require(_0xb00b('0x2'));var _=require('lodash');var squel=require(_0xb00b('0x3'));var Redis=require('ioredis');var qs=require(_0xb00b('0x4'));var logger=require(_0xb00b('0x5'))('api');var config=require(_0xb00b('0x6'));var db=require(_0xb00b('0x7'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xb00b('0x8'),'port':0x18eb});var socket=require(_0xb00b('0x9'))(new Redis(config[_0xb00b('0xa')]));require(_0xb00b('0xb'))[_0xb00b('0xc')](socket);function respondWithStatusCode(_0x3c36c5,_0x5b0c03){_0x5b0c03=_0x5b0c03||0xcc;return function(_0x51d12b){if(_0x51d12b){return _0x3c36c5[_0xb00b('0xd')](_0x5b0c03);}return _0x3c36c5[_0xb00b('0xe')](_0x5b0c03)[_0xb00b('0xf')]();};}function respondWithResult(_0x46a25c,_0x28d3cc){_0x28d3cc=_0x28d3cc||0xc8;return function(_0x48e125){if(_0x48e125){return _0x46a25c[_0xb00b('0xe')](_0x28d3cc)['json'](_0x48e125);}};}function respondWithFilteredResult(_0x5a4fea,_0x594075){return function(_0x4ff792){if(_0x4ff792){var _0x2d8ddf=typeof _0x594075[_0xb00b('0x10')]===_0xb00b('0x11')&&typeof _0x594075[_0xb00b('0x12')]===_0xb00b('0x11');var _0x4ada81=_0x4ff792[_0xb00b('0x13')];var _0xb0d42e=_0x2d8ddf?0x0:_0x594075['offset'];var _0x88d95e=_0x2d8ddf?_0x4ff792[_0xb00b('0x13')]:_0x594075['offset']+_0x594075['limit'];var _0x9b471e;if(_0x88d95e>=_0x4ada81){_0x88d95e=_0x4ada81;_0x9b471e=0xc8;}else{_0x9b471e=0xce;}_0x5a4fea['status'](_0x9b471e);return _0x5a4fea['set'](_0xb00b('0x14'),_0xb0d42e+'-'+_0x88d95e+'/'+_0x4ada81)[_0xb00b('0x15')](_0x4ff792);}return null;};}function saveUpdates(_0x387d97){return function(_0xbb72fc){if(_0xbb72fc){return _0xbb72fc['update'](_0x387d97)[_0xb00b('0x16')](function(_0x599347){return _0x599347;});}return null;};}function removeEntity(_0x415f91){return function(_0x5aa9a0){if(_0x5aa9a0){return _0x5aa9a0[_0xb00b('0x17')]()['then'](function(){var _0xb26ebb=_0x5aa9a0[_0xb00b('0x18')]({'plain':!![]});var _0x53ee68=[{'name':'VoiceQueues','value':_0xb00b('0x19'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb00b('0x1a'),'ignore':![]}];var _0x43da66=_(_0x53ee68)[_0xb00b('0x1b')](_0xb00b('0x1c'))['map'](_0xb00b('0x1d'))['value']();if(_[_0xb00b('0x1e')](_0x43da66,_0xb26ebb[_0xb00b('0x1f')])){return;}var _0x51b841=_[_0xb00b('0x20')](_0x53ee68,[_0xb00b('0x1d'),_0xb26ebb['type']])[_0xb00b('0x21')];return db[_0xb00b('0x22')]['destroy']({'where':{'type':_0x51b841,'resourceId':_0xb26ebb['id']}})[_0xb00b('0x16')](function(){return _0x5aa9a0;});})[_0xb00b('0x16')](function(){_0x415f91[_0xb00b('0xe')](0xcc)[_0xb00b('0xf')]();});}};}function handleEntityNotFound(_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x520e55[_0xb00b('0xd')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x23')](_0x4a635e[_0xb00b('0x24')]);if(_0x4a635e[_0xb00b('0x21')]){delete _0x4a635e[_0xb00b('0x21')];}_0x490380[_0xb00b('0xe')](_0x550587)[_0xb00b('0x25')](_0x4a635e);};}exports[_0xb00b('0x26')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={};var _0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x27')](db['VoiceQueue'][_0xb00b('0x28')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x29')],'type':_0x280ed3[_0xb00b('0x1f')][_0xb00b('0x2a')]};});_0x503c9c=qs[_0xb00b('0x2b')](_0x348165,_0x4a8d2b);var _0x2e160a={'where':_0x503c9c[_0xb00b('0x2c')]};return db[_0xb00b('0x2d')]['count'](_0x2e160a)[_0xb00b('0x16')](function(_0x44918d){_0x450129['count']=_0x44918d;_0x503c9c[_0xb00b('0x2e')]=qs[_0xb00b('0x2e')](_0x4a8d2b['query']);return db[_0xb00b('0x2d')]['findAll'](_0x503c9c);})[_0xb00b('0x16')](function(_0x4117f2){_0x450129[_0xb00b('0x2f')]=_0x4117f2;return _0x450129;})[_0xb00b('0x16')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x30')](handleError(_0x22c22d,null));};exports[_0xb00b('0x31')]=function(_0x17f613,_0x594840){var _0x57e8f9={'raw':![],'where':{'id':_0x17f613[_0xb00b('0x32')]['id']}},_0x5b04c2={};_0x5b04c2[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x5b04c2[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x17f613[_0xb00b('0x35')]);_0x5b04c2[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x5b04c2[_0xb00b('0x33')],_0x5b04c2[_0xb00b('0x35')]);_0x57e8f9[_0xb00b('0x38')]=_['intersection'](_0x5b04c2['model'],qs[_0xb00b('0x39')](_0x17f613['query'][_0xb00b('0x39')]));_0x57e8f9[_0xb00b('0x38')]=_0x57e8f9[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x57e8f9[_0xb00b('0x38')]:_0x5b04c2[_0xb00b('0x33')];if(_0x17f613[_0xb00b('0x35')]['includeAll']){_0x57e8f9[_0xb00b('0x2e')]=[{'all':!![]}];}_0x57e8f9=_[_0xb00b('0x3b')]({},_0x57e8f9,_0x17f613[_0xb00b('0x3c')]);return db[_0xb00b('0x2d')][_0xb00b('0x20')](_0x57e8f9)[_0xb00b('0x16')](handleEntityNotFound(_0x594840,null))['then'](respondWithResult(_0x594840,null))[_0xb00b('0x30')](handleError(_0x594840,null));};exports[_0xb00b('0x3d')]=function(_0x4801e7,_0x17ff34){return db[_0xb00b('0x2d')][_0xb00b('0x3d')](_0x4801e7[_0xb00b('0x3e')],{})[_0xb00b('0x16')](function(_0x5636b1){var _0x14ff6a=_0x4801e7[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x14ff6a)throw new Error(_0xb00b('0x40'));if(_0x14ff6a['role']==='user'){var _0x43f834=_0x5636b1[_0xb00b('0x18')]({'plain':!![]});var _0x10a348=[{'name':_0xb00b('0x41'),'value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x493841=_[_0xb00b('0x20')](_0x10a348,[_0xb00b('0x1d'),_0x43f834[_0xb00b('0x1f')]])[_0xb00b('0x21')];return db[_0xb00b('0x43')][_0xb00b('0x20')]({'where':{'name':_0x493841,'userProfileId':_0x14ff6a[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x2d58e2){if(_0x2d58e2&&_0x2d58e2[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x43f834['name'],'resourceId':_0x43f834['id'],'type':_0x2d58e2[_0xb00b('0x21')],'sectionId':_0x2d58e2['id']},{})[_0xb00b('0x16')](function(){return _0x5636b1;});}else{return _0x5636b1;}})[_0xb00b('0x30')](function(_0x44afa0){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x44afa0);throw _0x44afa0;});}return _0x5636b1;})[_0xb00b('0x16')](respondWithResult(_0x17ff34,0xc9))[_0xb00b('0x30')](handleError(_0x17ff34,null));};exports[_0xb00b('0x47')]=function(_0x103320,_0x1eec12){var _0x3b3031={'where':{'id':_0x103320['params']['id']}},_0x5dbe00={};_0x5dbe00['model']=_[_0xb00b('0x34')](db[_0xb00b('0x2d')]['rawAttributes']);_0x3b3031[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x5dbe00[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x103320['query']['fields']));_0x3b3031[_0xb00b('0x38')]=_0x3b3031[_0xb00b('0x38')]['length']?_0x3b3031['attributes']:_0x5dbe00[_0xb00b('0x33')];if(_0x103320[_0xb00b('0x35')]['includeAll']){_0x3b3031[_0xb00b('0x2e')]=[{'all':!![]}];}_0x3b3031=_['merge']({},_0x3b3031,_0x103320['options']);return db['VoiceQueue'][_0xb00b('0x20')](_0x3b3031)['then'](handleEntityNotFound(_0x1eec12,null))[_0xb00b('0x16')](function(_0x3178aa){if(_0x3178aa){var _0x4b6482=_0x3178aa[_0xb00b('0x18')]({'plain':!![]});_0x4b6482=qs[_0xb00b('0x48')](_0x4b6482,['id',_0xb00b('0x49'),'updatedAt']);_0x103320['body']=_[_0xb00b('0x48')](_0x103320[_0xb00b('0x3e')],['id','createdAt',_0xb00b('0x4a')]);return db[_0xb00b('0x2d')]['create'](_[_0xb00b('0x3b')](_0x4b6482,_0x103320[_0xb00b('0x3e')]),{'include':_0x103320[_0xb00b('0x35')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x19f907){var _0x398deb=_0x103320[_0xb00b('0x3f')][_0xb00b('0x18')]({'plain':!![]});if(!_0x398deb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x398deb[_0xb00b('0x4b')]===_0xb00b('0x3f')){var _0x4ad9cb=_0x19f907['get']({'plain':!![]});var _0x160965=[{'name':'VoiceQueues','value':_0xb00b('0x19')},{'name':_0xb00b('0x42'),'value':_0xb00b('0x1a')}];var _0x222459=_[_0xb00b('0x20')](_0x160965,[_0xb00b('0x1d'),_0x4ad9cb['type']])[_0xb00b('0x21')];return db['UserProfileSection'][_0xb00b('0x20')]({'where':{'name':_0x222459,'userProfileId':_0x398deb[_0xb00b('0x44')]},'raw':!![]})[_0xb00b('0x16')](function(_0x5ac79e){if(_0x5ac79e&&_0x5ac79e[_0xb00b('0x45')]===0x0){return db[_0xb00b('0x22')][_0xb00b('0x3d')]({'name':_0x4ad9cb['name'],'resourceId':_0x4ad9cb['id'],'type':_0x5ac79e[_0xb00b('0x21')],'sectionId':_0x5ac79e['id']},{})[_0xb00b('0x16')](function(){return _0x19f907;});}else{return _0x19f907;}})[_0xb00b('0x30')](function(_0x385029){logger[_0xb00b('0x23')](_0xb00b('0x46'),_0x385029);throw _0x385029;});}return _0x19f907;});}})[_0xb00b('0x16')](respondWithResult(_0x1eec12,0xc9))[_0xb00b('0x30')](handleError(_0x1eec12,null));};exports['update']=function(_0x153551,_0x2cbe80){if(_0x153551[_0xb00b('0x3e')]['id']){delete _0x153551['body']['id'];}return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x153551[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2cbe80,null))[_0xb00b('0x16')](saveUpdates(_0x153551['body'],null))[_0xb00b('0x16')](respondWithResult(_0x2cbe80,null))[_0xb00b('0x30')](handleError(_0x2cbe80,null));};exports[_0xb00b('0x17')]=function(_0x1cad79,_0x4b1e5f){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x1cad79[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4b1e5f,null))[_0xb00b('0x16')](removeEntity(_0x4b1e5f,null))[_0xb00b('0x30')](handleError(_0x4b1e5f,null));};exports[_0xb00b('0x4c')]=function(_0x542223,_0x2b090a){var _0x502822={'raw':![],'where':{}};var _0x3e0648={};var _0x4c2186={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x542223[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x2b090a,null))[_0xb00b('0x16')](function(_0x2534ed){if(_0x2534ed){_0x3e0648[_0xb00b('0x33')]=_['keys'](db['CmHopper']['rawAttributes']);_0x3e0648[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x542223[_0xb00b('0x35')]);_0x3e0648['filters']=_[_0xb00b('0x37')](_0x3e0648[_0xb00b('0x33')],_0x3e0648[_0xb00b('0x35')]);_0x502822[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3e0648['model'],qs[_0xb00b('0x39')](_0x542223[_0xb00b('0x35')]['fields']));_0x502822[_0xb00b('0x38')]=_0x502822[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x502822['attributes']:_0x3e0648['model'];if(!_0x542223[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x502822['limit']=qs['limit'](_0x542223['query']['limit']);_0x502822[_0xb00b('0x10')]=qs['offset'](_0x542223[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x502822['order']=qs[_0xb00b('0x4f')](_0x542223[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x502822[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x542223[_0xb00b('0x35')],_0x3e0648[_0xb00b('0x36')]));_0x502822[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2534ed['id'];if(_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x502822[_0xb00b('0x2c')]=_['merge'](_0x502822[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x502822[_0xb00b('0x38')],function(_0x328f72){var _0x109f56={};_0x109f56[_0x328f72]={'$like':'%'+_0x542223[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x109f56;})});}_0x502822=_[_0xb00b('0x3b')]({},_0x502822,_0x542223['options']);return db[_0xb00b('0x51')][_0xb00b('0x13')]({'where':_0x502822[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3d6b33){_0x4c2186[_0xb00b('0x13')]=_0x3d6b33;if(_0x542223[_0xb00b('0x35')][_0xb00b('0x52')]){_0x502822['include']=[{'all':!![]}];}return db[_0xb00b('0x51')][_0xb00b('0x53')](_0x502822);})[_0xb00b('0x16')](function(_0x26b82a){_0x4c2186[_0xb00b('0x2f')]=_0x26b82a;return _0x4c2186;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x2b090a,_0x502822))[_0xb00b('0x30')](handleError(_0x2b090a,null));};exports['getHopperHistories']=function(_0x207bda,_0x37a4c0){var _0x28ecf8={'raw':!![],'where':{}};var _0x22b19c={};var _0x16e8ff={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')]['findOne']({'where':{'id':_0x207bda[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x37a4c0,null))[_0xb00b('0x16')](function(_0x50922f){if(_0x50922f){_0x22b19c[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x54')]['rawAttributes']);_0x22b19c['query']=_[_0xb00b('0x34')](_0x207bda[_0xb00b('0x35')]);_0x22b19c[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],_0x22b19c[_0xb00b('0x35')]);_0x28ecf8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x22b19c[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x39')]));_0x28ecf8[_0xb00b('0x38')]=_0x28ecf8[_0xb00b('0x38')]['length']?_0x28ecf8['attributes']:_0x22b19c[_0xb00b('0x33')];if(!_0x207bda[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x28ecf8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x207bda[_0xb00b('0x35')]['limit']);_0x28ecf8[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x207bda[_0xb00b('0x35')][_0xb00b('0x10')]);}_0x28ecf8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x207bda[_0xb00b('0x35')]['sort']);_0x28ecf8[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x207bda[_0xb00b('0x35')],_0x22b19c['filters']));_0x28ecf8[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x50922f['id'];if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x28ecf8[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x28ecf8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x28ecf8[_0xb00b('0x38')],function(_0x383d16){var _0x2ec3f2={};_0x2ec3f2[_0x383d16]={'$like':'%'+_0x207bda[_0xb00b('0x35')]['filter']+'%'};return _0x2ec3f2;})});}_0x28ecf8=_[_0xb00b('0x3b')]({},_0x28ecf8,_0x207bda[_0xb00b('0x3c')]);return db[_0xb00b('0x54')][_0xb00b('0x13')]({'where':_0x28ecf8['where']})[_0xb00b('0x16')](function(_0x17503d){_0x16e8ff[_0xb00b('0x13')]=_0x17503d;if(_0x207bda[_0xb00b('0x35')][_0xb00b('0x52')]){_0x28ecf8['include']=[{'all':!![]}];}return db[_0xb00b('0x54')][_0xb00b('0x53')](_0x28ecf8);})[_0xb00b('0x16')](function(_0x2b66b7){_0x16e8ff['rows']=_0x2b66b7;return _0x16e8ff;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x37a4c0,_0x28ecf8))['catch'](handleError(_0x37a4c0,null));};exports[_0xb00b('0x57')]=function(_0x202d5f,_0x69b4e0){var _0x165442={'raw':!![],'where':{}};var _0x188349={};var _0x27e051={'count':0x0,'rows':[]};return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x202d5f[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x69b4e0,null))[_0xb00b('0x16')](function(_0x551a55){if(_0x551a55){_0x188349[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x59')][_0xb00b('0x28')]);_0x188349['query']=_[_0xb00b('0x34')](_0x202d5f[_0xb00b('0x35')]);_0x188349['filters']=_[_0xb00b('0x37')](_0x188349['model'],_0x188349[_0xb00b('0x35')]);_0x165442[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x188349['model'],qs[_0xb00b('0x39')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x39')]));_0x165442[_0xb00b('0x38')]=_0x165442[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x165442[_0xb00b('0x38')]:_0x188349[_0xb00b('0x33')];if(!_0x202d5f[_0xb00b('0x35')]['hasOwnProperty']('nolimit')){_0x165442[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x202d5f[_0xb00b('0x35')][_0xb00b('0x12')]);_0x165442['offset']=qs[_0xb00b('0x10')](_0x202d5f[_0xb00b('0x35')]['offset']);}_0x165442[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x202d5f[_0xb00b('0x35')]['sort']);_0x165442[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x202d5f[_0xb00b('0x35')],_0x188349[_0xb00b('0x36')]));_0x165442[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x551a55['id'];if(_0x202d5f[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x165442[_0xb00b('0x2c')]=_[_0xb00b('0x3b')](_0x165442['where'],{'$or':_[_0xb00b('0x27')](_0x165442[_0xb00b('0x38')],function(_0x320542){var _0x29d101={};_0x29d101[_0x320542]={'$like':'%'+_0x202d5f['query'][_0xb00b('0x1b')]+'%'};return _0x29d101;})});}_0x165442=_['merge']({},_0x165442,_0x202d5f[_0xb00b('0x3c')]);return db['CmHopperFinal'][_0xb00b('0x13')]({'where':_0x165442[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0x3e0e49){_0x27e051[_0xb00b('0x13')]=_0x3e0e49;if(_0x202d5f['query'][_0xb00b('0x52')]){_0x165442[_0xb00b('0x2e')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xb00b('0x53')](_0x165442);})['then'](function(_0x20a690){_0x27e051[_0xb00b('0x2f')]=_0x20a690;return _0x27e051;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x69b4e0,_0x165442))[_0xb00b('0x30')](handleError(_0x69b4e0,null));};exports['getHopperBlacks']=function(_0x3ae4a4,_0x76b483){var _0x190019={'raw':!![],'where':{}};var _0x44ea58={};var _0x11172e={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x3ae4a4[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x76b483,null))[_0xb00b('0x16')](function(_0x2d5652){if(_0x2d5652){_0x44ea58[_0xb00b('0x33')]=_['keys'](db['CmHopperBlack'][_0xb00b('0x28')]);_0x44ea58[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x3ae4a4[_0xb00b('0x35')]);_0x44ea58[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x44ea58[_0xb00b('0x33')],_0x44ea58['query']);_0x190019[_0xb00b('0x38')]=_['intersection'](_0x44ea58[_0xb00b('0x33')],qs['fields'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x39')]));_0x190019[_0xb00b('0x38')]=_0x190019[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x190019[_0xb00b('0x38')]:_0x44ea58[_0xb00b('0x33')];if(!_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x190019[_0xb00b('0x12')]=qs['limit'](_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x12')]);_0x190019[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x3ae4a4['query'][_0xb00b('0x10')]);}_0x190019[_0xb00b('0x55')]=qs['sort'](_0x3ae4a4[_0xb00b('0x35')]['sort']);_0x190019[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x3ae4a4[_0xb00b('0x35')],_0x44ea58[_0xb00b('0x36')]));_0x190019[_0xb00b('0x2c')][_0xb00b('0x50')]=_0x2d5652['id'];if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x190019['where']=_[_0xb00b('0x3b')](_0x190019['where'],{'$or':_[_0xb00b('0x27')](_0x190019[_0xb00b('0x38')],function(_0x140bfd){var _0x43fbc5={};_0x43fbc5[_0x140bfd]={'$like':'%'+_0x3ae4a4['query'][_0xb00b('0x1b')]+'%'};return _0x43fbc5;})});}_0x190019=_[_0xb00b('0x3b')]({},_0x190019,_0x3ae4a4[_0xb00b('0x3c')]);return db['CmHopperBlack'][_0xb00b('0x13')]({'where':_0x190019[_0xb00b('0x2c')]})[_0xb00b('0x16')](function(_0xcc2183){_0x11172e['count']=_0xcc2183;if(_0x3ae4a4[_0xb00b('0x35')][_0xb00b('0x52')]){_0x190019[_0xb00b('0x2e')]=[{'all':!![]}];}return db[_0xb00b('0x5a')][_0xb00b('0x53')](_0x190019);})[_0xb00b('0x16')](function(_0x568c0a){_0x11172e['rows']=_0x568c0a;return _0x11172e;});}})[_0xb00b('0x16')](respondWithFilteredResult(_0x76b483,_0x190019))[_0xb00b('0x30')](handleError(_0x76b483,null));};exports[_0xb00b('0x5b')]=function(_0x2ec514,_0x3de4f6){var _0x5f0fd8={};var _0x3d80e7={};var _0xbe553c;var _0x14597c;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x2ec514[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x3de4f6,null))[_0xb00b('0x16')](function(_0x2414bd){if(_0x2414bd){_0xbe553c=_0x2414bd;_0x3d80e7[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x5c')][_0xb00b('0x28')]);_0x3d80e7[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x2ec514[_0xb00b('0x35')]);_0x3d80e7[_0xb00b('0x36')]=_['intersection'](_0x3d80e7['model'],_0x3d80e7[_0xb00b('0x35')]);_0x5f0fd8[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x3d80e7['model'],qs['fields'](_0x2ec514['query'][_0xb00b('0x39')]));_0x5f0fd8[_0xb00b('0x38')]=_0x5f0fd8[_0xb00b('0x38')]['length']?_0x5f0fd8[_0xb00b('0x38')]:_0x3d80e7[_0xb00b('0x33')];_0x5f0fd8[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x2ec514['query'][_0xb00b('0x4f')]);_0x5f0fd8[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x2ec514[_0xb00b('0x35')],_0x3d80e7[_0xb00b('0x36')]));if(_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x5f0fd8['where']=_[_0xb00b('0x3b')](_0x5f0fd8[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x5f0fd8[_0xb00b('0x38')],function(_0xf9c361){var _0x24c646={};_0x24c646[_0xf9c361]={'$like':'%'+_0x2ec514[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x24c646;})});}_0x5f0fd8=_['merge']({},_0x5f0fd8,_0x2ec514[_0xb00b('0x3c')]);return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x122522){if(_0x122522){_0x14597c=_0x122522['length'];if(!_0x2ec514[_0xb00b('0x35')][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0x5f0fd8[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x2ec514[_0xb00b('0x35')][_0xb00b('0x12')]);_0x5f0fd8[_0xb00b('0x10')]=qs['offset'](_0x2ec514['query'][_0xb00b('0x10')]);}return _0xbe553c[_0xb00b('0x5b')](_0x5f0fd8);}})[_0xb00b('0x16')](function(_0x58894a){if(_0x58894a){return _0x58894a?{'count':_0x14597c,'rows':_0x58894a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3de4f6,null))[_0xb00b('0x30')](handleError(_0x3de4f6,null));};exports[_0xb00b('0x5d')]=function(_0x581548,_0x44d3c0){var _0x3d5880=_0x581548[_0xb00b('0x3e')]['teams'];var _0x58808e=_[_0xb00b('0x27')](_0x3d5880,'id');return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x58808e},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]}]})[_0xb00b('0x16')](function(_0x5c5a04){if(_0x5c5a04){var _0x1aa5e5=_['flatMap'](_0x5c5a04,function(_0x592206){var _0x3551ca=_0x592206[_0xb00b('0x18')]({'plain':!![]});_0x3551ca[_0xb00b('0x61')][_0xb00b('0x62')](function(_0x8b31d3){_0x8b31d3[_0xb00b('0x63')]=_['find'](_0x3d5880,{'id':_0x3551ca['id']})[_0xb00b('0x63')];});return _0x3551ca['Agents'];});return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x581548[_0xb00b('0x32')]['id']}})['then'](function(_0x226527){return db[_0xb00b('0x64')][_0xb00b('0x65')](function(_0x3dc8d2){return _0x226527['addTeams'](_0x58808e,{'transaction':_0x3dc8d2})['then'](function(){return BPromise[_0xb00b('0x66')](_0x3d5880,function(_0x55bb31){return db['TeamVoiceQueue'][_0xb00b('0x67')]({'TeamId':_0x55bb31['id'],'VoiceQueueId':_0x581548['params']['id'],'penalty':_0x55bb31['penalty']},{'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_0x1aa5e5,function(_0x745803){return db[_0xb00b('0x68')]['findOrCreate']({'where':{'UserId':_0x745803['id'],'VoiceQueueId':_0x581548['params']['id']},'defaults':{'penalty':_0x745803[_0xb00b('0x63')]},'transaction':_0x3dc8d2});});})[_0xb00b('0x16')](function(){return BPromise[_0xb00b('0x66')](_['filter'](_0x1aa5e5,{'online':!![]}),function(_0x48bac5){return db[_0xb00b('0x69')]['upsert']({'membername':_0x48bac5['name'],'UserId':_0x48bac5['id'],'queue_name':_0x226527[_0xb00b('0x21')],'VoiceQueueId':_0x226527['id'],'interface':_['isNil'](_0x48bac5[_0xb00b('0x60')])?util['format'](_0xb00b('0x6a'),_0x48bac5['name']):_0x48bac5[_0xb00b('0x60')],'paused':_0x48bac5[_0xb00b('0x5f')]||![],'penalty':_0x48bac5[_0xb00b('0x63')]},{'transaction':_0x3dc8d2});});})['then'](function(){_0x1aa5e5[_0xb00b('0x62')](function(_0x596092){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':_0x596092['id'],'VoiceQueueId':_0x226527['id']});});});});});}})['then'](respondWithStatusCode(_0x44d3c0,null))['catch'](handleError(_0x44d3c0,null));};exports['removeTeams']=function(_0x552f73,_0x192b43){return db['Team'][_0xb00b('0x53')]({'where':{'id':_0x552f73['query'][_0xb00b('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xb00b('0x6e')],'as':_0xb00b('0x61'),'attributes':['id'],'raw':!![]}]})[_0xb00b('0x16')](handleEntityNotFound(_0x192b43,null))[_0xb00b('0x16')](function(_0x5b1576){var _0x8292fe=_[_0xb00b('0x27')](_0x5b1576,'id');var _0x3c1cc5=[];var _0x38e425=[];var _0x515143=squel['select']();_0x515143[_0xb00b('0x6f')](_0xb00b('0x70'))[_0xb00b('0x71')](_0xb00b('0x72'),'tq')[_0xb00b('0x73')](_0xb00b('0x74'),'ut',_0xb00b('0x75'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x552f73['params']['id']);for(var _0x45bae8=0x0;_0x45bae8<_0x5b1576[_0xb00b('0x3a')];_0x45bae8+=0x1){let _0x496500=_0x5b1576[_0x45bae8];for(var _0x475ebb=0x0;_0x475ebb<_0x496500['Agents'][_0xb00b('0x3a')];_0x475ebb+=0x1){let _0x13054a=_0x496500['Agents'][_0x475ebb];var _0x4ce456=_0x515143[_0xb00b('0x47')]();_0x4ce456[_0xb00b('0x2c')](_0xb00b('0x77'),_0x13054a['id']);_0x38e425['push'](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4ce456[_0xb00b('0x78')](),{'type':db['sequelize'][_0xb00b('0x79')]['SELECT']})['then'](function(_0x58ea43){if(_0x58ea43[_0xb00b('0x3a')]===0x1){return _0x13054a['id'];}else{var _0x4d42af=_[_0xb00b('0x7a')](_[_0xb00b('0x27')](_0x58ea43,'TeamId'),function(_0x4c389f){return _[_0xb00b('0x1e')](_0x8292fe,_0x4c389f);});if(_0x4d42af){return _0x13054a['id'];}}}));}}return BPromise[_0xb00b('0x7b')](_0x38e425)['then'](function(_0x2f131e){_0x3c1cc5=_(_0x3c1cc5)[_0xb00b('0x7c')](_0x2f131e)[_0xb00b('0x7d')]()[_0xb00b('0x1d')]();return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x552f73['params']['id']}})[_0xb00b('0x16')](function(_0x22b425){return db['sequelize'][_0xb00b('0x65')](function(_0x4ed3c7){return _0x22b425['removeTeams'](_0x552f73[_0xb00b('0x35')]['ids'],{'transaction':_0x4ed3c7})[_0xb00b('0x16')](function(){if(!_[_0xb00b('0x7e')](_0x3c1cc5)){return _0x22b425[_0xb00b('0x7f')](_0x3c1cc5,{'transaction':_0x4ed3c7})['then'](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x552f73[_0xb00b('0x32')]['id'],'UserId':_0x3c1cc5},'transaction':_0x4ed3c7});});}})[_0xb00b('0x16')](function(){_0x3c1cc5['forEach'](function(_0x20f4d2){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':_0x20f4d2,'VoiceQueueId':_0x22b425['id']});});});});});});})[_0xb00b('0x16')](respondWithStatusCode(_0x192b43,null))[_0xb00b('0x30')](handleError(_0x192b43,null));};exports[_0xb00b('0x81')]=function(_0x21ecef,_0x40f6f6){var _0x48125c,_0x1b097a;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x21ecef['params']['id']}})['then'](handleEntityNotFound(_0x40f6f6,null))['then'](function(_0x1e66eb){if(_0x1e66eb){_0x1b097a=_0x1e66eb;return _0x1e66eb[_0xb00b('0x81')](_0x21ecef[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x21ecef[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{})[_0xb00b('0x82')](function(_0x2c3557){for(var _0x5b7137=0x0;_0x5b7137<_0x21ecef[_0xb00b('0x3e')]['ids'][_0xb00b('0x3a')];_0x5b7137+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x6c'),{'UserId':Number(_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')][_0x5b7137]),'VoiceQueueId':Number(_0x21ecef[_0xb00b('0x32')]['id'])});}return _0x2c3557;});}})['then'](function(_0xeaa6ea){_0x48125c=_0xeaa6ea||[];if(_0x1b097a){return db[_0xb00b('0x6e')][_0xb00b('0x53')]({'where':{'id':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x6d')]},'attributes':['id',_0xb00b('0x21'),_0xb00b('0x5e'),_0xb00b('0x5f'),_0xb00b('0x60')],'raw':!![]});}})[_0xb00b('0x16')](function(_0x5f1258){if(!_[_0xb00b('0x7e')](_0x5f1258)){var _0x33952b=[];for(var _0x4cd459=0x0;_0x4cd459<_0x5f1258[_0xb00b('0x3a')];_0x4cd459++){if(_0x5f1258[_0x4cd459]['online']){_0x33952b['push'](db['UserVoiceQueueRt'][_0xb00b('0x67')]({'membername':_0x5f1258[_0x4cd459]['name'],'UserId':_0x5f1258[_0x4cd459]['id'],'queue_name':_0x1b097a[_0xb00b('0x21')],'VoiceQueueId':_0x1b097a['id'],'interface':_[_0xb00b('0x83')](_0x5f1258[_0x4cd459][_0xb00b('0x60')])?util[_0xb00b('0x84')](_0xb00b('0x6a'),_0x5f1258[_0x4cd459][_0xb00b('0x21')]):_0x5f1258[_0x4cd459][_0xb00b('0x60')],'paused':_0x5f1258[_0x4cd459][_0xb00b('0x5f')]||![],'penalty':_0x21ecef[_0xb00b('0x3e')][_0xb00b('0x63')]||0x0}));}}return BPromise[_0xb00b('0x7b')](_0x33952b);}})[_0xb00b('0x16')](function(){return _0x48125c;})[_0xb00b('0x16')](respondWithResult(_0x40f6f6,null))[_0xb00b('0x30')](handleError(_0x40f6f6,null));};exports['removeAgents']=function(_0x31d2f0,_0x15f9cd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x31d2f0[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x15f9cd,null))[_0xb00b('0x16')](function(_0x387744){if(_0x387744){return _0x387744['removeAgents'](_0x31d2f0['query'][_0xb00b('0x6d')])[_0xb00b('0x16')](function(){if(_[_0xb00b('0x85')](_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')])){for(var _0x11f9b7=0x0;_0x11f9b7<_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')][_0xb00b('0x3a')];_0x11f9b7+=0x1){socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0['query'][_0xb00b('0x6d')][_0x11f9b7]),'VoiceQueueId':Number(_0x31d2f0['params']['id'])});}}else{socket[_0xb00b('0x6b')](_0xb00b('0x80'),{'UserId':Number(_0x31d2f0[_0xb00b('0x35')][_0xb00b('0x6d')]),'VoiceQueueId':Number(_0x31d2f0[_0xb00b('0x32')]['id'])});}});}})[_0xb00b('0x16')](function(_0x59c4b6){return db[_0xb00b('0x69')][_0xb00b('0x17')]({'where':{'VoiceQueueId':_0x31d2f0[_0xb00b('0x32')]['id'],'UserId':_0x31d2f0[_0xb00b('0x35')]['ids']}})[_0xb00b('0x16')](function(){return _0x59c4b6;});})[_0xb00b('0x16')](respondWithStatusCode(_0x15f9cd,null))['catch'](handleError(_0x15f9cd,null));};exports[_0xb00b('0x86')]=function(_0x16cca9,_0x3c57b2){var _0xca4a87={};var _0x456515={};var _0x26145a;var _0x31fa5b;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x16cca9['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3c57b2,null))[_0xb00b('0x16')](function(_0x4b0306){if(_0x4b0306){_0x26145a=_0x4b0306;_0x456515[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x6e')][_0xb00b('0x28')]);_0x456515[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x16cca9[_0xb00b('0x35')]);_0x456515[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],_0x456515[_0xb00b('0x35')]);_0xca4a87['attributes']=_[_0xb00b('0x37')](_0x456515[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x16cca9['query'][_0xb00b('0x39')]));_0xca4a87[_0xb00b('0x38')]=_0xca4a87[_0xb00b('0x38')][_0xb00b('0x3a')]?_0xca4a87['attributes']:_0x456515[_0xb00b('0x33')];_0xca4a87[_0xb00b('0x55')]=qs['sort'](_0x16cca9['query'][_0xb00b('0x4f')]);_0xca4a87[_0xb00b('0x2c')]=qs['filters'](_[_0xb00b('0x56')](_0x16cca9['query'],_0x456515['filters']));if(_0x16cca9[_0xb00b('0x35')]['filter']){_0xca4a87['where']=_[_0xb00b('0x3b')](_0xca4a87[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0xca4a87[_0xb00b('0x38')],function(_0x11e9b4){var _0x2ae27c={};_0x2ae27c[_0x11e9b4]={'$like':'%'+_0x16cca9[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x2ae27c;})});}_0xca4a87=_[_0xb00b('0x3b')]({},_0xca4a87,_0x16cca9[_0xb00b('0x3c')]);return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})[_0xb00b('0x16')](function(_0x29ba55){if(_0x29ba55){_0x31fa5b=_0x29ba55[_0xb00b('0x3a')];if(!_0x16cca9['query'][_0xb00b('0x4d')](_0xb00b('0x4e'))){_0xca4a87['limit']=qs[_0xb00b('0x12')](_0x16cca9['query'][_0xb00b('0x12')]);_0xca4a87[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x16cca9['query'][_0xb00b('0x10')]);}return _0x26145a[_0xb00b('0x86')](_0xca4a87);}})['then'](function(_0x8478c8){if(_0x8478c8){return _0x8478c8?{'count':_0x31fa5b,'rows':_0x8478c8}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3c57b2,null))[_0xb00b('0x30')](handleError(_0x3c57b2,null));};exports[_0xb00b('0x87')]=function(_0x57bfab,_0x2dab12){var _0x47194e={};var _0x19d24b={};var _0x52b54b;var _0x571811;return db['VoiceQueue'][_0xb00b('0x58')]({'where':{'id':_0x57bfab[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x2dab12,null))[_0xb00b('0x16')](function(_0x344379){if(_0x344379){_0x52b54b=_0x344379;_0x19d24b[_0xb00b('0x33')]=_[_0xb00b('0x34')](db[_0xb00b('0x69')][_0xb00b('0x28')]);_0x19d24b['query']=_['keys'](_0x57bfab[_0xb00b('0x35')]);_0x19d24b[_0xb00b('0x36')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],_0x19d24b['query']);_0x47194e[_0xb00b('0x38')]=_['intersection'](_0x19d24b[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x57bfab['query'][_0xb00b('0x39')]));_0x47194e[_0xb00b('0x38')]=_0x47194e['attributes'][_0xb00b('0x3a')]?_0x47194e['attributes']:_0x19d24b[_0xb00b('0x33')];_0x47194e[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x47194e[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x57bfab[_0xb00b('0x35')],_0x19d24b[_0xb00b('0x36')]));if(_0x57bfab['query']['filter']){_0x47194e[_0xb00b('0x2c')]=_['merge'](_0x47194e[_0xb00b('0x2c')],{'$or':_['map'](_0x47194e[_0xb00b('0x38')],function(_0x1600f1){var _0x58bd2a={};_0x58bd2a[_0x1600f1]={'$like':'%'+_0x57bfab[_0xb00b('0x35')]['filter']+'%'};return _0x58bd2a;})});}_0x47194e=_[_0xb00b('0x3b')]({},_0x47194e,_0x57bfab[_0xb00b('0x3c')]);return _0x52b54b['getMembers'](_0x47194e);}})[_0xb00b('0x16')](function(_0x307c52){if(_0x307c52){_0x571811=_0x307c52[_0xb00b('0x3a')];if(!_0x57bfab[_0xb00b('0x35')][_0xb00b('0x4d')]('nolimit')){_0x47194e[_0xb00b('0x12')]=qs[_0xb00b('0x12')](_0x57bfab['query']['limit']);_0x47194e[_0xb00b('0x10')]=qs['offset'](_0x57bfab['query']['offset']);}return _0x52b54b[_0xb00b('0x87')](_0x47194e);}})[_0xb00b('0x16')](function(_0x39eb7a){return _0x39eb7a?{'count':_0x571811,'rows':_0x39eb7a}:null;})[_0xb00b('0x16')](respondWithResult(_0x2dab12,null))['catch'](handleError(_0x2dab12,null));};exports[_0xb00b('0x88')]=function(_0x482fc4,_0x3232cc){var _0x89225a={};var _0x22f2f6={};var _0x459f30;var _0x5aa72a;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x482fc4['params']['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x3232cc,null))[_0xb00b('0x16')](function(_0x4291a3){if(_0x4291a3){_0x459f30=_0x4291a3;_0x22f2f6['model']=_['keys'](db[_0xb00b('0x89')][_0xb00b('0x28')]);_0x22f2f6[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x482fc4[_0xb00b('0x35')]);_0x22f2f6[_0xb00b('0x36')]=_[_0xb00b('0x37')](_0x22f2f6['model'],_0x22f2f6['query']);_0x89225a[_0xb00b('0x38')]=_['intersection'](_0x22f2f6['model'],qs[_0xb00b('0x39')](_0x482fc4[_0xb00b('0x35')]['fields']));_0x89225a[_0xb00b('0x38')]=_0x89225a[_0xb00b('0x38')][_0xb00b('0x3a')]?_0x89225a['attributes']:_0x22f2f6[_0xb00b('0x33')];_0x89225a[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x89225a[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_['pick'](_0x482fc4[_0xb00b('0x35')],_0x22f2f6[_0xb00b('0x36')]));if(_0x482fc4['query']['filter']){_0x89225a['where']=_[_0xb00b('0x3b')](_0x89225a[_0xb00b('0x2c')],{'$or':_[_0xb00b('0x27')](_0x89225a[_0xb00b('0x38')],function(_0x3deb79){var _0x1901d1={};_0x1901d1[_0x3deb79]={'$like':'%'+_0x482fc4[_0xb00b('0x35')]['filter']+'%'};return _0x1901d1;})});}_0x89225a=_['merge']({},_0x89225a,_0x482fc4[_0xb00b('0x3c')]);return _0x459f30[_0xb00b('0x88')](_0x89225a);}})['then'](function(_0x3517d6){if(_0x3517d6){_0x5aa72a=_0x3517d6[_0xb00b('0x3a')];if(!_0x482fc4['query'][_0xb00b('0x4d')]('nolimit')){_0x89225a[_0xb00b('0x12')]=qs['limit'](_0x482fc4['query']['limit']);_0x89225a[_0xb00b('0x10')]=qs[_0xb00b('0x10')](_0x482fc4[_0xb00b('0x35')][_0xb00b('0x10')]);}return _0x459f30['getLists'](_0x89225a);}})[_0xb00b('0x16')](function(_0x481abb){if(_0x481abb){return _0x481abb?{'count':_0x5aa72a,'rows':_0x481abb}:null;}})[_0xb00b('0x16')](respondWithResult(_0x3232cc,null))[_0xb00b('0x30')](handleError(_0x3232cc,null));};exports[_0xb00b('0x8a')]=function(_0x7ecc19,_0x1cc9fb){var _0x259acf=moment()[_0xb00b('0x84')](_0xb00b('0x8b'));var _0x57834b,_0x5448bb;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x7ecc19[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x1cc9fb,null))[_0xb00b('0x16')](function(_0x1e0206){if(_0x1e0206){_0x5448bb=_0x1e0206;return _0x1e0206[_0xb00b('0x8a')](_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x6d')],_['omit'](_0x7ecc19[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x26b234){var _0x4fe674;_0x57834b=_0x26b234||[];var _0x45ad1f=[];if(_0x26b234){for(var _0x11b817=0x0;_0x11b817<_0x26b234[_0xb00b('0x3a')];_0x11b817+=0x1){var _0x89dd0a=_0x26b234[_0x11b817][_0xb00b('0x18')]({'plain':!![]});_0x5448bb[_0xb00b('0x8c')]=_0x7ecc19[_0xb00b('0x3e')][_0xb00b('0x8c')]?_0x7ecc19[_0xb00b('0x3e')]['dialCheckDuplicateType']:_0x5448bb['dialCheckDuplicateType'];switch(_0x5448bb[_0xb00b('0x8c')]){case _0xb00b('0x8d'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),'ListId')['field'](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27','updatedAt')['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()[_0xb00b('0x6f')](_0xb00b('0x9d'))[_0xb00b('0x71')](_0xb00b('0x9e'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19['params']['id'][_0xb00b('0x78')]()))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel[_0xb00b('0x95')]()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))[_0xb00b('0x2c')](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;case _0xb00b('0x9f'):_0x4fe674=squel[_0xb00b('0x8e')]()[_0xb00b('0x8f')](_0xb00b('0x90'))['fromQuery']([_0xb00b('0x92'),_0xb00b('0x96'),_0xb00b('0x93'),_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field'](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))['field']('id','ContactId')['field'](_0x89dd0a[_0xb00b('0x97')]['toString'](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')](),'VoiceQueueId')['field']('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))['field']('\x27'+_0x259acf+'\x27','updatedAt')[_0xb00b('0x71')]('cm_contacts')[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a['CmListId'][_0xb00b('0x78')]())[_0xb00b('0x2c')](_0xb00b('0x9b'))[_0xb00b('0x2c')](_0xb00b('0x9c'),squel['select']()['field']('COALESCE(phone,\x27\x27)')[_0xb00b('0x71')](_0xb00b('0x90'))['where'](_0xb00b('0x76'),_0x7ecc19[_0xb00b('0x32')]['id'][_0xb00b('0x78')]())))[_0xb00b('0x78')]();break;default:_0x4fe674=squel['insert']()[_0xb00b('0x8f')](_0xb00b('0x90'))[_0xb00b('0x91')]([_0xb00b('0x92'),'scheduledAt',_0xb00b('0x93'),'ListId',_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),_0xb00b('0x92'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x96'))[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x7ecc19[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0x98'))[_0xb00b('0x2c')](_0xb00b('0x99'))[_0xb00b('0x2c')](_0xb00b('0x9a'),_0x89dd0a[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))['toString']();}_0x45ad1f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x4fe674));}return BPromise['all'](_0x45ad1f);}})[_0xb00b('0x16')](function(){var _0x2bf68f=[];var _0x283ad6=squel[_0xb00b('0x8e')]()['into']('cm_hopper_additional_phones')[_0xb00b('0x91')]([_0xb00b('0xa1'),'phone',_0xb00b('0xa2'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()['field']('h.id')[_0xb00b('0x6f')](_0xb00b('0xa3'))[_0xb00b('0x6f')](_0xb00b('0xa4'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x49'))[_0xb00b('0x6f')]('\x27'+_0x259acf+'\x27',_0xb00b('0x4a'))['from'](_0xb00b('0xa5'),'ci')[_0xb00b('0x73')](_0xb00b('0x90'),'h',_0xb00b('0xa6'))[_0xb00b('0x2c')](_0xb00b('0xa7'),_0x259acf)[_0xb00b('0x2c')]('ci.ItemClass=?',_0xb00b('0xa8')))[_0xb00b('0x78')]();_0x2bf68f[_0xb00b('0xa0')](db[_0xb00b('0x64')][_0xb00b('0x35')](_0x283ad6));return BPromise[_0xb00b('0x7b')](_0x2bf68f);})[_0xb00b('0x16')](function(){return _0x57834b;})[_0xb00b('0x16')](respondWithResult(_0x1cc9fb,null))[_0xb00b('0x30')](handleError(_0x1cc9fb,null));};exports[_0xb00b('0xa9')]=function(_0x229197,_0x5ce3f3){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x229197[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5ce3f3,null))[_0xb00b('0x16')](function(_0x406469){if(_0x406469){return _0x406469['removeLists'](_0x229197[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x4ffe41){if(_0x4ffe41){return db['CmHopper'][_0xb00b('0x17')]({'where':{'ListId':_0x229197['query'][_0xb00b('0x6d')],'VoiceQueueId':_0x229197[_0xb00b('0x32')]['id']}})['then'](function(){return _0x4ffe41;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5ce3f3,null))['catch'](handleError(_0x5ce3f3,null));};exports['getBlackLists']=function(_0x122be3,_0x4cb6ba){var _0x3ca253={};var _0x438281={};var _0x23b994;var _0x564934;return db[_0xb00b('0x2d')][_0xb00b('0x58')]({'where':{'id':_0x122be3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x4cb6ba,null))[_0xb00b('0x16')](function(_0x18f5ac){if(_0x18f5ac){_0x23b994=_0x18f5ac;_0x438281[_0xb00b('0x33')]=_['keys'](db[_0xb00b('0x89')]['rawAttributes']);_0x438281[_0xb00b('0x35')]=_[_0xb00b('0x34')](_0x122be3[_0xb00b('0x35')]);_0x438281[_0xb00b('0x36')]=_['intersection'](_0x438281[_0xb00b('0x33')],_0x438281[_0xb00b('0x35')]);_0x3ca253[_0xb00b('0x38')]=_[_0xb00b('0x37')](_0x438281[_0xb00b('0x33')],qs[_0xb00b('0x39')](_0x122be3['query'][_0xb00b('0x39')]));_0x3ca253[_0xb00b('0x38')]=_0x3ca253['attributes'][_0xb00b('0x3a')]?_0x3ca253[_0xb00b('0x38')]:_0x438281[_0xb00b('0x33')];_0x3ca253[_0xb00b('0x55')]=qs[_0xb00b('0x4f')](_0x122be3[_0xb00b('0x35')][_0xb00b('0x4f')]);_0x3ca253[_0xb00b('0x2c')]=qs[_0xb00b('0x36')](_[_0xb00b('0x56')](_0x122be3[_0xb00b('0x35')],_0x438281[_0xb00b('0x36')]));if(_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]){_0x3ca253['where']=_['merge'](_0x3ca253['where'],{'$or':_[_0xb00b('0x27')](_0x3ca253[_0xb00b('0x38')],function(_0x966247){var _0x58b695={};_0x58b695[_0x966247]={'$like':'%'+_0x122be3[_0xb00b('0x35')][_0xb00b('0x1b')]+'%'};return _0x58b695;})});}_0x3ca253=_[_0xb00b('0x3b')]({},_0x3ca253,_0x122be3[_0xb00b('0x3c')]);return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})['then'](function(_0x1bafb2){if(_0x1bafb2){_0x564934=_0x1bafb2['length'];if(!_0x122be3['query']['hasOwnProperty'](_0xb00b('0x4e'))){_0x3ca253[_0xb00b('0x12')]=qs['limit'](_0x122be3[_0xb00b('0x35')][_0xb00b('0x12')]);_0x3ca253[_0xb00b('0x10')]=qs['offset'](_0x122be3[_0xb00b('0x35')]['offset']);}return _0x23b994[_0xb00b('0xaa')](_0x3ca253);}})[_0xb00b('0x16')](function(_0x2e3e5a){if(_0x2e3e5a){return _0x2e3e5a?{'count':_0x564934,'rows':_0x2e3e5a}:null;}})[_0xb00b('0x16')](respondWithResult(_0x4cb6ba,null))['catch'](handleError(_0x4cb6ba,null));};exports['addBlackLists']=function(_0x470c4a,_0x12cc9d){var _0xe5b66f;return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x470c4a[_0xb00b('0x32')]['id']}})['then'](handleEntityNotFound(_0x12cc9d,null))[_0xb00b('0x16')](function(_0x3afb66){if(_0x3afb66){return _0x3afb66[_0xb00b('0xab')](_0x470c4a[_0xb00b('0x3e')]['ids'],_[_0xb00b('0x48')](_0x470c4a[_0xb00b('0x3e')],[_0xb00b('0x6d'),'id'])||{});}return null;})[_0xb00b('0x82')](function(_0x379b81){var _0x46c784;_0xe5b66f=_0x379b81||[];var _0x471db4=[];if(_0x379b81){for(var _0x333bee=0x0;_0x333bee<_0x379b81['length'];_0x333bee+=0x1){var _0x1a94bf=_0x379b81[_0x333bee][_0xb00b('0x18')]({'plain':!![]});_0x46c784=squel[_0xb00b('0x8e')]()['into'](_0xb00b('0xac'))[_0xb00b('0x91')]([_0xb00b('0x92'),'ContactId',_0xb00b('0x94'),_0xb00b('0x50'),_0xb00b('0x49'),_0xb00b('0x4a')],squel[_0xb00b('0x95')]()[_0xb00b('0x6f')](_0xb00b('0x92'),'phone')[_0xb00b('0x6f')]('id',_0xb00b('0x93'))[_0xb00b('0x6f')](_0x1a94bf['CmListId'][_0xb00b('0x78')](),_0xb00b('0x94'))[_0xb00b('0x6f')](_0x470c4a[_0xb00b('0x32')]['id']['toString'](),_0xb00b('0x50'))['field'](_0xb00b('0xad'),_0xb00b('0x49'))['field'](_0xb00b('0xad'),_0xb00b('0x4a'))[_0xb00b('0x71')](_0xb00b('0x98'))[_0xb00b('0x2c')]('deletedAt\x20IS\x20NULL')['where'](_0xb00b('0x9a'),_0x1a94bf[_0xb00b('0x97')][_0xb00b('0x78')]())['where'](_0xb00b('0x9b')))[_0xb00b('0x78')]();_0x471db4[_0xb00b('0xa0')](db['sequelize'][_0xb00b('0x35')](_0x46c784));}return BPromise[_0xb00b('0x7b')](_0x471db4);}})[_0xb00b('0x16')](function(){return _0xe5b66f;})['then'](respondWithResult(_0x12cc9d,null))[_0xb00b('0x30')](handleError(_0x12cc9d,null));};exports[_0xb00b('0xae')]=function(_0x4d30c3,_0x5099fd){return db[_0xb00b('0x2d')][_0xb00b('0x20')]({'where':{'id':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](handleEntityNotFound(_0x5099fd,null))['then'](function(_0x45b2e1){if(_0x45b2e1){return _0x45b2e1[_0xb00b('0xae')](_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')]);}})[_0xb00b('0x16')](function(_0x5e12dc){if(_0x5e12dc){return db[_0xb00b('0x5a')][_0xb00b('0x17')]({'where':{'ListId':_0x4d30c3[_0xb00b('0x35')][_0xb00b('0x6d')],'VoiceQueueId':_0x4d30c3[_0xb00b('0x32')]['id']}})[_0xb00b('0x16')](function(){return _0x5e12dc;});}})[_0xb00b('0x16')](respondWithStatusCode(_0x5099fd,null))[_0xb00b('0x30')](handleError(_0x5099fd,null));};
\ No newline at end of file