Built motion from commit (unavailable).|2.5.24
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index 13984f0..bee35ea 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x2d4a=['value','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','includeAll','outbound','userProfileId','error','findOne','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','flatMap','forEach','penalty','each','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','interface','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','team_has_voice_queues','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','all','union','compact','transaction','isEmpty','userVoiceQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','getMembers','getLists','addLists','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','from','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','zip-dir','mustache','sox','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','inbound','QueueCampaigns','filter','ignore','map','includes','find','type','name','stack','send','index','VoiceQueue','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues'];(function(_0x335271,_0x5025f2){var _0xa9fff8=function(_0x28d0bd){while(--_0x28d0bd){_0x335271['push'](_0x335271['shift']());}};_0xa9fff8(++_0x5025f2);}(_0x2d4a,0x119));var _0xa2d4=function(_0x2e0b24,_0x1cc9cf){_0x2e0b24=_0x2e0b24-0x0;var _0x7d96cd=_0x2d4a[_0x2e0b24];return _0x7d96cd;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa2d4('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa2d4('0x1'));var util=require('util');var path=require('path');var sox=require(_0xa2d4('0x2'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa2d4('0x3'));var squel=require('squel');var crypto=require(_0xa2d4('0x4'));var jsforce=require(_0xa2d4('0x5'));var deskjs=require(_0xa2d4('0x6'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xa2d4('0x7'));var authService=require('../../components/auth/service');var qs=require(_0xa2d4('0x8'));var as=require(_0xa2d4('0x9'));var hardwareService=require(_0xa2d4('0xa'));var logger=require(_0xa2d4('0xb'))(_0xa2d4('0xc'));var utils=require(_0xa2d4('0xd'));var config=require(_0xa2d4('0xe'));var licenseUtil=require(_0xa2d4('0xf'));var db=require(_0xa2d4('0x10'))['db'];config[_0xa2d4('0x11')]=_[_0xa2d4('0x12')](config['redis'],{'host':_0xa2d4('0x13'),'port':0x18eb});var socket=require(_0xa2d4('0x14'))(new Redis(config[_0xa2d4('0x11')]));require(_0xa2d4('0x15'))[_0xa2d4('0x16')](socket);function respondWithStatusCode(_0x4a5d63,_0x5643fa){_0x5643fa=_0x5643fa||0xcc;return function(_0x5b91d7){if(_0x5b91d7){return _0x4a5d63[_0xa2d4('0x17')](_0x5643fa);}return _0x4a5d63[_0xa2d4('0x18')](_0x5643fa)[_0xa2d4('0x19')]();};}function respondWithResult(_0x5234fc,_0x24c224){_0x24c224=_0x24c224||0xc8;return function(_0x2a7d57){if(_0x2a7d57){return _0x5234fc[_0xa2d4('0x18')](_0x24c224)[_0xa2d4('0x1a')](_0x2a7d57);}};}function respondWithFilteredResult(_0x5398b5,_0x124f7a){return function(_0x3810bf){if(_0x3810bf){var _0x5f2c78=_0x3810bf[_0xa2d4('0x1b')],_0x995d2e=_0x124f7a[_0xa2d4('0x1c')],_0x27907c=_0x124f7a[_0xa2d4('0x1c')]+_0x124f7a[_0xa2d4('0x1d')],_0x21118c;if(_0x27907c>=_0x5f2c78){_0x27907c=_0x5f2c78;_0x21118c=0xc8;}else{_0x21118c=0xce;}_0x5398b5['status'](_0x21118c);return _0x5398b5[_0xa2d4('0x1e')](_0xa2d4('0x1f'),_0x995d2e+'-'+_0x27907c+'/'+_0x5f2c78)[_0xa2d4('0x1a')](_0x3810bf);}return null;};}function patchUpdates(_0x4aa937){return function(_0x350ed2){try{jsonpatch[_0xa2d4('0x20')](_0x350ed2,_0x4aa937,!![]);}catch(_0x59f7fd){return BPromise[_0xa2d4('0x21')](_0x59f7fd);}return _0x350ed2[_0xa2d4('0x22')]();};}function saveUpdates(_0x40d8c8,_0x45a1a4){return function(_0x64a90f){if(_0x64a90f){return _0x64a90f['update'](_0x40d8c8)[_0xa2d4('0x23')](function(_0x529749){return _0x529749;});}return null;};}function removeEntity(_0x548598,_0xedc80f){return function(_0x1a6d72){if(_0x1a6d72){return _0x1a6d72[_0xa2d4('0x24')]()[_0xa2d4('0x23')](function(){var _0x48df35=_0x1a6d72[_0xa2d4('0x25')]({'plain':!![]});var _0x4266f4=[{'name':'VoiceQueues','value':_0xa2d4('0x26'),'ignore':![]},{'name':_0xa2d4('0x27'),'value':'outbound','ignore':![]}];var _0x51557b=_(_0x4266f4)[_0xa2d4('0x28')](_0xa2d4('0x29'))[_0xa2d4('0x2a')]('value')['value']();if(_[_0xa2d4('0x2b')](_0x51557b,_0x48df35['type'])){return;}var _0x11549c=_[_0xa2d4('0x2c')](_0x4266f4,['value',_0x48df35[_0xa2d4('0x2d')]])[_0xa2d4('0x2e')];return db['UserProfileResource'][_0xa2d4('0x24')]({'where':{'type':_0x11549c,'resourceId':_0x48df35['id']}})['then'](function(){return _0x1a6d72;});})[_0xa2d4('0x23')](function(){_0x548598['status'](0xcc)[_0xa2d4('0x19')]();});}};}function handleEntityNotFound(_0x42db4d,_0x57603e){return function(_0x4d0660){if(!_0x4d0660){_0x42db4d['sendStatus'](0x194);}return _0x4d0660;};}function handleError(_0x43b658,_0x3019ed){_0x3019ed=_0x3019ed||0x1f4;return function(_0x189426){logger['error'](_0x189426[_0xa2d4('0x2f')]);if(_0x189426[_0xa2d4('0x2e')]){delete _0x189426[_0xa2d4('0x2e')];}_0x43b658['status'](_0x3019ed)[_0xa2d4('0x30')](_0x189426);};}exports[_0xa2d4('0x31')]=function(_0x551d38,_0x398c1a){var _0x249859={},_0x4afba7={},_0x102763={'count':0x0,'rows':[]};var _0x4adef3=_[_0xa2d4('0x2a')](db[_0xa2d4('0x32')][_0xa2d4('0x33')],function(_0x521bb4){return{'name':_0x521bb4[_0xa2d4('0x34')],'type':_0x521bb4[_0xa2d4('0x2d')]['key']};});_0x4afba7[_0xa2d4('0x35')]=_[_0xa2d4('0x2a')](_0x4adef3,_0xa2d4('0x2e'));_0x4afba7[_0xa2d4('0x36')]=_[_0xa2d4('0x37')](_0x551d38[_0xa2d4('0x36')]);_0x4afba7['filters']=_['intersection'](_0x4afba7['model'],_0x4afba7[_0xa2d4('0x36')]);_0x249859[_0xa2d4('0x38')]=_[_0xa2d4('0x39')](_0x4afba7['model'],qs[_0xa2d4('0x3a')](_0x551d38[_0xa2d4('0x36')][_0xa2d4('0x3a')]));_0x249859[_0xa2d4('0x38')]=_0x249859['attributes'][_0xa2d4('0x3b')]?_0x249859[_0xa2d4('0x38')]:_0x4afba7[_0xa2d4('0x35')];if(!_0x551d38['query'][_0xa2d4('0x3c')](_0xa2d4('0x3d'))){_0x249859['limit']=qs[_0xa2d4('0x1d')](_0x551d38[_0xa2d4('0x36')][_0xa2d4('0x1d')]);_0x249859[_0xa2d4('0x1c')]=qs[_0xa2d4('0x1c')](_0x551d38[_0xa2d4('0x36')]['offset']);}_0x249859[_0xa2d4('0x3e')]=qs[_0xa2d4('0x3f')](_0x551d38[_0xa2d4('0x36')][_0xa2d4('0x3f')]);_0x249859[_0xa2d4('0x40')]=qs['filters'](_[_0xa2d4('0x41')](_0x551d38['query'],_0x4afba7[_0xa2d4('0x42')]),_0x4adef3);if(_0x551d38[_0xa2d4('0x36')][_0xa2d4('0x28')]){_0x249859[_0xa2d4('0x40')]=_[_0xa2d4('0x43')](_0x249859[_0xa2d4('0x40')],{'$or':_[_0xa2d4('0x2a')](_0x4adef3,function(_0x459c7b){if(_0x459c7b[_0xa2d4('0x2d')]!==_0xa2d4('0x44')){var _0x1d02fe={};_0x1d02fe[_0x459c7b[_0xa2d4('0x2e')]]={'$like':'%'+_0x551d38['query']['filter']+'%'};return _0x1d02fe;}})});}_0x249859=_[_0xa2d4('0x43')]({},_0x249859,_0x551d38[_0xa2d4('0x45')]);var _0x8cfec8={'where':_0x249859[_0xa2d4('0x40')]};return db[_0xa2d4('0x32')][_0xa2d4('0x1b')](_0x8cfec8)[_0xa2d4('0x23')](function(_0x24d728){_0x102763[_0xa2d4('0x1b')]=_0x24d728;if(_0x551d38['query']['includeAll']){_0x249859[_0xa2d4('0x46')]=[{'all':!![]}];}return db['VoiceQueue'][_0xa2d4('0x47')](_0x249859);})[_0xa2d4('0x23')](function(_0x534480){_0x102763[_0xa2d4('0x48')]=_0x534480;return _0x102763;})[_0xa2d4('0x23')](respondWithFilteredResult(_0x398c1a,_0x249859))[_0xa2d4('0x49')](handleError(_0x398c1a,null));};exports[_0xa2d4('0x4a')]=function(_0x3540f1,_0xe07722){var _0x4066bf={'raw':![],'where':{'id':_0x3540f1[_0xa2d4('0x4b')]['id']}},_0x2fddef={};_0x2fddef[_0xa2d4('0x35')]=_[_0xa2d4('0x37')](db[_0xa2d4('0x32')][_0xa2d4('0x33')]);_0x2fddef[_0xa2d4('0x36')]=_[_0xa2d4('0x37')](_0x3540f1[_0xa2d4('0x36')]);_0x2fddef[_0xa2d4('0x42')]=_[_0xa2d4('0x39')](_0x2fddef[_0xa2d4('0x35')],_0x2fddef[_0xa2d4('0x36')]);_0x4066bf[_0xa2d4('0x38')]=_[_0xa2d4('0x39')](_0x2fddef[_0xa2d4('0x35')],qs[_0xa2d4('0x3a')](_0x3540f1['query'][_0xa2d4('0x3a')]));_0x4066bf['attributes']=_0x4066bf[_0xa2d4('0x38')][_0xa2d4('0x3b')]?_0x4066bf[_0xa2d4('0x38')]:_0x2fddef[_0xa2d4('0x35')];if(_0x3540f1[_0xa2d4('0x36')]['includeAll']){_0x4066bf[_0xa2d4('0x46')]=[{'all':!![]}];}_0x4066bf=_[_0xa2d4('0x43')]({},_0x4066bf,_0x3540f1[_0xa2d4('0x45')]);return db['VoiceQueue'][_0xa2d4('0x2c')](_0x4066bf)[_0xa2d4('0x23')](handleEntityNotFound(_0xe07722,null))[_0xa2d4('0x23')](respondWithResult(_0xe07722,null))['catch'](handleError(_0xe07722,null));};exports[_0xa2d4('0x4c')]=function(_0x472b62,_0xe496df){return db[_0xa2d4('0x32')]['create'](_0x472b62['body'],{})['then'](function(_0x34a52c){var _0x278c18=_0x472b62[_0xa2d4('0x4d')][_0xa2d4('0x25')]({'plain':!![]});if(!_0x278c18)throw new Error(_0xa2d4('0x4e'));if(_0x278c18[_0xa2d4('0x4f')]===_0xa2d4('0x4d')){var _0x2c33df=_0x34a52c[_0xa2d4('0x25')]({'plain':!![]});var _0x1929d1=[{'name':_0xa2d4('0x50'),'value':'inbound'},{'name':_0xa2d4('0x27'),'value':'outbound'}];var _0x888222=_[_0xa2d4('0x2c')](_0x1929d1,[_0xa2d4('0x51'),_0x2c33df[_0xa2d4('0x2d')]])[_0xa2d4('0x2e')];return db[_0xa2d4('0x52')][_0xa2d4('0x2c')]({'where':{'name':_0x888222,'userProfileId':_0x278c18['userProfileId']},'raw':!![]})['then'](function(_0x408e23){if(_0x408e23&&_0x408e23[_0xa2d4('0x53')]===0x0){return db[_0xa2d4('0x54')][_0xa2d4('0x4c')]({'name':_0x2c33df[_0xa2d4('0x2e')],'resourceId':_0x2c33df['id'],'type':_0x408e23[_0xa2d4('0x2e')],'sectionId':_0x408e23['id']},{})[_0xa2d4('0x23')](function(){return _0x34a52c;});}else{return _0x34a52c;}})[_0xa2d4('0x49')](function(_0x145e90){logger['error'](_0xa2d4('0x55'),_0x145e90);throw _0x145e90;});}return _0x34a52c;})[_0xa2d4('0x23')](respondWithResult(_0xe496df,0xc9))['catch'](handleError(_0xe496df,null));};exports[_0xa2d4('0x56')]=function(_0x340f31,_0x20eb83){var _0x4f087d={'where':{'id':_0x340f31[_0xa2d4('0x4b')]['id']}},_0xc64382={};_0xc64382[_0xa2d4('0x35')]=_[_0xa2d4('0x37')](db[_0xa2d4('0x32')][_0xa2d4('0x33')]);_0x4f087d[_0xa2d4('0x38')]=_[_0xa2d4('0x39')](_0xc64382[_0xa2d4('0x35')],qs['fields'](_0x340f31[_0xa2d4('0x36')]['fields']));_0x4f087d['attributes']=_0x4f087d['attributes']['length']?_0x4f087d[_0xa2d4('0x38')]:_0xc64382['model'];if(_0x340f31[_0xa2d4('0x36')]['includeAll']){_0x4f087d[_0xa2d4('0x46')]=[{'all':!![]}];}_0x4f087d=_[_0xa2d4('0x43')]({},_0x4f087d,_0x340f31[_0xa2d4('0x45')]);return db[_0xa2d4('0x32')][_0xa2d4('0x2c')](_0x4f087d)['then'](handleEntityNotFound(_0x20eb83,null))[_0xa2d4('0x23')](function(_0x3d2dba){if(_0x3d2dba){var _0x371aa1=_0x3d2dba[_0xa2d4('0x25')]({'plain':!![]});_0x371aa1=qs[_0xa2d4('0x57')](_0x371aa1,['id',_0xa2d4('0x58'),_0xa2d4('0x59')]);_0x340f31[_0xa2d4('0x5a')]=_['omit'](_0x340f31[_0xa2d4('0x5a')],['id',_0xa2d4('0x58'),'updatedAt']);return db['VoiceQueue']['create'](_['merge'](_0x371aa1,_0x340f31[_0xa2d4('0x5a')]),{'include':_0x340f31[_0xa2d4('0x36')][_0xa2d4('0x5b')]?[{'all':!![]}]:undefined})[_0xa2d4('0x23')](function(_0x3cf302){var _0x2ae684=_0x340f31['user']['get']({'plain':!![]});if(!_0x2ae684)throw new Error(_0xa2d4('0x4e'));if(_0x2ae684[_0xa2d4('0x4f')]===_0xa2d4('0x4d')){var _0x38548e=_0x3cf302[_0xa2d4('0x25')]({'plain':!![]});var _0x26d1f4=[{'name':_0xa2d4('0x50'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xa2d4('0x5c')}];var _0x1eac83=_['find'](_0x26d1f4,[_0xa2d4('0x51'),_0x38548e[_0xa2d4('0x2d')]])[_0xa2d4('0x2e')];return db[_0xa2d4('0x52')][_0xa2d4('0x2c')]({'where':{'name':_0x1eac83,'userProfileId':_0x2ae684[_0xa2d4('0x5d')]},'raw':!![]})['then'](function(_0x1bd7ad){if(_0x1bd7ad&&_0x1bd7ad[_0xa2d4('0x53')]===0x0){return db[_0xa2d4('0x54')]['create']({'name':_0x38548e[_0xa2d4('0x2e')],'resourceId':_0x38548e['id'],'type':_0x1bd7ad[_0xa2d4('0x2e')],'sectionId':_0x1bd7ad['id']},{})[_0xa2d4('0x23')](function(){return _0x3cf302;});}else{return _0x3cf302;}})[_0xa2d4('0x49')](function(_0x57e442){logger[_0xa2d4('0x5e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57e442);throw _0x57e442;});}return _0x3cf302;});}})[_0xa2d4('0x23')](respondWithResult(_0x20eb83,0xc9))[_0xa2d4('0x49')](handleError(_0x20eb83,null));};exports['update']=function(_0x3004b3,_0x5b4ac0){if(_0x3004b3[_0xa2d4('0x5a')]['id']){delete _0x3004b3['body']['id'];}return db['VoiceQueue'][_0xa2d4('0x2c')]({'where':{'id':_0x3004b3[_0xa2d4('0x4b')]['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x5b4ac0,null))['then'](saveUpdates(_0x3004b3['body'],null))[_0xa2d4('0x23')](respondWithResult(_0x5b4ac0,null))[_0xa2d4('0x49')](handleError(_0x5b4ac0,null));};exports[_0xa2d4('0x24')]=function(_0x573d89,_0x4246a1){return db[_0xa2d4('0x32')]['find']({'where':{'id':_0x573d89[_0xa2d4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4246a1,null))[_0xa2d4('0x23')](removeEntity(_0x4246a1,null))[_0xa2d4('0x49')](handleError(_0x4246a1,null));};exports['getHoppers']=function(_0x2f633a,_0x19a158,_0x28e7cb){var _0x1d0846={'raw':![],'where':{}};var _0x4b3068={};var _0xd68e6={'count':0x0,'rows':[]};return db[_0xa2d4('0x32')][_0xa2d4('0x5f')]({'where':{'id':_0x2f633a[_0xa2d4('0x4b')]['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x19a158,null))[_0xa2d4('0x23')](function(_0x14f720){if(_0x14f720){_0x4b3068[_0xa2d4('0x35')]=_[_0xa2d4('0x37')](db[_0xa2d4('0x60')][_0xa2d4('0x33')]);_0x4b3068[_0xa2d4('0x36')]=_[_0xa2d4('0x37')](_0x2f633a['query']);_0x4b3068[_0xa2d4('0x42')]=_[_0xa2d4('0x39')](_0x4b3068[_0xa2d4('0x35')],_0x4b3068[_0xa2d4('0x36')]);_0x1d0846[_0xa2d4('0x38')]=_[_0xa2d4('0x39')](_0x4b3068[_0xa2d4('0x35')],qs[_0xa2d4('0x3a')](_0x2f633a[_0xa2d4('0x36')][_0xa2d4('0x3a')]));_0x1d0846[_0xa2d4('0x38')]=_0x1d0846[_0xa2d4('0x38')]['length']?_0x1d0846['attributes']:_0x4b3068[_0xa2d4('0x35')];if(!_0x2f633a[_0xa2d4('0x36')][_0xa2d4('0x3c')](_0xa2d4('0x3d'))){_0x1d0846[_0xa2d4('0x1d')]=qs[_0xa2d4('0x1d')](_0x2f633a[_0xa2d4('0x36')][_0xa2d4('0x1d')]);_0x1d0846[_0xa2d4('0x1c')]=qs[_0xa2d4('0x1c')](_0x2f633a['query'][_0xa2d4('0x1c')]);}_0x1d0846['order']=qs['sort'](_0x2f633a['query'][_0xa2d4('0x3f')]);_0x1d0846['where']=qs[_0xa2d4('0x42')](_[_0xa2d4('0x41')](_0x2f633a[_0xa2d4('0x36')],_0x4b3068[_0xa2d4('0x42')]));_0x1d0846[_0xa2d4('0x40')]['VoiceQueueId']=_0x14f720['id'];if(_0x2f633a[_0xa2d4('0x36')]['filter']){_0x1d0846[_0xa2d4('0x40')]=_[_0xa2d4('0x43')](_0x1d0846['where'],{'$or':_[_0xa2d4('0x2a')](_0x1d0846[_0xa2d4('0x38')],function(_0x491193){var _0x1f7450={};_0x1f7450[_0x491193]={'$like':'%'+_0x2f633a[_0xa2d4('0x36')]['filter']+'%'};return _0x1f7450;})});}_0x1d0846=_[_0xa2d4('0x43')]({},_0x1d0846,_0x2f633a['options']);return db[_0xa2d4('0x60')][_0xa2d4('0x1b')]({'where':_0x1d0846[_0xa2d4('0x40')]})['then'](function(_0x3c8215){_0xd68e6[_0xa2d4('0x1b')]=_0x3c8215;if(_0x2f633a[_0xa2d4('0x36')][_0xa2d4('0x5b')]){_0x1d0846[_0xa2d4('0x46')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x1d0846);})[_0xa2d4('0x23')](function(_0x6e4c75){_0xd68e6[_0xa2d4('0x48')]=_0x6e4c75;return _0xd68e6;});}})[_0xa2d4('0x23')](respondWithFilteredResult(_0x19a158,_0x1d0846))[_0xa2d4('0x49')](handleError(_0x19a158,null));};exports[_0xa2d4('0x61')]=function(_0x3da6f3,_0x58fe8b,_0x3b5b50){var _0x5b1f5e={'raw':!![],'where':{}};var _0x30c677={};var _0xd3d743={'count':0x0,'rows':[]};return db[_0xa2d4('0x32')][_0xa2d4('0x5f')]({'where':{'id':_0x3da6f3[_0xa2d4('0x4b')]['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x58fe8b,null))['then'](function(_0x4a83e1){if(_0x4a83e1){_0x30c677[_0xa2d4('0x35')]=_[_0xa2d4('0x37')](db[_0xa2d4('0x62')]['rawAttributes']);_0x30c677[_0xa2d4('0x36')]=_[_0xa2d4('0x37')](_0x3da6f3[_0xa2d4('0x36')]);_0x30c677[_0xa2d4('0x42')]=_[_0xa2d4('0x39')](_0x30c677[_0xa2d4('0x35')],_0x30c677[_0xa2d4('0x36')]);_0x5b1f5e['attributes']=_['intersection'](_0x30c677[_0xa2d4('0x35')],qs[_0xa2d4('0x3a')](_0x3da6f3[_0xa2d4('0x36')][_0xa2d4('0x3a')]));_0x5b1f5e[_0xa2d4('0x38')]=_0x5b1f5e[_0xa2d4('0x38')][_0xa2d4('0x3b')]?_0x5b1f5e[_0xa2d4('0x38')]:_0x30c677[_0xa2d4('0x35')];if(!_0x3da6f3[_0xa2d4('0x36')][_0xa2d4('0x3c')](_0xa2d4('0x3d'))){_0x5b1f5e[_0xa2d4('0x1d')]=qs['limit'](_0x3da6f3['query']['limit']);_0x5b1f5e[_0xa2d4('0x1c')]=qs[_0xa2d4('0x1c')](_0x3da6f3[_0xa2d4('0x36')][_0xa2d4('0x1c')]);}_0x5b1f5e[_0xa2d4('0x3e')]=qs[_0xa2d4('0x3f')](_0x3da6f3[_0xa2d4('0x36')][_0xa2d4('0x3f')]);_0x5b1f5e[_0xa2d4('0x40')]=qs[_0xa2d4('0x42')](_['pick'](_0x3da6f3['query'],_0x30c677[_0xa2d4('0x42')]));_0x5b1f5e[_0xa2d4('0x40')][_0xa2d4('0x63')]=_0x4a83e1['id'];if(_0x3da6f3[_0xa2d4('0x36')][_0xa2d4('0x28')]){_0x5b1f5e['where']=_['merge'](_0x5b1f5e[_0xa2d4('0x40')],{'$or':_[_0xa2d4('0x2a')](_0x5b1f5e[_0xa2d4('0x38')],function(_0x1fc87e){var _0x3deaa4={};_0x3deaa4[_0x1fc87e]={'$like':'%'+_0x3da6f3[_0xa2d4('0x36')]['filter']+'%'};return _0x3deaa4;})});}_0x5b1f5e=_[_0xa2d4('0x43')]({},_0x5b1f5e,_0x3da6f3[_0xa2d4('0x45')]);return db[_0xa2d4('0x62')][_0xa2d4('0x1b')]({'where':_0x5b1f5e[_0xa2d4('0x40')]})[_0xa2d4('0x23')](function(_0x1c4ccf){_0xd3d743[_0xa2d4('0x1b')]=_0x1c4ccf;if(_0x3da6f3[_0xa2d4('0x36')][_0xa2d4('0x5b')]){_0x5b1f5e[_0xa2d4('0x46')]=[{'all':!![]}];}return db[_0xa2d4('0x62')][_0xa2d4('0x47')](_0x5b1f5e);})[_0xa2d4('0x23')](function(_0x80e65f){_0xd3d743[_0xa2d4('0x48')]=_0x80e65f;return _0xd3d743;});}})[_0xa2d4('0x23')](respondWithFilteredResult(_0x58fe8b,_0x5b1f5e))[_0xa2d4('0x49')](handleError(_0x58fe8b,null));};exports['getHopperFinals']=function(_0x2de35e,_0x219c52,_0x61d610){var _0x50692d={'raw':!![],'where':{}};var _0x28393c={};var _0x566002={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xa2d4('0x5f')]({'where':{'id':_0x2de35e[_0xa2d4('0x4b')]['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x219c52,null))[_0xa2d4('0x23')](function(_0x333701){if(_0x333701){_0x28393c[_0xa2d4('0x35')]=_['keys'](db[_0xa2d4('0x64')][_0xa2d4('0x33')]);_0x28393c[_0xa2d4('0x36')]=_['keys'](_0x2de35e[_0xa2d4('0x36')]);_0x28393c[_0xa2d4('0x42')]=_['intersection'](_0x28393c['model'],_0x28393c[_0xa2d4('0x36')]);_0x50692d[_0xa2d4('0x38')]=_[_0xa2d4('0x39')](_0x28393c[_0xa2d4('0x35')],qs['fields'](_0x2de35e[_0xa2d4('0x36')][_0xa2d4('0x3a')]));_0x50692d[_0xa2d4('0x38')]=_0x50692d[_0xa2d4('0x38')][_0xa2d4('0x3b')]?_0x50692d[_0xa2d4('0x38')]:_0x28393c[_0xa2d4('0x35')];if(!_0x2de35e[_0xa2d4('0x36')][_0xa2d4('0x3c')]('nolimit')){_0x50692d[_0xa2d4('0x1d')]=qs[_0xa2d4('0x1d')](_0x2de35e[_0xa2d4('0x36')][_0xa2d4('0x1d')]);_0x50692d['offset']=qs[_0xa2d4('0x1c')](_0x2de35e[_0xa2d4('0x36')]['offset']);}_0x50692d['order']=qs['sort'](_0x2de35e[_0xa2d4('0x36')][_0xa2d4('0x3f')]);_0x50692d[_0xa2d4('0x40')]=qs[_0xa2d4('0x42')](_[_0xa2d4('0x41')](_0x2de35e[_0xa2d4('0x36')],_0x28393c[_0xa2d4('0x42')]));_0x50692d[_0xa2d4('0x40')][_0xa2d4('0x63')]=_0x333701['id'];if(_0x2de35e[_0xa2d4('0x36')]['filter']){_0x50692d[_0xa2d4('0x40')]=_[_0xa2d4('0x43')](_0x50692d['where'],{'$or':_['map'](_0x50692d[_0xa2d4('0x38')],function(_0x4f7006){var _0x34d113={};_0x34d113[_0x4f7006]={'$like':'%'+_0x2de35e[_0xa2d4('0x36')][_0xa2d4('0x28')]+'%'};return _0x34d113;})});}_0x50692d=_[_0xa2d4('0x43')]({},_0x50692d,_0x2de35e['options']);return db[_0xa2d4('0x64')]['count']({'where':_0x50692d[_0xa2d4('0x40')]})[_0xa2d4('0x23')](function(_0xa5652b){_0x566002['count']=_0xa5652b;if(_0x2de35e[_0xa2d4('0x36')][_0xa2d4('0x5b')]){_0x50692d['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0xa2d4('0x47')](_0x50692d);})[_0xa2d4('0x23')](function(_0x3f8101){_0x566002['rows']=_0x3f8101;return _0x566002;});}})[_0xa2d4('0x23')](respondWithFilteredResult(_0x219c52,_0x50692d))[_0xa2d4('0x49')](handleError(_0x219c52,null));};exports[_0xa2d4('0x65')]=function(_0x2e1994,_0x428608,_0x317356){var _0x46a0f0={'raw':!![],'where':{}};var _0x5a860a={};var _0x4f4a79={'count':0x0,'rows':[]};return db[_0xa2d4('0x32')]['findOne']({'where':{'id':_0x2e1994['params']['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x428608,null))['then'](function(_0x250f30){if(_0x250f30){_0x5a860a[_0xa2d4('0x35')]=_[_0xa2d4('0x37')](db[_0xa2d4('0x66')][_0xa2d4('0x33')]);_0x5a860a['query']=_[_0xa2d4('0x37')](_0x2e1994[_0xa2d4('0x36')]);_0x5a860a[_0xa2d4('0x42')]=_[_0xa2d4('0x39')](_0x5a860a[_0xa2d4('0x35')],_0x5a860a[_0xa2d4('0x36')]);_0x46a0f0['attributes']=_[_0xa2d4('0x39')](_0x5a860a['model'],qs['fields'](_0x2e1994[_0xa2d4('0x36')][_0xa2d4('0x3a')]));_0x46a0f0[_0xa2d4('0x38')]=_0x46a0f0['attributes'][_0xa2d4('0x3b')]?_0x46a0f0[_0xa2d4('0x38')]:_0x5a860a[_0xa2d4('0x35')];if(!_0x2e1994[_0xa2d4('0x36')][_0xa2d4('0x3c')]('nolimit')){_0x46a0f0['limit']=qs[_0xa2d4('0x1d')](_0x2e1994[_0xa2d4('0x36')]['limit']);_0x46a0f0[_0xa2d4('0x1c')]=qs[_0xa2d4('0x1c')](_0x2e1994[_0xa2d4('0x36')][_0xa2d4('0x1c')]);}_0x46a0f0[_0xa2d4('0x3e')]=qs[_0xa2d4('0x3f')](_0x2e1994[_0xa2d4('0x36')][_0xa2d4('0x3f')]);_0x46a0f0[_0xa2d4('0x40')]=qs[_0xa2d4('0x42')](_['pick'](_0x2e1994['query'],_0x5a860a[_0xa2d4('0x42')]));_0x46a0f0[_0xa2d4('0x40')]['VoiceQueueId']=_0x250f30['id'];if(_0x2e1994[_0xa2d4('0x36')][_0xa2d4('0x28')]){_0x46a0f0[_0xa2d4('0x40')]=_[_0xa2d4('0x43')](_0x46a0f0[_0xa2d4('0x40')],{'$or':_[_0xa2d4('0x2a')](_0x46a0f0[_0xa2d4('0x38')],function(_0x47f517){var _0x14838b={};_0x14838b[_0x47f517]={'$like':'%'+_0x2e1994['query'][_0xa2d4('0x28')]+'%'};return _0x14838b;})});}_0x46a0f0=_[_0xa2d4('0x43')]({},_0x46a0f0,_0x2e1994[_0xa2d4('0x45')]);return db['CmHopperBlack']['count']({'where':_0x46a0f0['where']})[_0xa2d4('0x23')](function(_0x4de9a7){_0x4f4a79[_0xa2d4('0x1b')]=_0x4de9a7;if(_0x2e1994[_0xa2d4('0x36')][_0xa2d4('0x5b')]){_0x46a0f0[_0xa2d4('0x46')]=[{'all':!![]}];}return db[_0xa2d4('0x66')][_0xa2d4('0x47')](_0x46a0f0);})[_0xa2d4('0x23')](function(_0xefc0bb){_0x4f4a79[_0xa2d4('0x48')]=_0xefc0bb;return _0x4f4a79;});}})[_0xa2d4('0x23')](respondWithFilteredResult(_0x428608,_0x46a0f0))[_0xa2d4('0x49')](handleError(_0x428608,null));};exports[_0xa2d4('0x67')]=function(_0x151118,_0x422b2e,_0x175b83){var _0x39d85b={};var _0x259cb4={};var _0x475a49;var _0x591131;return db['VoiceQueue']['findOne']({'where':{'id':_0x151118[_0xa2d4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x422b2e,null))[_0xa2d4('0x23')](function(_0x5a98cf){if(_0x5a98cf){_0x475a49=_0x5a98cf;_0x259cb4[_0xa2d4('0x35')]=_[_0xa2d4('0x37')](db['Team']['rawAttributes']);_0x259cb4[_0xa2d4('0x36')]=_['keys'](_0x151118['query']);_0x259cb4[_0xa2d4('0x42')]=_[_0xa2d4('0x39')](_0x259cb4[_0xa2d4('0x35')],_0x259cb4['query']);_0x39d85b[_0xa2d4('0x38')]=_[_0xa2d4('0x39')](_0x259cb4[_0xa2d4('0x35')],qs['fields'](_0x151118[_0xa2d4('0x36')][_0xa2d4('0x3a')]));_0x39d85b[_0xa2d4('0x38')]=_0x39d85b['attributes'][_0xa2d4('0x3b')]?_0x39d85b[_0xa2d4('0x38')]:_0x259cb4[_0xa2d4('0x35')];_0x39d85b['order']=qs[_0xa2d4('0x3f')](_0x151118['query'][_0xa2d4('0x3f')]);_0x39d85b['where']=qs[_0xa2d4('0x42')](_[_0xa2d4('0x41')](_0x151118[_0xa2d4('0x36')],_0x259cb4[_0xa2d4('0x42')]));if(_0x151118['query']['filter']){_0x39d85b['where']=_[_0xa2d4('0x43')](_0x39d85b['where'],{'$or':_[_0xa2d4('0x2a')](_0x39d85b[_0xa2d4('0x38')],function(_0x5c6631){var _0x305636={};_0x305636[_0x5c6631]={'$like':'%'+_0x151118[_0xa2d4('0x36')][_0xa2d4('0x28')]+'%'};return _0x305636;})});}_0x39d85b=_[_0xa2d4('0x43')]({},_0x39d85b,_0x151118['options']);return _0x475a49['getTeams'](_0x39d85b);}})[_0xa2d4('0x23')](function(_0xfec82d){if(_0xfec82d){_0x591131=_0xfec82d[_0xa2d4('0x3b')];if(!_0x151118[_0xa2d4('0x36')][_0xa2d4('0x3c')]('nolimit')){_0x39d85b[_0xa2d4('0x1d')]=qs[_0xa2d4('0x1d')](_0x151118[_0xa2d4('0x36')][_0xa2d4('0x1d')]);_0x39d85b[_0xa2d4('0x1c')]=qs[_0xa2d4('0x1c')](_0x151118[_0xa2d4('0x36')][_0xa2d4('0x1c')]);}return _0x475a49['getTeams'](_0x39d85b);}})['then'](function(_0x2c09e8){if(_0x2c09e8){return _0x2c09e8?{'count':_0x591131,'rows':_0x2c09e8}:null;}})[_0xa2d4('0x23')](respondWithResult(_0x422b2e,null))['catch'](handleError(_0x422b2e,null));};exports[_0xa2d4('0x68')]=function(_0x59cd93,_0x3b9fa1,_0x464029){var _0x4598af=_0x59cd93[_0xa2d4('0x5a')][_0xa2d4('0x69')];var _0x273a50=_[_0xa2d4('0x2a')](_0x4598af,'id');return db[_0xa2d4('0x6a')][_0xa2d4('0x47')]({'where':{'id':_0x273a50},'attributes':['id'],'include':[{'model':db[_0xa2d4('0x6b')],'as':_0xa2d4('0x6c'),'attributes':['id',_0xa2d4('0x2e'),_0xa2d4('0x6d'),_0xa2d4('0x6e'),'interface'],'raw':!![]}]})['then'](function(_0x174f2a){if(_0x174f2a){var _0x4bd396=_[_0xa2d4('0x6f')](_0x174f2a,function(_0x40b9f2){var _0x2bf1cf=_0x40b9f2['get']({'plain':!![]});_0x2bf1cf[_0xa2d4('0x6c')][_0xa2d4('0x70')](function(_0x4fb901){_0x4fb901['penalty']=_[_0xa2d4('0x2c')](_0x4598af,{'id':_0x2bf1cf['id']})[_0xa2d4('0x71')];});return _0x2bf1cf[_0xa2d4('0x6c')];});return db[_0xa2d4('0x32')][_0xa2d4('0x2c')]({'where':{'id':_0x59cd93[_0xa2d4('0x4b')]['id']}})[_0xa2d4('0x23')](function(_0x24f374){return db['sequelize']['transaction'](function(_0x325ae9){return _0x24f374['addTeams'](_0x273a50,{'transaction':_0x325ae9})['then'](function(){return BPromise[_0xa2d4('0x72')](_0x4bd396,function(_0x27cbb7){return db[_0xa2d4('0x73')]['findOrCreate']({'where':{'UserId':_0x27cbb7['id'],'VoiceQueueId':_0x59cd93[_0xa2d4('0x4b')]['id']},'defaults':{'penalty':_0x27cbb7[_0xa2d4('0x71')]},'transaction':_0x325ae9});});})[_0xa2d4('0x23')](function(){return BPromise['each'](_[_0xa2d4('0x28')](_0x4bd396,{'online':!![]}),function(_0x2fd9a1){return db[_0xa2d4('0x74')][_0xa2d4('0x75')]({'membername':_0x2fd9a1[_0xa2d4('0x2e')],'UserId':_0x2fd9a1['id'],'queue_name':_0x24f374[_0xa2d4('0x2e')],'VoiceQueueId':_0x24f374['id'],'interface':_[_0xa2d4('0x76')](_0x2fd9a1[_0xa2d4('0x77')])?util[_0xa2d4('0x78')](_0xa2d4('0x79'),_0x2fd9a1['name']):_0x2fd9a1[_0xa2d4('0x77')],'paused':_0x2fd9a1[_0xa2d4('0x6e')]||![],'penalty':_0x2fd9a1[_0xa2d4('0x71')]},{'transaction':_0x325ae9});});})[_0xa2d4('0x23')](function(){_0x4bd396['forEach'](function(_0x3dc99c){socket[_0xa2d4('0x7a')](_0xa2d4('0x7b'),{'UserId':_0x3dc99c['id'],'VoiceQueueId':_0x24f374['id']});});});});});}})['then'](respondWithStatusCode(_0x3b9fa1,null))[_0xa2d4('0x49')](handleError(_0x3b9fa1,null));};exports[_0xa2d4('0x7c')]=function(_0x27c960,_0x27c30a,_0x330ce0){return db[_0xa2d4('0x6a')][_0xa2d4('0x47')]({'where':{'id':_0x27c960[_0xa2d4('0x36')][_0xa2d4('0x7d')]},'attributes':['id'],'include':[{'model':db[_0xa2d4('0x6b')],'as':_0xa2d4('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xa2d4('0x23')](handleEntityNotFound(_0x27c30a,null))['then'](function(_0x14fd5e){var _0x1263ed=_[_0xa2d4('0x2a')](_0x14fd5e,'id');var _0x4a539f=[];var _0x185184=[];var _0x2bdda7=squel[_0xa2d4('0x7e')]();_0x2bdda7[_0xa2d4('0x7f')]('tq.TeamId')['from'](_0xa2d4('0x80'),'tq')[_0xa2d4('0x81')]('user_has_teams','ut',_0xa2d4('0x82'))[_0xa2d4('0x40')](_0xa2d4('0x83'),_0x27c960[_0xa2d4('0x4b')]['id']);for(var _0x2e2457=0x0;_0x2e2457<_0x14fd5e[_0xa2d4('0x3b')];_0x2e2457+=0x1){let _0x2f5465=_0x14fd5e[_0x2e2457];for(var _0x510c9a=0x0;_0x510c9a<_0x2f5465['Agents'][_0xa2d4('0x3b')];_0x510c9a+=0x1){let _0x18a05f=_0x2f5465['Agents'][_0x510c9a];var _0x54005c=_0x2bdda7['clone']();_0x54005c[_0xa2d4('0x40')](_0xa2d4('0x84'),_0x18a05f['id']);_0x185184[_0xa2d4('0x85')](db['sequelize'][_0xa2d4('0x36')](_0x54005c[_0xa2d4('0x86')](),{'type':db[_0xa2d4('0x87')][_0xa2d4('0x88')][_0xa2d4('0x89')]})[_0xa2d4('0x23')](function(_0x2be98f){if(_0x2be98f[_0xa2d4('0x3b')]===0x1){return _0x18a05f['id'];}else{var _0xa1234b=_[_0xa2d4('0x8a')](_[_0xa2d4('0x2a')](_0x2be98f,_0xa2d4('0x8b')),function(_0xa79b3e){return _[_0xa2d4('0x2b')](_0x1263ed,_0xa79b3e);});if(_0xa1234b){return _0x18a05f['id'];}}}));}}return BPromise[_0xa2d4('0x8c')](_0x185184)[_0xa2d4('0x23')](function(_0x182f6c){_0x4a539f=_(_0x4a539f)[_0xa2d4('0x8d')](_0x182f6c)[_0xa2d4('0x8e')]()[_0xa2d4('0x51')]();return db[_0xa2d4('0x32')][_0xa2d4('0x2c')]({'where':{'id':_0x27c960['params']['id']}})[_0xa2d4('0x23')](function(_0x594f95){return db[_0xa2d4('0x87')][_0xa2d4('0x8f')](function(_0x25fbe8){return _0x594f95[_0xa2d4('0x7c')](_0x27c960[_0xa2d4('0x36')][_0xa2d4('0x7d')],{'transaction':_0x25fbe8})[_0xa2d4('0x23')](function(){if(!_[_0xa2d4('0x90')](_0x4a539f)){return _0x594f95['removeAgents'](_0x4a539f,{'transaction':_0x25fbe8})[_0xa2d4('0x23')](function(){return db[_0xa2d4('0x74')]['destroy']({'where':{'VoiceQueueId':_0x27c960[_0xa2d4('0x4b')]['id'],'UserId':_0x4a539f},'transaction':_0x25fbe8});});}})[_0xa2d4('0x23')](function(){_0x4a539f[_0xa2d4('0x70')](function(_0x1c96c8){socket['emit'](_0xa2d4('0x91'),{'UserId':_0x1c96c8,'VoiceQueueId':_0x594f95['id']});});});});});});})['then'](respondWithStatusCode(_0x27c30a,null))[_0xa2d4('0x49')](handleError(_0x27c30a,null));};exports[_0xa2d4('0x92')]=function(_0x335945,_0x47f748,_0xcd46ca){var _0x3fb86d,_0x2e31a8;return db[_0xa2d4('0x32')][_0xa2d4('0x2c')]({'where':{'id':_0x335945[_0xa2d4('0x4b')]['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x47f748,null))[_0xa2d4('0x23')](function(_0x489b86){if(_0x489b86){_0x2e31a8=_0x489b86;return _0x489b86['addAgents'](_0x335945[_0xa2d4('0x5a')][_0xa2d4('0x7d')],_[_0xa2d4('0x57')](_0x335945[_0xa2d4('0x5a')],[_0xa2d4('0x7d'),'id'])||{})[_0xa2d4('0x93')](function(_0x575d1d){for(var _0x365b5b=0x0;_0x365b5b<_0x335945[_0xa2d4('0x5a')][_0xa2d4('0x7d')]['length'];_0x365b5b+=0x1){socket[_0xa2d4('0x7a')]('userVoiceQueue:save',{'UserId':_0x335945[_0xa2d4('0x5a')][_0xa2d4('0x7d')][_0x365b5b],'VoiceQueueId':_0x335945[_0xa2d4('0x4b')]['id']});}return _0x575d1d;});}})[_0xa2d4('0x23')](function(_0x2cce6c){_0x3fb86d=_0x2cce6c||[];if(_0x2e31a8){return db[_0xa2d4('0x6b')][_0xa2d4('0x47')]({'where':{'id':_0x335945[_0xa2d4('0x5a')][_0xa2d4('0x7d')]},'attributes':['id','name',_0xa2d4('0x6d'),_0xa2d4('0x6e'),'interface'],'raw':!![]});}})[_0xa2d4('0x23')](function(_0x49f743){if(!_[_0xa2d4('0x90')](_0x49f743)){var _0x58f0ac=[];for(var _0x450277=0x0;_0x450277<_0x49f743[_0xa2d4('0x3b')];_0x450277++){if(_0x49f743[_0x450277]['online']){_0x58f0ac[_0xa2d4('0x85')](db[_0xa2d4('0x74')][_0xa2d4('0x75')]({'membername':_0x49f743[_0x450277][_0xa2d4('0x2e')],'UserId':_0x49f743[_0x450277]['id'],'queue_name':_0x2e31a8[_0xa2d4('0x2e')],'VoiceQueueId':_0x2e31a8['id'],'interface':_[_0xa2d4('0x76')](_0x49f743[_0x450277][_0xa2d4('0x77')])?util[_0xa2d4('0x78')]('SIP/%s',_0x49f743[_0x450277]['name']):_0x49f743[_0x450277][_0xa2d4('0x77')],'paused':_0x49f743[_0x450277][_0xa2d4('0x6e')]||![],'penalty':_0x335945['body']['penalty']||0x0}));}}return BPromise['all'](_0x58f0ac);}})[_0xa2d4('0x23')](function(){return _0x3fb86d;})[_0xa2d4('0x23')](respondWithResult(_0x47f748,null))[_0xa2d4('0x49')](handleError(_0x47f748,null));};exports['removeAgents']=function(_0x146391,_0x58a39a,_0x28736f){return db[_0xa2d4('0x32')][_0xa2d4('0x2c')]({'where':{'id':_0x146391[_0xa2d4('0x4b')]['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x58a39a,null))[_0xa2d4('0x23')](function(_0x332e7d){if(_0x332e7d){return _0x332e7d[_0xa2d4('0x94')](_0x146391[_0xa2d4('0x36')][_0xa2d4('0x7d')])[_0xa2d4('0x23')](function(){if(_[_0xa2d4('0x95')](_0x146391[_0xa2d4('0x36')][_0xa2d4('0x7d')])){for(var _0x2c0229=0x0;_0x2c0229<_0x146391[_0xa2d4('0x36')][_0xa2d4('0x7d')][_0xa2d4('0x3b')];_0x2c0229+=0x1){socket[_0xa2d4('0x7a')](_0xa2d4('0x91'),{'UserId':Number(_0x146391[_0xa2d4('0x36')][_0xa2d4('0x7d')][_0x2c0229]),'VoiceQueueId':Number(_0x146391['params']['id'])});}}else{socket[_0xa2d4('0x7a')](_0xa2d4('0x91'),{'UserId':Number(_0x146391[_0xa2d4('0x36')][_0xa2d4('0x7d')]),'VoiceQueueId':Number(_0x146391[_0xa2d4('0x4b')]['id'])});}});}})[_0xa2d4('0x23')](function(_0x7e5a43){return db['UserVoiceQueueRt'][_0xa2d4('0x24')]({'where':{'VoiceQueueId':_0x146391[_0xa2d4('0x4b')]['id'],'UserId':_0x146391[_0xa2d4('0x36')][_0xa2d4('0x7d')]}})[_0xa2d4('0x23')](function(){return _0x7e5a43;});})['then'](respondWithStatusCode(_0x58a39a,null))[_0xa2d4('0x49')](handleError(_0x58a39a,null));};exports['getAgents']=function(_0x678d14,_0x155667,_0x4c93e5){var _0x876dce={};var _0x3e67c6={};var _0x5488c8;var _0x1e3a43;return db['VoiceQueue'][_0xa2d4('0x5f')]({'where':{'id':_0x678d14['params']['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x155667,null))[_0xa2d4('0x23')](function(_0x6b3c8a){if(_0x6b3c8a){_0x5488c8=_0x6b3c8a;_0x3e67c6[_0xa2d4('0x35')]=_[_0xa2d4('0x37')](db[_0xa2d4('0x6b')][_0xa2d4('0x33')]);_0x3e67c6['query']=_[_0xa2d4('0x37')](_0x678d14['query']);_0x3e67c6['filters']=_['intersection'](_0x3e67c6['model'],_0x3e67c6[_0xa2d4('0x36')]);_0x876dce[_0xa2d4('0x38')]=_[_0xa2d4('0x39')](_0x3e67c6['model'],qs['fields'](_0x678d14[_0xa2d4('0x36')][_0xa2d4('0x3a')]));_0x876dce[_0xa2d4('0x38')]=_0x876dce['attributes'][_0xa2d4('0x3b')]?_0x876dce[_0xa2d4('0x38')]:_0x3e67c6['model'];_0x876dce[_0xa2d4('0x3e')]=qs[_0xa2d4('0x3f')](_0x678d14[_0xa2d4('0x36')][_0xa2d4('0x3f')]);_0x876dce[_0xa2d4('0x40')]=qs['filters'](_['pick'](_0x678d14[_0xa2d4('0x36')],_0x3e67c6['filters']));if(_0x678d14['query'][_0xa2d4('0x28')]){_0x876dce[_0xa2d4('0x40')]=_['merge'](_0x876dce[_0xa2d4('0x40')],{'$or':_['map'](_0x876dce['attributes'],function(_0x5f2f7d){var _0x27b437={};_0x27b437[_0x5f2f7d]={'$like':'%'+_0x678d14['query'][_0xa2d4('0x28')]+'%'};return _0x27b437;})});}_0x876dce=_['merge']({},_0x876dce,_0x678d14[_0xa2d4('0x45')]);return _0x5488c8['getAgents'](_0x876dce);}})['then'](function(_0x3157e1){if(_0x3157e1){_0x1e3a43=_0x3157e1[_0xa2d4('0x3b')];if(!_0x678d14[_0xa2d4('0x36')]['hasOwnProperty'](_0xa2d4('0x3d'))){_0x876dce['limit']=qs['limit'](_0x678d14[_0xa2d4('0x36')][_0xa2d4('0x1d')]);_0x876dce[_0xa2d4('0x1c')]=qs[_0xa2d4('0x1c')](_0x678d14[_0xa2d4('0x36')][_0xa2d4('0x1c')]);}return _0x5488c8[_0xa2d4('0x96')](_0x876dce);}})[_0xa2d4('0x23')](function(_0x1eac1f){if(_0x1eac1f){return _0x1eac1f?{'count':_0x1e3a43,'rows':_0x1eac1f}:null;}})[_0xa2d4('0x23')](respondWithResult(_0x155667,null))[_0xa2d4('0x49')](handleError(_0x155667,null));};exports['getMembers']=function(_0x15770f,_0x53d48c,_0x53eab3){var _0x2eb23f={};var _0x4e03f3={};var _0x2e470e;var _0x235cce;return db[_0xa2d4('0x32')]['findOne']({'where':{'id':_0x15770f[_0xa2d4('0x4b')]['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x53d48c,null))['then'](function(_0x4e7a31){if(_0x4e7a31){_0x2e470e=_0x4e7a31;_0x4e03f3[_0xa2d4('0x35')]=_[_0xa2d4('0x37')](db[_0xa2d4('0x74')][_0xa2d4('0x33')]);_0x4e03f3[_0xa2d4('0x36')]=_[_0xa2d4('0x37')](_0x15770f[_0xa2d4('0x36')]);_0x4e03f3[_0xa2d4('0x42')]=_['intersection'](_0x4e03f3[_0xa2d4('0x35')],_0x4e03f3[_0xa2d4('0x36')]);_0x2eb23f[_0xa2d4('0x38')]=_['intersection'](_0x4e03f3[_0xa2d4('0x35')],qs[_0xa2d4('0x3a')](_0x15770f[_0xa2d4('0x36')][_0xa2d4('0x3a')]));_0x2eb23f[_0xa2d4('0x38')]=_0x2eb23f['attributes'][_0xa2d4('0x3b')]?_0x2eb23f[_0xa2d4('0x38')]:_0x4e03f3[_0xa2d4('0x35')];_0x2eb23f['order']=qs['sort'](_0x15770f[_0xa2d4('0x36')][_0xa2d4('0x3f')]);_0x2eb23f[_0xa2d4('0x40')]=qs['filters'](_[_0xa2d4('0x41')](_0x15770f['query'],_0x4e03f3[_0xa2d4('0x42')]));if(_0x15770f[_0xa2d4('0x36')][_0xa2d4('0x28')]){_0x2eb23f[_0xa2d4('0x40')]=_[_0xa2d4('0x43')](_0x2eb23f[_0xa2d4('0x40')],{'$or':_[_0xa2d4('0x2a')](_0x2eb23f[_0xa2d4('0x38')],function(_0x2fd975){var _0x39055b={};_0x39055b[_0x2fd975]={'$like':'%'+_0x15770f[_0xa2d4('0x36')]['filter']+'%'};return _0x39055b;})});}_0x2eb23f=_['merge']({},_0x2eb23f,_0x15770f[_0xa2d4('0x45')]);return _0x2e470e[_0xa2d4('0x97')](_0x2eb23f);}})[_0xa2d4('0x23')](function(_0x4c12bf){if(_0x4c12bf){_0x235cce=_0x4c12bf[_0xa2d4('0x3b')];if(!_0x15770f[_0xa2d4('0x36')][_0xa2d4('0x3c')](_0xa2d4('0x3d'))){_0x2eb23f[_0xa2d4('0x1d')]=qs[_0xa2d4('0x1d')](_0x15770f[_0xa2d4('0x36')][_0xa2d4('0x1d')]);_0x2eb23f[_0xa2d4('0x1c')]=qs[_0xa2d4('0x1c')](_0x15770f[_0xa2d4('0x36')]['offset']);}return _0x2e470e['getMembers'](_0x2eb23f);}})[_0xa2d4('0x23')](function(_0x526957){return _0x526957?{'count':_0x235cce,'rows':_0x526957}:null;})[_0xa2d4('0x23')](respondWithResult(_0x53d48c,null))[_0xa2d4('0x49')](handleError(_0x53d48c,null));};exports[_0xa2d4('0x98')]=function(_0x16d930,_0x5c121d,_0x3b05da){var _0xfda4a1={};var _0x7cba6={};var _0x3f7573;var _0x2d7b0b;return db[_0xa2d4('0x32')][_0xa2d4('0x5f')]({'where':{'id':_0x16d930['params']['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x5c121d,null))[_0xa2d4('0x23')](function(_0x4e09c8){if(_0x4e09c8){_0x3f7573=_0x4e09c8;_0x7cba6[_0xa2d4('0x35')]=_[_0xa2d4('0x37')](db['CmList'][_0xa2d4('0x33')]);_0x7cba6[_0xa2d4('0x36')]=_[_0xa2d4('0x37')](_0x16d930[_0xa2d4('0x36')]);_0x7cba6[_0xa2d4('0x42')]=_[_0xa2d4('0x39')](_0x7cba6[_0xa2d4('0x35')],_0x7cba6['query']);_0xfda4a1['attributes']=_['intersection'](_0x7cba6[_0xa2d4('0x35')],qs[_0xa2d4('0x3a')](_0x16d930[_0xa2d4('0x36')][_0xa2d4('0x3a')]));_0xfda4a1[_0xa2d4('0x38')]=_0xfda4a1[_0xa2d4('0x38')]['length']?_0xfda4a1[_0xa2d4('0x38')]:_0x7cba6[_0xa2d4('0x35')];_0xfda4a1[_0xa2d4('0x3e')]=qs[_0xa2d4('0x3f')](_0x16d930[_0xa2d4('0x36')]['sort']);_0xfda4a1['where']=qs[_0xa2d4('0x42')](_['pick'](_0x16d930[_0xa2d4('0x36')],_0x7cba6['filters']));if(_0x16d930[_0xa2d4('0x36')][_0xa2d4('0x28')]){_0xfda4a1[_0xa2d4('0x40')]=_[_0xa2d4('0x43')](_0xfda4a1['where'],{'$or':_[_0xa2d4('0x2a')](_0xfda4a1['attributes'],function(_0x2f4bbc){var _0xb7b5bf={};_0xb7b5bf[_0x2f4bbc]={'$like':'%'+_0x16d930[_0xa2d4('0x36')][_0xa2d4('0x28')]+'%'};return _0xb7b5bf;})});}_0xfda4a1=_['merge']({},_0xfda4a1,_0x16d930[_0xa2d4('0x45')]);return _0x3f7573['getLists'](_0xfda4a1);}})['then'](function(_0x119694){if(_0x119694){_0x2d7b0b=_0x119694[_0xa2d4('0x3b')];if(!_0x16d930[_0xa2d4('0x36')][_0xa2d4('0x3c')](_0xa2d4('0x3d'))){_0xfda4a1[_0xa2d4('0x1d')]=qs[_0xa2d4('0x1d')](_0x16d930[_0xa2d4('0x36')][_0xa2d4('0x1d')]);_0xfda4a1['offset']=qs[_0xa2d4('0x1c')](_0x16d930[_0xa2d4('0x36')][_0xa2d4('0x1c')]);}return _0x3f7573['getLists'](_0xfda4a1);}})[_0xa2d4('0x23')](function(_0x12fc45){if(_0x12fc45){return _0x12fc45?{'count':_0x2d7b0b,'rows':_0x12fc45}:null;}})[_0xa2d4('0x23')](respondWithResult(_0x5c121d,null))[_0xa2d4('0x49')](handleError(_0x5c121d,null));};exports[_0xa2d4('0x99')]=function(_0xcccd79,_0x34b55d,_0x942168){var _0x4ec72a,_0x30e95a;return db[_0xa2d4('0x32')]['find']({'where':{'id':_0xcccd79[_0xa2d4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x34b55d,null))['then'](function(_0x7c2f55){if(_0x7c2f55){_0x30e95a=_0x7c2f55;return _0x7c2f55[_0xa2d4('0x99')](_0xcccd79[_0xa2d4('0x5a')][_0xa2d4('0x7d')],_['omit'](_0xcccd79[_0xa2d4('0x5a')],[_0xa2d4('0x7d'),'id'])||{});}return null;})[_0xa2d4('0x93')](function(_0x112436){var _0x5bfb0e;_0x4ec72a=_0x112436||[];var _0x4d5222=[];if(_0x112436){for(var _0x4dcd5f=0x0;_0x4dcd5f<_0x112436[_0xa2d4('0x3b')];_0x4dcd5f+=0x1){var _0x5dcf58=_0x112436[_0x4dcd5f][_0xa2d4('0x25')]({'plain':!![]});_0x30e95a['dialCheckDuplicateType']=_0xcccd79[_0xa2d4('0x5a')]['dialCheckDuplicateType']?_0xcccd79[_0xa2d4('0x5a')][_0xa2d4('0x9a')]:_0x30e95a['dialCheckDuplicateType'];switch(_0x30e95a[_0xa2d4('0x9a')]){case _0xa2d4('0x9b'):_0x5bfb0e=squel[_0xa2d4('0x9c')]()['into'](_0xa2d4('0x9d'))[_0xa2d4('0x9e')]([_0xa2d4('0x9f'),_0xa2d4('0xa0'),'ContactId',_0xa2d4('0xa1'),_0xa2d4('0x63'),_0xa2d4('0x58'),_0xa2d4('0x59')],squel[_0xa2d4('0x7e')]()['field'](_0xa2d4('0x9f'),_0xa2d4('0x9f'))[_0xa2d4('0x7f')](_0xa2d4('0xa2'),'scheduledAt')[_0xa2d4('0x7f')]('id',_0xa2d4('0xa3'))[_0xa2d4('0x7f')](_0x5dcf58[_0xa2d4('0xa4')][_0xa2d4('0x86')](),_0xa2d4('0xa1'))[_0xa2d4('0x7f')](_0xcccd79['params']['id'][_0xa2d4('0x86')](),_0xa2d4('0x63'))[_0xa2d4('0x7f')](_0xa2d4('0xa2'),_0xa2d4('0x58'))['field'](_0xa2d4('0xa2'),_0xa2d4('0x59'))[_0xa2d4('0xa5')](_0xa2d4('0xa6'))['where']('deletedAt\x20IS\x20NULL')[_0xa2d4('0x40')](_0xa2d4('0xa7'),_0x5dcf58[_0xa2d4('0xa4')]['toString']())[_0xa2d4('0x40')](_0xa2d4('0xa8'))[_0xa2d4('0x40')](_0xa2d4('0xa9'),squel[_0xa2d4('0x7e')]()['field'](_0xa2d4('0xaa'))[_0xa2d4('0xa5')](_0xa2d4('0xab'))[_0xa2d4('0x40')]('VoiceQueueId\x20=\x20?',_0xcccd79[_0xa2d4('0x4b')]['id'][_0xa2d4('0x86')]()))[_0xa2d4('0x40')](_0xa2d4('0xa9'),squel['select']()[_0xa2d4('0x7f')](_0xa2d4('0xac'))[_0xa2d4('0xa5')](_0xa2d4('0x9d'))[_0xa2d4('0x40')](_0xa2d4('0x83'),_0xcccd79[_0xa2d4('0x4b')]['id'][_0xa2d4('0x86')]())))['toString']();break;case _0xa2d4('0xad'):_0x5bfb0e=squel['insert']()[_0xa2d4('0xae')](_0xa2d4('0x9d'))[_0xa2d4('0x9e')]([_0xa2d4('0x9f'),_0xa2d4('0xa0'),_0xa2d4('0xa3'),'ListId','VoiceQueueId','createdAt',_0xa2d4('0x59')],squel[_0xa2d4('0x7e')]()[_0xa2d4('0x7f')](_0xa2d4('0x9f'),_0xa2d4('0x9f'))[_0xa2d4('0x7f')](_0xa2d4('0xa2'),'scheduledAt')['field']('id',_0xa2d4('0xa3'))[_0xa2d4('0x7f')](_0x5dcf58['CmListId'][_0xa2d4('0x86')](),_0xa2d4('0xa1'))[_0xa2d4('0x7f')](_0xcccd79['params']['id'][_0xa2d4('0x86')](),'VoiceQueueId')['field'](_0xa2d4('0xa2'),_0xa2d4('0x58'))[_0xa2d4('0x7f')](_0xa2d4('0xa2'),_0xa2d4('0x59'))[_0xa2d4('0xa5')](_0xa2d4('0xa6'))['where'](_0xa2d4('0xaf'))[_0xa2d4('0x40')](_0xa2d4('0xa7'),_0x5dcf58[_0xa2d4('0xa4')][_0xa2d4('0x86')]())[_0xa2d4('0x40')](_0xa2d4('0xa8'))[_0xa2d4('0x40')](_0xa2d4('0xa9'),squel[_0xa2d4('0x7e')]()[_0xa2d4('0x7f')](_0xa2d4('0xac'))[_0xa2d4('0xa5')](_0xa2d4('0x9d'))[_0xa2d4('0x40')]('VoiceQueueId\x20=\x20?',_0xcccd79[_0xa2d4('0x4b')]['id'][_0xa2d4('0x86')]())))[_0xa2d4('0x86')]();break;default:_0x5bfb0e=squel[_0xa2d4('0x9c')]()[_0xa2d4('0xae')](_0xa2d4('0x9d'))['fromQuery']([_0xa2d4('0x9f'),_0xa2d4('0xa0'),'ContactId',_0xa2d4('0xa1'),'VoiceQueueId',_0xa2d4('0x58'),_0xa2d4('0x59')],squel['select']()[_0xa2d4('0x7f')](_0xa2d4('0x9f'),_0xa2d4('0x9f'))[_0xa2d4('0x7f')](_0xa2d4('0xa2'),_0xa2d4('0xa0'))['field']('id',_0xa2d4('0xa3'))[_0xa2d4('0x7f')](_0x5dcf58[_0xa2d4('0xa4')][_0xa2d4('0x86')](),_0xa2d4('0xa1'))['field'](_0xcccd79[_0xa2d4('0x4b')]['id'][_0xa2d4('0x86')](),_0xa2d4('0x63'))[_0xa2d4('0x7f')](_0xa2d4('0xa2'),_0xa2d4('0x58'))['field'](_0xa2d4('0xa2'),_0xa2d4('0x59'))[_0xa2d4('0xa5')]('cm_contacts')[_0xa2d4('0x40')](_0xa2d4('0xaf'))['where']('ListId\x20=\x20?',_0x5dcf58[_0xa2d4('0xa4')][_0xa2d4('0x86')]())[_0xa2d4('0x40')](_0xa2d4('0xa8')))['toString']();}_0x4d5222['push'](db[_0xa2d4('0x87')][_0xa2d4('0x36')](_0x5bfb0e));}return BPromise['all'](_0x4d5222);}})[_0xa2d4('0x23')](function(){return _0x4ec72a;})['then'](respondWithResult(_0x34b55d,null))[_0xa2d4('0x49')](handleError(_0x34b55d,null));};exports[_0xa2d4('0xb0')]=function(_0x42bac9,_0x4b813c,_0x4a6b42){return db[_0xa2d4('0x32')][_0xa2d4('0x2c')]({'where':{'id':_0x42bac9['params']['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x4b813c,null))['then'](function(_0x4c6d39){if(_0x4c6d39){return _0x4c6d39['removeLists'](_0x42bac9[_0xa2d4('0x36')]['ids']);}})[_0xa2d4('0x23')](function(_0x18ce09){if(_0x18ce09){return db[_0xa2d4('0x60')][_0xa2d4('0x24')]({'where':{'ListId':_0x42bac9[_0xa2d4('0x36')]['ids'],'VoiceQueueId':_0x42bac9[_0xa2d4('0x4b')]['id']}})['then'](function(){return _0x18ce09;});}})[_0xa2d4('0x23')](respondWithStatusCode(_0x4b813c,null))[_0xa2d4('0x49')](handleError(_0x4b813c,null));};exports[_0xa2d4('0xb1')]=function(_0x44a965,_0x12929e,_0x15dfa5){var _0x4a4291={};var _0x313f60={};var _0x4831f7;var _0x136407;return db[_0xa2d4('0x32')]['findOne']({'where':{'id':_0x44a965[_0xa2d4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x12929e,null))['then'](function(_0x50fada){if(_0x50fada){_0x4831f7=_0x50fada;_0x313f60[_0xa2d4('0x35')]=_['keys'](db['CmList']['rawAttributes']);_0x313f60[_0xa2d4('0x36')]=_[_0xa2d4('0x37')](_0x44a965[_0xa2d4('0x36')]);_0x313f60['filters']=_[_0xa2d4('0x39')](_0x313f60[_0xa2d4('0x35')],_0x313f60['query']);_0x4a4291[_0xa2d4('0x38')]=_[_0xa2d4('0x39')](_0x313f60['model'],qs['fields'](_0x44a965[_0xa2d4('0x36')]['fields']));_0x4a4291['attributes']=_0x4a4291[_0xa2d4('0x38')][_0xa2d4('0x3b')]?_0x4a4291['attributes']:_0x313f60['model'];_0x4a4291[_0xa2d4('0x3e')]=qs[_0xa2d4('0x3f')](_0x44a965[_0xa2d4('0x36')]['sort']);_0x4a4291['where']=qs[_0xa2d4('0x42')](_['pick'](_0x44a965[_0xa2d4('0x36')],_0x313f60[_0xa2d4('0x42')]));if(_0x44a965[_0xa2d4('0x36')][_0xa2d4('0x28')]){_0x4a4291[_0xa2d4('0x40')]=_[_0xa2d4('0x43')](_0x4a4291[_0xa2d4('0x40')],{'$or':_[_0xa2d4('0x2a')](_0x4a4291['attributes'],function(_0x3618f9){var _0x4d7bc6={};_0x4d7bc6[_0x3618f9]={'$like':'%'+_0x44a965[_0xa2d4('0x36')][_0xa2d4('0x28')]+'%'};return _0x4d7bc6;})});}_0x4a4291=_[_0xa2d4('0x43')]({},_0x4a4291,_0x44a965[_0xa2d4('0x45')]);return _0x4831f7[_0xa2d4('0xb1')](_0x4a4291);}})['then'](function(_0x5d4d9a){if(_0x5d4d9a){_0x136407=_0x5d4d9a[_0xa2d4('0x3b')];if(!_0x44a965[_0xa2d4('0x36')][_0xa2d4('0x3c')]('nolimit')){_0x4a4291[_0xa2d4('0x1d')]=qs[_0xa2d4('0x1d')](_0x44a965['query'][_0xa2d4('0x1d')]);_0x4a4291['offset']=qs[_0xa2d4('0x1c')](_0x44a965['query'][_0xa2d4('0x1c')]);}return _0x4831f7[_0xa2d4('0xb1')](_0x4a4291);}})[_0xa2d4('0x23')](function(_0x1e064d){if(_0x1e064d){return _0x1e064d?{'count':_0x136407,'rows':_0x1e064d}:null;}})[_0xa2d4('0x23')](respondWithResult(_0x12929e,null))['catch'](handleError(_0x12929e,null));};exports[_0xa2d4('0xb2')]=function(_0x2462cd,_0x249a24,_0x1cd107){var _0x2e230e,_0x315b6;return db[_0xa2d4('0x32')][_0xa2d4('0x2c')]({'where':{'id':_0x2462cd[_0xa2d4('0x4b')]['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x249a24,null))[_0xa2d4('0x23')](function(_0x4d7d20){if(_0x4d7d20){_0x315b6=_0x4d7d20;return _0x4d7d20[_0xa2d4('0xb2')](_0x2462cd[_0xa2d4('0x5a')]['ids'],_['omit'](_0x2462cd[_0xa2d4('0x5a')],[_0xa2d4('0x7d'),'id'])||{});}return null;})['spread'](function(_0x3af656){var _0xdc4deb;_0x2e230e=_0x3af656||[];var _0x51cc69=[];if(_0x3af656){for(var _0x3841d6=0x0;_0x3841d6<_0x3af656[_0xa2d4('0x3b')];_0x3841d6+=0x1){var _0x4e9d62=_0x3af656[_0x3841d6]['get']({'plain':!![]});_0xdc4deb=squel['insert']()[_0xa2d4('0xae')](_0xa2d4('0xb3'))['fromQuery']([_0xa2d4('0x9f'),'ContactId',_0xa2d4('0xa1'),_0xa2d4('0x63'),'createdAt',_0xa2d4('0x59')],squel['select']()['field'](_0xa2d4('0x9f'),_0xa2d4('0x9f'))[_0xa2d4('0x7f')]('id',_0xa2d4('0xa3'))['field'](_0x4e9d62[_0xa2d4('0xa4')][_0xa2d4('0x86')](),'ListId')[_0xa2d4('0x7f')](_0x2462cd[_0xa2d4('0x4b')]['id'][_0xa2d4('0x86')](),_0xa2d4('0x63'))['field'](_0xa2d4('0xa2'),'createdAt')['field'](_0xa2d4('0xa2'),'updatedAt')[_0xa2d4('0xa5')](_0xa2d4('0xa6'))[_0xa2d4('0x40')]('deletedAt\x20IS\x20NULL')['where'](_0xa2d4('0xa7'),_0x4e9d62[_0xa2d4('0xa4')][_0xa2d4('0x86')]())[_0xa2d4('0x40')](_0xa2d4('0xa8')))[_0xa2d4('0x86')]();_0x51cc69[_0xa2d4('0x85')](db[_0xa2d4('0x87')][_0xa2d4('0x36')](_0xdc4deb));}return BPromise[_0xa2d4('0x8c')](_0x51cc69);}})[_0xa2d4('0x23')](function(){return _0x2e230e;})[_0xa2d4('0x23')](respondWithResult(_0x249a24,null))[_0xa2d4('0x49')](handleError(_0x249a24,null));};exports[_0xa2d4('0xb4')]=function(_0x4220cc,_0x1bca39,_0x335e29){return db[_0xa2d4('0x32')][_0xa2d4('0x2c')]({'where':{'id':_0x4220cc[_0xa2d4('0x4b')]['id']}})[_0xa2d4('0x23')](handleEntityNotFound(_0x1bca39,null))['then'](function(_0x2d2fe4){if(_0x2d2fe4){return _0x2d2fe4[_0xa2d4('0xb4')](_0x4220cc['query'][_0xa2d4('0x7d')]);}})[_0xa2d4('0x23')](function(_0x13a54e){if(_0x13a54e){return db[_0xa2d4('0x66')][_0xa2d4('0x24')]({'where':{'ListId':_0x4220cc[_0xa2d4('0x36')]['ids'],'VoiceQueueId':_0x4220cc[_0xa2d4('0x4b')]['id']}})['then'](function(){return _0x13a54e;});}})[_0xa2d4('0x23')](respondWithStatusCode(_0x1bca39,null))[_0xa2d4('0x49')](handleError(_0x1bca39,null));};
\ No newline at end of file
+var _0xf786=['length','hasOwnProperty','nolimit','order','sort','merge','where','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','QueueCampaigns','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','body','createdAt','inbound','value','userProfileId','update','getHoppers','findOne','CmHopper','pick','VoiceQueueId','include','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','User','voicePause','interface','flatMap','penalty','sequelize','transaction','TeamVoiceQueue','each','UserVoiceQueue','isNil','format','SIP/%s','forEach','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','Agents','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','emit','userVoiceQueue:remove','addAgents','spread','online','upsert','all','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','cm_hopper','phone','scheduledAt','ContactId','ListId','field','NOW()','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','into','fromQuery','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','./voiceQueue.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','then','destroy','VoiceQueues','filter','ignore','map','type','find','name','UserProfileResource','stack','send','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x5d71fb,_0x5b3f42){var _0x19bac8=function(_0x436c7d){while(--_0x436c7d){_0x5d71fb['push'](_0x5d71fb['shift']());}};_0x19bac8(++_0x5b3f42);}(_0xf786,0x136));var _0x6f78=function(_0x54facc,_0x3eac15){_0x54facc=_0x54facc-0x0;var _0x5b39ef=_0xf786[_0x54facc];return _0x5b39ef;};'use strict';var pdf=require(_0x6f78('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6f78('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6f78('0x2'));var rp=require(_0x6f78('0x3'));var moment=require(_0x6f78('0x4'));var BPromise=require(_0x6f78('0x5'));var Mustache=require(_0x6f78('0x6'));var util=require(_0x6f78('0x7'));var path=require('path');var sox=require(_0x6f78('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x6f78('0x9'));var squel=require(_0x6f78('0xa'));var crypto=require(_0x6f78('0xb'));var jsforce=require(_0x6f78('0xc'));var deskjs=require(_0x6f78('0xd'));var toCsv=require(_0x6f78('0xe'));var querystring=require('querystring');var Papa=require(_0x6f78('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6f78('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f78('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x6f78('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x6f78('0x13'));var db=require(_0x6f78('0x14'))['db'];config[_0x6f78('0x15')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f78('0x15')]));require(_0x6f78('0x16'))[_0x6f78('0x17')](socket);function respondWithStatusCode(_0x2894bc,_0x5b2c76){_0x5b2c76=_0x5b2c76||0xcc;return function(_0x4fed1c){if(_0x4fed1c){return _0x2894bc[_0x6f78('0x18')](_0x5b2c76);}return _0x2894bc[_0x6f78('0x19')](_0x5b2c76)[_0x6f78('0x1a')]();};}function respondWithResult(_0x299f21,_0x560002){_0x560002=_0x560002||0xc8;return function(_0x4e7b4d){if(_0x4e7b4d){return _0x299f21['status'](_0x560002)['json'](_0x4e7b4d);}};}function respondWithFilteredResult(_0x1a7e9c,_0x576200){return function(_0x3908ea){if(_0x3908ea){var _0x1644ee=_0x3908ea[_0x6f78('0x1b')],_0x48e36b=_0x576200[_0x6f78('0x1c')],_0x80bfda=_0x576200[_0x6f78('0x1c')]+_0x576200[_0x6f78('0x1d')],_0x30b434;if(_0x80bfda>=_0x1644ee){_0x80bfda=_0x1644ee;_0x30b434=0xc8;}else{_0x30b434=0xce;}_0x1a7e9c[_0x6f78('0x19')](_0x30b434);return _0x1a7e9c['set'](_0x6f78('0x1e'),_0x48e36b+'-'+_0x80bfda+'/'+_0x1644ee)[_0x6f78('0x1f')](_0x3908ea);}return null;};}function patchUpdates(_0x51891f){return function(_0x148737){try{jsonpatch[_0x6f78('0x20')](_0x148737,_0x51891f,!![]);}catch(_0x49fa31){return BPromise['reject'](_0x49fa31);}return _0x148737['save']();};}function saveUpdates(_0x3b38e4,_0x712f54){return function(_0x308844){if(_0x308844){return _0x308844['update'](_0x3b38e4)[_0x6f78('0x21')](function(_0x2b4d64){return _0x2b4d64;});}return null;};}function removeEntity(_0x155d07,_0x4969c0){return function(_0x883e5b){if(_0x883e5b){return _0x883e5b[_0x6f78('0x22')]()['then'](function(){var _0x438f4a=_0x883e5b['get']({'plain':!![]});var _0x282081=[{'name':_0x6f78('0x23'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x370fa1=_(_0x282081)[_0x6f78('0x24')](_0x6f78('0x25'))[_0x6f78('0x26')]('value')['value']();if(_['includes'](_0x370fa1,_0x438f4a[_0x6f78('0x27')])){return;}var _0x2cd061=_[_0x6f78('0x28')](_0x282081,['value',_0x438f4a[_0x6f78('0x27')]])[_0x6f78('0x29')];return db[_0x6f78('0x2a')]['destroy']({'where':{'type':_0x2cd061,'resourceId':_0x438f4a['id']}})[_0x6f78('0x21')](function(){return _0x883e5b;});})['then'](function(){_0x155d07[_0x6f78('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x253c69,_0x5506ec){return function(_0x460b46){if(!_0x460b46){_0x253c69[_0x6f78('0x18')](0x194);}return _0x460b46;};}function handleError(_0x26dcd8,_0x2dab2a){_0x2dab2a=_0x2dab2a||0x1f4;return function(_0x1494a5){logger['error'](_0x1494a5[_0x6f78('0x2b')]);if(_0x1494a5[_0x6f78('0x29')]){delete _0x1494a5['name'];}_0x26dcd8[_0x6f78('0x19')](_0x2dab2a)[_0x6f78('0x2c')](_0x1494a5);};}exports['index']=function(_0x25f07a,_0x246092){var _0x4daf21={},_0x515281={},_0x570f39={'count':0x0,'rows':[]};var _0xf32bfa=_[_0x6f78('0x26')](db[_0x6f78('0x2d')][_0x6f78('0x2e')],function(_0x4b8bc2){return{'name':_0x4b8bc2[_0x6f78('0x2f')],'type':_0x4b8bc2[_0x6f78('0x27')][_0x6f78('0x30')]};});_0x515281[_0x6f78('0x31')]=_[_0x6f78('0x26')](_0xf32bfa,'name');_0x515281[_0x6f78('0x32')]=_[_0x6f78('0x33')](_0x25f07a['query']);_0x515281[_0x6f78('0x34')]=_['intersection'](_0x515281['model'],_0x515281[_0x6f78('0x32')]);_0x4daf21[_0x6f78('0x35')]=_[_0x6f78('0x36')](_0x515281[_0x6f78('0x31')],qs[_0x6f78('0x37')](_0x25f07a[_0x6f78('0x32')][_0x6f78('0x37')]));_0x4daf21[_0x6f78('0x35')]=_0x4daf21['attributes'][_0x6f78('0x38')]?_0x4daf21['attributes']:_0x515281[_0x6f78('0x31')];if(!_0x25f07a[_0x6f78('0x32')][_0x6f78('0x39')](_0x6f78('0x3a'))){_0x4daf21[_0x6f78('0x1d')]=qs[_0x6f78('0x1d')](_0x25f07a['query']['limit']);_0x4daf21[_0x6f78('0x1c')]=qs['offset'](_0x25f07a[_0x6f78('0x32')][_0x6f78('0x1c')]);}_0x4daf21[_0x6f78('0x3b')]=qs[_0x6f78('0x3c')](_0x25f07a[_0x6f78('0x32')][_0x6f78('0x3c')]);_0x4daf21['where']=qs[_0x6f78('0x34')](_['pick'](_0x25f07a[_0x6f78('0x32')],_0x515281[_0x6f78('0x34')]),_0xf32bfa);if(_0x25f07a[_0x6f78('0x32')][_0x6f78('0x24')]){_0x4daf21['where']=_[_0x6f78('0x3d')](_0x4daf21[_0x6f78('0x3e')],{'$or':_[_0x6f78('0x26')](_0xf32bfa,function(_0x279c8d){if(_0x279c8d['type']!==_0x6f78('0x3f')){var _0x10ee35={};_0x10ee35[_0x279c8d[_0x6f78('0x29')]]={'$like':'%'+_0x25f07a[_0x6f78('0x32')][_0x6f78('0x24')]+'%'};return _0x10ee35;}})});}_0x4daf21=_[_0x6f78('0x3d')]({},_0x4daf21,_0x25f07a[_0x6f78('0x40')]);var _0x5c49cb={'where':_0x4daf21[_0x6f78('0x3e')]};return db['VoiceQueue'][_0x6f78('0x1b')](_0x5c49cb)[_0x6f78('0x21')](function(_0x206a37){_0x570f39[_0x6f78('0x1b')]=_0x206a37;if(_0x25f07a[_0x6f78('0x32')]['includeAll']){_0x4daf21['include']=[{'all':!![]}];}return db['VoiceQueue'][_0x6f78('0x41')](_0x4daf21);})[_0x6f78('0x21')](function(_0x2d3f91){_0x570f39[_0x6f78('0x42')]=_0x2d3f91;return _0x570f39;})[_0x6f78('0x21')](respondWithFilteredResult(_0x246092,_0x4daf21))[_0x6f78('0x43')](handleError(_0x246092,null));};exports[_0x6f78('0x44')]=function(_0x2da6ec,_0x4bc367){var _0x24a6f1={'raw':![],'where':{'id':_0x2da6ec[_0x6f78('0x45')]['id']}},_0x49512e={};_0x49512e['model']=_[_0x6f78('0x33')](db[_0x6f78('0x2d')]['rawAttributes']);_0x49512e[_0x6f78('0x32')]=_[_0x6f78('0x33')](_0x2da6ec[_0x6f78('0x32')]);_0x49512e[_0x6f78('0x34')]=_[_0x6f78('0x36')](_0x49512e[_0x6f78('0x31')],_0x49512e[_0x6f78('0x32')]);_0x24a6f1[_0x6f78('0x35')]=_['intersection'](_0x49512e[_0x6f78('0x31')],qs['fields'](_0x2da6ec['query'][_0x6f78('0x37')]));_0x24a6f1['attributes']=_0x24a6f1[_0x6f78('0x35')][_0x6f78('0x38')]?_0x24a6f1[_0x6f78('0x35')]:_0x49512e['model'];if(_0x2da6ec['query'][_0x6f78('0x46')]){_0x24a6f1['include']=[{'all':!![]}];}_0x24a6f1=_[_0x6f78('0x3d')]({},_0x24a6f1,_0x2da6ec['options']);return db['VoiceQueue'][_0x6f78('0x28')](_0x24a6f1)[_0x6f78('0x21')](handleEntityNotFound(_0x4bc367,null))[_0x6f78('0x21')](respondWithResult(_0x4bc367,null))[_0x6f78('0x43')](handleError(_0x4bc367,null));};exports[_0x6f78('0x47')]=function(_0x42445b,_0x118def){return db[_0x6f78('0x2d')]['create'](_0x42445b['body'],{})['then'](function(_0x5ca17d){var _0x1e5f50=_0x42445b[_0x6f78('0x48')][_0x6f78('0x49')]({'plain':!![]});if(!_0x1e5f50)throw new Error(_0x6f78('0x4a'));if(_0x1e5f50[_0x6f78('0x4b')]===_0x6f78('0x48')){var _0xdfe3c9=_0x5ca17d[_0x6f78('0x49')]({'plain':!![]});var _0x5931a8=[{'name':_0x6f78('0x23'),'value':'inbound'},{'name':_0x6f78('0x4c'),'value':_0x6f78('0x4d')}];var _0x455632=_['find'](_0x5931a8,['value',_0xdfe3c9[_0x6f78('0x27')]])[_0x6f78('0x29')];return db[_0x6f78('0x4e')]['find']({'where':{'name':_0x455632,'userProfileId':_0x1e5f50['userProfileId']},'raw':!![]})['then'](function(_0x2239a8){if(_0x2239a8&&_0x2239a8[_0x6f78('0x4f')]===0x0){return db[_0x6f78('0x2a')][_0x6f78('0x47')]({'name':_0xdfe3c9[_0x6f78('0x29')],'resourceId':_0xdfe3c9['id'],'type':_0x2239a8[_0x6f78('0x29')],'sectionId':_0x2239a8['id']},{})[_0x6f78('0x21')](function(){return _0x5ca17d;});}else{return _0x5ca17d;}})['catch'](function(_0x438075){logger[_0x6f78('0x50')](_0x6f78('0x51'),_0x438075);throw _0x438075;});}return _0x5ca17d;})[_0x6f78('0x21')](respondWithResult(_0x118def,0xc9))[_0x6f78('0x43')](handleError(_0x118def,null));};exports[_0x6f78('0x52')]=function(_0x30e09f,_0x5417c5){var _0x37b0ae={'where':{'id':_0x30e09f[_0x6f78('0x45')]['id']}},_0x47fe3d={};_0x47fe3d['model']=_[_0x6f78('0x33')](db[_0x6f78('0x2d')][_0x6f78('0x2e')]);_0x37b0ae[_0x6f78('0x35')]=_['intersection'](_0x47fe3d['model'],qs[_0x6f78('0x37')](_0x30e09f['query'][_0x6f78('0x37')]));_0x37b0ae['attributes']=_0x37b0ae[_0x6f78('0x35')][_0x6f78('0x38')]?_0x37b0ae[_0x6f78('0x35')]:_0x47fe3d[_0x6f78('0x31')];if(_0x30e09f[_0x6f78('0x32')]['includeAll']){_0x37b0ae['include']=[{'all':!![]}];}_0x37b0ae=_[_0x6f78('0x3d')]({},_0x37b0ae,_0x30e09f[_0x6f78('0x40')]);return db[_0x6f78('0x2d')][_0x6f78('0x28')](_0x37b0ae)[_0x6f78('0x21')](handleEntityNotFound(_0x5417c5,null))[_0x6f78('0x21')](function(_0x10f36f){if(_0x10f36f){var _0x5c4dea=_0x10f36f[_0x6f78('0x49')]({'plain':!![]});_0x5c4dea=qs[_0x6f78('0x53')](_0x5c4dea,['id','createdAt',_0x6f78('0x54')]);_0x30e09f[_0x6f78('0x55')]=_[_0x6f78('0x53')](_0x30e09f[_0x6f78('0x55')],['id',_0x6f78('0x56'),'updatedAt']);return db[_0x6f78('0x2d')]['create'](_['merge'](_0x5c4dea,_0x30e09f[_0x6f78('0x55')]),{'include':_0x30e09f['query'][_0x6f78('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x31be8c){var _0x4a66ab=_0x30e09f[_0x6f78('0x48')][_0x6f78('0x49')]({'plain':!![]});if(!_0x4a66ab)throw new Error(_0x6f78('0x4a'));if(_0x4a66ab[_0x6f78('0x4b')]===_0x6f78('0x48')){var _0x3fadcc=_0x31be8c['get']({'plain':!![]});var _0x19cddb=[{'name':_0x6f78('0x23'),'value':_0x6f78('0x57')},{'name':'QueueCampaigns','value':_0x6f78('0x4d')}];var _0x31a6b1=_[_0x6f78('0x28')](_0x19cddb,[_0x6f78('0x58'),_0x3fadcc[_0x6f78('0x27')]])[_0x6f78('0x29')];return db[_0x6f78('0x4e')][_0x6f78('0x28')]({'where':{'name':_0x31a6b1,'userProfileId':_0x4a66ab[_0x6f78('0x59')]},'raw':!![]})[_0x6f78('0x21')](function(_0x2b9f67){if(_0x2b9f67&&_0x2b9f67['autoAssociation']===0x0){return db['UserProfileResource'][_0x6f78('0x47')]({'name':_0x3fadcc[_0x6f78('0x29')],'resourceId':_0x3fadcc['id'],'type':_0x2b9f67[_0x6f78('0x29')],'sectionId':_0x2b9f67['id']},{})[_0x6f78('0x21')](function(){return _0x31be8c;});}else{return _0x31be8c;}})[_0x6f78('0x43')](function(_0x1c6d6a){logger[_0x6f78('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c6d6a);throw _0x1c6d6a;});}return _0x31be8c;});}})[_0x6f78('0x21')](respondWithResult(_0x5417c5,0xc9))['catch'](handleError(_0x5417c5,null));};exports[_0x6f78('0x5a')]=function(_0x2e5ae5,_0x394961){if(_0x2e5ae5[_0x6f78('0x55')]['id']){delete _0x2e5ae5['body']['id'];}return db['VoiceQueue'][_0x6f78('0x28')]({'where':{'id':_0x2e5ae5[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x394961,null))[_0x6f78('0x21')](saveUpdates(_0x2e5ae5['body'],null))[_0x6f78('0x21')](respondWithResult(_0x394961,null))[_0x6f78('0x43')](handleError(_0x394961,null));};exports[_0x6f78('0x22')]=function(_0x4f6dbb,_0x46f76f){return db['VoiceQueue'][_0x6f78('0x28')]({'where':{'id':_0x4f6dbb[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x46f76f,null))[_0x6f78('0x21')](removeEntity(_0x46f76f,null))[_0x6f78('0x43')](handleError(_0x46f76f,null));};exports[_0x6f78('0x5b')]=function(_0x4a50da,_0x5c2d50,_0x3ad56f){var _0x25636a={'raw':![],'where':{}};var _0x52e939={};var _0x1d28db={'count':0x0,'rows':[]};return db[_0x6f78('0x2d')][_0x6f78('0x5c')]({'where':{'id':_0x4a50da[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x5c2d50,null))['then'](function(_0x247b95){if(_0x247b95){_0x52e939['model']=_[_0x6f78('0x33')](db[_0x6f78('0x5d')]['rawAttributes']);_0x52e939['query']=_[_0x6f78('0x33')](_0x4a50da[_0x6f78('0x32')]);_0x52e939[_0x6f78('0x34')]=_['intersection'](_0x52e939[_0x6f78('0x31')],_0x52e939[_0x6f78('0x32')]);_0x25636a[_0x6f78('0x35')]=_[_0x6f78('0x36')](_0x52e939[_0x6f78('0x31')],qs[_0x6f78('0x37')](_0x4a50da[_0x6f78('0x32')]['fields']));_0x25636a['attributes']=_0x25636a[_0x6f78('0x35')][_0x6f78('0x38')]?_0x25636a[_0x6f78('0x35')]:_0x52e939[_0x6f78('0x31')];if(!_0x4a50da[_0x6f78('0x32')][_0x6f78('0x39')](_0x6f78('0x3a'))){_0x25636a[_0x6f78('0x1d')]=qs['limit'](_0x4a50da[_0x6f78('0x32')][_0x6f78('0x1d')]);_0x25636a[_0x6f78('0x1c')]=qs[_0x6f78('0x1c')](_0x4a50da[_0x6f78('0x32')]['offset']);}_0x25636a['order']=qs[_0x6f78('0x3c')](_0x4a50da['query'][_0x6f78('0x3c')]);_0x25636a[_0x6f78('0x3e')]=qs[_0x6f78('0x34')](_[_0x6f78('0x5e')](_0x4a50da[_0x6f78('0x32')],_0x52e939['filters']));_0x25636a[_0x6f78('0x3e')][_0x6f78('0x5f')]=_0x247b95['id'];if(_0x4a50da[_0x6f78('0x32')]['filter']){_0x25636a['where']=_['merge'](_0x25636a['where'],{'$or':_['map'](_0x25636a['attributes'],function(_0x26684f){var _0x3c02ae={};_0x3c02ae[_0x26684f]={'$like':'%'+_0x4a50da[_0x6f78('0x32')][_0x6f78('0x24')]+'%'};return _0x3c02ae;})});}_0x25636a=_[_0x6f78('0x3d')]({},_0x25636a,_0x4a50da[_0x6f78('0x40')]);return db[_0x6f78('0x5d')]['count']({'where':_0x25636a[_0x6f78('0x3e')]})[_0x6f78('0x21')](function(_0x208169){_0x1d28db[_0x6f78('0x1b')]=_0x208169;if(_0x4a50da[_0x6f78('0x32')][_0x6f78('0x46')]){_0x25636a[_0x6f78('0x60')]=[{'all':!![]}];}return db['CmHopper'][_0x6f78('0x41')](_0x25636a);})[_0x6f78('0x21')](function(_0x4a2121){_0x1d28db[_0x6f78('0x42')]=_0x4a2121;return _0x1d28db;});}})[_0x6f78('0x21')](respondWithFilteredResult(_0x5c2d50,_0x25636a))['catch'](handleError(_0x5c2d50,null));};exports[_0x6f78('0x61')]=function(_0x23ab83,_0x195b74,_0x58c92b){var _0x2844c7={'raw':!![],'where':{}};var _0x202d42={};var _0x37f9a8={'count':0x0,'rows':[]};return db[_0x6f78('0x2d')][_0x6f78('0x5c')]({'where':{'id':_0x23ab83[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x195b74,null))[_0x6f78('0x21')](function(_0x4afac6){if(_0x4afac6){_0x202d42[_0x6f78('0x31')]=_[_0x6f78('0x33')](db[_0x6f78('0x62')][_0x6f78('0x2e')]);_0x202d42[_0x6f78('0x32')]=_[_0x6f78('0x33')](_0x23ab83[_0x6f78('0x32')]);_0x202d42[_0x6f78('0x34')]=_[_0x6f78('0x36')](_0x202d42[_0x6f78('0x31')],_0x202d42[_0x6f78('0x32')]);_0x2844c7[_0x6f78('0x35')]=_[_0x6f78('0x36')](_0x202d42[_0x6f78('0x31')],qs[_0x6f78('0x37')](_0x23ab83[_0x6f78('0x32')]['fields']));_0x2844c7['attributes']=_0x2844c7['attributes']['length']?_0x2844c7[_0x6f78('0x35')]:_0x202d42[_0x6f78('0x31')];if(!_0x23ab83[_0x6f78('0x32')]['hasOwnProperty'](_0x6f78('0x3a'))){_0x2844c7[_0x6f78('0x1d')]=qs[_0x6f78('0x1d')](_0x23ab83[_0x6f78('0x32')]['limit']);_0x2844c7[_0x6f78('0x1c')]=qs[_0x6f78('0x1c')](_0x23ab83[_0x6f78('0x32')][_0x6f78('0x1c')]);}_0x2844c7['order']=qs[_0x6f78('0x3c')](_0x23ab83[_0x6f78('0x32')][_0x6f78('0x3c')]);_0x2844c7[_0x6f78('0x3e')]=qs[_0x6f78('0x34')](_['pick'](_0x23ab83[_0x6f78('0x32')],_0x202d42[_0x6f78('0x34')]));_0x2844c7[_0x6f78('0x3e')][_0x6f78('0x5f')]=_0x4afac6['id'];if(_0x23ab83['query'][_0x6f78('0x24')]){_0x2844c7[_0x6f78('0x3e')]=_[_0x6f78('0x3d')](_0x2844c7[_0x6f78('0x3e')],{'$or':_[_0x6f78('0x26')](_0x2844c7[_0x6f78('0x35')],function(_0x26684c){var _0x5c06af={};_0x5c06af[_0x26684c]={'$like':'%'+_0x23ab83['query']['filter']+'%'};return _0x5c06af;})});}_0x2844c7=_[_0x6f78('0x3d')]({},_0x2844c7,_0x23ab83[_0x6f78('0x40')]);return db[_0x6f78('0x62')][_0x6f78('0x1b')]({'where':_0x2844c7[_0x6f78('0x3e')]})[_0x6f78('0x21')](function(_0x3ab3d1){_0x37f9a8['count']=_0x3ab3d1;if(_0x23ab83[_0x6f78('0x32')][_0x6f78('0x46')]){_0x2844c7[_0x6f78('0x60')]=[{'all':!![]}];}return db[_0x6f78('0x62')][_0x6f78('0x41')](_0x2844c7);})[_0x6f78('0x21')](function(_0x4ec07f){_0x37f9a8[_0x6f78('0x42')]=_0x4ec07f;return _0x37f9a8;});}})[_0x6f78('0x21')](respondWithFilteredResult(_0x195b74,_0x2844c7))[_0x6f78('0x43')](handleError(_0x195b74,null));};exports[_0x6f78('0x63')]=function(_0x3a2bba,_0x46b436,_0x56325d){var _0x3403e7={'raw':!![],'where':{}};var _0x2c8068={};var _0x478496={'count':0x0,'rows':[]};return db[_0x6f78('0x2d')][_0x6f78('0x5c')]({'where':{'id':_0x3a2bba[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x46b436,null))[_0x6f78('0x21')](function(_0xfdfa8b){if(_0xfdfa8b){_0x2c8068[_0x6f78('0x31')]=_['keys'](db[_0x6f78('0x64')][_0x6f78('0x2e')]);_0x2c8068[_0x6f78('0x32')]=_['keys'](_0x3a2bba['query']);_0x2c8068[_0x6f78('0x34')]=_['intersection'](_0x2c8068['model'],_0x2c8068[_0x6f78('0x32')]);_0x3403e7[_0x6f78('0x35')]=_[_0x6f78('0x36')](_0x2c8068[_0x6f78('0x31')],qs['fields'](_0x3a2bba['query'][_0x6f78('0x37')]));_0x3403e7['attributes']=_0x3403e7[_0x6f78('0x35')][_0x6f78('0x38')]?_0x3403e7[_0x6f78('0x35')]:_0x2c8068[_0x6f78('0x31')];if(!_0x3a2bba[_0x6f78('0x32')][_0x6f78('0x39')](_0x6f78('0x3a'))){_0x3403e7[_0x6f78('0x1d')]=qs[_0x6f78('0x1d')](_0x3a2bba[_0x6f78('0x32')][_0x6f78('0x1d')]);_0x3403e7[_0x6f78('0x1c')]=qs[_0x6f78('0x1c')](_0x3a2bba[_0x6f78('0x32')][_0x6f78('0x1c')]);}_0x3403e7[_0x6f78('0x3b')]=qs[_0x6f78('0x3c')](_0x3a2bba[_0x6f78('0x32')][_0x6f78('0x3c')]);_0x3403e7[_0x6f78('0x3e')]=qs[_0x6f78('0x34')](_[_0x6f78('0x5e')](_0x3a2bba[_0x6f78('0x32')],_0x2c8068[_0x6f78('0x34')]));_0x3403e7[_0x6f78('0x3e')]['VoiceQueueId']=_0xfdfa8b['id'];if(_0x3a2bba['query'][_0x6f78('0x24')]){_0x3403e7[_0x6f78('0x3e')]=_[_0x6f78('0x3d')](_0x3403e7['where'],{'$or':_[_0x6f78('0x26')](_0x3403e7['attributes'],function(_0x5032ce){var _0x341781={};_0x341781[_0x5032ce]={'$like':'%'+_0x3a2bba[_0x6f78('0x32')][_0x6f78('0x24')]+'%'};return _0x341781;})});}_0x3403e7=_[_0x6f78('0x3d')]({},_0x3403e7,_0x3a2bba[_0x6f78('0x40')]);return db['CmHopperFinal']['count']({'where':_0x3403e7[_0x6f78('0x3e')]})[_0x6f78('0x21')](function(_0x359064){_0x478496[_0x6f78('0x1b')]=_0x359064;if(_0x3a2bba[_0x6f78('0x32')][_0x6f78('0x46')]){_0x3403e7[_0x6f78('0x60')]=[{'all':!![]}];}return db[_0x6f78('0x64')]['findAll'](_0x3403e7);})[_0x6f78('0x21')](function(_0xbade06){_0x478496['rows']=_0xbade06;return _0x478496;});}})['then'](respondWithFilteredResult(_0x46b436,_0x3403e7))[_0x6f78('0x43')](handleError(_0x46b436,null));};exports[_0x6f78('0x65')]=function(_0x2dbb22,_0x2e8745,_0x128ea8){var _0x414f1a={'raw':!![],'where':{}};var _0xa928dd={};var _0xdad9a8={'count':0x0,'rows':[]};return db[_0x6f78('0x2d')][_0x6f78('0x5c')]({'where':{'id':_0x2dbb22[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x2e8745,null))[_0x6f78('0x21')](function(_0x5c5fc9){if(_0x5c5fc9){_0xa928dd[_0x6f78('0x31')]=_['keys'](db[_0x6f78('0x66')][_0x6f78('0x2e')]);_0xa928dd[_0x6f78('0x32')]=_[_0x6f78('0x33')](_0x2dbb22[_0x6f78('0x32')]);_0xa928dd[_0x6f78('0x34')]=_[_0x6f78('0x36')](_0xa928dd[_0x6f78('0x31')],_0xa928dd['query']);_0x414f1a['attributes']=_[_0x6f78('0x36')](_0xa928dd[_0x6f78('0x31')],qs[_0x6f78('0x37')](_0x2dbb22[_0x6f78('0x32')]['fields']));_0x414f1a[_0x6f78('0x35')]=_0x414f1a[_0x6f78('0x35')][_0x6f78('0x38')]?_0x414f1a[_0x6f78('0x35')]:_0xa928dd[_0x6f78('0x31')];if(!_0x2dbb22[_0x6f78('0x32')][_0x6f78('0x39')](_0x6f78('0x3a'))){_0x414f1a[_0x6f78('0x1d')]=qs[_0x6f78('0x1d')](_0x2dbb22[_0x6f78('0x32')][_0x6f78('0x1d')]);_0x414f1a[_0x6f78('0x1c')]=qs[_0x6f78('0x1c')](_0x2dbb22[_0x6f78('0x32')][_0x6f78('0x1c')]);}_0x414f1a['order']=qs['sort'](_0x2dbb22[_0x6f78('0x32')][_0x6f78('0x3c')]);_0x414f1a[_0x6f78('0x3e')]=qs['filters'](_[_0x6f78('0x5e')](_0x2dbb22[_0x6f78('0x32')],_0xa928dd[_0x6f78('0x34')]));_0x414f1a[_0x6f78('0x3e')][_0x6f78('0x5f')]=_0x5c5fc9['id'];if(_0x2dbb22[_0x6f78('0x32')][_0x6f78('0x24')]){_0x414f1a[_0x6f78('0x3e')]=_[_0x6f78('0x3d')](_0x414f1a[_0x6f78('0x3e')],{'$or':_[_0x6f78('0x26')](_0x414f1a[_0x6f78('0x35')],function(_0x475362){var _0x2f58fc={};_0x2f58fc[_0x475362]={'$like':'%'+_0x2dbb22['query']['filter']+'%'};return _0x2f58fc;})});}_0x414f1a=_[_0x6f78('0x3d')]({},_0x414f1a,_0x2dbb22['options']);return db[_0x6f78('0x66')]['count']({'where':_0x414f1a[_0x6f78('0x3e')]})['then'](function(_0x6664a2){_0xdad9a8[_0x6f78('0x1b')]=_0x6664a2;if(_0x2dbb22['query'][_0x6f78('0x46')]){_0x414f1a[_0x6f78('0x60')]=[{'all':!![]}];}return db[_0x6f78('0x66')][_0x6f78('0x41')](_0x414f1a);})[_0x6f78('0x21')](function(_0x24fc06){_0xdad9a8[_0x6f78('0x42')]=_0x24fc06;return _0xdad9a8;});}})['then'](respondWithFilteredResult(_0x2e8745,_0x414f1a))[_0x6f78('0x43')](handleError(_0x2e8745,null));};exports[_0x6f78('0x67')]=function(_0x89af27,_0x11b0ba,_0x68b585){var _0x4ffec4={};var _0x2504fc={};var _0x222283;var _0x297a2e;return db[_0x6f78('0x2d')][_0x6f78('0x5c')]({'where':{'id':_0x89af27[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x11b0ba,null))[_0x6f78('0x21')](function(_0x64c03b){if(_0x64c03b){_0x222283=_0x64c03b;_0x2504fc[_0x6f78('0x31')]=_[_0x6f78('0x33')](db[_0x6f78('0x68')][_0x6f78('0x2e')]);_0x2504fc['query']=_['keys'](_0x89af27[_0x6f78('0x32')]);_0x2504fc['filters']=_[_0x6f78('0x36')](_0x2504fc[_0x6f78('0x31')],_0x2504fc['query']);_0x4ffec4[_0x6f78('0x35')]=_[_0x6f78('0x36')](_0x2504fc[_0x6f78('0x31')],qs[_0x6f78('0x37')](_0x89af27['query'][_0x6f78('0x37')]));_0x4ffec4[_0x6f78('0x35')]=_0x4ffec4[_0x6f78('0x35')]['length']?_0x4ffec4['attributes']:_0x2504fc[_0x6f78('0x31')];_0x4ffec4['order']=qs[_0x6f78('0x3c')](_0x89af27['query'][_0x6f78('0x3c')]);_0x4ffec4['where']=qs['filters'](_[_0x6f78('0x5e')](_0x89af27['query'],_0x2504fc[_0x6f78('0x34')]));if(_0x89af27[_0x6f78('0x32')][_0x6f78('0x24')]){_0x4ffec4[_0x6f78('0x3e')]=_['merge'](_0x4ffec4[_0x6f78('0x3e')],{'$or':_[_0x6f78('0x26')](_0x4ffec4[_0x6f78('0x35')],function(_0x4150c1){var _0x73baaf={};_0x73baaf[_0x4150c1]={'$like':'%'+_0x89af27['query'][_0x6f78('0x24')]+'%'};return _0x73baaf;})});}_0x4ffec4=_['merge']({},_0x4ffec4,_0x89af27[_0x6f78('0x40')]);return _0x222283[_0x6f78('0x67')](_0x4ffec4);}})[_0x6f78('0x21')](function(_0x2db2ad){if(_0x2db2ad){_0x297a2e=_0x2db2ad[_0x6f78('0x38')];if(!_0x89af27['query'][_0x6f78('0x39')](_0x6f78('0x3a'))){_0x4ffec4[_0x6f78('0x1d')]=qs[_0x6f78('0x1d')](_0x89af27['query']['limit']);_0x4ffec4[_0x6f78('0x1c')]=qs[_0x6f78('0x1c')](_0x89af27['query']['offset']);}return _0x222283[_0x6f78('0x67')](_0x4ffec4);}})[_0x6f78('0x21')](function(_0x4b0720){if(_0x4b0720){return _0x4b0720?{'count':_0x297a2e,'rows':_0x4b0720}:null;}})[_0x6f78('0x21')](respondWithResult(_0x11b0ba,null))['catch'](handleError(_0x11b0ba,null));};exports[_0x6f78('0x69')]=function(_0x2fb215,_0x469196,_0x20934b){var _0xd7b3f1=_0x2fb215[_0x6f78('0x55')]['teams'];var _0x4a3a7a=_[_0x6f78('0x26')](_0xd7b3f1,'id');return db['Team'][_0x6f78('0x41')]({'where':{'id':_0x4a3a7a},'attributes':['id'],'include':[{'model':db[_0x6f78('0x6a')],'as':'Agents','attributes':['id','name','online',_0x6f78('0x6b'),_0x6f78('0x6c')],'raw':!![]}]})[_0x6f78('0x21')](function(_0x5ebee8){if(_0x5ebee8){var _0x3e19d=_[_0x6f78('0x6d')](_0x5ebee8,function(_0x45c97f){var _0x5df4e4=_0x45c97f['get']({'plain':!![]});_0x5df4e4['Agents']['forEach'](function(_0x222819){_0x222819[_0x6f78('0x6e')]=_[_0x6f78('0x28')](_0xd7b3f1,{'id':_0x5df4e4['id']})[_0x6f78('0x6e')];});return _0x5df4e4['Agents'];});return db[_0x6f78('0x2d')]['find']({'where':{'id':_0x2fb215[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](function(_0x376f67){return db[_0x6f78('0x6f')][_0x6f78('0x70')](function(_0x2ebc53){return _0x376f67[_0x6f78('0x69')](_0x4a3a7a,{'transaction':_0x2ebc53})[_0x6f78('0x21')](function(){return BPromise['each'](_0xd7b3f1,function(_0x115b89){return db[_0x6f78('0x71')]['upsert']({'TeamId':_0x115b89['id'],'VoiceQueueId':_0x2fb215['params']['id'],'penalty':_0x115b89[_0x6f78('0x6e')]},{'transaction':_0x2ebc53});});})[_0x6f78('0x21')](function(){return BPromise[_0x6f78('0x72')](_0x3e19d,function(_0x3146a8){return db[_0x6f78('0x73')]['findOrCreate']({'where':{'UserId':_0x3146a8['id'],'VoiceQueueId':_0x2fb215[_0x6f78('0x45')]['id']},'defaults':{'penalty':_0x3146a8[_0x6f78('0x6e')]},'transaction':_0x2ebc53});});})[_0x6f78('0x21')](function(){return BPromise[_0x6f78('0x72')](_[_0x6f78('0x24')](_0x3e19d,{'online':!![]}),function(_0x3ea390){return db['UserVoiceQueueRt']['upsert']({'membername':_0x3ea390[_0x6f78('0x29')],'UserId':_0x3ea390['id'],'queue_name':_0x376f67['name'],'VoiceQueueId':_0x376f67['id'],'interface':_[_0x6f78('0x74')](_0x3ea390[_0x6f78('0x6c')])?util[_0x6f78('0x75')](_0x6f78('0x76'),_0x3ea390[_0x6f78('0x29')]):_0x3ea390['interface'],'paused':_0x3ea390[_0x6f78('0x6b')]||![],'penalty':_0x3ea390['penalty']},{'transaction':_0x2ebc53});});})[_0x6f78('0x21')](function(){_0x3e19d[_0x6f78('0x77')](function(_0x36bbdd){socket['emit'](_0x6f78('0x78'),{'UserId':_0x36bbdd['id'],'VoiceQueueId':_0x376f67['id']});});});});});}})[_0x6f78('0x21')](respondWithStatusCode(_0x469196,null))[_0x6f78('0x43')](handleError(_0x469196,null));};exports[_0x6f78('0x79')]=function(_0x396df9,_0x5cc509,_0xf8fa16){return db[_0x6f78('0x68')][_0x6f78('0x41')]({'where':{'id':_0x396df9[_0x6f78('0x32')][_0x6f78('0x7a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5cc509,null))[_0x6f78('0x21')](function(_0x4cfd0d){var _0x132d20=_[_0x6f78('0x26')](_0x4cfd0d,'id');var _0x1ad038=[];var _0x30c9ab=[];var _0x3ad33a=squel[_0x6f78('0x7b')]();_0x3ad33a['field'](_0x6f78('0x7c'))['from'](_0x6f78('0x7d'),'tq')['join'](_0x6f78('0x7e'),'ut',_0x6f78('0x7f'))[_0x6f78('0x3e')](_0x6f78('0x80'),_0x396df9['params']['id']);for(var _0x560b6d=0x0;_0x560b6d<_0x4cfd0d[_0x6f78('0x38')];_0x560b6d+=0x1){let _0x1b2581=_0x4cfd0d[_0x560b6d];for(var _0x18a162=0x0;_0x18a162<_0x1b2581[_0x6f78('0x81')][_0x6f78('0x38')];_0x18a162+=0x1){let _0x70f72c=_0x1b2581[_0x6f78('0x81')][_0x18a162];var _0x2d8b9b=_0x3ad33a[_0x6f78('0x52')]();_0x2d8b9b[_0x6f78('0x3e')](_0x6f78('0x82'),_0x70f72c['id']);_0x30c9ab[_0x6f78('0x83')](db[_0x6f78('0x6f')][_0x6f78('0x32')](_0x2d8b9b[_0x6f78('0x84')](),{'type':db[_0x6f78('0x6f')][_0x6f78('0x85')]['SELECT']})['then'](function(_0x500c3e){if(_0x500c3e['length']===0x1){return _0x70f72c['id'];}else{var _0x1ed20b=_[_0x6f78('0x86')](_[_0x6f78('0x26')](_0x500c3e,_0x6f78('0x87')),function(_0x993057){return _[_0x6f78('0x88')](_0x132d20,_0x993057);});if(_0x1ed20b){return _0x70f72c['id'];}}}));}}return BPromise['all'](_0x30c9ab)['then'](function(_0x39a261){_0x1ad038=_(_0x1ad038)[_0x6f78('0x89')](_0x39a261)[_0x6f78('0x8a')]()['value']();return db[_0x6f78('0x2d')][_0x6f78('0x28')]({'where':{'id':_0x396df9[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](function(_0x38fa8f){return db[_0x6f78('0x6f')][_0x6f78('0x70')](function(_0x322b1f){return _0x38fa8f[_0x6f78('0x79')](_0x396df9['query']['ids'],{'transaction':_0x322b1f})['then'](function(){if(!_[_0x6f78('0x8b')](_0x1ad038)){return _0x38fa8f[_0x6f78('0x8c')](_0x1ad038,{'transaction':_0x322b1f})[_0x6f78('0x21')](function(){return db[_0x6f78('0x8d')][_0x6f78('0x22')]({'where':{'VoiceQueueId':_0x396df9['params']['id'],'UserId':_0x1ad038},'transaction':_0x322b1f});});}})[_0x6f78('0x21')](function(){_0x1ad038[_0x6f78('0x77')](function(_0x156a15){socket[_0x6f78('0x8e')](_0x6f78('0x8f'),{'UserId':_0x156a15,'VoiceQueueId':_0x38fa8f['id']});});});});});});})['then'](respondWithStatusCode(_0x5cc509,null))[_0x6f78('0x43')](handleError(_0x5cc509,null));};exports[_0x6f78('0x90')]=function(_0x557743,_0x170857,_0x7bf7ce){var _0x1810ef,_0x203aa;return db['VoiceQueue'][_0x6f78('0x28')]({'where':{'id':_0x557743[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x170857,null))[_0x6f78('0x21')](function(_0x2deb6a){if(_0x2deb6a){_0x203aa=_0x2deb6a;return _0x2deb6a['addAgents'](_0x557743[_0x6f78('0x55')][_0x6f78('0x7a')],_[_0x6f78('0x53')](_0x557743[_0x6f78('0x55')],[_0x6f78('0x7a'),'id'])||{})[_0x6f78('0x91')](function(_0x4b33ff){for(var _0xdbb546=0x0;_0xdbb546<_0x557743['body'][_0x6f78('0x7a')][_0x6f78('0x38')];_0xdbb546+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':_0x557743[_0x6f78('0x55')]['ids'][_0xdbb546],'VoiceQueueId':_0x557743['params']['id']});}return _0x4b33ff;});}})[_0x6f78('0x21')](function(_0x33338c){_0x1810ef=_0x33338c||[];if(_0x203aa){return db[_0x6f78('0x6a')]['findAll']({'where':{'id':_0x557743['body'][_0x6f78('0x7a')]},'attributes':['id','name',_0x6f78('0x92'),'voicePause','interface'],'raw':!![]});}})['then'](function(_0x90e3e1){if(!_[_0x6f78('0x8b')](_0x90e3e1)){var _0x29acac=[];for(var _0x319a81=0x0;_0x319a81<_0x90e3e1[_0x6f78('0x38')];_0x319a81++){if(_0x90e3e1[_0x319a81][_0x6f78('0x92')]){_0x29acac['push'](db[_0x6f78('0x8d')][_0x6f78('0x93')]({'membername':_0x90e3e1[_0x319a81][_0x6f78('0x29')],'UserId':_0x90e3e1[_0x319a81]['id'],'queue_name':_0x203aa[_0x6f78('0x29')],'VoiceQueueId':_0x203aa['id'],'interface':_[_0x6f78('0x74')](_0x90e3e1[_0x319a81][_0x6f78('0x6c')])?util[_0x6f78('0x75')](_0x6f78('0x76'),_0x90e3e1[_0x319a81][_0x6f78('0x29')]):_0x90e3e1[_0x319a81][_0x6f78('0x6c')],'paused':_0x90e3e1[_0x319a81][_0x6f78('0x6b')]||![],'penalty':_0x557743[_0x6f78('0x55')][_0x6f78('0x6e')]||0x0}));}}return BPromise[_0x6f78('0x94')](_0x29acac);}})[_0x6f78('0x21')](function(){return _0x1810ef;})[_0x6f78('0x21')](respondWithResult(_0x170857,null))[_0x6f78('0x43')](handleError(_0x170857,null));};exports[_0x6f78('0x8c')]=function(_0x3ba1c2,_0x37d4cb,_0x58a358){return db[_0x6f78('0x2d')][_0x6f78('0x28')]({'where':{'id':_0x3ba1c2[_0x6f78('0x45')]['id']}})['then'](handleEntityNotFound(_0x37d4cb,null))['then'](function(_0x51ac1d){if(_0x51ac1d){return _0x51ac1d['removeAgents'](_0x3ba1c2[_0x6f78('0x32')]['ids'])['then'](function(){if(_[_0x6f78('0x95')](_0x3ba1c2[_0x6f78('0x32')][_0x6f78('0x7a')])){for(var _0xf98763=0x0;_0xf98763<_0x3ba1c2['query'][_0x6f78('0x7a')]['length'];_0xf98763+=0x1){socket[_0x6f78('0x8e')](_0x6f78('0x8f'),{'UserId':Number(_0x3ba1c2[_0x6f78('0x32')][_0x6f78('0x7a')][_0xf98763]),'VoiceQueueId':Number(_0x3ba1c2[_0x6f78('0x45')]['id'])});}}else{socket[_0x6f78('0x8e')]('userVoiceQueue:remove',{'UserId':Number(_0x3ba1c2[_0x6f78('0x32')][_0x6f78('0x7a')]),'VoiceQueueId':Number(_0x3ba1c2[_0x6f78('0x45')]['id'])});}});}})['then'](function(_0x5754cc){return db[_0x6f78('0x8d')][_0x6f78('0x22')]({'where':{'VoiceQueueId':_0x3ba1c2[_0x6f78('0x45')]['id'],'UserId':_0x3ba1c2['query'][_0x6f78('0x7a')]}})[_0x6f78('0x21')](function(){return _0x5754cc;});})[_0x6f78('0x21')](respondWithStatusCode(_0x37d4cb,null))[_0x6f78('0x43')](handleError(_0x37d4cb,null));};exports[_0x6f78('0x96')]=function(_0x591cad,_0x6d7ef7,_0x16b8dc){var _0x4d3916={};var _0x3128fc={};var _0x21c10b;var _0xe8736f;return db[_0x6f78('0x2d')][_0x6f78('0x5c')]({'where':{'id':_0x591cad[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x6d7ef7,null))[_0x6f78('0x21')](function(_0x584a2d){if(_0x584a2d){_0x21c10b=_0x584a2d;_0x3128fc[_0x6f78('0x31')]=_[_0x6f78('0x33')](db[_0x6f78('0x6a')][_0x6f78('0x2e')]);_0x3128fc[_0x6f78('0x32')]=_[_0x6f78('0x33')](_0x591cad[_0x6f78('0x32')]);_0x3128fc[_0x6f78('0x34')]=_[_0x6f78('0x36')](_0x3128fc[_0x6f78('0x31')],_0x3128fc['query']);_0x4d3916[_0x6f78('0x35')]=_['intersection'](_0x3128fc[_0x6f78('0x31')],qs[_0x6f78('0x37')](_0x591cad[_0x6f78('0x32')][_0x6f78('0x37')]));_0x4d3916[_0x6f78('0x35')]=_0x4d3916[_0x6f78('0x35')][_0x6f78('0x38')]?_0x4d3916[_0x6f78('0x35')]:_0x3128fc[_0x6f78('0x31')];_0x4d3916[_0x6f78('0x3b')]=qs[_0x6f78('0x3c')](_0x591cad['query']['sort']);_0x4d3916[_0x6f78('0x3e')]=qs[_0x6f78('0x34')](_['pick'](_0x591cad['query'],_0x3128fc[_0x6f78('0x34')]));if(_0x591cad[_0x6f78('0x32')][_0x6f78('0x24')]){_0x4d3916[_0x6f78('0x3e')]=_[_0x6f78('0x3d')](_0x4d3916[_0x6f78('0x3e')],{'$or':_['map'](_0x4d3916[_0x6f78('0x35')],function(_0x50e9d5){var _0x8d78b6={};_0x8d78b6[_0x50e9d5]={'$like':'%'+_0x591cad[_0x6f78('0x32')][_0x6f78('0x24')]+'%'};return _0x8d78b6;})});}_0x4d3916=_[_0x6f78('0x3d')]({},_0x4d3916,_0x591cad['options']);return _0x21c10b[_0x6f78('0x96')](_0x4d3916);}})[_0x6f78('0x21')](function(_0x56b8dd){if(_0x56b8dd){_0xe8736f=_0x56b8dd[_0x6f78('0x38')];if(!_0x591cad[_0x6f78('0x32')][_0x6f78('0x39')](_0x6f78('0x3a'))){_0x4d3916[_0x6f78('0x1d')]=qs[_0x6f78('0x1d')](_0x591cad[_0x6f78('0x32')][_0x6f78('0x1d')]);_0x4d3916[_0x6f78('0x1c')]=qs[_0x6f78('0x1c')](_0x591cad['query'][_0x6f78('0x1c')]);}return _0x21c10b[_0x6f78('0x96')](_0x4d3916);}})[_0x6f78('0x21')](function(_0x1d9085){if(_0x1d9085){return _0x1d9085?{'count':_0xe8736f,'rows':_0x1d9085}:null;}})[_0x6f78('0x21')](respondWithResult(_0x6d7ef7,null))[_0x6f78('0x43')](handleError(_0x6d7ef7,null));};exports[_0x6f78('0x97')]=function(_0x2a83cf,_0x556fbb,_0x372f44){var _0x55499c={};var _0x4dd5c6={};var _0x1b4568;var _0x973e81;return db['VoiceQueue'][_0x6f78('0x5c')]({'where':{'id':_0x2a83cf[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x556fbb,null))[_0x6f78('0x21')](function(_0x169f2e){if(_0x169f2e){_0x1b4568=_0x169f2e;_0x4dd5c6['model']=_['keys'](db[_0x6f78('0x8d')][_0x6f78('0x2e')]);_0x4dd5c6[_0x6f78('0x32')]=_[_0x6f78('0x33')](_0x2a83cf[_0x6f78('0x32')]);_0x4dd5c6[_0x6f78('0x34')]=_['intersection'](_0x4dd5c6['model'],_0x4dd5c6[_0x6f78('0x32')]);_0x55499c[_0x6f78('0x35')]=_['intersection'](_0x4dd5c6['model'],qs[_0x6f78('0x37')](_0x2a83cf[_0x6f78('0x32')][_0x6f78('0x37')]));_0x55499c['attributes']=_0x55499c['attributes'][_0x6f78('0x38')]?_0x55499c['attributes']:_0x4dd5c6[_0x6f78('0x31')];_0x55499c[_0x6f78('0x3b')]=qs[_0x6f78('0x3c')](_0x2a83cf[_0x6f78('0x32')]['sort']);_0x55499c[_0x6f78('0x3e')]=qs[_0x6f78('0x34')](_[_0x6f78('0x5e')](_0x2a83cf[_0x6f78('0x32')],_0x4dd5c6[_0x6f78('0x34')]));if(_0x2a83cf[_0x6f78('0x32')][_0x6f78('0x24')]){_0x55499c[_0x6f78('0x3e')]=_[_0x6f78('0x3d')](_0x55499c[_0x6f78('0x3e')],{'$or':_[_0x6f78('0x26')](_0x55499c['attributes'],function(_0x44bee2){var _0xddcece={};_0xddcece[_0x44bee2]={'$like':'%'+_0x2a83cf[_0x6f78('0x32')][_0x6f78('0x24')]+'%'};return _0xddcece;})});}_0x55499c=_['merge']({},_0x55499c,_0x2a83cf[_0x6f78('0x40')]);return _0x1b4568['getMembers'](_0x55499c);}})[_0x6f78('0x21')](function(_0x5c065a){if(_0x5c065a){_0x973e81=_0x5c065a[_0x6f78('0x38')];if(!_0x2a83cf['query'][_0x6f78('0x39')](_0x6f78('0x3a'))){_0x55499c[_0x6f78('0x1d')]=qs[_0x6f78('0x1d')](_0x2a83cf['query'][_0x6f78('0x1d')]);_0x55499c[_0x6f78('0x1c')]=qs['offset'](_0x2a83cf[_0x6f78('0x32')][_0x6f78('0x1c')]);}return _0x1b4568[_0x6f78('0x97')](_0x55499c);}})[_0x6f78('0x21')](function(_0x1c6559){return _0x1c6559?{'count':_0x973e81,'rows':_0x1c6559}:null;})[_0x6f78('0x21')](respondWithResult(_0x556fbb,null))[_0x6f78('0x43')](handleError(_0x556fbb,null));};exports[_0x6f78('0x98')]=function(_0x84d12b,_0x47b791,_0x358c85){var _0x4bc191={};var _0x59f3b9={};var _0x2e3f2e;var _0x4e0c93;return db[_0x6f78('0x2d')][_0x6f78('0x5c')]({'where':{'id':_0x84d12b['params']['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x47b791,null))['then'](function(_0x25a082){if(_0x25a082){_0x2e3f2e=_0x25a082;_0x59f3b9[_0x6f78('0x31')]=_[_0x6f78('0x33')](db[_0x6f78('0x99')][_0x6f78('0x2e')]);_0x59f3b9[_0x6f78('0x32')]=_[_0x6f78('0x33')](_0x84d12b[_0x6f78('0x32')]);_0x59f3b9[_0x6f78('0x34')]=_[_0x6f78('0x36')](_0x59f3b9['model'],_0x59f3b9[_0x6f78('0x32')]);_0x4bc191['attributes']=_[_0x6f78('0x36')](_0x59f3b9[_0x6f78('0x31')],qs[_0x6f78('0x37')](_0x84d12b['query'][_0x6f78('0x37')]));_0x4bc191['attributes']=_0x4bc191[_0x6f78('0x35')][_0x6f78('0x38')]?_0x4bc191[_0x6f78('0x35')]:_0x59f3b9[_0x6f78('0x31')];_0x4bc191[_0x6f78('0x3b')]=qs[_0x6f78('0x3c')](_0x84d12b[_0x6f78('0x32')][_0x6f78('0x3c')]);_0x4bc191[_0x6f78('0x3e')]=qs[_0x6f78('0x34')](_[_0x6f78('0x5e')](_0x84d12b[_0x6f78('0x32')],_0x59f3b9[_0x6f78('0x34')]));if(_0x84d12b[_0x6f78('0x32')]['filter']){_0x4bc191['where']=_[_0x6f78('0x3d')](_0x4bc191[_0x6f78('0x3e')],{'$or':_[_0x6f78('0x26')](_0x4bc191[_0x6f78('0x35')],function(_0xd8755a){var _0x48e525={};_0x48e525[_0xd8755a]={'$like':'%'+_0x84d12b[_0x6f78('0x32')][_0x6f78('0x24')]+'%'};return _0x48e525;})});}_0x4bc191=_['merge']({},_0x4bc191,_0x84d12b[_0x6f78('0x40')]);return _0x2e3f2e[_0x6f78('0x98')](_0x4bc191);}})[_0x6f78('0x21')](function(_0x478a28){if(_0x478a28){_0x4e0c93=_0x478a28[_0x6f78('0x38')];if(!_0x84d12b[_0x6f78('0x32')][_0x6f78('0x39')]('nolimit')){_0x4bc191[_0x6f78('0x1d')]=qs['limit'](_0x84d12b[_0x6f78('0x32')][_0x6f78('0x1d')]);_0x4bc191[_0x6f78('0x1c')]=qs[_0x6f78('0x1c')](_0x84d12b['query'][_0x6f78('0x1c')]);}return _0x2e3f2e[_0x6f78('0x98')](_0x4bc191);}})[_0x6f78('0x21')](function(_0x423fb0){if(_0x423fb0){return _0x423fb0?{'count':_0x4e0c93,'rows':_0x423fb0}:null;}})[_0x6f78('0x21')](respondWithResult(_0x47b791,null))[_0x6f78('0x43')](handleError(_0x47b791,null));};exports[_0x6f78('0x9a')]=function(_0x3aebae,_0x4c52bb,_0x362b25){var _0x307ccd,_0x345e79;return db[_0x6f78('0x2d')][_0x6f78('0x28')]({'where':{'id':_0x3aebae['params']['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x4c52bb,null))[_0x6f78('0x21')](function(_0x2293d8){if(_0x2293d8){_0x345e79=_0x2293d8;return _0x2293d8[_0x6f78('0x9a')](_0x3aebae[_0x6f78('0x55')][_0x6f78('0x7a')],_['omit'](_0x3aebae[_0x6f78('0x55')],[_0x6f78('0x7a'),'id'])||{});}return null;})['spread'](function(_0x2341b9){var _0x3e41d7;_0x307ccd=_0x2341b9||[];var _0x3b9524=[];if(_0x2341b9){for(var _0x44e556=0x0;_0x44e556<_0x2341b9['length'];_0x44e556+=0x1){var _0x3fd4ab=_0x2341b9[_0x44e556][_0x6f78('0x49')]({'plain':!![]});_0x345e79[_0x6f78('0x9b')]=_0x3aebae[_0x6f78('0x55')][_0x6f78('0x9b')]?_0x3aebae[_0x6f78('0x55')]['dialCheckDuplicateType']:_0x345e79['dialCheckDuplicateType'];switch(_0x345e79[_0x6f78('0x9b')]){case _0x6f78('0x9c'):_0x3e41d7=squel[_0x6f78('0x9d')]()['into'](_0x6f78('0x9e'))['fromQuery']([_0x6f78('0x9f'),_0x6f78('0xa0'),_0x6f78('0xa1'),_0x6f78('0xa2'),_0x6f78('0x5f'),'createdAt',_0x6f78('0x54')],squel['select']()[_0x6f78('0xa3')](_0x6f78('0x9f'),_0x6f78('0x9f'))[_0x6f78('0xa3')](_0x6f78('0xa4'),_0x6f78('0xa0'))[_0x6f78('0xa3')]('id','ContactId')[_0x6f78('0xa3')](_0x3fd4ab[_0x6f78('0xa5')][_0x6f78('0x84')](),_0x6f78('0xa2'))[_0x6f78('0xa3')](_0x3aebae[_0x6f78('0x45')]['id']['toString'](),'VoiceQueueId')[_0x6f78('0xa3')](_0x6f78('0xa4'),_0x6f78('0x56'))['field'](_0x6f78('0xa4'),_0x6f78('0x54'))[_0x6f78('0xa6')](_0x6f78('0xa7'))['where'](_0x6f78('0xa8'))[_0x6f78('0x3e')](_0x6f78('0xa9'),_0x3fd4ab[_0x6f78('0xa5')][_0x6f78('0x84')]())[_0x6f78('0x3e')](_0x6f78('0xaa'))[_0x6f78('0x3e')](_0x6f78('0xab'),squel[_0x6f78('0x7b')]()['field'](_0x6f78('0xac'))[_0x6f78('0xa6')](_0x6f78('0xad'))[_0x6f78('0x3e')](_0x6f78('0x80'),_0x3aebae['params']['id'][_0x6f78('0x84')]()))[_0x6f78('0x3e')](_0x6f78('0xab'),squel[_0x6f78('0x7b')]()['field'](_0x6f78('0xae'))[_0x6f78('0xa6')](_0x6f78('0x9e'))[_0x6f78('0x3e')](_0x6f78('0x80'),_0x3aebae[_0x6f78('0x45')]['id'][_0x6f78('0x84')]())))[_0x6f78('0x84')]();break;case _0x6f78('0xaf'):_0x3e41d7=squel['insert']()[_0x6f78('0xb0')]('cm_hopper')[_0x6f78('0xb1')](['phone','scheduledAt','ContactId',_0x6f78('0xa2'),'VoiceQueueId','createdAt','updatedAt'],squel[_0x6f78('0x7b')]()[_0x6f78('0xa3')]('phone',_0x6f78('0x9f'))['field'](_0x6f78('0xa4'),_0x6f78('0xa0'))[_0x6f78('0xa3')]('id',_0x6f78('0xa1'))[_0x6f78('0xa3')](_0x3fd4ab[_0x6f78('0xa5')][_0x6f78('0x84')](),'ListId')[_0x6f78('0xa3')](_0x3aebae[_0x6f78('0x45')]['id'][_0x6f78('0x84')](),_0x6f78('0x5f'))[_0x6f78('0xa3')]('NOW()',_0x6f78('0x56'))[_0x6f78('0xa3')](_0x6f78('0xa4'),_0x6f78('0x54'))[_0x6f78('0xa6')](_0x6f78('0xa7'))['where'](_0x6f78('0xa8'))[_0x6f78('0x3e')]('ListId\x20=\x20?',_0x3fd4ab[_0x6f78('0xa5')][_0x6f78('0x84')]())[_0x6f78('0x3e')](_0x6f78('0xaa'))[_0x6f78('0x3e')](_0x6f78('0xab'),squel[_0x6f78('0x7b')]()[_0x6f78('0xa3')]('COALESCE(phone,\x27\x27)')[_0x6f78('0xa6')](_0x6f78('0x9e'))[_0x6f78('0x3e')](_0x6f78('0x80'),_0x3aebae['params']['id'][_0x6f78('0x84')]())))[_0x6f78('0x84')]();break;default:_0x3e41d7=squel[_0x6f78('0x9d')]()[_0x6f78('0xb0')]('cm_hopper')[_0x6f78('0xb1')](['phone',_0x6f78('0xa0'),_0x6f78('0xa1'),_0x6f78('0xa2'),_0x6f78('0x5f'),_0x6f78('0x56'),_0x6f78('0x54')],squel['select']()['field'](_0x6f78('0x9f'),_0x6f78('0x9f'))['field']('NOW()',_0x6f78('0xa0'))[_0x6f78('0xa3')]('id','ContactId')['field'](_0x3fd4ab[_0x6f78('0xa5')]['toString'](),_0x6f78('0xa2'))['field'](_0x3aebae[_0x6f78('0x45')]['id']['toString'](),_0x6f78('0x5f'))[_0x6f78('0xa3')]('NOW()','createdAt')[_0x6f78('0xa3')]('NOW()',_0x6f78('0x54'))[_0x6f78('0xa6')]('cm_contacts')[_0x6f78('0x3e')](_0x6f78('0xa8'))[_0x6f78('0x3e')](_0x6f78('0xa9'),_0x3fd4ab[_0x6f78('0xa5')][_0x6f78('0x84')]())[_0x6f78('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0x6f78('0x84')]();}_0x3b9524[_0x6f78('0x83')](db[_0x6f78('0x6f')][_0x6f78('0x32')](_0x3e41d7));}return BPromise['all'](_0x3b9524);}})[_0x6f78('0x21')](function(){return _0x307ccd;})[_0x6f78('0x21')](respondWithResult(_0x4c52bb,null))[_0x6f78('0x43')](handleError(_0x4c52bb,null));};exports[_0x6f78('0xb2')]=function(_0x2fa626,_0x5ac716,_0x5cf494){return db[_0x6f78('0x2d')][_0x6f78('0x28')]({'where':{'id':_0x2fa626[_0x6f78('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ac716,null))['then'](function(_0x34373c){if(_0x34373c){return _0x34373c[_0x6f78('0xb2')](_0x2fa626['query']['ids']);}})[_0x6f78('0x21')](function(_0x2adb23){if(_0x2adb23){return db[_0x6f78('0x5d')][_0x6f78('0x22')]({'where':{'ListId':_0x2fa626[_0x6f78('0x32')][_0x6f78('0x7a')],'VoiceQueueId':_0x2fa626['params']['id']}})[_0x6f78('0x21')](function(){return _0x2adb23;});}})[_0x6f78('0x21')](respondWithStatusCode(_0x5ac716,null))[_0x6f78('0x43')](handleError(_0x5ac716,null));};exports[_0x6f78('0xb3')]=function(_0x3de681,_0x151914,_0x1da1b6){var _0x28e05c={};var _0x1787aa={};var _0x44dc13;var _0x236d5c;return db[_0x6f78('0x2d')][_0x6f78('0x5c')]({'where':{'id':_0x3de681[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x151914,null))[_0x6f78('0x21')](function(_0x3c25df){if(_0x3c25df){_0x44dc13=_0x3c25df;_0x1787aa[_0x6f78('0x31')]=_[_0x6f78('0x33')](db[_0x6f78('0x99')]['rawAttributes']);_0x1787aa[_0x6f78('0x32')]=_[_0x6f78('0x33')](_0x3de681[_0x6f78('0x32')]);_0x1787aa[_0x6f78('0x34')]=_[_0x6f78('0x36')](_0x1787aa[_0x6f78('0x31')],_0x1787aa[_0x6f78('0x32')]);_0x28e05c['attributes']=_['intersection'](_0x1787aa[_0x6f78('0x31')],qs[_0x6f78('0x37')](_0x3de681[_0x6f78('0x32')][_0x6f78('0x37')]));_0x28e05c[_0x6f78('0x35')]=_0x28e05c[_0x6f78('0x35')][_0x6f78('0x38')]?_0x28e05c[_0x6f78('0x35')]:_0x1787aa[_0x6f78('0x31')];_0x28e05c[_0x6f78('0x3b')]=qs['sort'](_0x3de681[_0x6f78('0x32')]['sort']);_0x28e05c[_0x6f78('0x3e')]=qs[_0x6f78('0x34')](_['pick'](_0x3de681[_0x6f78('0x32')],_0x1787aa['filters']));if(_0x3de681[_0x6f78('0x32')]['filter']){_0x28e05c[_0x6f78('0x3e')]=_['merge'](_0x28e05c[_0x6f78('0x3e')],{'$or':_['map'](_0x28e05c['attributes'],function(_0x130140){var _0x8bcf78={};_0x8bcf78[_0x130140]={'$like':'%'+_0x3de681[_0x6f78('0x32')]['filter']+'%'};return _0x8bcf78;})});}_0x28e05c=_['merge']({},_0x28e05c,_0x3de681['options']);return _0x44dc13[_0x6f78('0xb3')](_0x28e05c);}})[_0x6f78('0x21')](function(_0x487bca){if(_0x487bca){_0x236d5c=_0x487bca[_0x6f78('0x38')];if(!_0x3de681[_0x6f78('0x32')][_0x6f78('0x39')](_0x6f78('0x3a'))){_0x28e05c['limit']=qs[_0x6f78('0x1d')](_0x3de681[_0x6f78('0x32')][_0x6f78('0x1d')]);_0x28e05c[_0x6f78('0x1c')]=qs[_0x6f78('0x1c')](_0x3de681[_0x6f78('0x32')][_0x6f78('0x1c')]);}return _0x44dc13[_0x6f78('0xb3')](_0x28e05c);}})['then'](function(_0x12240c){if(_0x12240c){return _0x12240c?{'count':_0x236d5c,'rows':_0x12240c}:null;}})[_0x6f78('0x21')](respondWithResult(_0x151914,null))['catch'](handleError(_0x151914,null));};exports[_0x6f78('0xb4')]=function(_0x5da574,_0x16fd1d,_0x3a1ed3){var _0x6d8a03,_0x1a1af0;return db[_0x6f78('0x2d')][_0x6f78('0x28')]({'where':{'id':_0x5da574[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x16fd1d,null))['then'](function(_0x1101ef){if(_0x1101ef){_0x1a1af0=_0x1101ef;return _0x1101ef[_0x6f78('0xb4')](_0x5da574[_0x6f78('0x55')][_0x6f78('0x7a')],_[_0x6f78('0x53')](_0x5da574[_0x6f78('0x55')],[_0x6f78('0x7a'),'id'])||{});}return null;})[_0x6f78('0x91')](function(_0x136bd5){var _0x11f48d;_0x6d8a03=_0x136bd5||[];var _0xaca81b=[];if(_0x136bd5){for(var _0x320f89=0x0;_0x320f89<_0x136bd5[_0x6f78('0x38')];_0x320f89+=0x1){var _0x11c13a=_0x136bd5[_0x320f89][_0x6f78('0x49')]({'plain':!![]});_0x11f48d=squel[_0x6f78('0x9d')]()['into'](_0x6f78('0xb5'))[_0x6f78('0xb1')](['phone',_0x6f78('0xa1'),_0x6f78('0xa2'),'VoiceQueueId',_0x6f78('0x56'),_0x6f78('0x54')],squel[_0x6f78('0x7b')]()[_0x6f78('0xa3')](_0x6f78('0x9f'),'phone')[_0x6f78('0xa3')]('id','ContactId')[_0x6f78('0xa3')](_0x11c13a[_0x6f78('0xa5')][_0x6f78('0x84')](),_0x6f78('0xa2'))[_0x6f78('0xa3')](_0x5da574[_0x6f78('0x45')]['id'][_0x6f78('0x84')](),'VoiceQueueId')[_0x6f78('0xa3')](_0x6f78('0xa4'),'createdAt')[_0x6f78('0xa3')](_0x6f78('0xa4'),_0x6f78('0x54'))['from'](_0x6f78('0xa7'))[_0x6f78('0x3e')](_0x6f78('0xa8'))['where'](_0x6f78('0xa9'),_0x11c13a['CmListId'][_0x6f78('0x84')]())['where']('phone\x20IS\x20NOT\x20NULL'))[_0x6f78('0x84')]();_0xaca81b[_0x6f78('0x83')](db['sequelize']['query'](_0x11f48d));}return BPromise[_0x6f78('0x94')](_0xaca81b);}})[_0x6f78('0x21')](function(){return _0x6d8a03;})[_0x6f78('0x21')](respondWithResult(_0x16fd1d,null))[_0x6f78('0x43')](handleError(_0x16fd1d,null));};exports[_0x6f78('0xb6')]=function(_0x10bedd,_0x42c79b,_0x3fbdda){return db[_0x6f78('0x2d')]['find']({'where':{'id':_0x10bedd[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](handleEntityNotFound(_0x42c79b,null))[_0x6f78('0x21')](function(_0xc6424b){if(_0xc6424b){return _0xc6424b['removeBlackLists'](_0x10bedd['query']['ids']);}})['then'](function(_0x7f9adc){if(_0x7f9adc){return db[_0x6f78('0x66')][_0x6f78('0x22')]({'where':{'ListId':_0x10bedd['query'][_0x6f78('0x7a')],'VoiceQueueId':_0x10bedd[_0x6f78('0x45')]['id']}})[_0x6f78('0x21')](function(){return _0x7f9adc;});}})['then'](respondWithStatusCode(_0x42c79b,null))[_0x6f78('0x43')](handleError(_0x42c79b,null));};
\ No newline at end of file