Built motion from commit f7863d46.|2.5.41
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index 40a512f..435664e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4990=['options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','user','UserProfileSection','userProfileId','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','CmHopperFinal','CmHopperBlack','Team','getTeams','teams','User','Agents','interface','flatMap','forEach','penalty','sequelize','transaction','addTeams','TeamVoiceQueue','upsert','each','findOrCreate','UserVoiceQueueRt','isNil','format','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','ids','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','voicePause','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','cm_hopper','onlyIfOpen','insert','into','cm_contacts','phone\x20IS\x20NOT\x20NULL','COALESCE(phone,\x27\x27)','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','status','count','set','Content-Range','apply','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','type','find','name','UserProfileResource','error','send','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','offset','order','sort','where','pick','merge','VIRTUAL','VoiceQueue','includeAll','findAll','rows','catch','show','params','include'];(function(_0x19a087,_0xb1ff28){var _0x1785f6=function(_0x23725b){while(--_0x23725b){_0x19a087['push'](_0x19a087['shift']());}};_0x1785f6(++_0xb1ff28);}(_0x4990,0x11a));var _0x0499=function(_0x5be8cc,_0x4a6037){_0x5be8cc=_0x5be8cc-0x0;var _0x5f1b7e=_0x4990[_0x5be8cc];return _0x5f1b7e;};'use strict';var pdf=require(_0x0499('0x0'));var emlformat=require(_0x0499('0x1'));var rimraf=require(_0x0499('0x2'));var zipdir=require(_0x0499('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0499('0x4'));var moment=require('moment');var BPromise=require(_0x0499('0x5'));var Mustache=require(_0x0499('0x6'));var util=require(_0x0499('0x7'));var path=require(_0x0499('0x8'));var sox=require(_0x0499('0x9'));var csv=require(_0x0499('0xa'));var ejs=require(_0x0499('0xb'));var fs=require('fs');var _=require(_0x0499('0xc'));var squel=require('squel');var crypto=require(_0x0499('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0499('0xe'));var toCsv=require(_0x0499('0xa'));var querystring=require('querystring');var Papa=require(_0x0499('0xf'));var Redis=require(_0x0499('0x10'));var authService=require(_0x0499('0x11'));var qs=require(_0x0499('0x12'));var as=require(_0x0499('0x13'));var hardwareService=require(_0x0499('0x14'));var logger=require('../../config/logger')(_0x0499('0x15'));var utils=require(_0x0499('0x16'));var config=require(_0x0499('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x0499('0x18')](config['redis'],{'host':_0x0499('0x19'),'port':0x18eb});var socket=require(_0x0499('0x1a'))(new Redis(config['redis']));require(_0x0499('0x1b'))[_0x0499('0x1c')](socket);function respondWithStatusCode(_0x1c6a4a,_0x1f555a){_0x1f555a=_0x1f555a||0xcc;return function(_0x58ef44){if(_0x58ef44){return _0x1c6a4a[_0x0499('0x1d')](_0x1f555a);}return _0x1c6a4a['status'](_0x1f555a)[_0x0499('0x1e')]();};}function respondWithResult(_0x23fef6,_0x29762c){_0x29762c=_0x29762c||0xc8;return function(_0x1c1420){if(_0x1c1420){return _0x23fef6[_0x0499('0x1f')](_0x29762c)['json'](_0x1c1420);}};}function respondWithFilteredResult(_0x3c0bd2,_0x5343e7){return function(_0x460dae){if(_0x460dae){var _0x5b3c17=_0x460dae[_0x0499('0x20')],_0x3b8e86=_0x5343e7['offset'],_0x59f44e=_0x5343e7['offset']+_0x5343e7['limit'],_0x5dab37;if(_0x59f44e>=_0x5b3c17){_0x59f44e=_0x5b3c17;_0x5dab37=0xc8;}else{_0x5dab37=0xce;}_0x3c0bd2[_0x0499('0x1f')](_0x5dab37);return _0x3c0bd2[_0x0499('0x21')](_0x0499('0x22'),_0x3b8e86+'-'+_0x59f44e+'/'+_0x5b3c17)['json'](_0x460dae);}return null;};}function patchUpdates(_0x3166df){return function(_0x3cab4e){try{jsonpatch[_0x0499('0x23')](_0x3cab4e,_0x3166df,!![]);}catch(_0x34a6aa){return BPromise['reject'](_0x34a6aa);}return _0x3cab4e['save']();};}function saveUpdates(_0x2d1bd7,_0x51b1dd){return function(_0x53ed02){if(_0x53ed02){return _0x53ed02[_0x0499('0x24')](_0x2d1bd7)['then'](function(_0x1da232){return _0x1da232;});}return null;};}function removeEntity(_0x95e4ab,_0x396bdb){return function(_0x3ed348){if(_0x3ed348){return _0x3ed348[_0x0499('0x25')]()[_0x0499('0x26')](function(){var _0x4cbe9d=_0x3ed348[_0x0499('0x27')]({'plain':!![]});var _0x117b1d=[{'name':_0x0499('0x28'),'value':_0x0499('0x29'),'ignore':![]},{'name':_0x0499('0x2a'),'value':_0x0499('0x2b'),'ignore':![]}];var _0x389898=_(_0x117b1d)[_0x0499('0x2c')](_0x0499('0x2d'))[_0x0499('0x2e')](_0x0499('0x2f'))[_0x0499('0x2f')]();if(_['includes'](_0x389898,_0x4cbe9d[_0x0499('0x30')])){return;}var _0x3be255=_[_0x0499('0x31')](_0x117b1d,[_0x0499('0x2f'),_0x4cbe9d[_0x0499('0x30')]])[_0x0499('0x32')];return db[_0x0499('0x33')][_0x0499('0x25')]({'where':{'type':_0x3be255,'resourceId':_0x4cbe9d['id']}})[_0x0499('0x26')](function(){return _0x3ed348;});})[_0x0499('0x26')](function(){_0x95e4ab['status'](0xcc)[_0x0499('0x1e')]();});}};}function handleEntityNotFound(_0x11c8c6,_0x6be50e){return function(_0x23e430){if(!_0x23e430){_0x11c8c6[_0x0499('0x1d')](0x194);}return _0x23e430;};}function handleError(_0x47231d,_0x6cd2db){_0x6cd2db=_0x6cd2db||0x1f4;return function(_0x1d9972){logger[_0x0499('0x34')](_0x1d9972['stack']);if(_0x1d9972[_0x0499('0x32')]){delete _0x1d9972[_0x0499('0x32')];}_0x47231d['status'](_0x6cd2db)[_0x0499('0x35')](_0x1d9972);};}exports['index']=function(_0x1b2bc2,_0x4f815c){var _0x37dcc1={},_0x12a550={},_0xcd483e={'count':0x0,'rows':[]};var _0x1ca34e=_['map'](db['VoiceQueue'][_0x0499('0x36')],function(_0x48f080){return{'name':_0x48f080[_0x0499('0x37')],'type':_0x48f080[_0x0499('0x30')]['key']};});_0x12a550[_0x0499('0x38')]=_[_0x0499('0x2e')](_0x1ca34e,_0x0499('0x32'));_0x12a550['query']=_[_0x0499('0x39')](_0x1b2bc2[_0x0499('0x3a')]);_0x12a550[_0x0499('0x3b')]=_['intersection'](_0x12a550['model'],_0x12a550[_0x0499('0x3a')]);_0x37dcc1['attributes']=_[_0x0499('0x3c')](_0x12a550['model'],qs[_0x0499('0x3d')](_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x3d')]));_0x37dcc1[_0x0499('0x3e')]=_0x37dcc1['attributes'][_0x0499('0x3f')]?_0x37dcc1['attributes']:_0x12a550['model'];if(!_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x40')](_0x0499('0x41'))){_0x37dcc1[_0x0499('0x42')]=qs['limit'](_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x42')]);_0x37dcc1['offset']=qs[_0x0499('0x43')](_0x1b2bc2['query']['offset']);}_0x37dcc1[_0x0499('0x44')]=qs[_0x0499('0x45')](_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x45')]);_0x37dcc1[_0x0499('0x46')]=qs['filters'](_[_0x0499('0x47')](_0x1b2bc2[_0x0499('0x3a')],_0x12a550['filters']),_0x1ca34e);if(_0x1b2bc2[_0x0499('0x3a')]['filter']){_0x37dcc1['where']=_[_0x0499('0x48')](_0x37dcc1[_0x0499('0x46')],{'$or':_['map'](_0x1ca34e,function(_0xab14a4){if(_0xab14a4['type']!==_0x0499('0x49')){var _0x61bdc6={};_0x61bdc6[_0xab14a4[_0x0499('0x32')]]={'$like':'%'+_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x2c')]+'%'};return _0x61bdc6;}})});}_0x37dcc1=_[_0x0499('0x48')]({},_0x37dcc1,_0x1b2bc2['options']);var _0x13d4de={'where':_0x37dcc1[_0x0499('0x46')]};return db[_0x0499('0x4a')][_0x0499('0x20')](_0x13d4de)[_0x0499('0x26')](function(_0x4530d0){_0xcd483e[_0x0499('0x20')]=_0x4530d0;if(_0x1b2bc2[_0x0499('0x3a')][_0x0499('0x4b')]){_0x37dcc1['include']=[{'all':!![]}];}return db[_0x0499('0x4a')][_0x0499('0x4c')](_0x37dcc1);})[_0x0499('0x26')](function(_0x171874){_0xcd483e[_0x0499('0x4d')]=_0x171874;return _0xcd483e;})['then'](respondWithFilteredResult(_0x4f815c,_0x37dcc1))[_0x0499('0x4e')](handleError(_0x4f815c,null));};exports[_0x0499('0x4f')]=function(_0x2b3cf8,_0x5cf2a6){var _0x3f4688={'raw':![],'where':{'id':_0x2b3cf8[_0x0499('0x50')]['id']}},_0x36c81c={};_0x36c81c[_0x0499('0x38')]=_[_0x0499('0x39')](db['VoiceQueue'][_0x0499('0x36')]);_0x36c81c[_0x0499('0x3a')]=_[_0x0499('0x39')](_0x2b3cf8[_0x0499('0x3a')]);_0x36c81c['filters']=_[_0x0499('0x3c')](_0x36c81c[_0x0499('0x38')],_0x36c81c[_0x0499('0x3a')]);_0x3f4688[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x36c81c[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x2b3cf8[_0x0499('0x3a')][_0x0499('0x3d')]));_0x3f4688[_0x0499('0x3e')]=_0x3f4688[_0x0499('0x3e')]['length']?_0x3f4688['attributes']:_0x36c81c[_0x0499('0x38')];if(_0x2b3cf8[_0x0499('0x3a')][_0x0499('0x4b')]){_0x3f4688[_0x0499('0x51')]=[{'all':!![]}];}_0x3f4688=_['merge']({},_0x3f4688,_0x2b3cf8[_0x0499('0x52')]);return db[_0x0499('0x4a')][_0x0499('0x31')](_0x3f4688)[_0x0499('0x26')](handleEntityNotFound(_0x5cf2a6,null))['then'](respondWithResult(_0x5cf2a6,null))[_0x0499('0x4e')](handleError(_0x5cf2a6,null));};exports[_0x0499('0x53')]=function(_0x2b33b4,_0x1f93cb){return db[_0x0499('0x4a')][_0x0499('0x53')](_0x2b33b4[_0x0499('0x54')],{})[_0x0499('0x26')](function(_0x262432){var _0x1822ac=_0x2b33b4['user'][_0x0499('0x27')]({'plain':!![]});if(!_0x1822ac)throw new Error(_0x0499('0x55'));if(_0x1822ac[_0x0499('0x56')]==='user'){var _0x1b9c38=_0x262432[_0x0499('0x27')]({'plain':!![]});var _0x432de1=[{'name':'VoiceQueues','value':_0x0499('0x29')},{'name':_0x0499('0x2a'),'value':_0x0499('0x2b')}];var _0x20826b=_[_0x0499('0x31')](_0x432de1,[_0x0499('0x2f'),_0x1b9c38[_0x0499('0x30')]])['name'];return db['UserProfileSection']['find']({'where':{'name':_0x20826b,'userProfileId':_0x1822ac['userProfileId']},'raw':!![]})[_0x0499('0x26')](function(_0x3cd4d3){if(_0x3cd4d3&&_0x3cd4d3[_0x0499('0x57')]===0x0){return db[_0x0499('0x33')][_0x0499('0x53')]({'name':_0x1b9c38['name'],'resourceId':_0x1b9c38['id'],'type':_0x3cd4d3[_0x0499('0x32')],'sectionId':_0x3cd4d3['id']},{})[_0x0499('0x26')](function(){return _0x262432;});}else{return _0x262432;}})[_0x0499('0x4e')](function(_0x397392){logger[_0x0499('0x34')](_0x0499('0x58'),_0x397392);throw _0x397392;});}return _0x262432;})[_0x0499('0x26')](respondWithResult(_0x1f93cb,0xc9))['catch'](handleError(_0x1f93cb,null));};exports['clone']=function(_0x2d10f6,_0xcb4448){var _0x2ba045={'where':{'id':_0x2d10f6[_0x0499('0x50')]['id']}},_0x8f4f40={};_0x8f4f40[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x4a')][_0x0499('0x36')]);_0x2ba045[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x8f4f40['model'],qs[_0x0499('0x3d')](_0x2d10f6[_0x0499('0x3a')][_0x0499('0x3d')]));_0x2ba045[_0x0499('0x3e')]=_0x2ba045[_0x0499('0x3e')][_0x0499('0x3f')]?_0x2ba045[_0x0499('0x3e')]:_0x8f4f40['model'];if(_0x2d10f6['query']['includeAll']){_0x2ba045[_0x0499('0x51')]=[{'all':!![]}];}_0x2ba045=_[_0x0499('0x48')]({},_0x2ba045,_0x2d10f6[_0x0499('0x52')]);return db[_0x0499('0x4a')][_0x0499('0x31')](_0x2ba045)[_0x0499('0x26')](handleEntityNotFound(_0xcb4448,null))[_0x0499('0x26')](function(_0x575124){if(_0x575124){var _0x38a6e4=_0x575124['get']({'plain':!![]});_0x38a6e4=qs[_0x0499('0x59')](_0x38a6e4,['id',_0x0499('0x5a'),_0x0499('0x5b')]);_0x2d10f6[_0x0499('0x54')]=_[_0x0499('0x59')](_0x2d10f6[_0x0499('0x54')],['id',_0x0499('0x5a'),_0x0499('0x5b')]);return db['VoiceQueue'][_0x0499('0x53')](_['merge'](_0x38a6e4,_0x2d10f6[_0x0499('0x54')]),{'include':_0x2d10f6[_0x0499('0x3a')][_0x0499('0x4b')]?[{'all':!![]}]:undefined})[_0x0499('0x26')](function(_0x2e549b){var _0x563eae=_0x2d10f6['user']['get']({'plain':!![]});if(!_0x563eae)throw new Error(_0x0499('0x55'));if(_0x563eae['role']===_0x0499('0x5c')){var _0x3c15dd=_0x2e549b[_0x0499('0x27')]({'plain':!![]});var _0x51048f=[{'name':'VoiceQueues','value':_0x0499('0x29')},{'name':_0x0499('0x2a'),'value':_0x0499('0x2b')}];var _0xd6f199=_['find'](_0x51048f,['value',_0x3c15dd[_0x0499('0x30')]])[_0x0499('0x32')];return db[_0x0499('0x5d')][_0x0499('0x31')]({'where':{'name':_0xd6f199,'userProfileId':_0x563eae[_0x0499('0x5e')]},'raw':!![]})['then'](function(_0x22203a){if(_0x22203a&&_0x22203a[_0x0499('0x57')]===0x0){return db['UserProfileResource'][_0x0499('0x53')]({'name':_0x3c15dd['name'],'resourceId':_0x3c15dd['id'],'type':_0x22203a['name'],'sectionId':_0x22203a['id']},{})[_0x0499('0x26')](function(){return _0x2e549b;});}else{return _0x2e549b;}})[_0x0499('0x4e')](function(_0x498279){logger[_0x0499('0x34')](_0x0499('0x58'),_0x498279);throw _0x498279;});}return _0x2e549b;});}})[_0x0499('0x26')](respondWithResult(_0xcb4448,0xc9))[_0x0499('0x4e')](handleError(_0xcb4448,null));};exports[_0x0499('0x24')]=function(_0x441bde,_0x2438b6){if(_0x441bde[_0x0499('0x54')]['id']){delete _0x441bde[_0x0499('0x54')]['id'];}return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x441bde[_0x0499('0x50')]['id']}})['then'](handleEntityNotFound(_0x2438b6,null))[_0x0499('0x26')](saveUpdates(_0x441bde[_0x0499('0x54')],null))['then'](respondWithResult(_0x2438b6,null))['catch'](handleError(_0x2438b6,null));};exports['destroy']=function(_0x2fa114,_0x28d7b6){return db['VoiceQueue'][_0x0499('0x31')]({'where':{'id':_0x2fa114[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x28d7b6,null))['then'](removeEntity(_0x28d7b6,null))[_0x0499('0x4e')](handleError(_0x28d7b6,null));};exports[_0x0499('0x5f')]=function(_0x5ecf60,_0x196f30,_0x349b47){var _0x936ea={'raw':![],'where':{}};var _0x1ff364={};var _0x1a75f8={'count':0x0,'rows':[]};return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0x5ecf60['params']['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x196f30,null))[_0x0499('0x26')](function(_0xf75e4f){if(_0xf75e4f){_0x1ff364['model']=_[_0x0499('0x39')](db[_0x0499('0x61')][_0x0499('0x36')]);_0x1ff364[_0x0499('0x3a')]=_[_0x0499('0x39')](_0x5ecf60[_0x0499('0x3a')]);_0x1ff364[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x1ff364['model'],_0x1ff364[_0x0499('0x3a')]);_0x936ea[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x1ff364[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x5ecf60['query'][_0x0499('0x3d')]));_0x936ea[_0x0499('0x3e')]=_0x936ea[_0x0499('0x3e')][_0x0499('0x3f')]?_0x936ea[_0x0499('0x3e')]:_0x1ff364[_0x0499('0x38')];if(!_0x5ecf60['query'][_0x0499('0x40')]('nolimit')){_0x936ea['limit']=qs[_0x0499('0x42')](_0x5ecf60[_0x0499('0x3a')]['limit']);_0x936ea[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x5ecf60[_0x0499('0x3a')]['offset']);}_0x936ea['order']=qs[_0x0499('0x45')](_0x5ecf60[_0x0499('0x3a')][_0x0499('0x45')]);_0x936ea['where']=qs[_0x0499('0x3b')](_[_0x0499('0x47')](_0x5ecf60['query'],_0x1ff364['filters']));_0x936ea[_0x0499('0x46')][_0x0499('0x62')]=_0xf75e4f['id'];if(_0x5ecf60['query'][_0x0499('0x2c')]){_0x936ea[_0x0499('0x46')]=_[_0x0499('0x48')](_0x936ea[_0x0499('0x46')],{'$or':_['map'](_0x936ea[_0x0499('0x3e')],function(_0x486197){var _0x27c174={};_0x27c174[_0x486197]={'$like':'%'+_0x5ecf60['query'][_0x0499('0x2c')]+'%'};return _0x27c174;})});}_0x936ea=_[_0x0499('0x48')]({},_0x936ea,_0x5ecf60[_0x0499('0x52')]);return db[_0x0499('0x61')][_0x0499('0x20')]({'where':_0x936ea[_0x0499('0x46')]})[_0x0499('0x26')](function(_0x10d33e){_0x1a75f8['count']=_0x10d33e;if(_0x5ecf60[_0x0499('0x3a')][_0x0499('0x4b')]){_0x936ea[_0x0499('0x51')]=[{'all':!![]}];}return db[_0x0499('0x61')][_0x0499('0x4c')](_0x936ea);})[_0x0499('0x26')](function(_0x238866){_0x1a75f8[_0x0499('0x4d')]=_0x238866;return _0x1a75f8;});}})[_0x0499('0x26')](respondWithFilteredResult(_0x196f30,_0x936ea))[_0x0499('0x4e')](handleError(_0x196f30,null));};exports[_0x0499('0x63')]=function(_0x3e7f7,_0x42b2e9,_0x246b8e){var _0x419035={'raw':!![],'where':{}};var _0x450d5e={};var _0x2ce792={'count':0x0,'rows':[]};return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0x3e7f7[_0x0499('0x50')]['id']}})['then'](handleEntityNotFound(_0x42b2e9,null))[_0x0499('0x26')](function(_0x298b82){if(_0x298b82){_0x450d5e[_0x0499('0x38')]=_['keys'](db[_0x0499('0x64')]['rawAttributes']);_0x450d5e['query']=_[_0x0499('0x39')](_0x3e7f7[_0x0499('0x3a')]);_0x450d5e[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x450d5e[_0x0499('0x38')],_0x450d5e['query']);_0x419035[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x450d5e[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x3e7f7[_0x0499('0x3a')][_0x0499('0x3d')]));_0x419035[_0x0499('0x3e')]=_0x419035[_0x0499('0x3e')][_0x0499('0x3f')]?_0x419035[_0x0499('0x3e')]:_0x450d5e[_0x0499('0x38')];if(!_0x3e7f7['query'][_0x0499('0x40')](_0x0499('0x41'))){_0x419035['limit']=qs[_0x0499('0x42')](_0x3e7f7[_0x0499('0x3a')][_0x0499('0x42')]);_0x419035[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x3e7f7[_0x0499('0x3a')][_0x0499('0x43')]);}_0x419035[_0x0499('0x44')]=qs[_0x0499('0x45')](_0x3e7f7[_0x0499('0x3a')][_0x0499('0x45')]);_0x419035[_0x0499('0x46')]=qs[_0x0499('0x3b')](_['pick'](_0x3e7f7[_0x0499('0x3a')],_0x450d5e[_0x0499('0x3b')]));_0x419035[_0x0499('0x46')][_0x0499('0x62')]=_0x298b82['id'];if(_0x3e7f7[_0x0499('0x3a')][_0x0499('0x2c')]){_0x419035[_0x0499('0x46')]=_[_0x0499('0x48')](_0x419035['where'],{'$or':_['map'](_0x419035['attributes'],function(_0x4e0fe1){var _0x3a5263={};_0x3a5263[_0x4e0fe1]={'$like':'%'+_0x3e7f7[_0x0499('0x3a')][_0x0499('0x2c')]+'%'};return _0x3a5263;})});}_0x419035=_[_0x0499('0x48')]({},_0x419035,_0x3e7f7[_0x0499('0x52')]);return db[_0x0499('0x64')][_0x0499('0x20')]({'where':_0x419035[_0x0499('0x46')]})[_0x0499('0x26')](function(_0x4e9b95){_0x2ce792[_0x0499('0x20')]=_0x4e9b95;if(_0x3e7f7['query'][_0x0499('0x4b')]){_0x419035[_0x0499('0x51')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x0499('0x4c')](_0x419035);})[_0x0499('0x26')](function(_0x43523b){_0x2ce792[_0x0499('0x4d')]=_0x43523b;return _0x2ce792;});}})[_0x0499('0x26')](respondWithFilteredResult(_0x42b2e9,_0x419035))[_0x0499('0x4e')](handleError(_0x42b2e9,null));};exports['getHopperFinals']=function(_0x49e90f,_0x219eeb,_0x3c25a3){var _0x19f2d3={'raw':!![],'where':{}};var _0x2369b7={};var _0x151508={'count':0x0,'rows':[]};return db[_0x0499('0x4a')]['findOne']({'where':{'id':_0x49e90f[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x219eeb,null))[_0x0499('0x26')](function(_0x167a04){if(_0x167a04){_0x2369b7[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x65')][_0x0499('0x36')]);_0x2369b7[_0x0499('0x3a')]=_[_0x0499('0x39')](_0x49e90f[_0x0499('0x3a')]);_0x2369b7[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x2369b7['model'],_0x2369b7[_0x0499('0x3a')]);_0x19f2d3['attributes']=_['intersection'](_0x2369b7[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x49e90f[_0x0499('0x3a')][_0x0499('0x3d')]));_0x19f2d3[_0x0499('0x3e')]=_0x19f2d3['attributes'][_0x0499('0x3f')]?_0x19f2d3['attributes']:_0x2369b7[_0x0499('0x38')];if(!_0x49e90f['query']['hasOwnProperty'](_0x0499('0x41'))){_0x19f2d3[_0x0499('0x42')]=qs[_0x0499('0x42')](_0x49e90f[_0x0499('0x3a')][_0x0499('0x42')]);_0x19f2d3['offset']=qs[_0x0499('0x43')](_0x49e90f['query']['offset']);}_0x19f2d3[_0x0499('0x44')]=qs[_0x0499('0x45')](_0x49e90f['query']['sort']);_0x19f2d3[_0x0499('0x46')]=qs[_0x0499('0x3b')](_[_0x0499('0x47')](_0x49e90f[_0x0499('0x3a')],_0x2369b7['filters']));_0x19f2d3['where'][_0x0499('0x62')]=_0x167a04['id'];if(_0x49e90f['query']['filter']){_0x19f2d3['where']=_[_0x0499('0x48')](_0x19f2d3[_0x0499('0x46')],{'$or':_['map'](_0x19f2d3[_0x0499('0x3e')],function(_0x28ade8){var _0x3f1e08={};_0x3f1e08[_0x28ade8]={'$like':'%'+_0x49e90f['query'][_0x0499('0x2c')]+'%'};return _0x3f1e08;})});}_0x19f2d3=_[_0x0499('0x48')]({},_0x19f2d3,_0x49e90f[_0x0499('0x52')]);return db[_0x0499('0x65')][_0x0499('0x20')]({'where':_0x19f2d3[_0x0499('0x46')]})[_0x0499('0x26')](function(_0x29b8b9){_0x151508[_0x0499('0x20')]=_0x29b8b9;if(_0x49e90f[_0x0499('0x3a')][_0x0499('0x4b')]){_0x19f2d3[_0x0499('0x51')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x19f2d3);})[_0x0499('0x26')](function(_0x360bb7){_0x151508[_0x0499('0x4d')]=_0x360bb7;return _0x151508;});}})[_0x0499('0x26')](respondWithFilteredResult(_0x219eeb,_0x19f2d3))[_0x0499('0x4e')](handleError(_0x219eeb,null));};exports['getHopperBlacks']=function(_0x3e886e,_0x250b7c,_0x3264fc){var _0x370283={'raw':!![],'where':{}};var _0x426154={};var _0x5f3f35={'count':0x0,'rows':[]};return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0x3e886e[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x250b7c,null))[_0x0499('0x26')](function(_0x26fde2){if(_0x26fde2){_0x426154[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x66')]['rawAttributes']);_0x426154[_0x0499('0x3a')]=_[_0x0499('0x39')](_0x3e886e['query']);_0x426154[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x426154[_0x0499('0x38')],_0x426154[_0x0499('0x3a')]);_0x370283[_0x0499('0x3e')]=_['intersection'](_0x426154[_0x0499('0x38')],qs['fields'](_0x3e886e['query'][_0x0499('0x3d')]));_0x370283[_0x0499('0x3e')]=_0x370283[_0x0499('0x3e')][_0x0499('0x3f')]?_0x370283[_0x0499('0x3e')]:_0x426154[_0x0499('0x38')];if(!_0x3e886e['query'][_0x0499('0x40')](_0x0499('0x41'))){_0x370283[_0x0499('0x42')]=qs[_0x0499('0x42')](_0x3e886e[_0x0499('0x3a')][_0x0499('0x42')]);_0x370283[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x3e886e[_0x0499('0x3a')]['offset']);}_0x370283[_0x0499('0x44')]=qs['sort'](_0x3e886e['query'][_0x0499('0x45')]);_0x370283[_0x0499('0x46')]=qs['filters'](_[_0x0499('0x47')](_0x3e886e[_0x0499('0x3a')],_0x426154[_0x0499('0x3b')]));_0x370283[_0x0499('0x46')][_0x0499('0x62')]=_0x26fde2['id'];if(_0x3e886e['query']['filter']){_0x370283[_0x0499('0x46')]=_[_0x0499('0x48')](_0x370283[_0x0499('0x46')],{'$or':_[_0x0499('0x2e')](_0x370283[_0x0499('0x3e')],function(_0x4db38a){var _0x1626b0={};_0x1626b0[_0x4db38a]={'$like':'%'+_0x3e886e[_0x0499('0x3a')][_0x0499('0x2c')]+'%'};return _0x1626b0;})});}_0x370283=_[_0x0499('0x48')]({},_0x370283,_0x3e886e[_0x0499('0x52')]);return db[_0x0499('0x66')]['count']({'where':_0x370283[_0x0499('0x46')]})[_0x0499('0x26')](function(_0x1d2f4c){_0x5f3f35[_0x0499('0x20')]=_0x1d2f4c;if(_0x3e886e[_0x0499('0x3a')][_0x0499('0x4b')]){_0x370283[_0x0499('0x51')]=[{'all':!![]}];}return db[_0x0499('0x66')]['findAll'](_0x370283);})[_0x0499('0x26')](function(_0x5d7830){_0x5f3f35[_0x0499('0x4d')]=_0x5d7830;return _0x5f3f35;});}})[_0x0499('0x26')](respondWithFilteredResult(_0x250b7c,_0x370283))[_0x0499('0x4e')](handleError(_0x250b7c,null));};exports['getTeams']=function(_0x2493b2,_0x1222c3,_0x5248d8){var _0x56acce={};var _0x352e48={};var _0x4e62d7;var _0x36b3e8;return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0x2493b2['params']['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x1222c3,null))[_0x0499('0x26')](function(_0x32d204){if(_0x32d204){_0x4e62d7=_0x32d204;_0x352e48[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x67')][_0x0499('0x36')]);_0x352e48['query']=_[_0x0499('0x39')](_0x2493b2['query']);_0x352e48[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x352e48['model'],_0x352e48[_0x0499('0x3a')]);_0x56acce[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x352e48['model'],qs[_0x0499('0x3d')](_0x2493b2[_0x0499('0x3a')][_0x0499('0x3d')]));_0x56acce[_0x0499('0x3e')]=_0x56acce[_0x0499('0x3e')]['length']?_0x56acce[_0x0499('0x3e')]:_0x352e48['model'];_0x56acce['order']=qs[_0x0499('0x45')](_0x2493b2['query'][_0x0499('0x45')]);_0x56acce['where']=qs[_0x0499('0x3b')](_[_0x0499('0x47')](_0x2493b2[_0x0499('0x3a')],_0x352e48[_0x0499('0x3b')]));if(_0x2493b2[_0x0499('0x3a')][_0x0499('0x2c')]){_0x56acce[_0x0499('0x46')]=_[_0x0499('0x48')](_0x56acce['where'],{'$or':_[_0x0499('0x2e')](_0x56acce[_0x0499('0x3e')],function(_0x141fb3){var _0x5f1cdd={};_0x5f1cdd[_0x141fb3]={'$like':'%'+_0x2493b2['query'][_0x0499('0x2c')]+'%'};return _0x5f1cdd;})});}_0x56acce=_[_0x0499('0x48')]({},_0x56acce,_0x2493b2['options']);return _0x4e62d7[_0x0499('0x68')](_0x56acce);}})[_0x0499('0x26')](function(_0x407630){if(_0x407630){_0x36b3e8=_0x407630[_0x0499('0x3f')];if(!_0x2493b2[_0x0499('0x3a')]['hasOwnProperty']('nolimit')){_0x56acce[_0x0499('0x42')]=qs[_0x0499('0x42')](_0x2493b2[_0x0499('0x3a')][_0x0499('0x42')]);_0x56acce[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x2493b2['query']['offset']);}return _0x4e62d7['getTeams'](_0x56acce);}})[_0x0499('0x26')](function(_0x3d8d53){if(_0x3d8d53){return _0x3d8d53?{'count':_0x36b3e8,'rows':_0x3d8d53}:null;}})[_0x0499('0x26')](respondWithResult(_0x1222c3,null))[_0x0499('0x4e')](handleError(_0x1222c3,null));};exports['addTeams']=function(_0x5550ce,_0x17f760,_0x2d8544){var _0x6772c1=_0x5550ce[_0x0499('0x54')][_0x0499('0x69')];var _0x1ee815=_['map'](_0x6772c1,'id');return db[_0x0499('0x67')]['findAll']({'where':{'id':_0x1ee815},'attributes':['id'],'include':[{'model':db[_0x0499('0x6a')],'as':_0x0499('0x6b'),'attributes':['id',_0x0499('0x32'),'online','voicePause',_0x0499('0x6c')],'raw':!![]}]})[_0x0499('0x26')](function(_0x5a9a6a){if(_0x5a9a6a){var _0x1ea363=_[_0x0499('0x6d')](_0x5a9a6a,function(_0x4b3459){var _0x448d5e=_0x4b3459[_0x0499('0x27')]({'plain':!![]});_0x448d5e[_0x0499('0x6b')][_0x0499('0x6e')](function(_0x4f3e1a){_0x4f3e1a['penalty']=_['find'](_0x6772c1,{'id':_0x448d5e['id']})[_0x0499('0x6f')];});return _0x448d5e[_0x0499('0x6b')];});return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x5550ce[_0x0499('0x50')]['id']}})[_0x0499('0x26')](function(_0x56207a){return db[_0x0499('0x70')][_0x0499('0x71')](function(_0x9f1fe3){return _0x56207a[_0x0499('0x72')](_0x1ee815,{'transaction':_0x9f1fe3})[_0x0499('0x26')](function(){return BPromise['each'](_0x6772c1,function(_0x138b7b){return db[_0x0499('0x73')][_0x0499('0x74')]({'TeamId':_0x138b7b['id'],'VoiceQueueId':_0x5550ce[_0x0499('0x50')]['id'],'penalty':_0x138b7b[_0x0499('0x6f')]},{'transaction':_0x9f1fe3});});})[_0x0499('0x26')](function(){return BPromise[_0x0499('0x75')](_0x1ea363,function(_0x520e52){return db['UserVoiceQueue'][_0x0499('0x76')]({'where':{'UserId':_0x520e52['id'],'VoiceQueueId':_0x5550ce[_0x0499('0x50')]['id']},'defaults':{'penalty':_0x520e52[_0x0499('0x6f')]},'transaction':_0x9f1fe3});});})[_0x0499('0x26')](function(){return BPromise['each'](_[_0x0499('0x2c')](_0x1ea363,{'online':!![]}),function(_0x8d0bfb){return db[_0x0499('0x77')][_0x0499('0x74')]({'membername':_0x8d0bfb[_0x0499('0x32')],'UserId':_0x8d0bfb['id'],'queue_name':_0x56207a[_0x0499('0x32')],'VoiceQueueId':_0x56207a['id'],'interface':_[_0x0499('0x78')](_0x8d0bfb[_0x0499('0x6c')])?util[_0x0499('0x79')]('SIP/%s',_0x8d0bfb[_0x0499('0x32')]):_0x8d0bfb['interface'],'paused':_0x8d0bfb['voicePause']||![],'penalty':_0x8d0bfb[_0x0499('0x6f')]},{'transaction':_0x9f1fe3});});})[_0x0499('0x26')](function(){_0x1ea363[_0x0499('0x6e')](function(_0x54807f){socket[_0x0499('0x7a')](_0x0499('0x7b'),{'UserId':_0x54807f['id'],'VoiceQueueId':_0x56207a['id']});});});});});}})[_0x0499('0x26')](respondWithStatusCode(_0x17f760,null))[_0x0499('0x4e')](handleError(_0x17f760,null));};exports[_0x0499('0x7c')]=function(_0x415819,_0x4a8721,_0x450d45){return db[_0x0499('0x67')][_0x0499('0x4c')]({'where':{'id':_0x415819[_0x0499('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0x0499('0x6a')],'as':_0x0499('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4a8721,null))[_0x0499('0x26')](function(_0x5e95c7){var _0x586662=_[_0x0499('0x2e')](_0x5e95c7,'id');var _0x131991=[];var _0x218efc=[];var _0x302b81=squel[_0x0499('0x7d')]();_0x302b81[_0x0499('0x7e')](_0x0499('0x7f'))[_0x0499('0x80')](_0x0499('0x81'),'tq')['join'](_0x0499('0x82'),'ut',_0x0499('0x83'))['where'](_0x0499('0x84'),_0x415819[_0x0499('0x50')]['id']);for(var _0x51e90c=0x0;_0x51e90c<_0x5e95c7[_0x0499('0x3f')];_0x51e90c+=0x1){let _0x3adf79=_0x5e95c7[_0x51e90c];for(var _0x30474c=0x0;_0x30474c<_0x3adf79['Agents'][_0x0499('0x3f')];_0x30474c+=0x1){let _0x24f44c=_0x3adf79[_0x0499('0x6b')][_0x30474c];var _0xf24a46=_0x302b81[_0x0499('0x85')]();_0xf24a46['where'](_0x0499('0x86'),_0x24f44c['id']);_0x218efc[_0x0499('0x87')](db[_0x0499('0x70')]['query'](_0xf24a46[_0x0499('0x88')](),{'type':db[_0x0499('0x70')][_0x0499('0x89')][_0x0499('0x8a')]})[_0x0499('0x26')](function(_0x3ac1a0){if(_0x3ac1a0['length']===0x1){return _0x24f44c['id'];}else{var _0x39e65f=_[_0x0499('0x8b')](_[_0x0499('0x2e')](_0x3ac1a0,_0x0499('0x8c')),function(_0x229138){return _[_0x0499('0x8d')](_0x586662,_0x229138);});if(_0x39e65f){return _0x24f44c['id'];}}}));}}return BPromise[_0x0499('0x8e')](_0x218efc)[_0x0499('0x26')](function(_0xfe1edd){_0x131991=_(_0x131991)[_0x0499('0x8f')](_0xfe1edd)[_0x0499('0x90')]()[_0x0499('0x2f')]();return db['VoiceQueue']['find']({'where':{'id':_0x415819[_0x0499('0x50')]['id']}})[_0x0499('0x26')](function(_0x292a81){return db[_0x0499('0x70')]['transaction'](function(_0x2b2d5f){return _0x292a81[_0x0499('0x7c')](_0x415819[_0x0499('0x3a')][_0x0499('0x91')],{'transaction':_0x2b2d5f})['then'](function(){if(!_[_0x0499('0x92')](_0x131991)){return _0x292a81[_0x0499('0x93')](_0x131991,{'transaction':_0x2b2d5f})['then'](function(){return db[_0x0499('0x77')][_0x0499('0x25')]({'where':{'VoiceQueueId':_0x415819['params']['id'],'UserId':_0x131991},'transaction':_0x2b2d5f});});}})[_0x0499('0x26')](function(){_0x131991[_0x0499('0x6e')](function(_0xf37b65){socket[_0x0499('0x7a')](_0x0499('0x94'),{'UserId':_0xf37b65,'VoiceQueueId':_0x292a81['id']});});});});});});})[_0x0499('0x26')](respondWithStatusCode(_0x4a8721,null))[_0x0499('0x4e')](handleError(_0x4a8721,null));};exports[_0x0499('0x95')]=function(_0x4d1eaf,_0x2cc21f,_0x51ba59){var _0x5c4052,_0x143722;return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x4d1eaf[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x2cc21f,null))[_0x0499('0x26')](function(_0x5b924e){if(_0x5b924e){_0x143722=_0x5b924e;return _0x5b924e['addAgents'](_0x4d1eaf[_0x0499('0x54')][_0x0499('0x91')],_[_0x0499('0x59')](_0x4d1eaf[_0x0499('0x54')],['ids','id'])||{})[_0x0499('0x96')](function(_0x37d450){for(var _0x45cc16=0x0;_0x45cc16<_0x4d1eaf[_0x0499('0x54')][_0x0499('0x91')][_0x0499('0x3f')];_0x45cc16+=0x1){socket['emit'](_0x0499('0x7b'),{'UserId':_0x4d1eaf[_0x0499('0x54')][_0x0499('0x91')][_0x45cc16],'VoiceQueueId':_0x4d1eaf[_0x0499('0x50')]['id']});}return _0x37d450;});}})[_0x0499('0x26')](function(_0x370642){_0x5c4052=_0x370642||[];if(_0x143722){return db['User']['findAll']({'where':{'id':_0x4d1eaf[_0x0499('0x54')][_0x0499('0x91')]},'attributes':['id',_0x0499('0x32'),'online','voicePause',_0x0499('0x6c')],'raw':!![]});}})[_0x0499('0x26')](function(_0x57fe5a){if(!_[_0x0499('0x92')](_0x57fe5a)){var _0x224407=[];for(var _0x5d83da=0x0;_0x5d83da<_0x57fe5a[_0x0499('0x3f')];_0x5d83da++){if(_0x57fe5a[_0x5d83da]['online']){_0x224407[_0x0499('0x87')](db[_0x0499('0x77')]['upsert']({'membername':_0x57fe5a[_0x5d83da][_0x0499('0x32')],'UserId':_0x57fe5a[_0x5d83da]['id'],'queue_name':_0x143722['name'],'VoiceQueueId':_0x143722['id'],'interface':_[_0x0499('0x78')](_0x57fe5a[_0x5d83da][_0x0499('0x6c')])?util['format']('SIP/%s',_0x57fe5a[_0x5d83da][_0x0499('0x32')]):_0x57fe5a[_0x5d83da][_0x0499('0x6c')],'paused':_0x57fe5a[_0x5d83da][_0x0499('0x97')]||![],'penalty':_0x4d1eaf['body'][_0x0499('0x6f')]||0x0}));}}return BPromise[_0x0499('0x8e')](_0x224407);}})[_0x0499('0x26')](function(){return _0x5c4052;})[_0x0499('0x26')](respondWithResult(_0x2cc21f,null))[_0x0499('0x4e')](handleError(_0x2cc21f,null));};exports[_0x0499('0x93')]=function(_0x10ab62,_0x35b939,_0x2ae991){return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x10ab62['params']['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x35b939,null))['then'](function(_0x4590a4){if(_0x4590a4){return _0x4590a4[_0x0499('0x93')](_0x10ab62['query']['ids'])[_0x0499('0x26')](function(){if(_[_0x0499('0x98')](_0x10ab62['query'][_0x0499('0x91')])){for(var _0x5d481a=0x0;_0x5d481a<_0x10ab62[_0x0499('0x3a')][_0x0499('0x91')]['length'];_0x5d481a+=0x1){socket[_0x0499('0x7a')](_0x0499('0x94'),{'UserId':Number(_0x10ab62[_0x0499('0x3a')]['ids'][_0x5d481a]),'VoiceQueueId':Number(_0x10ab62[_0x0499('0x50')]['id'])});}}else{socket[_0x0499('0x7a')]('userVoiceQueue:remove',{'UserId':Number(_0x10ab62[_0x0499('0x3a')][_0x0499('0x91')]),'VoiceQueueId':Number(_0x10ab62['params']['id'])});}});}})[_0x0499('0x26')](function(_0x3ccede){return db[_0x0499('0x77')][_0x0499('0x25')]({'where':{'VoiceQueueId':_0x10ab62[_0x0499('0x50')]['id'],'UserId':_0x10ab62['query'][_0x0499('0x91')]}})[_0x0499('0x26')](function(){return _0x3ccede;});})[_0x0499('0x26')](respondWithStatusCode(_0x35b939,null))[_0x0499('0x4e')](handleError(_0x35b939,null));};exports[_0x0499('0x99')]=function(_0xa44d0e,_0x29735f,_0x849a52){var _0x41c2a2={};var _0x39ff64={};var _0x2e4e50;var _0x1a4a14;return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0xa44d0e[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x29735f,null))[_0x0499('0x26')](function(_0x15dd1b){if(_0x15dd1b){_0x2e4e50=_0x15dd1b;_0x39ff64[_0x0499('0x38')]=_['keys'](db[_0x0499('0x6a')][_0x0499('0x36')]);_0x39ff64['query']=_['keys'](_0xa44d0e[_0x0499('0x3a')]);_0x39ff64[_0x0499('0x3b')]=_['intersection'](_0x39ff64[_0x0499('0x38')],_0x39ff64[_0x0499('0x3a')]);_0x41c2a2[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x39ff64['model'],qs[_0x0499('0x3d')](_0xa44d0e[_0x0499('0x3a')]['fields']));_0x41c2a2[_0x0499('0x3e')]=_0x41c2a2[_0x0499('0x3e')][_0x0499('0x3f')]?_0x41c2a2[_0x0499('0x3e')]:_0x39ff64[_0x0499('0x38')];_0x41c2a2[_0x0499('0x44')]=qs[_0x0499('0x45')](_0xa44d0e[_0x0499('0x3a')]['sort']);_0x41c2a2['where']=qs['filters'](_[_0x0499('0x47')](_0xa44d0e[_0x0499('0x3a')],_0x39ff64[_0x0499('0x3b')]));if(_0xa44d0e['query']['filter']){_0x41c2a2['where']=_[_0x0499('0x48')](_0x41c2a2[_0x0499('0x46')],{'$or':_['map'](_0x41c2a2['attributes'],function(_0x1a3dfd){var _0x13a072={};_0x13a072[_0x1a3dfd]={'$like':'%'+_0xa44d0e[_0x0499('0x3a')][_0x0499('0x2c')]+'%'};return _0x13a072;})});}_0x41c2a2=_[_0x0499('0x48')]({},_0x41c2a2,_0xa44d0e[_0x0499('0x52')]);return _0x2e4e50[_0x0499('0x99')](_0x41c2a2);}})[_0x0499('0x26')](function(_0x51eba1){if(_0x51eba1){_0x1a4a14=_0x51eba1['length'];if(!_0xa44d0e[_0x0499('0x3a')][_0x0499('0x40')]('nolimit')){_0x41c2a2['limit']=qs[_0x0499('0x42')](_0xa44d0e[_0x0499('0x3a')][_0x0499('0x42')]);_0x41c2a2[_0x0499('0x43')]=qs[_0x0499('0x43')](_0xa44d0e[_0x0499('0x3a')][_0x0499('0x43')]);}return _0x2e4e50['getAgents'](_0x41c2a2);}})[_0x0499('0x26')](function(_0x3cfd29){if(_0x3cfd29){return _0x3cfd29?{'count':_0x1a4a14,'rows':_0x3cfd29}:null;}})[_0x0499('0x26')](respondWithResult(_0x29735f,null))[_0x0499('0x4e')](handleError(_0x29735f,null));};exports[_0x0499('0x9a')]=function(_0x52816a,_0x473cf3,_0x293ded){var _0x542fb5={};var _0x266aab={};var _0x2e3680;var _0x5d9b61;return db['VoiceQueue'][_0x0499('0x60')]({'where':{'id':_0x52816a[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x473cf3,null))[_0x0499('0x26')](function(_0x961448){if(_0x961448){_0x2e3680=_0x961448;_0x266aab['model']=_[_0x0499('0x39')](db['UserVoiceQueueRt'][_0x0499('0x36')]);_0x266aab[_0x0499('0x3a')]=_['keys'](_0x52816a[_0x0499('0x3a')]);_0x266aab[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x266aab['model'],_0x266aab[_0x0499('0x3a')]);_0x542fb5[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x266aab[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x52816a[_0x0499('0x3a')][_0x0499('0x3d')]));_0x542fb5[_0x0499('0x3e')]=_0x542fb5[_0x0499('0x3e')]['length']?_0x542fb5['attributes']:_0x266aab['model'];_0x542fb5[_0x0499('0x44')]=qs[_0x0499('0x45')](_0x52816a['query'][_0x0499('0x45')]);_0x542fb5[_0x0499('0x46')]=qs['filters'](_[_0x0499('0x47')](_0x52816a['query'],_0x266aab['filters']));if(_0x52816a[_0x0499('0x3a')]['filter']){_0x542fb5['where']=_[_0x0499('0x48')](_0x542fb5[_0x0499('0x46')],{'$or':_[_0x0499('0x2e')](_0x542fb5[_0x0499('0x3e')],function(_0x113063){var _0x46066f={};_0x46066f[_0x113063]={'$like':'%'+_0x52816a[_0x0499('0x3a')]['filter']+'%'};return _0x46066f;})});}_0x542fb5=_[_0x0499('0x48')]({},_0x542fb5,_0x52816a[_0x0499('0x52')]);return _0x2e3680[_0x0499('0x9a')](_0x542fb5);}})[_0x0499('0x26')](function(_0x58b51e){if(_0x58b51e){_0x5d9b61=_0x58b51e[_0x0499('0x3f')];if(!_0x52816a[_0x0499('0x3a')][_0x0499('0x40')](_0x0499('0x41'))){_0x542fb5[_0x0499('0x42')]=qs['limit'](_0x52816a[_0x0499('0x3a')][_0x0499('0x42')]);_0x542fb5[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x52816a[_0x0499('0x3a')][_0x0499('0x43')]);}return _0x2e3680[_0x0499('0x9a')](_0x542fb5);}})[_0x0499('0x26')](function(_0xeb3e16){return _0xeb3e16?{'count':_0x5d9b61,'rows':_0xeb3e16}:null;})['then'](respondWithResult(_0x473cf3,null))['catch'](handleError(_0x473cf3,null));};exports[_0x0499('0x9b')]=function(_0xa64028,_0x1a560c,_0xd6af9d){var _0x469478={};var _0x42ee3f={};var _0x2125c4;var _0x2d98f0;return db[_0x0499('0x4a')][_0x0499('0x60')]({'where':{'id':_0xa64028[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x1a560c,null))['then'](function(_0x1aff74){if(_0x1aff74){_0x2125c4=_0x1aff74;_0x42ee3f[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x9c')][_0x0499('0x36')]);_0x42ee3f[_0x0499('0x3a')]=_['keys'](_0xa64028[_0x0499('0x3a')]);_0x42ee3f[_0x0499('0x3b')]=_['intersection'](_0x42ee3f[_0x0499('0x38')],_0x42ee3f[_0x0499('0x3a')]);_0x469478[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x42ee3f[_0x0499('0x38')],qs[_0x0499('0x3d')](_0xa64028[_0x0499('0x3a')][_0x0499('0x3d')]));_0x469478[_0x0499('0x3e')]=_0x469478[_0x0499('0x3e')][_0x0499('0x3f')]?_0x469478[_0x0499('0x3e')]:_0x42ee3f[_0x0499('0x38')];_0x469478['order']=qs['sort'](_0xa64028['query']['sort']);_0x469478['where']=qs[_0x0499('0x3b')](_[_0x0499('0x47')](_0xa64028[_0x0499('0x3a')],_0x42ee3f[_0x0499('0x3b')]));if(_0xa64028[_0x0499('0x3a')][_0x0499('0x2c')]){_0x469478[_0x0499('0x46')]=_[_0x0499('0x48')](_0x469478['where'],{'$or':_[_0x0499('0x2e')](_0x469478[_0x0499('0x3e')],function(_0x397dab){var _0x4aa6ac={};_0x4aa6ac[_0x397dab]={'$like':'%'+_0xa64028[_0x0499('0x3a')]['filter']+'%'};return _0x4aa6ac;})});}_0x469478=_[_0x0499('0x48')]({},_0x469478,_0xa64028[_0x0499('0x52')]);return _0x2125c4[_0x0499('0x9b')](_0x469478);}})[_0x0499('0x26')](function(_0x2e07a9){if(_0x2e07a9){_0x2d98f0=_0x2e07a9[_0x0499('0x3f')];if(!_0xa64028[_0x0499('0x3a')][_0x0499('0x40')](_0x0499('0x41'))){_0x469478[_0x0499('0x42')]=qs[_0x0499('0x42')](_0xa64028[_0x0499('0x3a')][_0x0499('0x42')]);_0x469478[_0x0499('0x43')]=qs[_0x0499('0x43')](_0xa64028[_0x0499('0x3a')][_0x0499('0x43')]);}return _0x2125c4['getLists'](_0x469478);}})[_0x0499('0x26')](function(_0x1ba578){if(_0x1ba578){return _0x1ba578?{'count':_0x2d98f0,'rows':_0x1ba578}:null;}})['then'](respondWithResult(_0x1a560c,null))[_0x0499('0x4e')](handleError(_0x1a560c,null));};exports[_0x0499('0x9d')]=function(_0x56e968,_0xad1109,_0x5c502c){var _0x132557,_0x5792b5;return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x56e968[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0xad1109,null))['then'](function(_0x5b0ba5){if(_0x5b0ba5){_0x5792b5=_0x5b0ba5;return _0x5b0ba5[_0x0499('0x9d')](_0x56e968['body'][_0x0499('0x91')],_[_0x0499('0x59')](_0x56e968['body'],[_0x0499('0x91'),'id'])||{});}return null;})[_0x0499('0x96')](function(_0x649509){var _0x454f0c;_0x132557=_0x649509||[];var _0x3c87de=[];if(_0x649509){for(var _0x24f44f=0x0;_0x24f44f<_0x649509['length'];_0x24f44f+=0x1){var _0x4d9dbf=_0x649509[_0x24f44f][_0x0499('0x27')]({'plain':!![]});_0x5792b5[_0x0499('0x9e')]=_0x56e968[_0x0499('0x54')][_0x0499('0x9e')]?_0x56e968[_0x0499('0x54')][_0x0499('0x9e')]:_0x5792b5[_0x0499('0x9e')];switch(_0x5792b5[_0x0499('0x9e')]){case'always':_0x454f0c=squel['insert']()['into']('cm_hopper')[_0x0499('0x9f')]([_0x0499('0xa0'),_0x0499('0xa1'),'ContactId',_0x0499('0xa2'),_0x0499('0x62'),_0x0499('0x5a'),_0x0499('0x5b')],squel[_0x0499('0x7d')]()[_0x0499('0x7e')](_0x0499('0xa0'),'phone')['field'](_0x0499('0xa3'),_0x0499('0xa1'))['field']('id',_0x0499('0xa4'))['field'](_0x4d9dbf[_0x0499('0xa5')][_0x0499('0x88')](),_0x0499('0xa2'))[_0x0499('0x7e')](_0x56e968[_0x0499('0x50')]['id'][_0x0499('0x88')](),'VoiceQueueId')['field']('NOW()',_0x0499('0x5a'))[_0x0499('0x7e')]('NOW()',_0x0499('0x5b'))[_0x0499('0x80')]('cm_contacts')['where'](_0x0499('0xa6'))[_0x0499('0x46')](_0x0499('0xa7'),_0x4d9dbf[_0x0499('0xa5')]['toString']())[_0x0499('0x46')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x0499('0xa8'),squel[_0x0499('0x7d')]()['field']('COALESCE(calleridnum,\x27\x27)')['from'](_0x0499('0xa9'))[_0x0499('0x46')](_0x0499('0x84'),_0x56e968['params']['id'][_0x0499('0x88')]()))[_0x0499('0x46')](_0x0499('0xa8'),squel[_0x0499('0x7d')]()[_0x0499('0x7e')]('COALESCE(phone,\x27\x27)')['from'](_0x0499('0xaa'))[_0x0499('0x46')](_0x0499('0x84'),_0x56e968['params']['id'][_0x0499('0x88')]())))[_0x0499('0x88')]();break;case _0x0499('0xab'):_0x454f0c=squel[_0x0499('0xac')]()[_0x0499('0xad')](_0x0499('0xaa'))[_0x0499('0x9f')]([_0x0499('0xa0'),_0x0499('0xa1'),_0x0499('0xa4'),_0x0499('0xa2'),_0x0499('0x62'),'createdAt','updatedAt'],squel[_0x0499('0x7d')]()[_0x0499('0x7e')](_0x0499('0xa0'),'phone')[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0xa1'))[_0x0499('0x7e')]('id',_0x0499('0xa4'))['field'](_0x4d9dbf['CmListId'][_0x0499('0x88')](),_0x0499('0xa2'))[_0x0499('0x7e')](_0x56e968['params']['id']['toString'](),_0x0499('0x62'))[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0x5a'))[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0x5b'))[_0x0499('0x80')](_0x0499('0xae'))['where'](_0x0499('0xa6'))[_0x0499('0x46')](_0x0499('0xa7'),_0x4d9dbf[_0x0499('0xa5')][_0x0499('0x88')]())[_0x0499('0x46')](_0x0499('0xaf'))[_0x0499('0x46')](_0x0499('0xa8'),squel[_0x0499('0x7d')]()[_0x0499('0x7e')](_0x0499('0xb0'))[_0x0499('0x80')](_0x0499('0xaa'))[_0x0499('0x46')](_0x0499('0x84'),_0x56e968[_0x0499('0x50')]['id']['toString']())))[_0x0499('0x88')]();break;default:_0x454f0c=squel[_0x0499('0xac')]()[_0x0499('0xad')]('cm_hopper')[_0x0499('0x9f')]([_0x0499('0xa0'),_0x0499('0xa1'),_0x0499('0xa4'),'ListId','VoiceQueueId',_0x0499('0x5a'),_0x0499('0x5b')],squel[_0x0499('0x7d')]()[_0x0499('0x7e')](_0x0499('0xa0'),_0x0499('0xa0'))[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0xa1'))[_0x0499('0x7e')]('id',_0x0499('0xa4'))[_0x0499('0x7e')](_0x4d9dbf[_0x0499('0xa5')][_0x0499('0x88')](),'ListId')[_0x0499('0x7e')](_0x56e968[_0x0499('0x50')]['id'][_0x0499('0x88')](),_0x0499('0x62'))['field']('NOW()','createdAt')[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0x5b'))[_0x0499('0x80')]('cm_contacts')[_0x0499('0x46')](_0x0499('0xa6'))[_0x0499('0x46')](_0x0499('0xa7'),_0x4d9dbf[_0x0499('0xa5')][_0x0499('0x88')]())[_0x0499('0x46')]('phone\x20IS\x20NOT\x20NULL'))[_0x0499('0x88')]();}_0x3c87de[_0x0499('0x87')](db[_0x0499('0x70')]['query'](_0x454f0c));}return BPromise['all'](_0x3c87de);}})[_0x0499('0x26')](function(){return _0x132557;})[_0x0499('0x26')](respondWithResult(_0xad1109,null))['catch'](handleError(_0xad1109,null));};exports[_0x0499('0xb1')]=function(_0x18c67a,_0x2d797b,_0x1bc708){return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x18c67a[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x2d797b,null))[_0x0499('0x26')](function(_0x882f0d){if(_0x882f0d){return _0x882f0d[_0x0499('0xb1')](_0x18c67a['query'][_0x0499('0x91')]);}})['then'](function(_0x33ecd7){if(_0x33ecd7){return db[_0x0499('0x61')]['destroy']({'where':{'ListId':_0x18c67a['query'][_0x0499('0x91')],'VoiceQueueId':_0x18c67a[_0x0499('0x50')]['id']}})[_0x0499('0x26')](function(){return _0x33ecd7;});}})['then'](respondWithStatusCode(_0x2d797b,null))['catch'](handleError(_0x2d797b,null));};exports[_0x0499('0xb2')]=function(_0x4bec1a,_0x203019,_0x3c6d22){var _0x49809f={};var _0x426f87={};var _0x55e54c;var _0x4de74e;return db[_0x0499('0x4a')]['findOne']({'where':{'id':_0x4bec1a[_0x0499('0x50')]['id']}})['then'](handleEntityNotFound(_0x203019,null))[_0x0499('0x26')](function(_0x50d878){if(_0x50d878){_0x55e54c=_0x50d878;_0x426f87[_0x0499('0x38')]=_[_0x0499('0x39')](db[_0x0499('0x9c')][_0x0499('0x36')]);_0x426f87['query']=_['keys'](_0x4bec1a[_0x0499('0x3a')]);_0x426f87[_0x0499('0x3b')]=_[_0x0499('0x3c')](_0x426f87[_0x0499('0x38')],_0x426f87[_0x0499('0x3a')]);_0x49809f[_0x0499('0x3e')]=_[_0x0499('0x3c')](_0x426f87[_0x0499('0x38')],qs[_0x0499('0x3d')](_0x4bec1a['query'][_0x0499('0x3d')]));_0x49809f[_0x0499('0x3e')]=_0x49809f['attributes'][_0x0499('0x3f')]?_0x49809f[_0x0499('0x3e')]:_0x426f87[_0x0499('0x38')];_0x49809f[_0x0499('0x44')]=qs[_0x0499('0x45')](_0x4bec1a['query'][_0x0499('0x45')]);_0x49809f[_0x0499('0x46')]=qs[_0x0499('0x3b')](_[_0x0499('0x47')](_0x4bec1a[_0x0499('0x3a')],_0x426f87[_0x0499('0x3b')]));if(_0x4bec1a[_0x0499('0x3a')][_0x0499('0x2c')]){_0x49809f[_0x0499('0x46')]=_[_0x0499('0x48')](_0x49809f[_0x0499('0x46')],{'$or':_[_0x0499('0x2e')](_0x49809f[_0x0499('0x3e')],function(_0x542164){var _0x5b3099={};_0x5b3099[_0x542164]={'$like':'%'+_0x4bec1a[_0x0499('0x3a')][_0x0499('0x2c')]+'%'};return _0x5b3099;})});}_0x49809f=_[_0x0499('0x48')]({},_0x49809f,_0x4bec1a[_0x0499('0x52')]);return _0x55e54c[_0x0499('0xb2')](_0x49809f);}})[_0x0499('0x26')](function(_0x344697){if(_0x344697){_0x4de74e=_0x344697[_0x0499('0x3f')];if(!_0x4bec1a[_0x0499('0x3a')][_0x0499('0x40')](_0x0499('0x41'))){_0x49809f[_0x0499('0x42')]=qs['limit'](_0x4bec1a[_0x0499('0x3a')][_0x0499('0x42')]);_0x49809f[_0x0499('0x43')]=qs[_0x0499('0x43')](_0x4bec1a[_0x0499('0x3a')][_0x0499('0x43')]);}return _0x55e54c[_0x0499('0xb2')](_0x49809f);}})['then'](function(_0x5c6217){if(_0x5c6217){return _0x5c6217?{'count':_0x4de74e,'rows':_0x5c6217}:null;}})['then'](respondWithResult(_0x203019,null))[_0x0499('0x4e')](handleError(_0x203019,null));};exports[_0x0499('0xb3')]=function(_0x2fce7d,_0x441b0c,_0x1d2e43){var _0x31734,_0x228d94;return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x2fce7d[_0x0499('0x50')]['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x441b0c,null))[_0x0499('0x26')](function(_0x5b5c33){if(_0x5b5c33){_0x228d94=_0x5b5c33;return _0x5b5c33['addBlackLists'](_0x2fce7d['body']['ids'],_[_0x0499('0x59')](_0x2fce7d[_0x0499('0x54')],[_0x0499('0x91'),'id'])||{});}return null;})[_0x0499('0x96')](function(_0x5b0644){var _0x819386;_0x31734=_0x5b0644||[];var _0x3c5eb4=[];if(_0x5b0644){for(var _0x183f4b=0x0;_0x183f4b<_0x5b0644['length'];_0x183f4b+=0x1){var _0x3f7fd6=_0x5b0644[_0x183f4b][_0x0499('0x27')]({'plain':!![]});_0x819386=squel['insert']()['into'](_0x0499('0xb4'))['fromQuery']([_0x0499('0xa0'),_0x0499('0xa4'),_0x0499('0xa2'),_0x0499('0x62'),_0x0499('0x5a'),_0x0499('0x5b')],squel[_0x0499('0x7d')]()[_0x0499('0x7e')](_0x0499('0xa0'),_0x0499('0xa0'))[_0x0499('0x7e')]('id','ContactId')['field'](_0x3f7fd6[_0x0499('0xa5')][_0x0499('0x88')](),'ListId')[_0x0499('0x7e')](_0x2fce7d[_0x0499('0x50')]['id'][_0x0499('0x88')](),_0x0499('0x62'))[_0x0499('0x7e')](_0x0499('0xa3'),_0x0499('0x5a'))[_0x0499('0x7e')]('NOW()','updatedAt')[_0x0499('0x80')]('cm_contacts')[_0x0499('0x46')](_0x0499('0xa6'))['where'](_0x0499('0xa7'),_0x3f7fd6[_0x0499('0xa5')][_0x0499('0x88')]())[_0x0499('0x46')](_0x0499('0xaf')))[_0x0499('0x88')]();_0x3c5eb4[_0x0499('0x87')](db['sequelize']['query'](_0x819386));}return BPromise[_0x0499('0x8e')](_0x3c5eb4);}})[_0x0499('0x26')](function(){return _0x31734;})['then'](respondWithResult(_0x441b0c,null))[_0x0499('0x4e')](handleError(_0x441b0c,null));};exports['removeBlackLists']=function(_0x168395,_0x2fbbec,_0x1a2048){return db[_0x0499('0x4a')][_0x0499('0x31')]({'where':{'id':_0x168395['params']['id']}})[_0x0499('0x26')](handleEntityNotFound(_0x2fbbec,null))[_0x0499('0x26')](function(_0x33a041){if(_0x33a041){return _0x33a041[_0x0499('0xb5')](_0x168395[_0x0499('0x3a')][_0x0499('0x91')]);}})[_0x0499('0x26')](function(_0x5ea9d4){if(_0x5ea9d4){return db['CmHopperBlack'][_0x0499('0x25')]({'where':{'ListId':_0x168395[_0x0499('0x3a')][_0x0499('0x91')],'VoiceQueueId':_0x168395['params']['id']}})[_0x0499('0x26')](function(){return _0x5ea9d4;});}})[_0x0499('0x26')](respondWithStatusCode(_0x2fbbec,null))['catch'](handleError(_0x2fbbec,null));};
\ No newline at end of file
+var _0xb4f1=['show','params','options','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','get','omit','createdAt','updatedAt','includeAll','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','getHoppers','findOne','CmHopper','VoiceQueueId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','teams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','upsert','UserVoiceQueueRt','isNil','format','SIP/%s','emit','removeTeams','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','all','union','ids','isEmpty','removeAgents','addAgents','spread','push','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ListId','phone','ContactId','CmListId','NOW()','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_contacts','cm_hopper','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value','includes','type','UserProfileResource','error','stack','name','send','index','rawAttributes','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','include','VoiceQueue','findAll','rows','catch'];(function(_0x3e9a8f,_0x3a6aab){var _0x537cc9=function(_0x3b319c){while(--_0x3b319c){_0x3e9a8f['push'](_0x3e9a8f['shift']());}};_0x537cc9(++_0x3a6aab);}(_0xb4f1,0x1d6));var _0x1b4f=function(_0x42755c,_0x1c1fdf){_0x42755c=_0x42755c-0x0;var _0x29b701=_0xb4f1[_0x42755c];return _0x29b701;};'use strict';var emlformat=require(_0x1b4f('0x0'));var rimraf=require(_0x1b4f('0x1'));var zipdir=require(_0x1b4f('0x2'));var jsonpatch=require(_0x1b4f('0x3'));var rp=require(_0x1b4f('0x4'));var moment=require('moment');var BPromise=require(_0x1b4f('0x5'));var Mustache=require(_0x1b4f('0x6'));var util=require(_0x1b4f('0x7'));var path=require(_0x1b4f('0x8'));var sox=require('sox');var csv=require(_0x1b4f('0x9'));var ejs=require(_0x1b4f('0xa'));var fs=require('fs');var fs_extra=require(_0x1b4f('0xb'));var _=require(_0x1b4f('0xc'));var squel=require(_0x1b4f('0xd'));var crypto=require(_0x1b4f('0xe'));var jsforce=require(_0x1b4f('0xf'));var deskjs=require(_0x1b4f('0x10'));var toCsv=require(_0x1b4f('0x9'));var querystring=require(_0x1b4f('0x11'));var Papa=require(_0x1b4f('0x12'));var Redis=require(_0x1b4f('0x13'));var authService=require(_0x1b4f('0x14'));var qs=require(_0x1b4f('0x15'));var as=require(_0x1b4f('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1b4f('0x17'))('api');var utils=require(_0x1b4f('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b4f('0x19'))['db'];config[_0x1b4f('0x1a')]=_[_0x1b4f('0x1b')](config[_0x1b4f('0x1a')],{'host':_0x1b4f('0x1c'),'port':0x18eb});var socket=require(_0x1b4f('0x1d'))(new Redis(config[_0x1b4f('0x1a')]));require(_0x1b4f('0x1e'))[_0x1b4f('0x1f')](socket);function respondWithStatusCode(_0x2463c7,_0x44d5c1){_0x44d5c1=_0x44d5c1||0xcc;return function(_0x418fdb){if(_0x418fdb){return _0x2463c7[_0x1b4f('0x20')](_0x44d5c1);}return _0x2463c7['status'](_0x44d5c1)[_0x1b4f('0x21')]();};}function respondWithResult(_0x335d3d,_0x2b6420){_0x2b6420=_0x2b6420||0xc8;return function(_0x3b13eb){if(_0x3b13eb){return _0x335d3d['status'](_0x2b6420)[_0x1b4f('0x22')](_0x3b13eb);}};}function respondWithFilteredResult(_0x505cf5,_0x1b3079){return function(_0x4e70c9){if(_0x4e70c9){var _0x2e47cb=typeof _0x1b3079[_0x1b4f('0x23')]==='undefined'&&typeof _0x1b3079[_0x1b4f('0x24')]===_0x1b4f('0x25');var _0x56ca66=_0x4e70c9[_0x1b4f('0x26')];var _0x1059da=_0x2e47cb?0x0:_0x1b3079[_0x1b4f('0x23')];var _0x44f107=_0x2e47cb?_0x4e70c9[_0x1b4f('0x26')]:_0x1b3079[_0x1b4f('0x23')]+_0x1b3079[_0x1b4f('0x24')];var _0x50b25a;if(_0x44f107>=_0x56ca66){_0x44f107=_0x56ca66;_0x50b25a=0xc8;}else{_0x50b25a=0xce;}_0x505cf5[_0x1b4f('0x27')](_0x50b25a);return _0x505cf5[_0x1b4f('0x28')]('Content-Range',_0x1059da+'-'+_0x44f107+'/'+_0x56ca66)[_0x1b4f('0x22')](_0x4e70c9);}return null;};}function patchUpdates(_0x20f756){return function(_0x13edad){try{jsonpatch[_0x1b4f('0x29')](_0x13edad,_0x20f756,!![]);}catch(_0x1d264d){return BPromise[_0x1b4f('0x2a')](_0x1d264d);}return _0x13edad[_0x1b4f('0x2b')]();};}function saveUpdates(_0x5dad1a,_0x49cc59){return function(_0x4846e1){if(_0x4846e1){return _0x4846e1[_0x1b4f('0x2c')](_0x5dad1a)[_0x1b4f('0x2d')](function(_0x2da25d){return _0x2da25d;});}return null;};}function removeEntity(_0x37e1ff,_0x3f1440){return function(_0xf6c573){if(_0xf6c573){return _0xf6c573[_0x1b4f('0x2e')]()[_0x1b4f('0x2d')](function(){var _0xeda405=_0xf6c573['get']({'plain':!![]});var _0x32b17a=[{'name':_0x1b4f('0x2f'),'value':_0x1b4f('0x30'),'ignore':![]},{'name':_0x1b4f('0x31'),'value':_0x1b4f('0x32'),'ignore':![]}];var _0x350db7=_(_0x32b17a)[_0x1b4f('0x33')](_0x1b4f('0x34'))[_0x1b4f('0x35')](_0x1b4f('0x36'))[_0x1b4f('0x36')]();if(_[_0x1b4f('0x37')](_0x350db7,_0xeda405[_0x1b4f('0x38')])){return;}var _0x701778=_['find'](_0x32b17a,['value',_0xeda405['type']])['name'];return db[_0x1b4f('0x39')][_0x1b4f('0x2e')]({'where':{'type':_0x701778,'resourceId':_0xeda405['id']}})[_0x1b4f('0x2d')](function(){return _0xf6c573;});})['then'](function(){_0x37e1ff['status'](0xcc)[_0x1b4f('0x21')]();});}};}function handleEntityNotFound(_0x51952f,_0x1e716d){return function(_0x1ea7d4){if(!_0x1ea7d4){_0x51952f[_0x1b4f('0x20')](0x194);}return _0x1ea7d4;};}function handleError(_0x4cefb8,_0x38b4a5){_0x38b4a5=_0x38b4a5||0x1f4;return function(_0x4a6198){logger[_0x1b4f('0x3a')](_0x4a6198[_0x1b4f('0x3b')]);if(_0x4a6198[_0x1b4f('0x3c')]){delete _0x4a6198[_0x1b4f('0x3c')];}_0x4cefb8[_0x1b4f('0x27')](_0x38b4a5)[_0x1b4f('0x3d')](_0x4a6198);};}exports[_0x1b4f('0x3e')]=function(_0xfa5406,_0x5996d0){var _0x1792c1={},_0x5f09d2={},_0x340660={'count':0x0,'rows':[]};var _0x5e6e61=_['map'](db['VoiceQueue'][_0x1b4f('0x3f')],function(_0x27e652){return{'name':_0x27e652[_0x1b4f('0x40')],'type':_0x27e652[_0x1b4f('0x38')]['key']};});_0x5f09d2[_0x1b4f('0x41')]=_[_0x1b4f('0x35')](_0x5e6e61,_0x1b4f('0x3c'));_0x5f09d2[_0x1b4f('0x42')]=_[_0x1b4f('0x43')](_0xfa5406[_0x1b4f('0x42')]);_0x5f09d2['filters']=_[_0x1b4f('0x44')](_0x5f09d2[_0x1b4f('0x41')],_0x5f09d2[_0x1b4f('0x42')]);_0x1792c1[_0x1b4f('0x45')]=_[_0x1b4f('0x44')](_0x5f09d2[_0x1b4f('0x41')],qs[_0x1b4f('0x46')](_0xfa5406[_0x1b4f('0x42')]['fields']));_0x1792c1[_0x1b4f('0x45')]=_0x1792c1[_0x1b4f('0x45')][_0x1b4f('0x47')]?_0x1792c1['attributes']:_0x5f09d2[_0x1b4f('0x41')];if(!_0xfa5406[_0x1b4f('0x42')][_0x1b4f('0x48')](_0x1b4f('0x49'))){_0x1792c1[_0x1b4f('0x24')]=qs[_0x1b4f('0x24')](_0xfa5406[_0x1b4f('0x42')]['limit']);_0x1792c1[_0x1b4f('0x23')]=qs['offset'](_0xfa5406[_0x1b4f('0x42')][_0x1b4f('0x23')]);}_0x1792c1[_0x1b4f('0x4a')]=qs[_0x1b4f('0x4b')](_0xfa5406[_0x1b4f('0x42')][_0x1b4f('0x4b')]);_0x1792c1[_0x1b4f('0x4c')]=qs[_0x1b4f('0x4d')](_[_0x1b4f('0x4e')](_0xfa5406[_0x1b4f('0x42')],_0x5f09d2[_0x1b4f('0x4d')]),_0x5e6e61);if(_0xfa5406[_0x1b4f('0x42')][_0x1b4f('0x33')]){_0x1792c1[_0x1b4f('0x4c')]=_[_0x1b4f('0x4f')](_0x1792c1[_0x1b4f('0x4c')],{'$or':_[_0x1b4f('0x35')](_0x5e6e61,function(_0x34d537){if(_0x34d537[_0x1b4f('0x38')]!=='VIRTUAL'){var _0x392051={};_0x392051[_0x34d537[_0x1b4f('0x3c')]]={'$like':'%'+_0xfa5406[_0x1b4f('0x42')][_0x1b4f('0x33')]+'%'};return _0x392051;}})});}_0x1792c1=_[_0x1b4f('0x4f')]({},_0x1792c1,_0xfa5406['options']);var _0x2d0060={'where':_0x1792c1[_0x1b4f('0x4c')]};return db['VoiceQueue']['count'](_0x2d0060)[_0x1b4f('0x2d')](function(_0x2e6aa4){_0x340660[_0x1b4f('0x26')]=_0x2e6aa4;if(_0xfa5406[_0x1b4f('0x42')]['includeAll']){_0x1792c1[_0x1b4f('0x50')]=[{'all':!![]}];}return db[_0x1b4f('0x51')][_0x1b4f('0x52')](_0x1792c1);})[_0x1b4f('0x2d')](function(_0x2b61a5){_0x340660[_0x1b4f('0x53')]=_0x2b61a5;return _0x340660;})['then'](respondWithFilteredResult(_0x5996d0,_0x1792c1))[_0x1b4f('0x54')](handleError(_0x5996d0,null));};exports[_0x1b4f('0x55')]=function(_0x19afc9,_0x2131f0){var _0x437814={'raw':![],'where':{'id':_0x19afc9[_0x1b4f('0x56')]['id']}},_0x2dabcf={};_0x2dabcf['model']=_[_0x1b4f('0x43')](db[_0x1b4f('0x51')][_0x1b4f('0x3f')]);_0x2dabcf['query']=_['keys'](_0x19afc9[_0x1b4f('0x42')]);_0x2dabcf[_0x1b4f('0x4d')]=_[_0x1b4f('0x44')](_0x2dabcf['model'],_0x2dabcf[_0x1b4f('0x42')]);_0x437814[_0x1b4f('0x45')]=_[_0x1b4f('0x44')](_0x2dabcf[_0x1b4f('0x41')],qs[_0x1b4f('0x46')](_0x19afc9['query'][_0x1b4f('0x46')]));_0x437814[_0x1b4f('0x45')]=_0x437814[_0x1b4f('0x45')]['length']?_0x437814[_0x1b4f('0x45')]:_0x2dabcf[_0x1b4f('0x41')];if(_0x19afc9[_0x1b4f('0x42')]['includeAll']){_0x437814['include']=[{'all':!![]}];}_0x437814=_[_0x1b4f('0x4f')]({},_0x437814,_0x19afc9[_0x1b4f('0x57')]);return db[_0x1b4f('0x51')][_0x1b4f('0x58')](_0x437814)['then'](handleEntityNotFound(_0x2131f0,null))['then'](respondWithResult(_0x2131f0,null))[_0x1b4f('0x54')](handleError(_0x2131f0,null));};exports[_0x1b4f('0x59')]=function(_0x3ac7b9,_0x526041){return db[_0x1b4f('0x51')]['create'](_0x3ac7b9[_0x1b4f('0x5a')],{})[_0x1b4f('0x2d')](function(_0x486ad4){var _0xc8adff=_0x3ac7b9[_0x1b4f('0x5b')]['get']({'plain':!![]});if(!_0xc8adff)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc8adff['role']==='user'){var _0x492873=_0x486ad4['get']({'plain':!![]});var _0x107285=[{'name':_0x1b4f('0x2f'),'value':_0x1b4f('0x30')},{'name':_0x1b4f('0x31'),'value':_0x1b4f('0x32')}];var _0xd3d3c1=_[_0x1b4f('0x58')](_0x107285,['value',_0x492873[_0x1b4f('0x38')]])['name'];return db[_0x1b4f('0x5c')][_0x1b4f('0x58')]({'where':{'name':_0xd3d3c1,'userProfileId':_0xc8adff[_0x1b4f('0x5d')]},'raw':!![]})[_0x1b4f('0x2d')](function(_0x2ca579){if(_0x2ca579&&_0x2ca579[_0x1b4f('0x5e')]===0x0){return db[_0x1b4f('0x39')][_0x1b4f('0x59')]({'name':_0x492873[_0x1b4f('0x3c')],'resourceId':_0x492873['id'],'type':_0x2ca579[_0x1b4f('0x3c')],'sectionId':_0x2ca579['id']},{})[_0x1b4f('0x2d')](function(){return _0x486ad4;});}else{return _0x486ad4;}})[_0x1b4f('0x54')](function(_0x4b3b7e){logger[_0x1b4f('0x3a')](_0x1b4f('0x5f'),_0x4b3b7e);throw _0x4b3b7e;});}return _0x486ad4;})['then'](respondWithResult(_0x526041,0xc9))[_0x1b4f('0x54')](handleError(_0x526041,null));};exports[_0x1b4f('0x60')]=function(_0x2f690d,_0x1521b2){var _0x43cdbb={'where':{'id':_0x2f690d[_0x1b4f('0x56')]['id']}},_0x31afb9={};_0x31afb9[_0x1b4f('0x41')]=_['keys'](db['VoiceQueue'][_0x1b4f('0x3f')]);_0x43cdbb[_0x1b4f('0x45')]=_['intersection'](_0x31afb9[_0x1b4f('0x41')],qs['fields'](_0x2f690d[_0x1b4f('0x42')][_0x1b4f('0x46')]));_0x43cdbb['attributes']=_0x43cdbb[_0x1b4f('0x45')]['length']?_0x43cdbb[_0x1b4f('0x45')]:_0x31afb9[_0x1b4f('0x41')];if(_0x2f690d[_0x1b4f('0x42')]['includeAll']){_0x43cdbb[_0x1b4f('0x50')]=[{'all':!![]}];}_0x43cdbb=_[_0x1b4f('0x4f')]({},_0x43cdbb,_0x2f690d[_0x1b4f('0x57')]);return db[_0x1b4f('0x51')][_0x1b4f('0x58')](_0x43cdbb)[_0x1b4f('0x2d')](handleEntityNotFound(_0x1521b2,null))[_0x1b4f('0x2d')](function(_0x490898){if(_0x490898){var _0x4288a1=_0x490898[_0x1b4f('0x61')]({'plain':!![]});_0x4288a1=qs[_0x1b4f('0x62')](_0x4288a1,['id',_0x1b4f('0x63'),_0x1b4f('0x64')]);_0x2f690d['body']=_['omit'](_0x2f690d[_0x1b4f('0x5a')],['id',_0x1b4f('0x63'),_0x1b4f('0x64')]);return db['VoiceQueue']['create'](_[_0x1b4f('0x4f')](_0x4288a1,_0x2f690d[_0x1b4f('0x5a')]),{'include':_0x2f690d[_0x1b4f('0x42')][_0x1b4f('0x65')]?[{'all':!![]}]:undefined})['then'](function(_0x4f84ea){var _0x2a2775=_0x2f690d[_0x1b4f('0x5b')][_0x1b4f('0x61')]({'plain':!![]});if(!_0x2a2775)throw new Error(_0x1b4f('0x66'));if(_0x2a2775[_0x1b4f('0x67')]==='user'){var _0x2b072b=_0x4f84ea['get']({'plain':!![]});var _0x249aae=[{'name':_0x1b4f('0x2f'),'value':_0x1b4f('0x30')},{'name':_0x1b4f('0x31'),'value':'outbound'}];var _0xa4ec54=_[_0x1b4f('0x58')](_0x249aae,[_0x1b4f('0x36'),_0x2b072b[_0x1b4f('0x38')]])[_0x1b4f('0x3c')];return db[_0x1b4f('0x5c')][_0x1b4f('0x58')]({'where':{'name':_0xa4ec54,'userProfileId':_0x2a2775['userProfileId']},'raw':!![]})['then'](function(_0x55d488){if(_0x55d488&&_0x55d488[_0x1b4f('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x2b072b['name'],'resourceId':_0x2b072b['id'],'type':_0x55d488['name'],'sectionId':_0x55d488['id']},{})['then'](function(){return _0x4f84ea;});}else{return _0x4f84ea;}})[_0x1b4f('0x54')](function(_0x2d3905){logger[_0x1b4f('0x3a')](_0x1b4f('0x5f'),_0x2d3905);throw _0x2d3905;});}return _0x4f84ea;});}})[_0x1b4f('0x2d')](respondWithResult(_0x1521b2,0xc9))[_0x1b4f('0x54')](handleError(_0x1521b2,null));};exports[_0x1b4f('0x2c')]=function(_0x1da4af,_0x389835){if(_0x1da4af[_0x1b4f('0x5a')]['id']){delete _0x1da4af[_0x1b4f('0x5a')]['id'];}return db[_0x1b4f('0x51')][_0x1b4f('0x58')]({'where':{'id':_0x1da4af[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x389835,null))[_0x1b4f('0x2d')](saveUpdates(_0x1da4af[_0x1b4f('0x5a')],null))[_0x1b4f('0x2d')](respondWithResult(_0x389835,null))['catch'](handleError(_0x389835,null));};exports[_0x1b4f('0x2e')]=function(_0x5181a4,_0x3c3d32){return db['VoiceQueue'][_0x1b4f('0x58')]({'where':{'id':_0x5181a4[_0x1b4f('0x56')]['id']}})['then'](handleEntityNotFound(_0x3c3d32,null))[_0x1b4f('0x2d')](removeEntity(_0x3c3d32,null))['catch'](handleError(_0x3c3d32,null));};exports[_0x1b4f('0x68')]=function(_0x3f296f,_0x143eab,_0x3198f2){var _0x3fb4f6={'raw':![],'where':{}};var _0xed23c3={};var _0x2db6b1={'count':0x0,'rows':[]};return db[_0x1b4f('0x51')][_0x1b4f('0x69')]({'where':{'id':_0x3f296f['params']['id']}})['then'](handleEntityNotFound(_0x143eab,null))[_0x1b4f('0x2d')](function(_0x4b5d5b){if(_0x4b5d5b){_0xed23c3['model']=_[_0x1b4f('0x43')](db[_0x1b4f('0x6a')][_0x1b4f('0x3f')]);_0xed23c3[_0x1b4f('0x42')]=_[_0x1b4f('0x43')](_0x3f296f['query']);_0xed23c3[_0x1b4f('0x4d')]=_[_0x1b4f('0x44')](_0xed23c3['model'],_0xed23c3[_0x1b4f('0x42')]);_0x3fb4f6[_0x1b4f('0x45')]=_[_0x1b4f('0x44')](_0xed23c3['model'],qs[_0x1b4f('0x46')](_0x3f296f[_0x1b4f('0x42')][_0x1b4f('0x46')]));_0x3fb4f6[_0x1b4f('0x45')]=_0x3fb4f6[_0x1b4f('0x45')]['length']?_0x3fb4f6[_0x1b4f('0x45')]:_0xed23c3[_0x1b4f('0x41')];if(!_0x3f296f[_0x1b4f('0x42')][_0x1b4f('0x48')](_0x1b4f('0x49'))){_0x3fb4f6['limit']=qs[_0x1b4f('0x24')](_0x3f296f[_0x1b4f('0x42')]['limit']);_0x3fb4f6[_0x1b4f('0x23')]=qs[_0x1b4f('0x23')](_0x3f296f[_0x1b4f('0x42')][_0x1b4f('0x23')]);}_0x3fb4f6[_0x1b4f('0x4a')]=qs['sort'](_0x3f296f[_0x1b4f('0x42')][_0x1b4f('0x4b')]);_0x3fb4f6['where']=qs[_0x1b4f('0x4d')](_[_0x1b4f('0x4e')](_0x3f296f[_0x1b4f('0x42')],_0xed23c3[_0x1b4f('0x4d')]));_0x3fb4f6[_0x1b4f('0x4c')][_0x1b4f('0x6b')]=_0x4b5d5b['id'];if(_0x3f296f[_0x1b4f('0x42')][_0x1b4f('0x33')]){_0x3fb4f6[_0x1b4f('0x4c')]=_[_0x1b4f('0x4f')](_0x3fb4f6[_0x1b4f('0x4c')],{'$or':_[_0x1b4f('0x35')](_0x3fb4f6[_0x1b4f('0x45')],function(_0x55f3cd){var _0x16fda7={};_0x16fda7[_0x55f3cd]={'$like':'%'+_0x3f296f[_0x1b4f('0x42')]['filter']+'%'};return _0x16fda7;})});}_0x3fb4f6=_[_0x1b4f('0x4f')]({},_0x3fb4f6,_0x3f296f[_0x1b4f('0x57')]);return db[_0x1b4f('0x6a')][_0x1b4f('0x26')]({'where':_0x3fb4f6[_0x1b4f('0x4c')]})['then'](function(_0x431bbf){_0x2db6b1[_0x1b4f('0x26')]=_0x431bbf;if(_0x3f296f[_0x1b4f('0x42')][_0x1b4f('0x65')]){_0x3fb4f6[_0x1b4f('0x50')]=[{'all':!![]}];}return db[_0x1b4f('0x6a')][_0x1b4f('0x52')](_0x3fb4f6);})[_0x1b4f('0x2d')](function(_0x3695db){_0x2db6b1['rows']=_0x3695db;return _0x2db6b1;});}})[_0x1b4f('0x2d')](respondWithFilteredResult(_0x143eab,_0x3fb4f6))[_0x1b4f('0x54')](handleError(_0x143eab,null));};exports[_0x1b4f('0x6c')]=function(_0x2ef697,_0x5a022a,_0x1a3e32){var _0xcd6687={'raw':!![],'where':{}};var _0xdbf77e={};var _0x51e6ec={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2ef697[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x5a022a,null))[_0x1b4f('0x2d')](function(_0x3c92bb){if(_0x3c92bb){_0xdbf77e[_0x1b4f('0x41')]=_[_0x1b4f('0x43')](db[_0x1b4f('0x6d')][_0x1b4f('0x3f')]);_0xdbf77e[_0x1b4f('0x42')]=_['keys'](_0x2ef697[_0x1b4f('0x42')]);_0xdbf77e[_0x1b4f('0x4d')]=_[_0x1b4f('0x44')](_0xdbf77e['model'],_0xdbf77e[_0x1b4f('0x42')]);_0xcd6687[_0x1b4f('0x45')]=_[_0x1b4f('0x44')](_0xdbf77e[_0x1b4f('0x41')],qs[_0x1b4f('0x46')](_0x2ef697[_0x1b4f('0x42')][_0x1b4f('0x46')]));_0xcd6687[_0x1b4f('0x45')]=_0xcd6687[_0x1b4f('0x45')][_0x1b4f('0x47')]?_0xcd6687['attributes']:_0xdbf77e[_0x1b4f('0x41')];if(!_0x2ef697[_0x1b4f('0x42')]['hasOwnProperty'](_0x1b4f('0x49'))){_0xcd6687[_0x1b4f('0x24')]=qs[_0x1b4f('0x24')](_0x2ef697['query'][_0x1b4f('0x24')]);_0xcd6687[_0x1b4f('0x23')]=qs['offset'](_0x2ef697[_0x1b4f('0x42')][_0x1b4f('0x23')]);}_0xcd6687[_0x1b4f('0x4a')]=qs[_0x1b4f('0x4b')](_0x2ef697[_0x1b4f('0x42')][_0x1b4f('0x4b')]);_0xcd6687[_0x1b4f('0x4c')]=qs['filters'](_[_0x1b4f('0x4e')](_0x2ef697[_0x1b4f('0x42')],_0xdbf77e[_0x1b4f('0x4d')]));_0xcd6687[_0x1b4f('0x4c')][_0x1b4f('0x6b')]=_0x3c92bb['id'];if(_0x2ef697[_0x1b4f('0x42')][_0x1b4f('0x33')]){_0xcd6687['where']=_[_0x1b4f('0x4f')](_0xcd6687['where'],{'$or':_['map'](_0xcd6687[_0x1b4f('0x45')],function(_0x1af8cc){var _0xd2ac87={};_0xd2ac87[_0x1af8cc]={'$like':'%'+_0x2ef697['query'][_0x1b4f('0x33')]+'%'};return _0xd2ac87;})});}_0xcd6687=_[_0x1b4f('0x4f')]({},_0xcd6687,_0x2ef697[_0x1b4f('0x57')]);return db[_0x1b4f('0x6d')][_0x1b4f('0x26')]({'where':_0xcd6687[_0x1b4f('0x4c')]})[_0x1b4f('0x2d')](function(_0x2e8f1b){_0x51e6ec['count']=_0x2e8f1b;if(_0x2ef697[_0x1b4f('0x42')][_0x1b4f('0x65')]){_0xcd6687[_0x1b4f('0x50')]=[{'all':!![]}];}return db[_0x1b4f('0x6d')][_0x1b4f('0x52')](_0xcd6687);})[_0x1b4f('0x2d')](function(_0x5e4421){_0x51e6ec['rows']=_0x5e4421;return _0x51e6ec;});}})['then'](respondWithFilteredResult(_0x5a022a,_0xcd6687))[_0x1b4f('0x54')](handleError(_0x5a022a,null));};exports[_0x1b4f('0x6e')]=function(_0x2e962e,_0x415eb7,_0xc35c26){var _0xc12419={'raw':!![],'where':{}};var _0xbf96d8={};var _0x41a7c6={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2e962e[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x415eb7,null))[_0x1b4f('0x2d')](function(_0x128efd){if(_0x128efd){_0xbf96d8[_0x1b4f('0x41')]=_[_0x1b4f('0x43')](db[_0x1b4f('0x6f')][_0x1b4f('0x3f')]);_0xbf96d8[_0x1b4f('0x42')]=_[_0x1b4f('0x43')](_0x2e962e[_0x1b4f('0x42')]);_0xbf96d8['filters']=_[_0x1b4f('0x44')](_0xbf96d8[_0x1b4f('0x41')],_0xbf96d8[_0x1b4f('0x42')]);_0xc12419[_0x1b4f('0x45')]=_['intersection'](_0xbf96d8[_0x1b4f('0x41')],qs[_0x1b4f('0x46')](_0x2e962e['query'][_0x1b4f('0x46')]));_0xc12419[_0x1b4f('0x45')]=_0xc12419[_0x1b4f('0x45')][_0x1b4f('0x47')]?_0xc12419[_0x1b4f('0x45')]:_0xbf96d8[_0x1b4f('0x41')];if(!_0x2e962e['query'][_0x1b4f('0x48')](_0x1b4f('0x49'))){_0xc12419[_0x1b4f('0x24')]=qs['limit'](_0x2e962e[_0x1b4f('0x42')][_0x1b4f('0x24')]);_0xc12419[_0x1b4f('0x23')]=qs[_0x1b4f('0x23')](_0x2e962e[_0x1b4f('0x42')][_0x1b4f('0x23')]);}_0xc12419[_0x1b4f('0x4a')]=qs['sort'](_0x2e962e[_0x1b4f('0x42')]['sort']);_0xc12419[_0x1b4f('0x4c')]=qs[_0x1b4f('0x4d')](_[_0x1b4f('0x4e')](_0x2e962e['query'],_0xbf96d8[_0x1b4f('0x4d')]));_0xc12419[_0x1b4f('0x4c')][_0x1b4f('0x6b')]=_0x128efd['id'];if(_0x2e962e['query'][_0x1b4f('0x33')]){_0xc12419[_0x1b4f('0x4c')]=_[_0x1b4f('0x4f')](_0xc12419[_0x1b4f('0x4c')],{'$or':_[_0x1b4f('0x35')](_0xc12419[_0x1b4f('0x45')],function(_0x3ecf74){var _0x48bb6a={};_0x48bb6a[_0x3ecf74]={'$like':'%'+_0x2e962e[_0x1b4f('0x42')][_0x1b4f('0x33')]+'%'};return _0x48bb6a;})});}_0xc12419=_['merge']({},_0xc12419,_0x2e962e[_0x1b4f('0x57')]);return db[_0x1b4f('0x6f')][_0x1b4f('0x26')]({'where':_0xc12419[_0x1b4f('0x4c')]})['then'](function(_0x4c5b38){_0x41a7c6[_0x1b4f('0x26')]=_0x4c5b38;if(_0x2e962e[_0x1b4f('0x42')][_0x1b4f('0x65')]){_0xc12419[_0x1b4f('0x50')]=[{'all':!![]}];}return db[_0x1b4f('0x6f')]['findAll'](_0xc12419);})[_0x1b4f('0x2d')](function(_0x47558f){_0x41a7c6[_0x1b4f('0x53')]=_0x47558f;return _0x41a7c6;});}})['then'](respondWithFilteredResult(_0x415eb7,_0xc12419))[_0x1b4f('0x54')](handleError(_0x415eb7,null));};exports[_0x1b4f('0x70')]=function(_0x33957d,_0x63b91b,_0x50a552){var _0x36ad61={'raw':!![],'where':{}};var _0x41e131={};var _0x144a47={'count':0x0,'rows':[]};return db[_0x1b4f('0x51')][_0x1b4f('0x69')]({'where':{'id':_0x33957d[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x63b91b,null))[_0x1b4f('0x2d')](function(_0x7eaa4d){if(_0x7eaa4d){_0x41e131[_0x1b4f('0x41')]=_['keys'](db[_0x1b4f('0x71')][_0x1b4f('0x3f')]);_0x41e131[_0x1b4f('0x42')]=_[_0x1b4f('0x43')](_0x33957d['query']);_0x41e131[_0x1b4f('0x4d')]=_[_0x1b4f('0x44')](_0x41e131[_0x1b4f('0x41')],_0x41e131[_0x1b4f('0x42')]);_0x36ad61[_0x1b4f('0x45')]=_[_0x1b4f('0x44')](_0x41e131[_0x1b4f('0x41')],qs[_0x1b4f('0x46')](_0x33957d[_0x1b4f('0x42')]['fields']));_0x36ad61[_0x1b4f('0x45')]=_0x36ad61['attributes']['length']?_0x36ad61['attributes']:_0x41e131[_0x1b4f('0x41')];if(!_0x33957d[_0x1b4f('0x42')][_0x1b4f('0x48')](_0x1b4f('0x49'))){_0x36ad61[_0x1b4f('0x24')]=qs[_0x1b4f('0x24')](_0x33957d[_0x1b4f('0x42')][_0x1b4f('0x24')]);_0x36ad61[_0x1b4f('0x23')]=qs['offset'](_0x33957d['query']['offset']);}_0x36ad61[_0x1b4f('0x4a')]=qs[_0x1b4f('0x4b')](_0x33957d[_0x1b4f('0x42')]['sort']);_0x36ad61['where']=qs['filters'](_['pick'](_0x33957d[_0x1b4f('0x42')],_0x41e131[_0x1b4f('0x4d')]));_0x36ad61['where'][_0x1b4f('0x6b')]=_0x7eaa4d['id'];if(_0x33957d[_0x1b4f('0x42')][_0x1b4f('0x33')]){_0x36ad61['where']=_[_0x1b4f('0x4f')](_0x36ad61[_0x1b4f('0x4c')],{'$or':_[_0x1b4f('0x35')](_0x36ad61['attributes'],function(_0x22f34f){var _0x54a3ed={};_0x54a3ed[_0x22f34f]={'$like':'%'+_0x33957d[_0x1b4f('0x42')][_0x1b4f('0x33')]+'%'};return _0x54a3ed;})});}_0x36ad61=_[_0x1b4f('0x4f')]({},_0x36ad61,_0x33957d[_0x1b4f('0x57')]);return db[_0x1b4f('0x71')]['count']({'where':_0x36ad61[_0x1b4f('0x4c')]})['then'](function(_0x583ff6){_0x144a47[_0x1b4f('0x26')]=_0x583ff6;if(_0x33957d[_0x1b4f('0x42')][_0x1b4f('0x65')]){_0x36ad61[_0x1b4f('0x50')]=[{'all':!![]}];}return db[_0x1b4f('0x71')][_0x1b4f('0x52')](_0x36ad61);})['then'](function(_0x5a585b){_0x144a47['rows']=_0x5a585b;return _0x144a47;});}})[_0x1b4f('0x2d')](respondWithFilteredResult(_0x63b91b,_0x36ad61))[_0x1b4f('0x54')](handleError(_0x63b91b,null));};exports['getTeams']=function(_0x21c463,_0x5dc126,_0x594574){var _0x568d14={};var _0x4ecaad={};var _0xeb4f3f;var _0x5cdf25;return db['VoiceQueue'][_0x1b4f('0x69')]({'where':{'id':_0x21c463[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x5dc126,null))[_0x1b4f('0x2d')](function(_0x4c272d){if(_0x4c272d){_0xeb4f3f=_0x4c272d;_0x4ecaad[_0x1b4f('0x41')]=_[_0x1b4f('0x43')](db[_0x1b4f('0x72')]['rawAttributes']);_0x4ecaad[_0x1b4f('0x42')]=_[_0x1b4f('0x43')](_0x21c463[_0x1b4f('0x42')]);_0x4ecaad[_0x1b4f('0x4d')]=_[_0x1b4f('0x44')](_0x4ecaad[_0x1b4f('0x41')],_0x4ecaad[_0x1b4f('0x42')]);_0x568d14[_0x1b4f('0x45')]=_[_0x1b4f('0x44')](_0x4ecaad[_0x1b4f('0x41')],qs[_0x1b4f('0x46')](_0x21c463[_0x1b4f('0x42')]['fields']));_0x568d14[_0x1b4f('0x45')]=_0x568d14['attributes'][_0x1b4f('0x47')]?_0x568d14['attributes']:_0x4ecaad[_0x1b4f('0x41')];_0x568d14[_0x1b4f('0x4a')]=qs[_0x1b4f('0x4b')](_0x21c463['query'][_0x1b4f('0x4b')]);_0x568d14[_0x1b4f('0x4c')]=qs['filters'](_[_0x1b4f('0x4e')](_0x21c463[_0x1b4f('0x42')],_0x4ecaad[_0x1b4f('0x4d')]));if(_0x21c463[_0x1b4f('0x42')][_0x1b4f('0x33')]){_0x568d14[_0x1b4f('0x4c')]=_[_0x1b4f('0x4f')](_0x568d14[_0x1b4f('0x4c')],{'$or':_['map'](_0x568d14[_0x1b4f('0x45')],function(_0xe378c0){var _0x3a11d0={};_0x3a11d0[_0xe378c0]={'$like':'%'+_0x21c463[_0x1b4f('0x42')][_0x1b4f('0x33')]+'%'};return _0x3a11d0;})});}_0x568d14=_['merge']({},_0x568d14,_0x21c463[_0x1b4f('0x57')]);return _0xeb4f3f['getTeams'](_0x568d14);}})[_0x1b4f('0x2d')](function(_0x4f6852){if(_0x4f6852){_0x5cdf25=_0x4f6852[_0x1b4f('0x47')];if(!_0x21c463[_0x1b4f('0x42')][_0x1b4f('0x48')](_0x1b4f('0x49'))){_0x568d14[_0x1b4f('0x24')]=qs[_0x1b4f('0x24')](_0x21c463['query'][_0x1b4f('0x24')]);_0x568d14[_0x1b4f('0x23')]=qs['offset'](_0x21c463[_0x1b4f('0x42')][_0x1b4f('0x23')]);}return _0xeb4f3f[_0x1b4f('0x73')](_0x568d14);}})[_0x1b4f('0x2d')](function(_0x5de13f){if(_0x5de13f){return _0x5de13f?{'count':_0x5cdf25,'rows':_0x5de13f}:null;}})[_0x1b4f('0x2d')](respondWithResult(_0x5dc126,null))[_0x1b4f('0x54')](handleError(_0x5dc126,null));};exports['addTeams']=function(_0x53a5dd,_0xcbeb6,_0x492753){var _0x823c36=_0x53a5dd[_0x1b4f('0x5a')][_0x1b4f('0x74')];var _0x4e33f1=_['map'](_0x823c36,'id');return db[_0x1b4f('0x72')]['findAll']({'where':{'id':_0x4e33f1},'attributes':['id'],'include':[{'model':db[_0x1b4f('0x75')],'as':'Agents','attributes':['id',_0x1b4f('0x3c'),_0x1b4f('0x76'),_0x1b4f('0x77'),_0x1b4f('0x78')],'raw':!![]}]})[_0x1b4f('0x2d')](function(_0x287075){if(_0x287075){var _0xb93dd7=_[_0x1b4f('0x79')](_0x287075,function(_0x180fa2){var _0x2456b0=_0x180fa2[_0x1b4f('0x61')]({'plain':!![]});_0x2456b0[_0x1b4f('0x7a')][_0x1b4f('0x7b')](function(_0x15a766){_0x15a766[_0x1b4f('0x7c')]=_['find'](_0x823c36,{'id':_0x2456b0['id']})[_0x1b4f('0x7c')];});return _0x2456b0[_0x1b4f('0x7a')];});return db['VoiceQueue'][_0x1b4f('0x58')]({'where':{'id':_0x53a5dd['params']['id']}})[_0x1b4f('0x2d')](function(_0x1e7ae9){return db[_0x1b4f('0x7d')][_0x1b4f('0x7e')](function(_0x40f84e){return _0x1e7ae9['addTeams'](_0x4e33f1,{'transaction':_0x40f84e})['then'](function(){return BPromise[_0x1b4f('0x7f')](_0x823c36,function(_0x19930d){return db['TeamVoiceQueue'][_0x1b4f('0x80')]({'TeamId':_0x19930d['id'],'VoiceQueueId':_0x53a5dd[_0x1b4f('0x56')]['id'],'penalty':_0x19930d[_0x1b4f('0x7c')]},{'transaction':_0x40f84e});});})[_0x1b4f('0x2d')](function(){return BPromise[_0x1b4f('0x7f')](_0xb93dd7,function(_0x2ef0a){return db['UserVoiceQueue']['findOrCreate']({'where':{'UserId':_0x2ef0a['id'],'VoiceQueueId':_0x53a5dd[_0x1b4f('0x56')]['id']},'defaults':{'penalty':_0x2ef0a['penalty']},'transaction':_0x40f84e});});})['then'](function(){return BPromise['each'](_[_0x1b4f('0x33')](_0xb93dd7,{'online':!![]}),function(_0x5d3852){return db[_0x1b4f('0x81')][_0x1b4f('0x80')]({'membername':_0x5d3852[_0x1b4f('0x3c')],'UserId':_0x5d3852['id'],'queue_name':_0x1e7ae9[_0x1b4f('0x3c')],'VoiceQueueId':_0x1e7ae9['id'],'interface':_[_0x1b4f('0x82')](_0x5d3852[_0x1b4f('0x78')])?util[_0x1b4f('0x83')](_0x1b4f('0x84'),_0x5d3852[_0x1b4f('0x3c')]):_0x5d3852['interface'],'paused':_0x5d3852[_0x1b4f('0x77')]||![],'penalty':_0x5d3852[_0x1b4f('0x7c')]},{'transaction':_0x40f84e});});})[_0x1b4f('0x2d')](function(){_0xb93dd7[_0x1b4f('0x7b')](function(_0x31e676){socket[_0x1b4f('0x85')]('userVoiceQueue:save',{'UserId':_0x31e676['id'],'VoiceQueueId':_0x1e7ae9['id']});});});});});}})[_0x1b4f('0x2d')](respondWithStatusCode(_0xcbeb6,null))[_0x1b4f('0x54')](handleError(_0xcbeb6,null));};exports[_0x1b4f('0x86')]=function(_0x3d26e6,_0x2b3f64,_0xbbfbcf){return db[_0x1b4f('0x72')][_0x1b4f('0x52')]({'where':{'id':_0x3d26e6[_0x1b4f('0x42')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1b4f('0x75')],'as':_0x1b4f('0x7a'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2b3f64,null))[_0x1b4f('0x2d')](function(_0x49a6fb){var _0x551da2=_[_0x1b4f('0x35')](_0x49a6fb,'id');var _0x1543c6=[];var _0x3f5686=[];var _0x55c66c=squel[_0x1b4f('0x87')]();_0x55c66c[_0x1b4f('0x88')]('tq.TeamId')[_0x1b4f('0x89')]('team_has_voice_queues','tq')['join'](_0x1b4f('0x8a'),'ut',_0x1b4f('0x8b'))[_0x1b4f('0x4c')](_0x1b4f('0x8c'),_0x3d26e6[_0x1b4f('0x56')]['id']);for(var _0x1ae57d=0x0;_0x1ae57d<_0x49a6fb[_0x1b4f('0x47')];_0x1ae57d+=0x1){let _0x25184f=_0x49a6fb[_0x1ae57d];for(var _0x501a13=0x0;_0x501a13<_0x25184f['Agents'][_0x1b4f('0x47')];_0x501a13+=0x1){let _0x480675=_0x25184f['Agents'][_0x501a13];var _0x43f47b=_0x55c66c[_0x1b4f('0x60')]();_0x43f47b[_0x1b4f('0x4c')](_0x1b4f('0x8d'),_0x480675['id']);_0x3f5686['push'](db[_0x1b4f('0x7d')]['query'](_0x43f47b[_0x1b4f('0x8e')](),{'type':db[_0x1b4f('0x7d')][_0x1b4f('0x8f')]['SELECT']})['then'](function(_0x13c8cb){if(_0x13c8cb['length']===0x1){return _0x480675['id'];}else{var _0x152334=_[_0x1b4f('0x90')](_[_0x1b4f('0x35')](_0x13c8cb,_0x1b4f('0x91')),function(_0x5dc3d6){return _[_0x1b4f('0x37')](_0x551da2,_0x5dc3d6);});if(_0x152334){return _0x480675['id'];}}}));}}return BPromise[_0x1b4f('0x92')](_0x3f5686)[_0x1b4f('0x2d')](function(_0x5dd6a9){_0x1543c6=_(_0x1543c6)[_0x1b4f('0x93')](_0x5dd6a9)['compact']()['value']();return db[_0x1b4f('0x51')][_0x1b4f('0x58')]({'where':{'id':_0x3d26e6[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](function(_0x25b758){return db[_0x1b4f('0x7d')][_0x1b4f('0x7e')](function(_0x3b3d5a){return _0x25b758[_0x1b4f('0x86')](_0x3d26e6[_0x1b4f('0x42')][_0x1b4f('0x94')],{'transaction':_0x3b3d5a})[_0x1b4f('0x2d')](function(){if(!_[_0x1b4f('0x95')](_0x1543c6)){return _0x25b758[_0x1b4f('0x96')](_0x1543c6,{'transaction':_0x3b3d5a})[_0x1b4f('0x2d')](function(){return db[_0x1b4f('0x81')][_0x1b4f('0x2e')]({'where':{'VoiceQueueId':_0x3d26e6[_0x1b4f('0x56')]['id'],'UserId':_0x1543c6},'transaction':_0x3b3d5a});});}})[_0x1b4f('0x2d')](function(){_0x1543c6[_0x1b4f('0x7b')](function(_0x116eda){socket['emit']('userVoiceQueue:remove',{'UserId':_0x116eda,'VoiceQueueId':_0x25b758['id']});});});});});});})[_0x1b4f('0x2d')](respondWithStatusCode(_0x2b3f64,null))[_0x1b4f('0x54')](handleError(_0x2b3f64,null));};exports['addAgents']=function(_0x30b7da,_0x2a0acf,_0x5bcc88){var _0x3a4ae3,_0x4243e1;return db[_0x1b4f('0x51')][_0x1b4f('0x58')]({'where':{'id':_0x30b7da[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x2a0acf,null))[_0x1b4f('0x2d')](function(_0x407688){if(_0x407688){_0x4243e1=_0x407688;return _0x407688[_0x1b4f('0x97')](_0x30b7da[_0x1b4f('0x5a')][_0x1b4f('0x94')],_[_0x1b4f('0x62')](_0x30b7da[_0x1b4f('0x5a')],[_0x1b4f('0x94'),'id'])||{})[_0x1b4f('0x98')](function(_0x41845c){for(var _0x724600=0x0;_0x724600<_0x30b7da[_0x1b4f('0x5a')][_0x1b4f('0x94')][_0x1b4f('0x47')];_0x724600+=0x1){socket[_0x1b4f('0x85')]('userVoiceQueue:save',{'UserId':Number(_0x30b7da['body'][_0x1b4f('0x94')][_0x724600]),'VoiceQueueId':Number(_0x30b7da[_0x1b4f('0x56')]['id'])});}return _0x41845c;});}})[_0x1b4f('0x2d')](function(_0x40a1d5){_0x3a4ae3=_0x40a1d5||[];if(_0x4243e1){return db['User'][_0x1b4f('0x52')]({'where':{'id':_0x30b7da['body'][_0x1b4f('0x94')]},'attributes':['id',_0x1b4f('0x3c'),_0x1b4f('0x76'),'voicePause','interface'],'raw':!![]});}})['then'](function(_0xf505ac){if(!_[_0x1b4f('0x95')](_0xf505ac)){var _0x3f7847=[];for(var _0x260e48=0x0;_0x260e48<_0xf505ac[_0x1b4f('0x47')];_0x260e48++){if(_0xf505ac[_0x260e48][_0x1b4f('0x76')]){_0x3f7847[_0x1b4f('0x99')](db[_0x1b4f('0x81')]['upsert']({'membername':_0xf505ac[_0x260e48]['name'],'UserId':_0xf505ac[_0x260e48]['id'],'queue_name':_0x4243e1['name'],'VoiceQueueId':_0x4243e1['id'],'interface':_[_0x1b4f('0x82')](_0xf505ac[_0x260e48]['interface'])?util[_0x1b4f('0x83')](_0x1b4f('0x84'),_0xf505ac[_0x260e48]['name']):_0xf505ac[_0x260e48][_0x1b4f('0x78')],'paused':_0xf505ac[_0x260e48]['voicePause']||![],'penalty':_0x30b7da[_0x1b4f('0x5a')][_0x1b4f('0x7c')]||0x0}));}}return BPromise[_0x1b4f('0x92')](_0x3f7847);}})[_0x1b4f('0x2d')](function(){return _0x3a4ae3;})['then'](respondWithResult(_0x2a0acf,null))['catch'](handleError(_0x2a0acf,null));};exports[_0x1b4f('0x96')]=function(_0x4df068,_0x12242c,_0xf22f5c){return db[_0x1b4f('0x51')][_0x1b4f('0x58')]({'where':{'id':_0x4df068[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x12242c,null))[_0x1b4f('0x2d')](function(_0xc200e7){if(_0xc200e7){return _0xc200e7['removeAgents'](_0x4df068['query'][_0x1b4f('0x94')])[_0x1b4f('0x2d')](function(){if(_[_0x1b4f('0x9a')](_0x4df068[_0x1b4f('0x42')][_0x1b4f('0x94')])){for(var _0x2f0371=0x0;_0x2f0371<_0x4df068['query'][_0x1b4f('0x94')][_0x1b4f('0x47')];_0x2f0371+=0x1){socket[_0x1b4f('0x85')](_0x1b4f('0x9b'),{'UserId':Number(_0x4df068[_0x1b4f('0x42')][_0x1b4f('0x94')][_0x2f0371]),'VoiceQueueId':Number(_0x4df068[_0x1b4f('0x56')]['id'])});}}else{socket['emit'](_0x1b4f('0x9b'),{'UserId':Number(_0x4df068[_0x1b4f('0x42')][_0x1b4f('0x94')]),'VoiceQueueId':Number(_0x4df068[_0x1b4f('0x56')]['id'])});}});}})[_0x1b4f('0x2d')](function(_0x33c5c0){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x4df068['params']['id'],'UserId':_0x4df068['query'][_0x1b4f('0x94')]}})[_0x1b4f('0x2d')](function(){return _0x33c5c0;});})['then'](respondWithStatusCode(_0x12242c,null))[_0x1b4f('0x54')](handleError(_0x12242c,null));};exports[_0x1b4f('0x9c')]=function(_0x42e8ce,_0x1df02b,_0x1b0e45){var _0x38e50f={};var _0x5e7803={};var _0x2978fe;var _0x3e70b6;return db[_0x1b4f('0x51')][_0x1b4f('0x69')]({'where':{'id':_0x42e8ce[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x1df02b,null))[_0x1b4f('0x2d')](function(_0x43e51d){if(_0x43e51d){_0x2978fe=_0x43e51d;_0x5e7803['model']=_[_0x1b4f('0x43')](db[_0x1b4f('0x75')][_0x1b4f('0x3f')]);_0x5e7803[_0x1b4f('0x42')]=_[_0x1b4f('0x43')](_0x42e8ce[_0x1b4f('0x42')]);_0x5e7803['filters']=_[_0x1b4f('0x44')](_0x5e7803['model'],_0x5e7803['query']);_0x38e50f['attributes']=_['intersection'](_0x5e7803[_0x1b4f('0x41')],qs[_0x1b4f('0x46')](_0x42e8ce[_0x1b4f('0x42')][_0x1b4f('0x46')]));_0x38e50f[_0x1b4f('0x45')]=_0x38e50f[_0x1b4f('0x45')]['length']?_0x38e50f['attributes']:_0x5e7803[_0x1b4f('0x41')];_0x38e50f[_0x1b4f('0x4a')]=qs['sort'](_0x42e8ce[_0x1b4f('0x42')][_0x1b4f('0x4b')]);_0x38e50f['where']=qs[_0x1b4f('0x4d')](_['pick'](_0x42e8ce[_0x1b4f('0x42')],_0x5e7803[_0x1b4f('0x4d')]));if(_0x42e8ce['query'][_0x1b4f('0x33')]){_0x38e50f[_0x1b4f('0x4c')]=_[_0x1b4f('0x4f')](_0x38e50f[_0x1b4f('0x4c')],{'$or':_[_0x1b4f('0x35')](_0x38e50f[_0x1b4f('0x45')],function(_0x1db9f){var _0x2bc9bb={};_0x2bc9bb[_0x1db9f]={'$like':'%'+_0x42e8ce['query'][_0x1b4f('0x33')]+'%'};return _0x2bc9bb;})});}_0x38e50f=_['merge']({},_0x38e50f,_0x42e8ce[_0x1b4f('0x57')]);return _0x2978fe[_0x1b4f('0x9c')](_0x38e50f);}})[_0x1b4f('0x2d')](function(_0x3dc6a4){if(_0x3dc6a4){_0x3e70b6=_0x3dc6a4[_0x1b4f('0x47')];if(!_0x42e8ce['query']['hasOwnProperty'](_0x1b4f('0x49'))){_0x38e50f[_0x1b4f('0x24')]=qs[_0x1b4f('0x24')](_0x42e8ce[_0x1b4f('0x42')]['limit']);_0x38e50f[_0x1b4f('0x23')]=qs[_0x1b4f('0x23')](_0x42e8ce[_0x1b4f('0x42')][_0x1b4f('0x23')]);}return _0x2978fe['getAgents'](_0x38e50f);}})[_0x1b4f('0x2d')](function(_0x4fcd22){if(_0x4fcd22){return _0x4fcd22?{'count':_0x3e70b6,'rows':_0x4fcd22}:null;}})[_0x1b4f('0x2d')](respondWithResult(_0x1df02b,null))['catch'](handleError(_0x1df02b,null));};exports[_0x1b4f('0x9d')]=function(_0x45d7bd,_0x56052b,_0x4abf05){var _0x3df72a={};var _0x352f57={};var _0x4e58e5;var _0x10b356;return db[_0x1b4f('0x51')][_0x1b4f('0x69')]({'where':{'id':_0x45d7bd[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x56052b,null))[_0x1b4f('0x2d')](function(_0x664c99){if(_0x664c99){_0x4e58e5=_0x664c99;_0x352f57[_0x1b4f('0x41')]=_[_0x1b4f('0x43')](db['UserVoiceQueueRt'][_0x1b4f('0x3f')]);_0x352f57[_0x1b4f('0x42')]=_['keys'](_0x45d7bd[_0x1b4f('0x42')]);_0x352f57[_0x1b4f('0x4d')]=_[_0x1b4f('0x44')](_0x352f57[_0x1b4f('0x41')],_0x352f57[_0x1b4f('0x42')]);_0x3df72a['attributes']=_[_0x1b4f('0x44')](_0x352f57[_0x1b4f('0x41')],qs[_0x1b4f('0x46')](_0x45d7bd[_0x1b4f('0x42')][_0x1b4f('0x46')]));_0x3df72a[_0x1b4f('0x45')]=_0x3df72a[_0x1b4f('0x45')]['length']?_0x3df72a[_0x1b4f('0x45')]:_0x352f57[_0x1b4f('0x41')];_0x3df72a['order']=qs[_0x1b4f('0x4b')](_0x45d7bd['query']['sort']);_0x3df72a['where']=qs[_0x1b4f('0x4d')](_[_0x1b4f('0x4e')](_0x45d7bd[_0x1b4f('0x42')],_0x352f57[_0x1b4f('0x4d')]));if(_0x45d7bd[_0x1b4f('0x42')][_0x1b4f('0x33')]){_0x3df72a[_0x1b4f('0x4c')]=_[_0x1b4f('0x4f')](_0x3df72a[_0x1b4f('0x4c')],{'$or':_[_0x1b4f('0x35')](_0x3df72a[_0x1b4f('0x45')],function(_0x3bad2e){var _0x3709ae={};_0x3709ae[_0x3bad2e]={'$like':'%'+_0x45d7bd[_0x1b4f('0x42')]['filter']+'%'};return _0x3709ae;})});}_0x3df72a=_[_0x1b4f('0x4f')]({},_0x3df72a,_0x45d7bd[_0x1b4f('0x57')]);return _0x4e58e5[_0x1b4f('0x9d')](_0x3df72a);}})[_0x1b4f('0x2d')](function(_0x11b5a9){if(_0x11b5a9){_0x10b356=_0x11b5a9[_0x1b4f('0x47')];if(!_0x45d7bd[_0x1b4f('0x42')][_0x1b4f('0x48')](_0x1b4f('0x49'))){_0x3df72a[_0x1b4f('0x24')]=qs[_0x1b4f('0x24')](_0x45d7bd[_0x1b4f('0x42')][_0x1b4f('0x24')]);_0x3df72a[_0x1b4f('0x23')]=qs[_0x1b4f('0x23')](_0x45d7bd[_0x1b4f('0x42')][_0x1b4f('0x23')]);}return _0x4e58e5[_0x1b4f('0x9d')](_0x3df72a);}})[_0x1b4f('0x2d')](function(_0x4e1449){return _0x4e1449?{'count':_0x10b356,'rows':_0x4e1449}:null;})[_0x1b4f('0x2d')](respondWithResult(_0x56052b,null))[_0x1b4f('0x54')](handleError(_0x56052b,null));};exports[_0x1b4f('0x9e')]=function(_0x3bc2bf,_0x282a6f,_0xd91eb5){var _0x57e434={};var _0x38b312={};var _0x4f8c6e;var _0x277758;return db['VoiceQueue'][_0x1b4f('0x69')]({'where':{'id':_0x3bc2bf[_0x1b4f('0x56')]['id']}})['then'](handleEntityNotFound(_0x282a6f,null))['then'](function(_0x53bfa8){if(_0x53bfa8){_0x4f8c6e=_0x53bfa8;_0x38b312[_0x1b4f('0x41')]=_[_0x1b4f('0x43')](db[_0x1b4f('0x9f')][_0x1b4f('0x3f')]);_0x38b312[_0x1b4f('0x42')]=_['keys'](_0x3bc2bf[_0x1b4f('0x42')]);_0x38b312[_0x1b4f('0x4d')]=_['intersection'](_0x38b312[_0x1b4f('0x41')],_0x38b312['query']);_0x57e434['attributes']=_['intersection'](_0x38b312[_0x1b4f('0x41')],qs['fields'](_0x3bc2bf['query'][_0x1b4f('0x46')]));_0x57e434[_0x1b4f('0x45')]=_0x57e434[_0x1b4f('0x45')]['length']?_0x57e434[_0x1b4f('0x45')]:_0x38b312[_0x1b4f('0x41')];_0x57e434[_0x1b4f('0x4a')]=qs['sort'](_0x3bc2bf['query'][_0x1b4f('0x4b')]);_0x57e434[_0x1b4f('0x4c')]=qs[_0x1b4f('0x4d')](_['pick'](_0x3bc2bf['query'],_0x38b312['filters']));if(_0x3bc2bf[_0x1b4f('0x42')]['filter']){_0x57e434[_0x1b4f('0x4c')]=_[_0x1b4f('0x4f')](_0x57e434[_0x1b4f('0x4c')],{'$or':_[_0x1b4f('0x35')](_0x57e434[_0x1b4f('0x45')],function(_0x1e56da){var _0x27a5f7={};_0x27a5f7[_0x1e56da]={'$like':'%'+_0x3bc2bf[_0x1b4f('0x42')][_0x1b4f('0x33')]+'%'};return _0x27a5f7;})});}_0x57e434=_['merge']({},_0x57e434,_0x3bc2bf[_0x1b4f('0x57')]);return _0x4f8c6e['getLists'](_0x57e434);}})['then'](function(_0x5b7194){if(_0x5b7194){_0x277758=_0x5b7194[_0x1b4f('0x47')];if(!_0x3bc2bf[_0x1b4f('0x42')][_0x1b4f('0x48')]('nolimit')){_0x57e434['limit']=qs['limit'](_0x3bc2bf['query'][_0x1b4f('0x24')]);_0x57e434['offset']=qs[_0x1b4f('0x23')](_0x3bc2bf[_0x1b4f('0x42')][_0x1b4f('0x23')]);}return _0x4f8c6e[_0x1b4f('0x9e')](_0x57e434);}})['then'](function(_0x2b1cab){if(_0x2b1cab){return _0x2b1cab?{'count':_0x277758,'rows':_0x2b1cab}:null;}})[_0x1b4f('0x2d')](respondWithResult(_0x282a6f,null))[_0x1b4f('0x54')](handleError(_0x282a6f,null));};exports[_0x1b4f('0xa0')]=function(_0x526887,_0x2fa062,_0x17d98d){var _0x35dc69,_0x5a0062;return db[_0x1b4f('0x51')]['find']({'where':{'id':_0x526887['params']['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x2fa062,null))[_0x1b4f('0x2d')](function(_0x2ae8d2){if(_0x2ae8d2){_0x5a0062=_0x2ae8d2;return _0x2ae8d2[_0x1b4f('0xa0')](_0x526887[_0x1b4f('0x5a')][_0x1b4f('0x94')],_[_0x1b4f('0x62')](_0x526887[_0x1b4f('0x5a')],[_0x1b4f('0x94'),'id'])||{});}return null;})[_0x1b4f('0x98')](function(_0x324354){var _0x17bc43;_0x35dc69=_0x324354||[];var _0x3c7bc9=[];if(_0x324354){for(var _0x2a0bde=0x0;_0x2a0bde<_0x324354['length'];_0x2a0bde+=0x1){var _0x3d2ba6=_0x324354[_0x2a0bde]['get']({'plain':!![]});_0x5a0062['dialCheckDuplicateType']=_0x526887[_0x1b4f('0x5a')][_0x1b4f('0xa1')]?_0x526887['body']['dialCheckDuplicateType']:_0x5a0062['dialCheckDuplicateType'];switch(_0x5a0062['dialCheckDuplicateType']){case _0x1b4f('0xa2'):_0x17bc43=squel[_0x1b4f('0xa3')]()[_0x1b4f('0xa4')]('cm_hopper')[_0x1b4f('0xa5')](['phone',_0x1b4f('0xa6'),'ContactId',_0x1b4f('0xa7'),'VoiceQueueId',_0x1b4f('0x63'),_0x1b4f('0x64')],squel[_0x1b4f('0x87')]()['field'](_0x1b4f('0xa8'),_0x1b4f('0xa8'))[_0x1b4f('0x88')]('NOW()',_0x1b4f('0xa6'))[_0x1b4f('0x88')]('id',_0x1b4f('0xa9'))[_0x1b4f('0x88')](_0x3d2ba6[_0x1b4f('0xaa')]['toString'](),_0x1b4f('0xa7'))[_0x1b4f('0x88')](_0x526887[_0x1b4f('0x56')]['id'][_0x1b4f('0x8e')](),_0x1b4f('0x6b'))[_0x1b4f('0x88')]('NOW()',_0x1b4f('0x63'))['field'](_0x1b4f('0xab'),_0x1b4f('0x64'))[_0x1b4f('0x89')]('cm_contacts')[_0x1b4f('0x4c')](_0x1b4f('0xac'))[_0x1b4f('0x4c')](_0x1b4f('0xad'),_0x3d2ba6[_0x1b4f('0xaa')]['toString']())[_0x1b4f('0x4c')](_0x1b4f('0xae'))[_0x1b4f('0x4c')](_0x1b4f('0xaf'),squel[_0x1b4f('0x87')]()[_0x1b4f('0x88')](_0x1b4f('0xb0'))[_0x1b4f('0x89')](_0x1b4f('0xb1'))[_0x1b4f('0x4c')](_0x1b4f('0x8c'),_0x526887['params']['id'][_0x1b4f('0x8e')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x1b4f('0xb2'))[_0x1b4f('0x89')]('cm_hopper')['where'](_0x1b4f('0x8c'),_0x526887[_0x1b4f('0x56')]['id'][_0x1b4f('0x8e')]())))[_0x1b4f('0x8e')]();break;case'onlyIfOpen':_0x17bc43=squel[_0x1b4f('0xa3')]()[_0x1b4f('0xa4')]('cm_hopper')[_0x1b4f('0xa5')]([_0x1b4f('0xa8'),_0x1b4f('0xa6'),_0x1b4f('0xa9'),_0x1b4f('0xa7'),_0x1b4f('0x6b'),_0x1b4f('0x63'),_0x1b4f('0x64')],squel[_0x1b4f('0x87')]()[_0x1b4f('0x88')](_0x1b4f('0xa8'),_0x1b4f('0xa8'))['field'](_0x1b4f('0xab'),_0x1b4f('0xa6'))[_0x1b4f('0x88')]('id',_0x1b4f('0xa9'))['field'](_0x3d2ba6[_0x1b4f('0xaa')][_0x1b4f('0x8e')](),_0x1b4f('0xa7'))['field'](_0x526887[_0x1b4f('0x56')]['id'][_0x1b4f('0x8e')](),_0x1b4f('0x6b'))['field'](_0x1b4f('0xab'),_0x1b4f('0x63'))[_0x1b4f('0x88')](_0x1b4f('0xab'),_0x1b4f('0x64'))['from'](_0x1b4f('0xb3'))['where'](_0x1b4f('0xac'))['where'](_0x1b4f('0xad'),_0x3d2ba6[_0x1b4f('0xaa')][_0x1b4f('0x8e')]())[_0x1b4f('0x4c')](_0x1b4f('0xae'))[_0x1b4f('0x4c')](_0x1b4f('0xaf'),squel[_0x1b4f('0x87')]()[_0x1b4f('0x88')](_0x1b4f('0xb2'))[_0x1b4f('0x89')](_0x1b4f('0xb4'))[_0x1b4f('0x4c')](_0x1b4f('0x8c'),_0x526887[_0x1b4f('0x56')]['id']['toString']())))[_0x1b4f('0x8e')]();break;default:_0x17bc43=squel['insert']()[_0x1b4f('0xa4')](_0x1b4f('0xb4'))[_0x1b4f('0xa5')](['phone',_0x1b4f('0xa6'),_0x1b4f('0xa9'),_0x1b4f('0xa7'),_0x1b4f('0x6b'),'createdAt','updatedAt'],squel['select']()[_0x1b4f('0x88')](_0x1b4f('0xa8'),_0x1b4f('0xa8'))[_0x1b4f('0x88')](_0x1b4f('0xab'),'scheduledAt')['field']('id','ContactId')[_0x1b4f('0x88')](_0x3d2ba6[_0x1b4f('0xaa')][_0x1b4f('0x8e')](),_0x1b4f('0xa7'))[_0x1b4f('0x88')](_0x526887[_0x1b4f('0x56')]['id'][_0x1b4f('0x8e')](),_0x1b4f('0x6b'))['field'](_0x1b4f('0xab'),_0x1b4f('0x63'))[_0x1b4f('0x88')](_0x1b4f('0xab'),'updatedAt')[_0x1b4f('0x89')](_0x1b4f('0xb3'))[_0x1b4f('0x4c')](_0x1b4f('0xac'))['where']('ListId\x20=\x20?',_0x3d2ba6[_0x1b4f('0xaa')]['toString']())[_0x1b4f('0x4c')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x3c7bc9[_0x1b4f('0x99')](db[_0x1b4f('0x7d')][_0x1b4f('0x42')](_0x17bc43));}return BPromise[_0x1b4f('0x92')](_0x3c7bc9);}})['then'](function(){return _0x35dc69;})[_0x1b4f('0x2d')](respondWithResult(_0x2fa062,null))['catch'](handleError(_0x2fa062,null));};exports[_0x1b4f('0xb5')]=function(_0x1a33b7,_0x7de61f,_0x3224b0){return db[_0x1b4f('0x51')]['find']({'where':{'id':_0x1a33b7[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x7de61f,null))[_0x1b4f('0x2d')](function(_0x54af1b){if(_0x54af1b){return _0x54af1b[_0x1b4f('0xb5')](_0x1a33b7[_0x1b4f('0x42')][_0x1b4f('0x94')]);}})[_0x1b4f('0x2d')](function(_0x2e4a38){if(_0x2e4a38){return db[_0x1b4f('0x6a')][_0x1b4f('0x2e')]({'where':{'ListId':_0x1a33b7['query'][_0x1b4f('0x94')],'VoiceQueueId':_0x1a33b7[_0x1b4f('0x56')]['id']}})[_0x1b4f('0x2d')](function(){return _0x2e4a38;});}})[_0x1b4f('0x2d')](respondWithStatusCode(_0x7de61f,null))[_0x1b4f('0x54')](handleError(_0x7de61f,null));};exports[_0x1b4f('0xb6')]=function(_0x32df3b,_0x42dc21,_0x5b99cc){var _0x3718b1={};var _0xf407e5={};var _0x5ed554;var _0x35da2b;return db['VoiceQueue']['findOne']({'where':{'id':_0x32df3b['params']['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x42dc21,null))['then'](function(_0x6f406e){if(_0x6f406e){_0x5ed554=_0x6f406e;_0xf407e5[_0x1b4f('0x41')]=_[_0x1b4f('0x43')](db[_0x1b4f('0x9f')][_0x1b4f('0x3f')]);_0xf407e5[_0x1b4f('0x42')]=_['keys'](_0x32df3b[_0x1b4f('0x42')]);_0xf407e5[_0x1b4f('0x4d')]=_['intersection'](_0xf407e5[_0x1b4f('0x41')],_0xf407e5[_0x1b4f('0x42')]);_0x3718b1[_0x1b4f('0x45')]=_[_0x1b4f('0x44')](_0xf407e5[_0x1b4f('0x41')],qs[_0x1b4f('0x46')](_0x32df3b[_0x1b4f('0x42')][_0x1b4f('0x46')]));_0x3718b1[_0x1b4f('0x45')]=_0x3718b1[_0x1b4f('0x45')][_0x1b4f('0x47')]?_0x3718b1['attributes']:_0xf407e5[_0x1b4f('0x41')];_0x3718b1[_0x1b4f('0x4a')]=qs[_0x1b4f('0x4b')](_0x32df3b[_0x1b4f('0x42')]['sort']);_0x3718b1[_0x1b4f('0x4c')]=qs['filters'](_['pick'](_0x32df3b[_0x1b4f('0x42')],_0xf407e5[_0x1b4f('0x4d')]));if(_0x32df3b[_0x1b4f('0x42')][_0x1b4f('0x33')]){_0x3718b1[_0x1b4f('0x4c')]=_['merge'](_0x3718b1['where'],{'$or':_['map'](_0x3718b1[_0x1b4f('0x45')],function(_0x468eaf){var _0x377b81={};_0x377b81[_0x468eaf]={'$like':'%'+_0x32df3b[_0x1b4f('0x42')]['filter']+'%'};return _0x377b81;})});}_0x3718b1=_[_0x1b4f('0x4f')]({},_0x3718b1,_0x32df3b[_0x1b4f('0x57')]);return _0x5ed554[_0x1b4f('0xb6')](_0x3718b1);}})[_0x1b4f('0x2d')](function(_0x522a68){if(_0x522a68){_0x35da2b=_0x522a68[_0x1b4f('0x47')];if(!_0x32df3b['query'][_0x1b4f('0x48')](_0x1b4f('0x49'))){_0x3718b1['limit']=qs['limit'](_0x32df3b[_0x1b4f('0x42')][_0x1b4f('0x24')]);_0x3718b1[_0x1b4f('0x23')]=qs[_0x1b4f('0x23')](_0x32df3b['query'][_0x1b4f('0x23')]);}return _0x5ed554[_0x1b4f('0xb6')](_0x3718b1);}})['then'](function(_0x22af95){if(_0x22af95){return _0x22af95?{'count':_0x35da2b,'rows':_0x22af95}:null;}})['then'](respondWithResult(_0x42dc21,null))[_0x1b4f('0x54')](handleError(_0x42dc21,null));};exports[_0x1b4f('0xb7')]=function(_0x2135dd,_0x5ab3da,_0x1a44eb){var _0x497b81,_0x3106dc;return db['VoiceQueue'][_0x1b4f('0x58')]({'where':{'id':_0x2135dd['params']['id']}})['then'](handleEntityNotFound(_0x5ab3da,null))['then'](function(_0x17886e){if(_0x17886e){_0x3106dc=_0x17886e;return _0x17886e[_0x1b4f('0xb7')](_0x2135dd[_0x1b4f('0x5a')][_0x1b4f('0x94')],_['omit'](_0x2135dd[_0x1b4f('0x5a')],[_0x1b4f('0x94'),'id'])||{});}return null;})[_0x1b4f('0x98')](function(_0x114c48){var _0x121f87;_0x497b81=_0x114c48||[];var _0x4349f4=[];if(_0x114c48){for(var _0x5c7c19=0x0;_0x5c7c19<_0x114c48[_0x1b4f('0x47')];_0x5c7c19+=0x1){var _0x45071a=_0x114c48[_0x5c7c19]['get']({'plain':!![]});_0x121f87=squel['insert']()[_0x1b4f('0xa4')]('cm_hopper_black')[_0x1b4f('0xa5')](['phone',_0x1b4f('0xa9'),_0x1b4f('0xa7'),_0x1b4f('0x6b'),_0x1b4f('0x63'),_0x1b4f('0x64')],squel['select']()[_0x1b4f('0x88')](_0x1b4f('0xa8'),_0x1b4f('0xa8'))[_0x1b4f('0x88')]('id',_0x1b4f('0xa9'))[_0x1b4f('0x88')](_0x45071a[_0x1b4f('0xaa')][_0x1b4f('0x8e')](),_0x1b4f('0xa7'))[_0x1b4f('0x88')](_0x2135dd[_0x1b4f('0x56')]['id']['toString'](),_0x1b4f('0x6b'))[_0x1b4f('0x88')](_0x1b4f('0xab'),'createdAt')[_0x1b4f('0x88')]('NOW()','updatedAt')[_0x1b4f('0x89')](_0x1b4f('0xb3'))[_0x1b4f('0x4c')](_0x1b4f('0xac'))[_0x1b4f('0x4c')](_0x1b4f('0xad'),_0x45071a[_0x1b4f('0xaa')][_0x1b4f('0x8e')]())[_0x1b4f('0x4c')](_0x1b4f('0xae')))[_0x1b4f('0x8e')]();_0x4349f4['push'](db[_0x1b4f('0x7d')][_0x1b4f('0x42')](_0x121f87));}return BPromise[_0x1b4f('0x92')](_0x4349f4);}})[_0x1b4f('0x2d')](function(){return _0x497b81;})[_0x1b4f('0x2d')](respondWithResult(_0x5ab3da,null))[_0x1b4f('0x54')](handleError(_0x5ab3da,null));};exports[_0x1b4f('0xb8')]=function(_0x524508,_0x2bd516,_0x55d915){return db[_0x1b4f('0x51')]['find']({'where':{'id':_0x524508['params']['id']}})[_0x1b4f('0x2d')](handleEntityNotFound(_0x2bd516,null))[_0x1b4f('0x2d')](function(_0xf9aaf3){if(_0xf9aaf3){return _0xf9aaf3[_0x1b4f('0xb8')](_0x524508[_0x1b4f('0x42')][_0x1b4f('0x94')]);}})['then'](function(_0x14ea1f){if(_0x14ea1f){return db[_0x1b4f('0x71')]['destroy']({'where':{'ListId':_0x524508['query'][_0x1b4f('0x94')],'VoiceQueueId':_0x524508['params']['id']}})['then'](function(){return _0x14ea1f;});}})[_0x1b4f('0x2d')](respondWithStatusCode(_0x2bd516,null))[_0x1b4f('0x54')](handleError(_0x2bd516,null));};
\ No newline at end of file