Built motion from commit 00bf23f6.|2.6.16
[motion2.git] / server / api / voiceQueue / voiceQueue.controller.js
index 9109678..3a72dd9 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xa902=['destroy','then','get','VoiceQueues','inbound','outbound','filter','ignore','map','includes','value','type','error','name','send','VoiceQueue','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','fields','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','QueueCampaigns','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','user','autoAssociation','getHoppers','findOne','CmHopper','hasOwnProperty','VoiceQueueId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','Agents','online','voicePause','interface','flatMap','forEach','penalty','transaction','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','toString','sequelize','SELECT','TeamId','all','union','compact','userVoiceQueue:remove','addAgents','spread','User','push','upsert','isNil','removeAgents','getAgents','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','ContactId','ListId','phone','NOW()','scheduledAt','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','VoiceQueueId\x20=\x20?','removeLists','getBlackLists','addBlackLists','removeBlackLists','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','update'];(function(_0x3df7b8,_0x55db91){var _0x16f05d=function(_0x5501c8){while(--_0x5501c8){_0x3df7b8['push'](_0x3df7b8['shift']());}};_0x16f05d(++_0x55db91);}(_0xa902,0x8d));var _0x2a90=function(_0x21bd89,_0x5cb3e3){_0x21bd89=_0x21bd89-0x0;var _0x5a07ee=_0xa902[_0x21bd89];return _0x5a07ee;};'use strict';var pdf=require(_0x2a90('0x0'));var emlformat=require(_0x2a90('0x1'));var rimraf=require(_0x2a90('0x2'));var zipdir=require(_0x2a90('0x3'));var jsonpatch=require(_0x2a90('0x4'));var rp=require('request-promise');var moment=require(_0x2a90('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2a90('0x6'));var path=require(_0x2a90('0x7'));var sox=require(_0x2a90('0x8'));var csv=require(_0x2a90('0x9'));var ejs=require(_0x2a90('0xa'));var fs=require('fs');var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x9'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var db=require('../../mysqldb')['db'];config[_0x2a90('0x16')]=_['defaults'](config[_0x2a90('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x2a90('0x17'))(new Redis(config[_0x2a90('0x16')]));require(_0x2a90('0x18'))['register'](socket);function respondWithStatusCode(_0x56d1b8,_0x57227c){_0x57227c=_0x57227c||0xcc;return function(_0x46cb32){if(_0x46cb32){return _0x56d1b8[_0x2a90('0x19')](_0x57227c);}return _0x56d1b8['status'](_0x57227c)[_0x2a90('0x1a')]();};}function respondWithResult(_0x21c648,_0x312782){_0x312782=_0x312782||0xc8;return function(_0x25bd0e){if(_0x25bd0e){return _0x21c648[_0x2a90('0x1b')](_0x312782)[_0x2a90('0x1c')](_0x25bd0e);}};}function respondWithFilteredResult(_0x2fa60f,_0x10cf94){return function(_0x43eea5){if(_0x43eea5){var _0x5c3e4b=_0x43eea5['count'],_0x162f0b=_0x10cf94[_0x2a90('0x1d')],_0x1d9a28=_0x10cf94[_0x2a90('0x1d')]+_0x10cf94[_0x2a90('0x1e')],_0x4190ff;if(_0x1d9a28>=_0x5c3e4b){_0x1d9a28=_0x5c3e4b;_0x4190ff=0xc8;}else{_0x4190ff=0xce;}_0x2fa60f[_0x2a90('0x1b')](_0x4190ff);return _0x2fa60f[_0x2a90('0x1f')](_0x2a90('0x20'),_0x162f0b+'-'+_0x1d9a28+'/'+_0x5c3e4b)[_0x2a90('0x1c')](_0x43eea5);}return null;};}function patchUpdates(_0x114d42){return function(_0xf97adb){try{jsonpatch[_0x2a90('0x21')](_0xf97adb,_0x114d42,!![]);}catch(_0x1340b9){return BPromise[_0x2a90('0x22')](_0x1340b9);}return _0xf97adb['save']();};}function saveUpdates(_0x3da7d0,_0x217873){return function(_0x2955a9){if(_0x2955a9){return _0x2955a9[_0x2a90('0x23')](_0x3da7d0)['then'](function(_0x180485){return _0x180485;});}return null;};}function removeEntity(_0xd033d,_0x4ed9e6){return function(_0x1bcfd7){if(_0x1bcfd7){return _0x1bcfd7[_0x2a90('0x24')]()[_0x2a90('0x25')](function(){var _0x2a4e28=_0x1bcfd7[_0x2a90('0x26')]({'plain':!![]});var _0x1303d9=[{'name':_0x2a90('0x27'),'value':_0x2a90('0x28'),'ignore':![]},{'name':'QueueCampaigns','value':_0x2a90('0x29'),'ignore':![]}];var _0x17f978=_(_0x1303d9)[_0x2a90('0x2a')](_0x2a90('0x2b'))[_0x2a90('0x2c')]('value')['value']();if(_[_0x2a90('0x2d')](_0x17f978,_0x2a4e28['type'])){return;}var _0x53391e=_['find'](_0x1303d9,[_0x2a90('0x2e'),_0x2a4e28[_0x2a90('0x2f')]])['name'];return db['UserProfileResource'][_0x2a90('0x24')]({'where':{'type':_0x53391e,'resourceId':_0x2a4e28['id']}})['then'](function(){return _0x1bcfd7;});})[_0x2a90('0x25')](function(){_0xd033d[_0x2a90('0x1b')](0xcc)[_0x2a90('0x1a')]();});}};}function handleEntityNotFound(_0x27b6b6,_0xf18d11){return function(_0x11586c){if(!_0x11586c){_0x27b6b6[_0x2a90('0x19')](0x194);}return _0x11586c;};}function handleError(_0x4a0bfa,_0x427918){_0x427918=_0x427918||0x1f4;return function(_0x22b1f3){logger[_0x2a90('0x30')](_0x22b1f3['stack']);if(_0x22b1f3[_0x2a90('0x31')]){delete _0x22b1f3[_0x2a90('0x31')];}_0x4a0bfa[_0x2a90('0x1b')](_0x427918)[_0x2a90('0x32')](_0x22b1f3);};}exports['index']=function(_0x44899d,_0x1b5f73){var _0xee69e4={},_0x38158b={},_0x129d6e={'count':0x0,'rows':[]};var _0x431942=_['map'](db[_0x2a90('0x33')][_0x2a90('0x34')],function(_0x1bdebf){return{'name':_0x1bdebf[_0x2a90('0x35')],'type':_0x1bdebf['type'][_0x2a90('0x36')]};});_0x38158b[_0x2a90('0x37')]=_['map'](_0x431942,_0x2a90('0x31'));_0x38158b[_0x2a90('0x38')]=_['keys'](_0x44899d['query']);_0x38158b[_0x2a90('0x39')]=_[_0x2a90('0x3a')](_0x38158b[_0x2a90('0x37')],_0x38158b['query']);_0xee69e4[_0x2a90('0x3b')]=_['intersection'](_0x38158b[_0x2a90('0x37')],qs['fields'](_0x44899d[_0x2a90('0x38')]['fields']));_0xee69e4['attributes']=_0xee69e4[_0x2a90('0x3b')]['length']?_0xee69e4[_0x2a90('0x3b')]:_0x38158b[_0x2a90('0x37')];if(!_0x44899d[_0x2a90('0x38')]['hasOwnProperty'](_0x2a90('0x3c'))){_0xee69e4[_0x2a90('0x1e')]=qs[_0x2a90('0x1e')](_0x44899d['query'][_0x2a90('0x1e')]);_0xee69e4[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x44899d['query'][_0x2a90('0x1d')]);}_0xee69e4[_0x2a90('0x3d')]=qs['sort'](_0x44899d[_0x2a90('0x38')][_0x2a90('0x3e')]);_0xee69e4[_0x2a90('0x3f')]=qs[_0x2a90('0x39')](_[_0x2a90('0x40')](_0x44899d[_0x2a90('0x38')],_0x38158b[_0x2a90('0x39')]));if(_0x44899d[_0x2a90('0x38')][_0x2a90('0x2a')]){_0xee69e4[_0x2a90('0x3f')]=_[_0x2a90('0x41')](_0xee69e4[_0x2a90('0x3f')],{'$or':_[_0x2a90('0x2c')](_0x431942,function(_0x18a6ea){if(_0x18a6ea['type']!==_0x2a90('0x42')){var _0x3a70fe={};_0x3a70fe[_0x18a6ea['name']]={'$like':'%'+_0x44899d[_0x2a90('0x38')][_0x2a90('0x2a')]+'%'};return _0x3a70fe;}})});}_0xee69e4=_[_0x2a90('0x41')]({},_0xee69e4,_0x44899d[_0x2a90('0x43')]);var _0x471f6a={'where':_0xee69e4['where']};return db[_0x2a90('0x33')]['count'](_0x471f6a)[_0x2a90('0x25')](function(_0x5161ec){_0x129d6e[_0x2a90('0x44')]=_0x5161ec;if(_0x44899d[_0x2a90('0x38')][_0x2a90('0x45')]){_0xee69e4[_0x2a90('0x46')]=[{'all':!![]}];}return db[_0x2a90('0x33')][_0x2a90('0x47')](_0xee69e4);})[_0x2a90('0x25')](function(_0x48d464){_0x129d6e['rows']=_0x48d464;return _0x129d6e;})[_0x2a90('0x25')](respondWithFilteredResult(_0x1b5f73,_0xee69e4))[_0x2a90('0x48')](handleError(_0x1b5f73,null));};exports[_0x2a90('0x49')]=function(_0x28944c,_0x1ae049){var _0xff4f4a={'raw':![],'where':{'id':_0x28944c[_0x2a90('0x4a')]['id']}},_0x654803={};_0x654803['model']=_[_0x2a90('0x4b')](db['VoiceQueue'][_0x2a90('0x34')]);_0x654803[_0x2a90('0x38')]=_['keys'](_0x28944c[_0x2a90('0x38')]);_0x654803[_0x2a90('0x39')]=_[_0x2a90('0x3a')](_0x654803[_0x2a90('0x37')],_0x654803[_0x2a90('0x38')]);_0xff4f4a[_0x2a90('0x3b')]=_[_0x2a90('0x3a')](_0x654803['model'],qs['fields'](_0x28944c[_0x2a90('0x38')][_0x2a90('0x4c')]));_0xff4f4a[_0x2a90('0x3b')]=_0xff4f4a[_0x2a90('0x3b')][_0x2a90('0x4d')]?_0xff4f4a['attributes']:_0x654803['model'];if(_0x28944c[_0x2a90('0x38')][_0x2a90('0x45')]){_0xff4f4a['include']=[{'all':!![]}];}_0xff4f4a=_['merge']({},_0xff4f4a,_0x28944c['options']);return db[_0x2a90('0x33')]['find'](_0xff4f4a)[_0x2a90('0x25')](handleEntityNotFound(_0x1ae049,null))[_0x2a90('0x25')](respondWithResult(_0x1ae049,null))[_0x2a90('0x48')](handleError(_0x1ae049,null));};exports[_0x2a90('0x4e')]=function(_0x3b2630,_0x3ade08){return db['VoiceQueue'][_0x2a90('0x4e')](_0x3b2630[_0x2a90('0x4f')],{})['then'](function(_0x265769){var _0x4d1303=_0x3b2630['user'][_0x2a90('0x26')]({'plain':!![]});if(!_0x4d1303)throw new Error(_0x2a90('0x50'));if(_0x4d1303['role']==='user'){var _0x2dd550=_0x265769['get']({'plain':!![]});var _0x273111=[{'name':_0x2a90('0x27'),'value':'inbound'},{'name':_0x2a90('0x51'),'value':_0x2a90('0x29')}];var _0xd7a708=_['find'](_0x273111,[_0x2a90('0x2e'),_0x2dd550[_0x2a90('0x2f')]])['name'];return db['UserProfileSection'][_0x2a90('0x52')]({'where':{'name':_0xd7a708,'userProfileId':_0x4d1303[_0x2a90('0x53')]},'raw':!![]})['then'](function(_0x274f25){if(_0x274f25&&_0x274f25['autoAssociation']===0x0){return db[_0x2a90('0x54')]['create']({'name':_0x2dd550[_0x2a90('0x31')],'resourceId':_0x2dd550['id'],'type':_0x274f25[_0x2a90('0x31')],'sectionId':_0x274f25['id']},{})[_0x2a90('0x25')](function(){return _0x265769;});}else{return _0x265769;}})['catch'](function(_0x5ad248){logger['error'](_0x2a90('0x55'),_0x5ad248);throw _0x5ad248;});}return _0x265769;})[_0x2a90('0x25')](respondWithResult(_0x3ade08,0xc9))[_0x2a90('0x48')](handleError(_0x3ade08,null));};exports[_0x2a90('0x56')]=function(_0x2e5762,_0x1f08d4){var _0x5148ce={'where':{'id':_0x2e5762[_0x2a90('0x4a')]['id']}},_0x37f34b={};_0x37f34b[_0x2a90('0x37')]=_[_0x2a90('0x4b')](db[_0x2a90('0x33')][_0x2a90('0x34')]);_0x5148ce['attributes']=_['intersection'](_0x37f34b['model'],qs[_0x2a90('0x4c')](_0x2e5762[_0x2a90('0x38')][_0x2a90('0x4c')]));_0x5148ce[_0x2a90('0x3b')]=_0x5148ce[_0x2a90('0x3b')][_0x2a90('0x4d')]?_0x5148ce[_0x2a90('0x3b')]:_0x37f34b[_0x2a90('0x37')];if(_0x2e5762[_0x2a90('0x38')][_0x2a90('0x45')]){_0x5148ce[_0x2a90('0x46')]=[{'all':!![]}];}_0x5148ce=_[_0x2a90('0x41')]({},_0x5148ce,_0x2e5762[_0x2a90('0x43')]);return db[_0x2a90('0x33')][_0x2a90('0x52')](_0x5148ce)[_0x2a90('0x25')](handleEntityNotFound(_0x1f08d4,null))['then'](function(_0x30e257){if(_0x30e257){var _0x4d2a63=_0x30e257[_0x2a90('0x26')]({'plain':!![]});_0x4d2a63=qs[_0x2a90('0x57')](_0x4d2a63,['id',_0x2a90('0x58'),_0x2a90('0x59')]);_0x2e5762[_0x2a90('0x4f')]=_[_0x2a90('0x57')](_0x2e5762[_0x2a90('0x4f')],['id','createdAt',_0x2a90('0x59')]);return db[_0x2a90('0x33')][_0x2a90('0x4e')](_['merge'](_0x4d2a63,_0x2e5762[_0x2a90('0x4f')]),{'include':_0x2e5762[_0x2a90('0x38')][_0x2a90('0x45')]?[{'all':!![]}]:undefined})[_0x2a90('0x25')](function(_0x502856){var _0x18dce7=_0x2e5762['user'][_0x2a90('0x26')]({'plain':!![]});if(!_0x18dce7)throw new Error(_0x2a90('0x50'));if(_0x18dce7[_0x2a90('0x5a')]===_0x2a90('0x5b')){var _0x106d01=_0x502856[_0x2a90('0x26')]({'plain':!![]});var _0x4e541a=[{'name':_0x2a90('0x27'),'value':_0x2a90('0x28')},{'name':_0x2a90('0x51'),'value':_0x2a90('0x29')}];var _0x1f8788=_[_0x2a90('0x52')](_0x4e541a,[_0x2a90('0x2e'),_0x106d01[_0x2a90('0x2f')]])[_0x2a90('0x31')];return db['UserProfileSection'][_0x2a90('0x52')]({'where':{'name':_0x1f8788,'userProfileId':_0x18dce7[_0x2a90('0x53')]},'raw':!![]})[_0x2a90('0x25')](function(_0x507599){if(_0x507599&&_0x507599[_0x2a90('0x5c')]===0x0){return db[_0x2a90('0x54')][_0x2a90('0x4e')]({'name':_0x106d01[_0x2a90('0x31')],'resourceId':_0x106d01['id'],'type':_0x507599[_0x2a90('0x31')],'sectionId':_0x507599['id']},{})['then'](function(){return _0x502856;});}else{return _0x502856;}})[_0x2a90('0x48')](function(_0x5e0bf2){logger['error'](_0x2a90('0x55'),_0x5e0bf2);throw _0x5e0bf2;});}return _0x502856;});}})['then'](respondWithResult(_0x1f08d4,0xc9))['catch'](handleError(_0x1f08d4,null));};exports[_0x2a90('0x23')]=function(_0x5f3ae1,_0xac4adb){if(_0x5f3ae1[_0x2a90('0x4f')]['id']){delete _0x5f3ae1['body']['id'];}return db['VoiceQueue'][_0x2a90('0x52')]({'where':{'id':_0x5f3ae1['params']['id']}})['then'](handleEntityNotFound(_0xac4adb,null))[_0x2a90('0x25')](saveUpdates(_0x5f3ae1[_0x2a90('0x4f')],null))[_0x2a90('0x25')](respondWithResult(_0xac4adb,null))[_0x2a90('0x48')](handleError(_0xac4adb,null));};exports['destroy']=function(_0x4eaee2,_0x370144){return db[_0x2a90('0x33')][_0x2a90('0x52')]({'where':{'id':_0x4eaee2[_0x2a90('0x4a')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x370144,null))[_0x2a90('0x25')](removeEntity(_0x370144,null))[_0x2a90('0x48')](handleError(_0x370144,null));};exports[_0x2a90('0x5d')]=function(_0x325c3a,_0xe20002,_0xe10abe){var _0x19edd1={'raw':![],'where':{}};var _0x5a1a53={};var _0x2e4646={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2a90('0x5e')]({'where':{'id':_0x325c3a['params']['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0xe20002,null))['then'](function(_0x4ea392){if(_0x4ea392){_0x5a1a53[_0x2a90('0x37')]=_[_0x2a90('0x4b')](db[_0x2a90('0x5f')][_0x2a90('0x34')]);_0x5a1a53['query']=_['keys'](_0x325c3a[_0x2a90('0x38')]);_0x5a1a53[_0x2a90('0x39')]=_[_0x2a90('0x3a')](_0x5a1a53[_0x2a90('0x37')],_0x5a1a53[_0x2a90('0x38')]);_0x19edd1[_0x2a90('0x3b')]=_[_0x2a90('0x3a')](_0x5a1a53[_0x2a90('0x37')],qs[_0x2a90('0x4c')](_0x325c3a[_0x2a90('0x38')][_0x2a90('0x4c')]));_0x19edd1[_0x2a90('0x3b')]=_0x19edd1['attributes'][_0x2a90('0x4d')]?_0x19edd1[_0x2a90('0x3b')]:_0x5a1a53[_0x2a90('0x37')];if(!_0x325c3a[_0x2a90('0x38')][_0x2a90('0x60')](_0x2a90('0x3c'))){_0x19edd1[_0x2a90('0x1e')]=qs[_0x2a90('0x1e')](_0x325c3a['query'][_0x2a90('0x1e')]);_0x19edd1[_0x2a90('0x1d')]=qs['offset'](_0x325c3a[_0x2a90('0x38')][_0x2a90('0x1d')]);}_0x19edd1[_0x2a90('0x3d')]=qs[_0x2a90('0x3e')](_0x325c3a[_0x2a90('0x38')][_0x2a90('0x3e')]);_0x19edd1['where']=qs[_0x2a90('0x39')](_[_0x2a90('0x40')](_0x325c3a[_0x2a90('0x38')],_0x5a1a53[_0x2a90('0x39')]));_0x19edd1[_0x2a90('0x3f')][_0x2a90('0x61')]=_0x4ea392['id'];if(_0x325c3a[_0x2a90('0x38')][_0x2a90('0x2a')]){_0x19edd1['where']=_[_0x2a90('0x41')](_0x19edd1[_0x2a90('0x3f')],{'$or':_[_0x2a90('0x2c')](_0x19edd1[_0x2a90('0x3b')],function(_0xb6fded){var _0x14138e={};_0x14138e[_0xb6fded]={'$like':'%'+_0x325c3a['query'][_0x2a90('0x2a')]+'%'};return _0x14138e;})});}_0x19edd1=_[_0x2a90('0x41')]({},_0x19edd1,_0x325c3a[_0x2a90('0x43')]);return db['CmHopper'][_0x2a90('0x44')]({'where':_0x19edd1[_0x2a90('0x3f')]})[_0x2a90('0x25')](function(_0x5c0a1b){_0x2e4646['count']=_0x5c0a1b;if(_0x325c3a[_0x2a90('0x38')][_0x2a90('0x45')]){_0x19edd1['include']=[{'all':!![]}];}return db[_0x2a90('0x5f')][_0x2a90('0x47')](_0x19edd1);})['then'](function(_0x241d4b){_0x2e4646[_0x2a90('0x62')]=_0x241d4b;return _0x2e4646;});}})['then'](respondWithFilteredResult(_0xe20002,_0x19edd1))[_0x2a90('0x48')](handleError(_0xe20002,null));};exports[_0x2a90('0x63')]=function(_0x4b480a,_0x58905e,_0x34c740){var _0x432db3={'raw':!![],'where':{}};var _0x184263={};var _0x3011e9={'count':0x0,'rows':[]};return db[_0x2a90('0x33')][_0x2a90('0x5e')]({'where':{'id':_0x4b480a[_0x2a90('0x4a')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x58905e,null))[_0x2a90('0x25')](function(_0x9c11df){if(_0x9c11df){_0x184263[_0x2a90('0x37')]=_['keys'](db[_0x2a90('0x64')][_0x2a90('0x34')]);_0x184263[_0x2a90('0x38')]=_['keys'](_0x4b480a[_0x2a90('0x38')]);_0x184263[_0x2a90('0x39')]=_[_0x2a90('0x3a')](_0x184263['model'],_0x184263[_0x2a90('0x38')]);_0x432db3[_0x2a90('0x3b')]=_[_0x2a90('0x3a')](_0x184263[_0x2a90('0x37')],qs[_0x2a90('0x4c')](_0x4b480a[_0x2a90('0x38')][_0x2a90('0x4c')]));_0x432db3['attributes']=_0x432db3['attributes'][_0x2a90('0x4d')]?_0x432db3['attributes']:_0x184263[_0x2a90('0x37')];if(!_0x4b480a[_0x2a90('0x38')]['hasOwnProperty'](_0x2a90('0x3c'))){_0x432db3[_0x2a90('0x1e')]=qs[_0x2a90('0x1e')](_0x4b480a[_0x2a90('0x38')][_0x2a90('0x1e')]);_0x432db3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x4b480a[_0x2a90('0x38')][_0x2a90('0x1d')]);}_0x432db3['order']=qs['sort'](_0x4b480a[_0x2a90('0x38')][_0x2a90('0x3e')]);_0x432db3[_0x2a90('0x3f')]=qs[_0x2a90('0x39')](_[_0x2a90('0x40')](_0x4b480a[_0x2a90('0x38')],_0x184263[_0x2a90('0x39')]));_0x432db3[_0x2a90('0x3f')][_0x2a90('0x61')]=_0x9c11df['id'];if(_0x4b480a[_0x2a90('0x38')][_0x2a90('0x2a')]){_0x432db3[_0x2a90('0x3f')]=_[_0x2a90('0x41')](_0x432db3[_0x2a90('0x3f')],{'$or':_[_0x2a90('0x2c')](_0x432db3[_0x2a90('0x3b')],function(_0x46b9de){var _0x484afc={};_0x484afc[_0x46b9de]={'$like':'%'+_0x4b480a[_0x2a90('0x38')][_0x2a90('0x2a')]+'%'};return _0x484afc;})});}_0x432db3=_[_0x2a90('0x41')]({},_0x432db3,_0x4b480a[_0x2a90('0x43')]);return db['CmHopperHistory'][_0x2a90('0x44')]({'where':_0x432db3[_0x2a90('0x3f')]})[_0x2a90('0x25')](function(_0x58110b){_0x3011e9[_0x2a90('0x44')]=_0x58110b;if(_0x4b480a[_0x2a90('0x38')][_0x2a90('0x45')]){_0x432db3[_0x2a90('0x46')]=[{'all':!![]}];}return db[_0x2a90('0x64')]['findAll'](_0x432db3);})['then'](function(_0xd429f5){_0x3011e9[_0x2a90('0x62')]=_0xd429f5;return _0x3011e9;});}})['then'](respondWithFilteredResult(_0x58905e,_0x432db3))[_0x2a90('0x48')](handleError(_0x58905e,null));};exports[_0x2a90('0x65')]=function(_0x32a924,_0x45570b,_0x1e0862){var _0x399f09={'raw':!![],'where':{}};var _0x99a847={};var _0x3411a6={'count':0x0,'rows':[]};return db[_0x2a90('0x33')][_0x2a90('0x5e')]({'where':{'id':_0x32a924['params']['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x45570b,null))[_0x2a90('0x25')](function(_0x2a6d16){if(_0x2a6d16){_0x99a847[_0x2a90('0x37')]=_[_0x2a90('0x4b')](db[_0x2a90('0x66')][_0x2a90('0x34')]);_0x99a847[_0x2a90('0x38')]=_[_0x2a90('0x4b')](_0x32a924[_0x2a90('0x38')]);_0x99a847['filters']=_[_0x2a90('0x3a')](_0x99a847[_0x2a90('0x37')],_0x99a847[_0x2a90('0x38')]);_0x399f09['attributes']=_[_0x2a90('0x3a')](_0x99a847[_0x2a90('0x37')],qs[_0x2a90('0x4c')](_0x32a924[_0x2a90('0x38')][_0x2a90('0x4c')]));_0x399f09['attributes']=_0x399f09['attributes']['length']?_0x399f09[_0x2a90('0x3b')]:_0x99a847[_0x2a90('0x37')];if(!_0x32a924[_0x2a90('0x38')][_0x2a90('0x60')](_0x2a90('0x3c'))){_0x399f09[_0x2a90('0x1e')]=qs[_0x2a90('0x1e')](_0x32a924[_0x2a90('0x38')]['limit']);_0x399f09[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x32a924[_0x2a90('0x38')][_0x2a90('0x1d')]);}_0x399f09[_0x2a90('0x3d')]=qs[_0x2a90('0x3e')](_0x32a924[_0x2a90('0x38')][_0x2a90('0x3e')]);_0x399f09[_0x2a90('0x3f')]=qs['filters'](_[_0x2a90('0x40')](_0x32a924[_0x2a90('0x38')],_0x99a847[_0x2a90('0x39')]));_0x399f09[_0x2a90('0x3f')][_0x2a90('0x61')]=_0x2a6d16['id'];if(_0x32a924[_0x2a90('0x38')]['filter']){_0x399f09[_0x2a90('0x3f')]=_[_0x2a90('0x41')](_0x399f09[_0x2a90('0x3f')],{'$or':_[_0x2a90('0x2c')](_0x399f09[_0x2a90('0x3b')],function(_0x5cb4b6){var _0x101477={};_0x101477[_0x5cb4b6]={'$like':'%'+_0x32a924[_0x2a90('0x38')][_0x2a90('0x2a')]+'%'};return _0x101477;})});}_0x399f09=_[_0x2a90('0x41')]({},_0x399f09,_0x32a924['options']);return db[_0x2a90('0x66')][_0x2a90('0x44')]({'where':_0x399f09[_0x2a90('0x3f')]})[_0x2a90('0x25')](function(_0x50201c){_0x3411a6['count']=_0x50201c;if(_0x32a924[_0x2a90('0x38')]['includeAll']){_0x399f09[_0x2a90('0x46')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x399f09);})[_0x2a90('0x25')](function(_0x5c9783){_0x3411a6[_0x2a90('0x62')]=_0x5c9783;return _0x3411a6;});}})[_0x2a90('0x25')](respondWithFilteredResult(_0x45570b,_0x399f09))[_0x2a90('0x48')](handleError(_0x45570b,null));};exports[_0x2a90('0x67')]=function(_0x39b7d4,_0x1f2e2a,_0x21ed4c){var _0x3fad53={'raw':!![],'where':{}};var _0x98059e={};var _0x113799={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x39b7d4[_0x2a90('0x4a')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x1f2e2a,null))[_0x2a90('0x25')](function(_0x1f0c76){if(_0x1f0c76){_0x98059e[_0x2a90('0x37')]=_['keys'](db['CmHopperBlack'][_0x2a90('0x34')]);_0x98059e[_0x2a90('0x38')]=_[_0x2a90('0x4b')](_0x39b7d4[_0x2a90('0x38')]);_0x98059e[_0x2a90('0x39')]=_[_0x2a90('0x3a')](_0x98059e[_0x2a90('0x37')],_0x98059e[_0x2a90('0x38')]);_0x3fad53['attributes']=_[_0x2a90('0x3a')](_0x98059e[_0x2a90('0x37')],qs[_0x2a90('0x4c')](_0x39b7d4['query'][_0x2a90('0x4c')]));_0x3fad53[_0x2a90('0x3b')]=_0x3fad53[_0x2a90('0x3b')]['length']?_0x3fad53[_0x2a90('0x3b')]:_0x98059e['model'];if(!_0x39b7d4[_0x2a90('0x38')]['hasOwnProperty'](_0x2a90('0x3c'))){_0x3fad53[_0x2a90('0x1e')]=qs[_0x2a90('0x1e')](_0x39b7d4[_0x2a90('0x38')][_0x2a90('0x1e')]);_0x3fad53[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x39b7d4[_0x2a90('0x38')][_0x2a90('0x1d')]);}_0x3fad53[_0x2a90('0x3d')]=qs['sort'](_0x39b7d4['query'][_0x2a90('0x3e')]);_0x3fad53[_0x2a90('0x3f')]=qs['filters'](_[_0x2a90('0x40')](_0x39b7d4['query'],_0x98059e['filters']));_0x3fad53[_0x2a90('0x3f')][_0x2a90('0x61')]=_0x1f0c76['id'];if(_0x39b7d4[_0x2a90('0x38')][_0x2a90('0x2a')]){_0x3fad53[_0x2a90('0x3f')]=_[_0x2a90('0x41')](_0x3fad53['where'],{'$or':_['map'](_0x3fad53[_0x2a90('0x3b')],function(_0x59fec5){var _0x2910b1={};_0x2910b1[_0x59fec5]={'$like':'%'+_0x39b7d4[_0x2a90('0x38')][_0x2a90('0x2a')]+'%'};return _0x2910b1;})});}_0x3fad53=_[_0x2a90('0x41')]({},_0x3fad53,_0x39b7d4[_0x2a90('0x43')]);return db[_0x2a90('0x68')][_0x2a90('0x44')]({'where':_0x3fad53['where']})[_0x2a90('0x25')](function(_0x1e89c9){_0x113799[_0x2a90('0x44')]=_0x1e89c9;if(_0x39b7d4[_0x2a90('0x38')][_0x2a90('0x45')]){_0x3fad53['include']=[{'all':!![]}];}return db[_0x2a90('0x68')]['findAll'](_0x3fad53);})['then'](function(_0x490f4a){_0x113799[_0x2a90('0x62')]=_0x490f4a;return _0x113799;});}})[_0x2a90('0x25')](respondWithFilteredResult(_0x1f2e2a,_0x3fad53))[_0x2a90('0x48')](handleError(_0x1f2e2a,null));};exports['getTeams']=function(_0x19e885,_0x1232aa,_0x5eecff){var _0x8d176c={};var _0x49842c={};var _0xbef2e2;var _0x5316c0;return db[_0x2a90('0x33')][_0x2a90('0x5e')]({'where':{'id':_0x19e885[_0x2a90('0x4a')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x1232aa,null))[_0x2a90('0x25')](function(_0x12bde8){if(_0x12bde8){_0xbef2e2=_0x12bde8;_0x49842c[_0x2a90('0x37')]=_['keys'](db[_0x2a90('0x69')]['rawAttributes']);_0x49842c[_0x2a90('0x38')]=_[_0x2a90('0x4b')](_0x19e885[_0x2a90('0x38')]);_0x49842c[_0x2a90('0x39')]=_[_0x2a90('0x3a')](_0x49842c[_0x2a90('0x37')],_0x49842c[_0x2a90('0x38')]);_0x8d176c[_0x2a90('0x3b')]=_['intersection'](_0x49842c['model'],qs[_0x2a90('0x4c')](_0x19e885[_0x2a90('0x38')][_0x2a90('0x4c')]));_0x8d176c[_0x2a90('0x3b')]=_0x8d176c[_0x2a90('0x3b')][_0x2a90('0x4d')]?_0x8d176c[_0x2a90('0x3b')]:_0x49842c[_0x2a90('0x37')];_0x8d176c[_0x2a90('0x3d')]=qs['sort'](_0x19e885['query']['sort']);_0x8d176c[_0x2a90('0x3f')]=qs[_0x2a90('0x39')](_[_0x2a90('0x40')](_0x19e885['query'],_0x49842c['filters']));if(_0x19e885['query'][_0x2a90('0x2a')]){_0x8d176c['where']=_[_0x2a90('0x41')](_0x8d176c[_0x2a90('0x3f')],{'$or':_[_0x2a90('0x2c')](_0x8d176c[_0x2a90('0x3b')],function(_0xe1b84c){var _0x1bf24c={};_0x1bf24c[_0xe1b84c]={'$like':'%'+_0x19e885[_0x2a90('0x38')][_0x2a90('0x2a')]+'%'};return _0x1bf24c;})});}_0x8d176c=_['merge']({},_0x8d176c,_0x19e885[_0x2a90('0x43')]);return _0xbef2e2[_0x2a90('0x6a')](_0x8d176c);}})[_0x2a90('0x25')](function(_0x4e9df0){if(_0x4e9df0){_0x5316c0=_0x4e9df0[_0x2a90('0x4d')];if(!_0x19e885[_0x2a90('0x38')][_0x2a90('0x60')](_0x2a90('0x3c'))){_0x8d176c[_0x2a90('0x1e')]=qs[_0x2a90('0x1e')](_0x19e885[_0x2a90('0x38')][_0x2a90('0x1e')]);_0x8d176c['offset']=qs['offset'](_0x19e885[_0x2a90('0x38')][_0x2a90('0x1d')]);}return _0xbef2e2[_0x2a90('0x6a')](_0x8d176c);}})[_0x2a90('0x25')](function(_0x16a109){if(_0x16a109){return _0x16a109?{'count':_0x5316c0,'rows':_0x16a109}:null;}})['then'](respondWithResult(_0x1232aa,null))[_0x2a90('0x48')](handleError(_0x1232aa,null));};exports[_0x2a90('0x6b')]=function(_0x5921b2,_0x25ce19,_0x20ac0e){var _0x255dce=_0x5921b2[_0x2a90('0x4f')][_0x2a90('0x6c')];var _0xcc1142=_[_0x2a90('0x2c')](_0x255dce,'id');return db[_0x2a90('0x69')][_0x2a90('0x47')]({'where':{'id':_0xcc1142},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2a90('0x6d'),'attributes':['id',_0x2a90('0x31'),_0x2a90('0x6e'),_0x2a90('0x6f'),_0x2a90('0x70')],'raw':!![]}]})[_0x2a90('0x25')](function(_0x33b421){if(_0x33b421){var _0x43e67f=_[_0x2a90('0x71')](_0x33b421,function(_0x69c0dd){var _0x3e90c8=_0x69c0dd['get']({'plain':!![]});_0x3e90c8['Agents'][_0x2a90('0x72')](function(_0x5a5b99){_0x5a5b99[_0x2a90('0x73')]=_[_0x2a90('0x52')](_0x255dce,{'id':_0x3e90c8['id']})[_0x2a90('0x73')];});return _0x3e90c8[_0x2a90('0x6d')];});return db[_0x2a90('0x33')][_0x2a90('0x52')]({'where':{'id':_0x5921b2[_0x2a90('0x4a')]['id']}})[_0x2a90('0x25')](function(_0x2b8bb1){return db['sequelize'][_0x2a90('0x74')](function(_0x200c65){return _0x2b8bb1['addTeams'](_0xcc1142,{'transaction':_0x200c65})[_0x2a90('0x25')](function(){return BPromise[_0x2a90('0x75')](_0x43e67f,function(_0x369dca){return db[_0x2a90('0x76')][_0x2a90('0x77')]({'where':{'UserId':_0x369dca['id'],'VoiceQueueId':_0x5921b2[_0x2a90('0x4a')]['id']},'defaults':{'penalty':_0x369dca[_0x2a90('0x73')]},'transaction':_0x200c65});});})[_0x2a90('0x25')](function(){return BPromise['each'](_['filter'](_0x43e67f,{'online':!![]}),function(_0x488f8b){return db[_0x2a90('0x78')]['upsert']({'membername':_0x488f8b['name'],'UserId':_0x488f8b['id'],'queue_name':_0x2b8bb1[_0x2a90('0x31')],'VoiceQueueId':_0x2b8bb1['id'],'interface':_['isNil'](_0x488f8b['interface'])?util[_0x2a90('0x79')](_0x2a90('0x7a'),_0x488f8b[_0x2a90('0x31')]):_0x488f8b['interface'],'paused':_0x488f8b[_0x2a90('0x6f')]||![],'penalty':_0x488f8b[_0x2a90('0x73')]},{'transaction':_0x200c65});});})[_0x2a90('0x25')](function(){_0x43e67f[_0x2a90('0x72')](function(_0x4e9303){socket[_0x2a90('0x7b')](_0x2a90('0x7c'),{'UserId':_0x4e9303['id'],'VoiceQueueId':_0x2b8bb1['id']});});});});});}})[_0x2a90('0x25')](respondWithStatusCode(_0x25ce19,null))[_0x2a90('0x48')](handleError(_0x25ce19,null));};exports[_0x2a90('0x7d')]=function(_0x2b5835,_0x378218,_0x201ee7){return db['Team'][_0x2a90('0x47')]({'where':{'id':_0x2b5835['query'][_0x2a90('0x7e')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2a90('0x6d'),'attributes':['id'],'raw':!![]}]})[_0x2a90('0x25')](handleEntityNotFound(_0x378218,null))[_0x2a90('0x25')](function(_0x2fe164){var _0x16e236=_[_0x2a90('0x2c')](_0x2fe164,'id');var _0x6626c3=[];var _0x446e2d=[];var _0x42723c=squel[_0x2a90('0x7f')]();_0x42723c[_0x2a90('0x80')](_0x2a90('0x81'))[_0x2a90('0x82')](_0x2a90('0x83'),'tq')['join'](_0x2a90('0x84'),'ut',_0x2a90('0x85'))[_0x2a90('0x3f')]('VoiceQueueId\x20=\x20?',_0x2b5835['params']['id']);for(var _0x304e0f=0x0;_0x304e0f<_0x2fe164[_0x2a90('0x4d')];_0x304e0f+=0x1){let _0x218bc0=_0x2fe164[_0x304e0f];for(var _0x260a19=0x0;_0x260a19<_0x218bc0[_0x2a90('0x6d')][_0x2a90('0x4d')];_0x260a19+=0x1){let _0x3b8266=_0x218bc0[_0x2a90('0x6d')][_0x260a19];var _0xed6e6c=_0x42723c['clone']();_0xed6e6c[_0x2a90('0x3f')]('ut.UserId\x20=\x20?',_0x3b8266['id']);_0x446e2d['push'](db['sequelize']['query'](_0xed6e6c[_0x2a90('0x86')](),{'type':db[_0x2a90('0x87')]['QueryTypes'][_0x2a90('0x88')]})[_0x2a90('0x25')](function(_0x5e2a44){if(_0x5e2a44[_0x2a90('0x4d')]===0x1){return _0x3b8266['id'];}else{var _0x477239=_['every'](_[_0x2a90('0x2c')](_0x5e2a44,_0x2a90('0x89')),function(_0x2ec4b9){return _[_0x2a90('0x2d')](_0x16e236,_0x2ec4b9);});if(_0x477239){return _0x3b8266['id'];}}}));}}return BPromise[_0x2a90('0x8a')](_0x446e2d)[_0x2a90('0x25')](function(_0x19c761){_0x6626c3=_(_0x6626c3)[_0x2a90('0x8b')](_0x19c761)[_0x2a90('0x8c')]()[_0x2a90('0x2e')]();return db['VoiceQueue']['find']({'where':{'id':_0x2b5835[_0x2a90('0x4a')]['id']}})[_0x2a90('0x25')](function(_0x58c865){return db[_0x2a90('0x87')][_0x2a90('0x74')](function(_0x28c8c3){return _0x58c865[_0x2a90('0x7d')](_0x2b5835[_0x2a90('0x38')][_0x2a90('0x7e')],{'transaction':_0x28c8c3})[_0x2a90('0x25')](function(){if(!_['isEmpty'](_0x6626c3)){return _0x58c865['removeAgents'](_0x6626c3,{'transaction':_0x28c8c3})[_0x2a90('0x25')](function(){return db['UserVoiceQueueRt'][_0x2a90('0x24')]({'where':{'VoiceQueueId':_0x2b5835[_0x2a90('0x4a')]['id'],'UserId':_0x6626c3},'transaction':_0x28c8c3});});}})[_0x2a90('0x25')](function(){_0x6626c3[_0x2a90('0x72')](function(_0x226ed8){socket[_0x2a90('0x7b')](_0x2a90('0x8d'),{'UserId':_0x226ed8,'VoiceQueueId':_0x58c865['id']});});});});});});})['then'](respondWithStatusCode(_0x378218,null))['catch'](handleError(_0x378218,null));};exports[_0x2a90('0x8e')]=function(_0x34b8bd,_0x4fff8d,_0x474512){var _0x4f4930,_0x470411;return db['VoiceQueue'][_0x2a90('0x52')]({'where':{'id':_0x34b8bd[_0x2a90('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4fff8d,null))[_0x2a90('0x25')](function(_0x4c8e97){if(_0x4c8e97){_0x470411=_0x4c8e97;return _0x4c8e97[_0x2a90('0x8e')](_0x34b8bd[_0x2a90('0x4f')][_0x2a90('0x7e')],_[_0x2a90('0x57')](_0x34b8bd[_0x2a90('0x4f')],['ids','id'])||{})[_0x2a90('0x8f')](function(_0x410639){for(var _0x134fdd=0x0;_0x134fdd<_0x34b8bd['body']['ids'][_0x2a90('0x4d')];_0x134fdd+=0x1){socket[_0x2a90('0x7b')]('userVoiceQueue:save',{'UserId':_0x34b8bd['body'][_0x2a90('0x7e')][_0x134fdd],'VoiceQueueId':_0x34b8bd[_0x2a90('0x4a')]['id']});}return _0x410639;});}})[_0x2a90('0x25')](function(_0x5026d0){_0x4f4930=_0x5026d0||[];if(_0x470411){return db[_0x2a90('0x90')][_0x2a90('0x47')]({'where':{'id':_0x34b8bd[_0x2a90('0x4f')]['ids']},'attributes':['id',_0x2a90('0x31'),_0x2a90('0x6e'),'voicePause',_0x2a90('0x70')],'raw':!![]});}})[_0x2a90('0x25')](function(_0x9a4568){if(!_['isEmpty'](_0x9a4568)){var _0x497267=[];for(var _0x155807=0x0;_0x155807<_0x9a4568['length'];_0x155807++){if(_0x9a4568[_0x155807][_0x2a90('0x6e')]){_0x497267[_0x2a90('0x91')](db[_0x2a90('0x78')][_0x2a90('0x92')]({'membername':_0x9a4568[_0x155807][_0x2a90('0x31')],'UserId':_0x9a4568[_0x155807]['id'],'queue_name':_0x470411[_0x2a90('0x31')],'VoiceQueueId':_0x470411['id'],'interface':_[_0x2a90('0x93')](_0x9a4568[_0x155807]['interface'])?util[_0x2a90('0x79')](_0x2a90('0x7a'),_0x9a4568[_0x155807]['name']):_0x9a4568[_0x155807]['interface'],'paused':_0x9a4568[_0x155807]['voicePause']||![],'penalty':_0x34b8bd[_0x2a90('0x4f')][_0x2a90('0x73')]||0x0}));}}return BPromise['all'](_0x497267);}})['then'](function(){return _0x4f4930;})[_0x2a90('0x25')](respondWithResult(_0x4fff8d,null))[_0x2a90('0x48')](handleError(_0x4fff8d,null));};exports[_0x2a90('0x94')]=function(_0x49f096,_0x4d75d8,_0x8fd8dd){return db['VoiceQueue'][_0x2a90('0x52')]({'where':{'id':_0x49f096['params']['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x4d75d8,null))[_0x2a90('0x25')](function(_0x5e7792){if(_0x5e7792){return _0x5e7792['removeAgents'](_0x49f096[_0x2a90('0x38')][_0x2a90('0x7e')])[_0x2a90('0x25')](function(){if(_['isArray'](_0x49f096['query']['ids'])){for(var _0x44b37c=0x0;_0x44b37c<_0x49f096['query']['ids'][_0x2a90('0x4d')];_0x44b37c+=0x1){socket[_0x2a90('0x7b')](_0x2a90('0x8d'),{'UserId':Number(_0x49f096['query'][_0x2a90('0x7e')][_0x44b37c]),'VoiceQueueId':Number(_0x49f096[_0x2a90('0x4a')]['id'])});}}else{socket[_0x2a90('0x7b')](_0x2a90('0x8d'),{'UserId':Number(_0x49f096['query']['ids']),'VoiceQueueId':Number(_0x49f096[_0x2a90('0x4a')]['id'])});}});}})[_0x2a90('0x25')](function(_0x1d1cb1){return db['UserVoiceQueueRt'][_0x2a90('0x24')]({'where':{'VoiceQueueId':_0x49f096[_0x2a90('0x4a')]['id'],'UserId':_0x49f096[_0x2a90('0x38')]['ids']}})[_0x2a90('0x25')](function(){return _0x1d1cb1;});})[_0x2a90('0x25')](respondWithStatusCode(_0x4d75d8,null))['catch'](handleError(_0x4d75d8,null));};exports[_0x2a90('0x95')]=function(_0x4b5b22,_0x5a345b,_0x42ce13){var _0x99db47={};var _0x229b3e={};var _0x208aaa;var _0x7072f0;return db['VoiceQueue'][_0x2a90('0x5e')]({'where':{'id':_0x4b5b22['params']['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x5a345b,null))['then'](function(_0x3dc509){if(_0x3dc509){_0x208aaa=_0x3dc509;_0x229b3e[_0x2a90('0x37')]=_[_0x2a90('0x4b')](db[_0x2a90('0x90')][_0x2a90('0x34')]);_0x229b3e[_0x2a90('0x38')]=_[_0x2a90('0x4b')](_0x4b5b22[_0x2a90('0x38')]);_0x229b3e[_0x2a90('0x39')]=_['intersection'](_0x229b3e[_0x2a90('0x37')],_0x229b3e[_0x2a90('0x38')]);_0x99db47[_0x2a90('0x3b')]=_['intersection'](_0x229b3e['model'],qs[_0x2a90('0x4c')](_0x4b5b22[_0x2a90('0x38')][_0x2a90('0x4c')]));_0x99db47[_0x2a90('0x3b')]=_0x99db47['attributes']['length']?_0x99db47[_0x2a90('0x3b')]:_0x229b3e[_0x2a90('0x37')];_0x99db47[_0x2a90('0x3d')]=qs['sort'](_0x4b5b22['query'][_0x2a90('0x3e')]);_0x99db47['where']=qs['filters'](_[_0x2a90('0x40')](_0x4b5b22['query'],_0x229b3e[_0x2a90('0x39')]));if(_0x4b5b22[_0x2a90('0x38')][_0x2a90('0x2a')]){_0x99db47[_0x2a90('0x3f')]=_['merge'](_0x99db47['where'],{'$or':_[_0x2a90('0x2c')](_0x99db47['attributes'],function(_0x5f0783){var _0x37dddf={};_0x37dddf[_0x5f0783]={'$like':'%'+_0x4b5b22['query'][_0x2a90('0x2a')]+'%'};return _0x37dddf;})});}_0x99db47=_['merge']({},_0x99db47,_0x4b5b22[_0x2a90('0x43')]);return _0x208aaa[_0x2a90('0x95')](_0x99db47);}})['then'](function(_0x2022c8){if(_0x2022c8){_0x7072f0=_0x2022c8[_0x2a90('0x4d')];if(!_0x4b5b22[_0x2a90('0x38')][_0x2a90('0x60')](_0x2a90('0x3c'))){_0x99db47[_0x2a90('0x1e')]=qs[_0x2a90('0x1e')](_0x4b5b22[_0x2a90('0x38')][_0x2a90('0x1e')]);_0x99db47[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x4b5b22[_0x2a90('0x38')][_0x2a90('0x1d')]);}return _0x208aaa[_0x2a90('0x95')](_0x99db47);}})[_0x2a90('0x25')](function(_0x5c8016){if(_0x5c8016){return _0x5c8016?{'count':_0x7072f0,'rows':_0x5c8016}:null;}})[_0x2a90('0x25')](respondWithResult(_0x5a345b,null))[_0x2a90('0x48')](handleError(_0x5a345b,null));};exports['getMembers']=function(_0x54d75b,_0x262a07,_0x1ee4ed){var _0x4eabcf={};var _0x5a219e={};var _0x316cfd;var _0x5004be;return db[_0x2a90('0x33')][_0x2a90('0x5e')]({'where':{'id':_0x54d75b[_0x2a90('0x4a')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x262a07,null))['then'](function(_0x33ea9f){if(_0x33ea9f){_0x316cfd=_0x33ea9f;_0x5a219e[_0x2a90('0x37')]=_[_0x2a90('0x4b')](db['UserVoiceQueueRt'][_0x2a90('0x34')]);_0x5a219e['query']=_['keys'](_0x54d75b[_0x2a90('0x38')]);_0x5a219e[_0x2a90('0x39')]=_[_0x2a90('0x3a')](_0x5a219e[_0x2a90('0x37')],_0x5a219e[_0x2a90('0x38')]);_0x4eabcf[_0x2a90('0x3b')]=_['intersection'](_0x5a219e['model'],qs[_0x2a90('0x4c')](_0x54d75b[_0x2a90('0x38')]['fields']));_0x4eabcf[_0x2a90('0x3b')]=_0x4eabcf[_0x2a90('0x3b')][_0x2a90('0x4d')]?_0x4eabcf[_0x2a90('0x3b')]:_0x5a219e[_0x2a90('0x37')];_0x4eabcf['order']=qs['sort'](_0x54d75b['query'][_0x2a90('0x3e')]);_0x4eabcf[_0x2a90('0x3f')]=qs[_0x2a90('0x39')](_[_0x2a90('0x40')](_0x54d75b[_0x2a90('0x38')],_0x5a219e['filters']));if(_0x54d75b[_0x2a90('0x38')][_0x2a90('0x2a')]){_0x4eabcf[_0x2a90('0x3f')]=_[_0x2a90('0x41')](_0x4eabcf['where'],{'$or':_['map'](_0x4eabcf[_0x2a90('0x3b')],function(_0xf121f1){var _0x31e36d={};_0x31e36d[_0xf121f1]={'$like':'%'+_0x54d75b[_0x2a90('0x38')]['filter']+'%'};return _0x31e36d;})});}_0x4eabcf=_[_0x2a90('0x41')]({},_0x4eabcf,_0x54d75b['options']);return _0x316cfd['getMembers'](_0x4eabcf);}})[_0x2a90('0x25')](function(_0x492f1e){if(_0x492f1e){_0x5004be=_0x492f1e['length'];if(!_0x54d75b[_0x2a90('0x38')]['hasOwnProperty'](_0x2a90('0x3c'))){_0x4eabcf[_0x2a90('0x1e')]=qs['limit'](_0x54d75b[_0x2a90('0x38')][_0x2a90('0x1e')]);_0x4eabcf['offset']=qs['offset'](_0x54d75b[_0x2a90('0x38')][_0x2a90('0x1d')]);}return _0x316cfd['getMembers'](_0x4eabcf);}})[_0x2a90('0x25')](function(_0x2b4bd1){return _0x2b4bd1?{'count':_0x5004be,'rows':_0x2b4bd1}:null;})[_0x2a90('0x25')](respondWithResult(_0x262a07,null))[_0x2a90('0x48')](handleError(_0x262a07,null));};exports[_0x2a90('0x96')]=function(_0x3cc791,_0xfd1836,_0x2a30ec){var _0x3626e0={};var _0x567f33={};var _0xd9b809;var _0x59c687;return db['VoiceQueue']['findOne']({'where':{'id':_0x3cc791['params']['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0xfd1836,null))[_0x2a90('0x25')](function(_0x423887){if(_0x423887){_0xd9b809=_0x423887;_0x567f33[_0x2a90('0x37')]=_[_0x2a90('0x4b')](db[_0x2a90('0x97')]['rawAttributes']);_0x567f33['query']=_[_0x2a90('0x4b')](_0x3cc791[_0x2a90('0x38')]);_0x567f33[_0x2a90('0x39')]=_[_0x2a90('0x3a')](_0x567f33[_0x2a90('0x37')],_0x567f33['query']);_0x3626e0[_0x2a90('0x3b')]=_[_0x2a90('0x3a')](_0x567f33[_0x2a90('0x37')],qs[_0x2a90('0x4c')](_0x3cc791[_0x2a90('0x38')][_0x2a90('0x4c')]));_0x3626e0['attributes']=_0x3626e0['attributes'][_0x2a90('0x4d')]?_0x3626e0[_0x2a90('0x3b')]:_0x567f33['model'];_0x3626e0[_0x2a90('0x3d')]=qs[_0x2a90('0x3e')](_0x3cc791[_0x2a90('0x38')][_0x2a90('0x3e')]);_0x3626e0[_0x2a90('0x3f')]=qs['filters'](_[_0x2a90('0x40')](_0x3cc791[_0x2a90('0x38')],_0x567f33[_0x2a90('0x39')]));if(_0x3cc791[_0x2a90('0x38')]['filter']){_0x3626e0[_0x2a90('0x3f')]=_['merge'](_0x3626e0['where'],{'$or':_[_0x2a90('0x2c')](_0x3626e0[_0x2a90('0x3b')],function(_0x643b0f){var _0x1c1217={};_0x1c1217[_0x643b0f]={'$like':'%'+_0x3cc791[_0x2a90('0x38')][_0x2a90('0x2a')]+'%'};return _0x1c1217;})});}_0x3626e0=_[_0x2a90('0x41')]({},_0x3626e0,_0x3cc791['options']);return _0xd9b809[_0x2a90('0x96')](_0x3626e0);}})['then'](function(_0x1b4b6){if(_0x1b4b6){_0x59c687=_0x1b4b6[_0x2a90('0x4d')];if(!_0x3cc791[_0x2a90('0x38')][_0x2a90('0x60')]('nolimit')){_0x3626e0[_0x2a90('0x1e')]=qs[_0x2a90('0x1e')](_0x3cc791[_0x2a90('0x38')][_0x2a90('0x1e')]);_0x3626e0[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x3cc791[_0x2a90('0x38')][_0x2a90('0x1d')]);}return _0xd9b809[_0x2a90('0x96')](_0x3626e0);}})[_0x2a90('0x25')](function(_0x4ddad3){if(_0x4ddad3){return _0x4ddad3?{'count':_0x59c687,'rows':_0x4ddad3}:null;}})[_0x2a90('0x25')](respondWithResult(_0xfd1836,null))[_0x2a90('0x48')](handleError(_0xfd1836,null));};exports[_0x2a90('0x98')]=function(_0x2d0fa7,_0x22cfc,_0x4061ff){var _0x2f0fa0,_0x26ba4c;return db[_0x2a90('0x33')]['find']({'where':{'id':_0x2d0fa7[_0x2a90('0x4a')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x22cfc,null))['then'](function(_0x184b09){if(_0x184b09){_0x26ba4c=_0x184b09;return _0x184b09[_0x2a90('0x98')](_0x2d0fa7[_0x2a90('0x4f')][_0x2a90('0x7e')],_['omit'](_0x2d0fa7[_0x2a90('0x4f')],[_0x2a90('0x7e'),'id'])||{});}return null;})['spread'](function(_0x4a477e){var _0x5c4694;_0x2f0fa0=_0x4a477e||[];var _0x4cc134=[];if(_0x4a477e){for(var _0x169416=0x0;_0x169416<_0x4a477e[_0x2a90('0x4d')];_0x169416+=0x1){var _0x58d288=_0x4a477e[_0x169416][_0x2a90('0x26')]({'plain':!![]});_0x26ba4c['dialCheckDuplicateType']=_0x2d0fa7[_0x2a90('0x4f')][_0x2a90('0x99')]?_0x2d0fa7[_0x2a90('0x4f')]['dialCheckDuplicateType']:_0x26ba4c[_0x2a90('0x99')];switch(_0x26ba4c['dialCheckDuplicateType']){case _0x2a90('0x9a'):_0x5c4694=squel[_0x2a90('0x9b')]()[_0x2a90('0x9c')](_0x2a90('0x9d'))[_0x2a90('0x9e')](['phone','scheduledAt',_0x2a90('0x9f'),_0x2a90('0xa0'),_0x2a90('0x61'),'createdAt',_0x2a90('0x59')],squel[_0x2a90('0x7f')]()[_0x2a90('0x80')](_0x2a90('0xa1'),_0x2a90('0xa1'))[_0x2a90('0x80')](_0x2a90('0xa2'),_0x2a90('0xa3'))[_0x2a90('0x80')]('id',_0x2a90('0x9f'))[_0x2a90('0x80')](_0x58d288[_0x2a90('0xa4')][_0x2a90('0x86')](),_0x2a90('0xa0'))[_0x2a90('0x80')](_0x2d0fa7[_0x2a90('0x4a')]['id'][_0x2a90('0x86')](),_0x2a90('0x61'))[_0x2a90('0x80')](_0x2a90('0xa2'),'createdAt')[_0x2a90('0x80')]('NOW()',_0x2a90('0x59'))[_0x2a90('0x82')](_0x2a90('0xa5'))[_0x2a90('0x3f')](_0x2a90('0xa6'))[_0x2a90('0x3f')](_0x2a90('0xa7'),_0x58d288[_0x2a90('0xa4')]['toString']())['where'](_0x2a90('0xa8'))[_0x2a90('0x3f')](_0x2a90('0xa9'),squel[_0x2a90('0x7f')]()[_0x2a90('0x80')]('COALESCE(calleridnum,\x27\x27)')[_0x2a90('0x82')](_0x2a90('0xaa'))['where']('VoiceQueueId\x20=\x20?',_0x2d0fa7[_0x2a90('0x4a')]['id']['toString']()))[_0x2a90('0x3f')]('phone\x20NOT\x20IN\x20(?)',squel['select']()['field'](_0x2a90('0xab'))[_0x2a90('0x82')](_0x2a90('0x9d'))[_0x2a90('0x3f')](_0x2a90('0xac'),_0x2d0fa7['params']['id'][_0x2a90('0x86')]())))[_0x2a90('0x86')]();break;case'onlyIfOpen':_0x5c4694=squel[_0x2a90('0x9b')]()['into'](_0x2a90('0x9d'))[_0x2a90('0x9e')]([_0x2a90('0xa1'),_0x2a90('0xa3'),'ContactId','ListId',_0x2a90('0x61'),'createdAt',_0x2a90('0x59')],squel[_0x2a90('0x7f')]()[_0x2a90('0x80')](_0x2a90('0xa1'),'phone')[_0x2a90('0x80')](_0x2a90('0xa2'),_0x2a90('0xa3'))[_0x2a90('0x80')]('id',_0x2a90('0x9f'))[_0x2a90('0x80')](_0x58d288[_0x2a90('0xa4')][_0x2a90('0x86')](),_0x2a90('0xa0'))[_0x2a90('0x80')](_0x2d0fa7['params']['id'][_0x2a90('0x86')](),_0x2a90('0x61'))[_0x2a90('0x80')](_0x2a90('0xa2'),_0x2a90('0x58'))['field'](_0x2a90('0xa2'),_0x2a90('0x59'))[_0x2a90('0x82')](_0x2a90('0xa5'))[_0x2a90('0x3f')](_0x2a90('0xa6'))['where'](_0x2a90('0xa7'),_0x58d288[_0x2a90('0xa4')][_0x2a90('0x86')]())[_0x2a90('0x3f')](_0x2a90('0xa8'))[_0x2a90('0x3f')](_0x2a90('0xa9'),squel[_0x2a90('0x7f')]()['field'](_0x2a90('0xab'))[_0x2a90('0x82')]('cm_hopper')[_0x2a90('0x3f')](_0x2a90('0xac'),_0x2d0fa7['params']['id']['toString']())))[_0x2a90('0x86')]();break;default:_0x5c4694=squel['insert']()['into']('cm_hopper')[_0x2a90('0x9e')]([_0x2a90('0xa1'),'scheduledAt','ContactId',_0x2a90('0xa0'),'VoiceQueueId',_0x2a90('0x58'),_0x2a90('0x59')],squel[_0x2a90('0x7f')]()['field']('phone',_0x2a90('0xa1'))[_0x2a90('0x80')](_0x2a90('0xa2'),_0x2a90('0xa3'))['field']('id',_0x2a90('0x9f'))[_0x2a90('0x80')](_0x58d288[_0x2a90('0xa4')][_0x2a90('0x86')](),'ListId')[_0x2a90('0x80')](_0x2d0fa7[_0x2a90('0x4a')]['id'][_0x2a90('0x86')](),_0x2a90('0x61'))[_0x2a90('0x80')]('NOW()','createdAt')[_0x2a90('0x80')](_0x2a90('0xa2'),_0x2a90('0x59'))[_0x2a90('0x82')](_0x2a90('0xa5'))[_0x2a90('0x3f')](_0x2a90('0xa6'))[_0x2a90('0x3f')](_0x2a90('0xa7'),_0x58d288[_0x2a90('0xa4')]['toString']())[_0x2a90('0x3f')](_0x2a90('0xa8')))[_0x2a90('0x86')]();}_0x4cc134['push'](db['sequelize']['query'](_0x5c4694));}return BPromise[_0x2a90('0x8a')](_0x4cc134);}})[_0x2a90('0x25')](function(){return _0x2f0fa0;})['then'](respondWithResult(_0x22cfc,null))[_0x2a90('0x48')](handleError(_0x22cfc,null));};exports[_0x2a90('0xad')]=function(_0xc8ec3b,_0x23550d,_0x5a626b){return db['VoiceQueue']['find']({'where':{'id':_0xc8ec3b[_0x2a90('0x4a')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x23550d,null))[_0x2a90('0x25')](function(_0x3dbefa){if(_0x3dbefa){return _0x3dbefa[_0x2a90('0xad')](_0xc8ec3b[_0x2a90('0x38')][_0x2a90('0x7e')]);}})[_0x2a90('0x25')](function(_0x54146d){if(_0x54146d){return db['CmHopper'][_0x2a90('0x24')]({'where':{'ListId':_0xc8ec3b[_0x2a90('0x38')]['ids'],'VoiceQueueId':_0xc8ec3b[_0x2a90('0x4a')]['id']}})['then'](function(){return _0x54146d;});}})[_0x2a90('0x25')](respondWithStatusCode(_0x23550d,null))[_0x2a90('0x48')](handleError(_0x23550d,null));};exports['getBlackLists']=function(_0xb20993,_0x24a06e,_0x18c12d){var _0x2f29ed={};var _0x4cc5cd={};var _0x427409;var _0x19976c;return db[_0x2a90('0x33')]['findOne']({'where':{'id':_0xb20993['params']['id']}})['then'](handleEntityNotFound(_0x24a06e,null))[_0x2a90('0x25')](function(_0x4af7f5){if(_0x4af7f5){_0x427409=_0x4af7f5;_0x4cc5cd['model']=_[_0x2a90('0x4b')](db[_0x2a90('0x97')][_0x2a90('0x34')]);_0x4cc5cd[_0x2a90('0x38')]=_['keys'](_0xb20993[_0x2a90('0x38')]);_0x4cc5cd[_0x2a90('0x39')]=_['intersection'](_0x4cc5cd[_0x2a90('0x37')],_0x4cc5cd[_0x2a90('0x38')]);_0x2f29ed[_0x2a90('0x3b')]=_[_0x2a90('0x3a')](_0x4cc5cd[_0x2a90('0x37')],qs[_0x2a90('0x4c')](_0xb20993[_0x2a90('0x38')][_0x2a90('0x4c')]));_0x2f29ed[_0x2a90('0x3b')]=_0x2f29ed[_0x2a90('0x3b')][_0x2a90('0x4d')]?_0x2f29ed[_0x2a90('0x3b')]:_0x4cc5cd[_0x2a90('0x37')];_0x2f29ed[_0x2a90('0x3d')]=qs['sort'](_0xb20993[_0x2a90('0x38')]['sort']);_0x2f29ed[_0x2a90('0x3f')]=qs['filters'](_[_0x2a90('0x40')](_0xb20993[_0x2a90('0x38')],_0x4cc5cd[_0x2a90('0x39')]));if(_0xb20993[_0x2a90('0x38')][_0x2a90('0x2a')]){_0x2f29ed[_0x2a90('0x3f')]=_['merge'](_0x2f29ed[_0x2a90('0x3f')],{'$or':_[_0x2a90('0x2c')](_0x2f29ed['attributes'],function(_0x1d8b7a){var _0x13f9ee={};_0x13f9ee[_0x1d8b7a]={'$like':'%'+_0xb20993['query']['filter']+'%'};return _0x13f9ee;})});}_0x2f29ed=_[_0x2a90('0x41')]({},_0x2f29ed,_0xb20993['options']);return _0x427409[_0x2a90('0xae')](_0x2f29ed);}})[_0x2a90('0x25')](function(_0x54a060){if(_0x54a060){_0x19976c=_0x54a060['length'];if(!_0xb20993[_0x2a90('0x38')][_0x2a90('0x60')]('nolimit')){_0x2f29ed[_0x2a90('0x1e')]=qs[_0x2a90('0x1e')](_0xb20993['query'][_0x2a90('0x1e')]);_0x2f29ed[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0xb20993[_0x2a90('0x38')]['offset']);}return _0x427409['getBlackLists'](_0x2f29ed);}})[_0x2a90('0x25')](function(_0x759ff5){if(_0x759ff5){return _0x759ff5?{'count':_0x19976c,'rows':_0x759ff5}:null;}})[_0x2a90('0x25')](respondWithResult(_0x24a06e,null))[_0x2a90('0x48')](handleError(_0x24a06e,null));};exports[_0x2a90('0xaf')]=function(_0x497cee,_0x20451f,_0x3cccb0){var _0x24624d,_0x5e9a30;return db[_0x2a90('0x33')][_0x2a90('0x52')]({'where':{'id':_0x497cee[_0x2a90('0x4a')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x20451f,null))[_0x2a90('0x25')](function(_0x437558){if(_0x437558){_0x5e9a30=_0x437558;return _0x437558['addBlackLists'](_0x497cee[_0x2a90('0x4f')][_0x2a90('0x7e')],_['omit'](_0x497cee[_0x2a90('0x4f')],[_0x2a90('0x7e'),'id'])||{});}return null;})[_0x2a90('0x8f')](function(_0x5c5ef3){var _0x572734;_0x24624d=_0x5c5ef3||[];var _0x44abf5=[];if(_0x5c5ef3){for(var _0x20c95c=0x0;_0x20c95c<_0x5c5ef3[_0x2a90('0x4d')];_0x20c95c+=0x1){var _0x5d2fbc=_0x5c5ef3[_0x20c95c][_0x2a90('0x26')]({'plain':!![]});_0x572734=squel[_0x2a90('0x9b')]()[_0x2a90('0x9c')]('cm_hopper_black')[_0x2a90('0x9e')]([_0x2a90('0xa1'),'ContactId',_0x2a90('0xa0'),'VoiceQueueId','createdAt',_0x2a90('0x59')],squel[_0x2a90('0x7f')]()[_0x2a90('0x80')]('phone',_0x2a90('0xa1'))[_0x2a90('0x80')]('id',_0x2a90('0x9f'))[_0x2a90('0x80')](_0x5d2fbc[_0x2a90('0xa4')][_0x2a90('0x86')](),_0x2a90('0xa0'))['field'](_0x497cee['params']['id']['toString'](),_0x2a90('0x61'))['field'](_0x2a90('0xa2'),'createdAt')[_0x2a90('0x80')]('NOW()',_0x2a90('0x59'))[_0x2a90('0x82')](_0x2a90('0xa5'))[_0x2a90('0x3f')]('deletedAt\x20IS\x20NULL')['where'](_0x2a90('0xa7'),_0x5d2fbc[_0x2a90('0xa4')][_0x2a90('0x86')]())[_0x2a90('0x3f')]('phone\x20IS\x20NOT\x20NULL'))[_0x2a90('0x86')]();_0x44abf5[_0x2a90('0x91')](db[_0x2a90('0x87')][_0x2a90('0x38')](_0x572734));}return BPromise[_0x2a90('0x8a')](_0x44abf5);}})['then'](function(){return _0x24624d;})[_0x2a90('0x25')](respondWithResult(_0x20451f,null))[_0x2a90('0x48')](handleError(_0x20451f,null));};exports[_0x2a90('0xb0')]=function(_0x1d4647,_0x3bc679,_0x8cc4fa){return db[_0x2a90('0x33')][_0x2a90('0x52')]({'where':{'id':_0x1d4647['params']['id']}})['then'](handleEntityNotFound(_0x3bc679,null))[_0x2a90('0x25')](function(_0x5175b4){if(_0x5175b4){return _0x5175b4[_0x2a90('0xb0')](_0x1d4647[_0x2a90('0x38')][_0x2a90('0x7e')]);}})[_0x2a90('0x25')](function(_0x38f01f){if(_0x38f01f){return db['CmHopperBlack'][_0x2a90('0x24')]({'where':{'ListId':_0x1d4647[_0x2a90('0x38')][_0x2a90('0x7e')],'VoiceQueueId':_0x1d4647['params']['id']}})[_0x2a90('0x25')](function(){return _0x38f01f;});}})[_0x2a90('0x25')](respondWithStatusCode(_0x3bc679,null))[_0x2a90('0x48')](handleError(_0x3bc679,null));};
\ No newline at end of file
+var _0x8f6b=['nolimit','order','sort','where','pick','filters','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','QueueCampaigns','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','omit','createdAt','create','user','getHoppers','findOne','CmHopper','VoiceQueueId','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','flatMap','Agents','penalty','sequelize','transaction','each','TeamVoiceQueue','upsert','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','interface','format','SIP/%s','voicePause','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','all','union','isEmpty','userVoiceQueue:remove','addAgents','ids','spread','push','removeAgents','isArray','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','always','insert','fromQuery','phone','scheduledAt','ContactId','ListId','updatedAt','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper','onlyIfOpen','into','COALESCE(phone,\x27\x27)','CmHopperId','OrderBy','h.id','ci.item','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','register','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','VoiceQueues','inbound','outbound','filter','ignore','map','includes','value','type','name','UserProfileResource','sendStatus','stack','index','VoiceQueue','key','keys','query','model','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x3a245d,_0x21d769){var _0x4867f2=function(_0x1dd270){while(--_0x1dd270){_0x3a245d['push'](_0x3a245d['shift']());}};_0x4867f2(++_0x21d769);}(_0x8f6b,0x146));var _0xb8f6=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0x8f6b[_0x5447fd];return _0x15b28a;};'use strict';var emlformat=require(_0xb8f6('0x0'));var rimraf=require(_0xb8f6('0x1'));var zipdir=require(_0xb8f6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8f6('0x3'));var moment=require(_0xb8f6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb8f6('0x5'));var util=require(_0xb8f6('0x6'));var path=require('path');var sox=require(_0xb8f6('0x7'));var csv=require('to-csv');var ejs=require(_0xb8f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb8f6('0x9'));var squel=require('squel');var crypto=require(_0xb8f6('0xa'));var jsforce=require(_0xb8f6('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb8f6('0xc'));var Papa=require(_0xb8f6('0xd'));var Redis=require(_0xb8f6('0xe'));var authService=require(_0xb8f6('0xf'));var qs=require(_0xb8f6('0x10'));var as=require(_0xb8f6('0x11'));var hardwareService=require(_0xb8f6('0x12'));var logger=require(_0xb8f6('0x13'))(_0xb8f6('0x14'));var utils=require(_0xb8f6('0x15'));var config=require(_0xb8f6('0x16'));var licenseUtil=require(_0xb8f6('0x17'));var db=require('../../mysqldb')['db'];config[_0xb8f6('0x18')]=_[_0xb8f6('0x19')](config['redis'],{'host':_0xb8f6('0x1a'),'port':0x18eb});var socket=require(_0xb8f6('0x1b'))(new Redis(config[_0xb8f6('0x18')]));require('./voiceQueue.socket')[_0xb8f6('0x1c')](socket);function respondWithStatusCode(_0x50d3a1,_0x237dc3){_0x237dc3=_0x237dc3||0xcc;return function(_0x2aee53){if(_0x2aee53){return _0x50d3a1['sendStatus'](_0x237dc3);}return _0x50d3a1['status'](_0x237dc3)[_0xb8f6('0x1d')]();};}function respondWithResult(_0x28c214,_0x2db63b){_0x2db63b=_0x2db63b||0xc8;return function(_0x8f42ec){if(_0x8f42ec){return _0x28c214[_0xb8f6('0x1e')](_0x2db63b)[_0xb8f6('0x1f')](_0x8f42ec);}};}function respondWithFilteredResult(_0x2e998b,_0x30c2b3){return function(_0x3592a5){if(_0x3592a5){var _0x537d5e=typeof _0x30c2b3['offset']===_0xb8f6('0x20')&&typeof _0x30c2b3[_0xb8f6('0x21')]===_0xb8f6('0x20');var _0x335e9c=_0x3592a5[_0xb8f6('0x22')];var _0x5c2506=_0x537d5e?0x0:_0x30c2b3[_0xb8f6('0x23')];var _0x13f964=_0x537d5e?_0x3592a5[_0xb8f6('0x22')]:_0x30c2b3[_0xb8f6('0x23')]+_0x30c2b3['limit'];var _0x38c93e;if(_0x13f964>=_0x335e9c){_0x13f964=_0x335e9c;_0x38c93e=0xc8;}else{_0x38c93e=0xce;}_0x2e998b[_0xb8f6('0x1e')](_0x38c93e);return _0x2e998b[_0xb8f6('0x24')](_0xb8f6('0x25'),_0x5c2506+'-'+_0x13f964+'/'+_0x335e9c)[_0xb8f6('0x1f')](_0x3592a5);}return null;};}function patchUpdates(_0x59c5f1){return function(_0x3805d7){try{jsonpatch[_0xb8f6('0x26')](_0x3805d7,_0x59c5f1,!![]);}catch(_0x4e62c0){return BPromise[_0xb8f6('0x27')](_0x4e62c0);}return _0x3805d7[_0xb8f6('0x28')]();};}function saveUpdates(_0x3a4fd2,_0x15e0cb){return function(_0x4ca430){if(_0x4ca430){return _0x4ca430[_0xb8f6('0x29')](_0x3a4fd2)[_0xb8f6('0x2a')](function(_0x4fea2e){return _0x4fea2e;});}return null;};}function removeEntity(_0x3e9b2b,_0x4ee750){return function(_0x126f78){if(_0x126f78){return _0x126f78[_0xb8f6('0x2b')]()[_0xb8f6('0x2a')](function(){var _0x1b0f80=_0x126f78['get']({'plain':!![]});var _0x36ad7a=[{'name':_0xb8f6('0x2c'),'value':_0xb8f6('0x2d'),'ignore':![]},{'name':'QueueCampaigns','value':_0xb8f6('0x2e'),'ignore':![]}];var _0x2c0600=_(_0x36ad7a)[_0xb8f6('0x2f')](_0xb8f6('0x30'))[_0xb8f6('0x31')]('value')['value']();if(_[_0xb8f6('0x32')](_0x2c0600,_0x1b0f80['type'])){return;}var _0x2f98ff=_['find'](_0x36ad7a,[_0xb8f6('0x33'),_0x1b0f80[_0xb8f6('0x34')]])[_0xb8f6('0x35')];return db[_0xb8f6('0x36')][_0xb8f6('0x2b')]({'where':{'type':_0x2f98ff,'resourceId':_0x1b0f80['id']}})[_0xb8f6('0x2a')](function(){return _0x126f78;});})[_0xb8f6('0x2a')](function(){_0x3e9b2b[_0xb8f6('0x1e')](0xcc)[_0xb8f6('0x1d')]();});}};}function handleEntityNotFound(_0x5b509a,_0x23def4){return function(_0x1173cb){if(!_0x1173cb){_0x5b509a[_0xb8f6('0x37')](0x194);}return _0x1173cb;};}function handleError(_0xcb1a51,_0x4c5c52){_0x4c5c52=_0x4c5c52||0x1f4;return function(_0x3bfc5a){logger['error'](_0x3bfc5a[_0xb8f6('0x38')]);if(_0x3bfc5a[_0xb8f6('0x35')]){delete _0x3bfc5a[_0xb8f6('0x35')];}_0xcb1a51[_0xb8f6('0x1e')](_0x4c5c52)['send'](_0x3bfc5a);};}exports[_0xb8f6('0x39')]=function(_0x4b5f65,_0x3b268b){var _0x546081={},_0x238778={},_0x5e9c8f={'count':0x0,'rows':[]};var _0x2bf4d2=_[_0xb8f6('0x31')](db[_0xb8f6('0x3a')]['rawAttributes'],function(_0x2ba31c){return{'name':_0x2ba31c['fieldName'],'type':_0x2ba31c[_0xb8f6('0x34')][_0xb8f6('0x3b')]};});_0x238778['model']=_[_0xb8f6('0x31')](_0x2bf4d2,_0xb8f6('0x35'));_0x238778['query']=_[_0xb8f6('0x3c')](_0x4b5f65[_0xb8f6('0x3d')]);_0x238778['filters']=_['intersection'](_0x238778[_0xb8f6('0x3e')],_0x238778[_0xb8f6('0x3d')]);_0x546081[_0xb8f6('0x3f')]=_[_0xb8f6('0x40')](_0x238778[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x4b5f65['query'][_0xb8f6('0x41')]));_0x546081[_0xb8f6('0x3f')]=_0x546081[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x546081[_0xb8f6('0x3f')]:_0x238778[_0xb8f6('0x3e')];if(!_0x4b5f65['query'][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x546081['limit']=qs[_0xb8f6('0x21')](_0x4b5f65[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0x546081[_0xb8f6('0x23')]=qs[_0xb8f6('0x23')](_0x4b5f65['query']['offset']);}_0x546081[_0xb8f6('0x45')]=qs['sort'](_0x4b5f65[_0xb8f6('0x3d')][_0xb8f6('0x46')]);_0x546081[_0xb8f6('0x47')]=qs['filters'](_[_0xb8f6('0x48')](_0x4b5f65[_0xb8f6('0x3d')],_0x238778[_0xb8f6('0x49')]),_0x2bf4d2);if(_0x4b5f65[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x546081[_0xb8f6('0x47')]=_['merge'](_0x546081[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x2bf4d2,function(_0x7fad7c){if(_0x7fad7c[_0xb8f6('0x34')]!==_0xb8f6('0x4a')){var _0x1a1650={};_0x1a1650[_0x7fad7c[_0xb8f6('0x35')]]={'$like':'%'+_0x4b5f65['query'][_0xb8f6('0x2f')]+'%'};return _0x1a1650;}})});}_0x546081=_[_0xb8f6('0x4b')]({},_0x546081,_0x4b5f65[_0xb8f6('0x4c')]);var _0x2d148f={'where':_0x546081[_0xb8f6('0x47')]};return db[_0xb8f6('0x3a')][_0xb8f6('0x22')](_0x2d148f)['then'](function(_0x5c1a54){_0x5e9c8f[_0xb8f6('0x22')]=_0x5c1a54;if(_0x4b5f65[_0xb8f6('0x3d')][_0xb8f6('0x4d')]){_0x546081[_0xb8f6('0x4e')]=[{'all':!![]}];}return db[_0xb8f6('0x3a')]['findAll'](_0x546081);})[_0xb8f6('0x2a')](function(_0x47e77c){_0x5e9c8f[_0xb8f6('0x4f')]=_0x47e77c;return _0x5e9c8f;})[_0xb8f6('0x2a')](respondWithFilteredResult(_0x3b268b,_0x546081))[_0xb8f6('0x50')](handleError(_0x3b268b,null));};exports[_0xb8f6('0x51')]=function(_0x331539,_0x2191ae){var _0x5702f4={'raw':![],'where':{'id':_0x331539[_0xb8f6('0x52')]['id']}},_0x47723a={};_0x47723a['model']=_[_0xb8f6('0x3c')](db['VoiceQueue']['rawAttributes']);_0x47723a['query']=_[_0xb8f6('0x3c')](_0x331539[_0xb8f6('0x3d')]);_0x47723a[_0xb8f6('0x49')]=_[_0xb8f6('0x40')](_0x47723a['model'],_0x47723a[_0xb8f6('0x3d')]);_0x5702f4[_0xb8f6('0x3f')]=_[_0xb8f6('0x40')](_0x47723a[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x331539[_0xb8f6('0x3d')][_0xb8f6('0x41')]));_0x5702f4['attributes']=_0x5702f4['attributes'][_0xb8f6('0x42')]?_0x5702f4[_0xb8f6('0x3f')]:_0x47723a[_0xb8f6('0x3e')];if(_0x331539[_0xb8f6('0x3d')][_0xb8f6('0x4d')]){_0x5702f4[_0xb8f6('0x4e')]=[{'all':!![]}];}_0x5702f4=_[_0xb8f6('0x4b')]({},_0x5702f4,_0x331539[_0xb8f6('0x4c')]);return db[_0xb8f6('0x3a')][_0xb8f6('0x53')](_0x5702f4)[_0xb8f6('0x2a')](handleEntityNotFound(_0x2191ae,null))['then'](respondWithResult(_0x2191ae,null))[_0xb8f6('0x50')](handleError(_0x2191ae,null));};exports['create']=function(_0x17b711,_0x5a5180){return db[_0xb8f6('0x3a')]['create'](_0x17b711[_0xb8f6('0x54')],{})['then'](function(_0x50bb2f){var _0x22ea73=_0x17b711['user']['get']({'plain':!![]});if(!_0x22ea73)throw new Error(_0xb8f6('0x55'));if(_0x22ea73[_0xb8f6('0x56')]==='user'){var _0x9440c8=_0x50bb2f[_0xb8f6('0x57')]({'plain':!![]});var _0x1a2328=[{'name':_0xb8f6('0x2c'),'value':_0xb8f6('0x2d')},{'name':_0xb8f6('0x58'),'value':'outbound'}];var _0x242c89=_['find'](_0x1a2328,[_0xb8f6('0x33'),_0x9440c8[_0xb8f6('0x34')]])[_0xb8f6('0x35')];return db['UserProfileSection']['find']({'where':{'name':_0x242c89,'userProfileId':_0x22ea73[_0xb8f6('0x59')]},'raw':!![]})[_0xb8f6('0x2a')](function(_0x5b397d){if(_0x5b397d&&_0x5b397d[_0xb8f6('0x5a')]===0x0){return db['UserProfileResource']['create']({'name':_0x9440c8['name'],'resourceId':_0x9440c8['id'],'type':_0x5b397d[_0xb8f6('0x35')],'sectionId':_0x5b397d['id']},{})[_0xb8f6('0x2a')](function(){return _0x50bb2f;});}else{return _0x50bb2f;}})['catch'](function(_0x362858){logger[_0xb8f6('0x5b')](_0xb8f6('0x5c'),_0x362858);throw _0x362858;});}return _0x50bb2f;})[_0xb8f6('0x2a')](respondWithResult(_0x5a5180,0xc9))[_0xb8f6('0x50')](handleError(_0x5a5180,null));};exports[_0xb8f6('0x5d')]=function(_0x26ceb6,_0x2463ed){var _0x12b485={'where':{'id':_0x26ceb6[_0xb8f6('0x52')]['id']}},_0x401e9f={};_0x401e9f[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x3a')][_0xb8f6('0x5e')]);_0x12b485[_0xb8f6('0x3f')]=_[_0xb8f6('0x40')](_0x401e9f[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x26ceb6[_0xb8f6('0x3d')]['fields']));_0x12b485[_0xb8f6('0x3f')]=_0x12b485['attributes'][_0xb8f6('0x42')]?_0x12b485[_0xb8f6('0x3f')]:_0x401e9f[_0xb8f6('0x3e')];if(_0x26ceb6[_0xb8f6('0x3d')][_0xb8f6('0x4d')]){_0x12b485[_0xb8f6('0x4e')]=[{'all':!![]}];}_0x12b485=_[_0xb8f6('0x4b')]({},_0x12b485,_0x26ceb6[_0xb8f6('0x4c')]);return db['VoiceQueue'][_0xb8f6('0x53')](_0x12b485)[_0xb8f6('0x2a')](handleEntityNotFound(_0x2463ed,null))[_0xb8f6('0x2a')](function(_0x1a1910){if(_0x1a1910){var _0x3587eb=_0x1a1910[_0xb8f6('0x57')]({'plain':!![]});_0x3587eb=qs[_0xb8f6('0x5f')](_0x3587eb,['id',_0xb8f6('0x60'),'updatedAt']);_0x26ceb6[_0xb8f6('0x54')]=_[_0xb8f6('0x5f')](_0x26ceb6[_0xb8f6('0x54')],['id',_0xb8f6('0x60'),'updatedAt']);return db[_0xb8f6('0x3a')][_0xb8f6('0x61')](_[_0xb8f6('0x4b')](_0x3587eb,_0x26ceb6[_0xb8f6('0x54')]),{'include':_0x26ceb6[_0xb8f6('0x3d')][_0xb8f6('0x4d')]?[{'all':!![]}]:undefined})[_0xb8f6('0x2a')](function(_0xce53f){var _0x2312d5=_0x26ceb6[_0xb8f6('0x62')][_0xb8f6('0x57')]({'plain':!![]});if(!_0x2312d5)throw new Error(_0xb8f6('0x55'));if(_0x2312d5[_0xb8f6('0x56')]==='user'){var _0x3dfa2d=_0xce53f['get']({'plain':!![]});var _0x3da374=[{'name':_0xb8f6('0x2c'),'value':_0xb8f6('0x2d')},{'name':'QueueCampaigns','value':_0xb8f6('0x2e')}];var _0x256df0=_[_0xb8f6('0x53')](_0x3da374,['value',_0x3dfa2d[_0xb8f6('0x34')]])['name'];return db['UserProfileSection'][_0xb8f6('0x53')]({'where':{'name':_0x256df0,'userProfileId':_0x2312d5[_0xb8f6('0x59')]},'raw':!![]})[_0xb8f6('0x2a')](function(_0x5556d5){if(_0x5556d5&&_0x5556d5[_0xb8f6('0x5a')]===0x0){return db[_0xb8f6('0x36')][_0xb8f6('0x61')]({'name':_0x3dfa2d[_0xb8f6('0x35')],'resourceId':_0x3dfa2d['id'],'type':_0x5556d5['name'],'sectionId':_0x5556d5['id']},{})['then'](function(){return _0xce53f;});}else{return _0xce53f;}})['catch'](function(_0x37873f){logger[_0xb8f6('0x5b')](_0xb8f6('0x5c'),_0x37873f);throw _0x37873f;});}return _0xce53f;});}})[_0xb8f6('0x2a')](respondWithResult(_0x2463ed,0xc9))[_0xb8f6('0x50')](handleError(_0x2463ed,null));};exports['update']=function(_0x34baf2,_0xf170e3){if(_0x34baf2[_0xb8f6('0x54')]['id']){delete _0x34baf2[_0xb8f6('0x54')]['id'];}return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x34baf2[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0xf170e3,null))[_0xb8f6('0x2a')](saveUpdates(_0x34baf2[_0xb8f6('0x54')],null))[_0xb8f6('0x2a')](respondWithResult(_0xf170e3,null))['catch'](handleError(_0xf170e3,null));};exports[_0xb8f6('0x2b')]=function(_0x55b72e,_0x5b547a){return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x55b72e[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x5b547a,null))['then'](removeEntity(_0x5b547a,null))[_0xb8f6('0x50')](handleError(_0x5b547a,null));};exports[_0xb8f6('0x63')]=function(_0x442b9d,_0x18967c,_0x3f04b2){var _0x454ca0={'raw':![],'where':{}};var _0x4684fb={};var _0x33f846={'count':0x0,'rows':[]};return db[_0xb8f6('0x3a')][_0xb8f6('0x64')]({'where':{'id':_0x442b9d['params']['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x18967c,null))[_0xb8f6('0x2a')](function(_0x3ae9c4){if(_0x3ae9c4){_0x4684fb[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x65')][_0xb8f6('0x5e')]);_0x4684fb[_0xb8f6('0x3d')]=_[_0xb8f6('0x3c')](_0x442b9d[_0xb8f6('0x3d')]);_0x4684fb[_0xb8f6('0x49')]=_[_0xb8f6('0x40')](_0x4684fb[_0xb8f6('0x3e')],_0x4684fb['query']);_0x454ca0[_0xb8f6('0x3f')]=_['intersection'](_0x4684fb[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x41')]));_0x454ca0[_0xb8f6('0x3f')]=_0x454ca0['attributes'][_0xb8f6('0x42')]?_0x454ca0[_0xb8f6('0x3f')]:_0x4684fb[_0xb8f6('0x3e')];if(!_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x454ca0[_0xb8f6('0x21')]=qs['limit'](_0x442b9d[_0xb8f6('0x3d')]['limit']);_0x454ca0['offset']=qs[_0xb8f6('0x23')](_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x23')]);}_0x454ca0[_0xb8f6('0x45')]=qs['sort'](_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x46')]);_0x454ca0['where']=qs['filters'](_[_0xb8f6('0x48')](_0x442b9d[_0xb8f6('0x3d')],_0x4684fb['filters']));_0x454ca0[_0xb8f6('0x47')][_0xb8f6('0x66')]=_0x3ae9c4['id'];if(_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x454ca0[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x454ca0[_0xb8f6('0x47')],{'$or':_['map'](_0x454ca0[_0xb8f6('0x3f')],function(_0x567190){var _0x42180c={};_0x42180c[_0x567190]={'$like':'%'+_0x442b9d[_0xb8f6('0x3d')][_0xb8f6('0x2f')]+'%'};return _0x42180c;})});}_0x454ca0=_['merge']({},_0x454ca0,_0x442b9d[_0xb8f6('0x4c')]);return db[_0xb8f6('0x65')][_0xb8f6('0x22')]({'where':_0x454ca0[_0xb8f6('0x47')]})[_0xb8f6('0x2a')](function(_0x28998e){_0x33f846['count']=_0x28998e;if(_0x442b9d['query']['includeAll']){_0x454ca0[_0xb8f6('0x4e')]=[{'all':!![]}];}return db[_0xb8f6('0x65')][_0xb8f6('0x67')](_0x454ca0);})[_0xb8f6('0x2a')](function(_0x5926c2){_0x33f846[_0xb8f6('0x4f')]=_0x5926c2;return _0x33f846;});}})[_0xb8f6('0x2a')](respondWithFilteredResult(_0x18967c,_0x454ca0))['catch'](handleError(_0x18967c,null));};exports['getHopperHistories']=function(_0x41bf59,_0x2c8055,_0x37e28c){var _0x164219={'raw':!![],'where':{}};var _0x435e8e={};var _0x4ad371={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x41bf59['params']['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x2c8055,null))[_0xb8f6('0x2a')](function(_0x583afa){if(_0x583afa){_0x435e8e[_0xb8f6('0x3e')]=_['keys'](db['CmHopperHistory'][_0xb8f6('0x5e')]);_0x435e8e['query']=_[_0xb8f6('0x3c')](_0x41bf59['query']);_0x435e8e[_0xb8f6('0x49')]=_[_0xb8f6('0x40')](_0x435e8e[_0xb8f6('0x3e')],_0x435e8e[_0xb8f6('0x3d')]);_0x164219[_0xb8f6('0x3f')]=_['intersection'](_0x435e8e[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x41bf59[_0xb8f6('0x3d')][_0xb8f6('0x41')]));_0x164219[_0xb8f6('0x3f')]=_0x164219[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x164219['attributes']:_0x435e8e[_0xb8f6('0x3e')];if(!_0x41bf59['query'][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x164219[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x41bf59['query'][_0xb8f6('0x21')]);_0x164219[_0xb8f6('0x23')]=qs[_0xb8f6('0x23')](_0x41bf59[_0xb8f6('0x3d')]['offset']);}_0x164219[_0xb8f6('0x45')]=qs[_0xb8f6('0x46')](_0x41bf59[_0xb8f6('0x3d')][_0xb8f6('0x46')]);_0x164219['where']=qs['filters'](_[_0xb8f6('0x48')](_0x41bf59[_0xb8f6('0x3d')],_0x435e8e[_0xb8f6('0x49')]));_0x164219[_0xb8f6('0x47')][_0xb8f6('0x66')]=_0x583afa['id'];if(_0x41bf59['query']['filter']){_0x164219[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x164219[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x164219['attributes'],function(_0x5347f5){var _0x27622d={};_0x27622d[_0x5347f5]={'$like':'%'+_0x41bf59[_0xb8f6('0x3d')][_0xb8f6('0x2f')]+'%'};return _0x27622d;})});}_0x164219=_[_0xb8f6('0x4b')]({},_0x164219,_0x41bf59[_0xb8f6('0x4c')]);return db[_0xb8f6('0x68')][_0xb8f6('0x22')]({'where':_0x164219[_0xb8f6('0x47')]})[_0xb8f6('0x2a')](function(_0x36ad59){_0x4ad371['count']=_0x36ad59;if(_0x41bf59[_0xb8f6('0x3d')][_0xb8f6('0x4d')]){_0x164219[_0xb8f6('0x4e')]=[{'all':!![]}];}return db[_0xb8f6('0x68')]['findAll'](_0x164219);})[_0xb8f6('0x2a')](function(_0x47ab85){_0x4ad371[_0xb8f6('0x4f')]=_0x47ab85;return _0x4ad371;});}})[_0xb8f6('0x2a')](respondWithFilteredResult(_0x2c8055,_0x164219))['catch'](handleError(_0x2c8055,null));};exports[_0xb8f6('0x69')]=function(_0x34b15c,_0x8cc47c,_0x343168){var _0x910baa={'raw':!![],'where':{}};var _0x25e482={};var _0x562671={'count':0x0,'rows':[]};return db[_0xb8f6('0x3a')]['findOne']({'where':{'id':_0x34b15c[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x8cc47c,null))[_0xb8f6('0x2a')](function(_0x2feb9c){if(_0x2feb9c){_0x25e482['model']=_['keys'](db[_0xb8f6('0x6a')][_0xb8f6('0x5e')]);_0x25e482['query']=_[_0xb8f6('0x3c')](_0x34b15c[_0xb8f6('0x3d')]);_0x25e482[_0xb8f6('0x49')]=_['intersection'](_0x25e482[_0xb8f6('0x3e')],_0x25e482[_0xb8f6('0x3d')]);_0x910baa['attributes']=_[_0xb8f6('0x40')](_0x25e482[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x34b15c[_0xb8f6('0x3d')]['fields']));_0x910baa['attributes']=_0x910baa[_0xb8f6('0x3f')]['length']?_0x910baa[_0xb8f6('0x3f')]:_0x25e482[_0xb8f6('0x3e')];if(!_0x34b15c[_0xb8f6('0x3d')][_0xb8f6('0x43')]('nolimit')){_0x910baa['limit']=qs[_0xb8f6('0x21')](_0x34b15c[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0x910baa[_0xb8f6('0x23')]=qs['offset'](_0x34b15c['query'][_0xb8f6('0x23')]);}_0x910baa[_0xb8f6('0x45')]=qs[_0xb8f6('0x46')](_0x34b15c['query'][_0xb8f6('0x46')]);_0x910baa[_0xb8f6('0x47')]=qs[_0xb8f6('0x49')](_['pick'](_0x34b15c[_0xb8f6('0x3d')],_0x25e482[_0xb8f6('0x49')]));_0x910baa[_0xb8f6('0x47')]['VoiceQueueId']=_0x2feb9c['id'];if(_0x34b15c[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x910baa[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x910baa[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x910baa[_0xb8f6('0x3f')],function(_0x280031){var _0x17aca4={};_0x17aca4[_0x280031]={'$like':'%'+_0x34b15c[_0xb8f6('0x3d')][_0xb8f6('0x2f')]+'%'};return _0x17aca4;})});}_0x910baa=_[_0xb8f6('0x4b')]({},_0x910baa,_0x34b15c[_0xb8f6('0x4c')]);return db[_0xb8f6('0x6a')][_0xb8f6('0x22')]({'where':_0x910baa[_0xb8f6('0x47')]})[_0xb8f6('0x2a')](function(_0x3c2134){_0x562671['count']=_0x3c2134;if(_0x34b15c[_0xb8f6('0x3d')]['includeAll']){_0x910baa[_0xb8f6('0x4e')]=[{'all':!![]}];}return db[_0xb8f6('0x6a')]['findAll'](_0x910baa);})['then'](function(_0x2773f2){_0x562671['rows']=_0x2773f2;return _0x562671;});}})[_0xb8f6('0x2a')](respondWithFilteredResult(_0x8cc47c,_0x910baa))['catch'](handleError(_0x8cc47c,null));};exports[_0xb8f6('0x6b')]=function(_0x240edd,_0x590b72,_0x4433ab){var _0x45addb={'raw':!![],'where':{}};var _0x175cc2={};var _0x380191={'count':0x0,'rows':[]};return db[_0xb8f6('0x3a')]['findOne']({'where':{'id':_0x240edd[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x590b72,null))[_0xb8f6('0x2a')](function(_0x230f75){if(_0x230f75){_0x175cc2[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x6c')][_0xb8f6('0x5e')]);_0x175cc2['query']=_['keys'](_0x240edd['query']);_0x175cc2[_0xb8f6('0x49')]=_['intersection'](_0x175cc2[_0xb8f6('0x3e')],_0x175cc2[_0xb8f6('0x3d')]);_0x45addb[_0xb8f6('0x3f')]=_[_0xb8f6('0x40')](_0x175cc2[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x240edd[_0xb8f6('0x3d')]['fields']));_0x45addb[_0xb8f6('0x3f')]=_0x45addb[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x45addb[_0xb8f6('0x3f')]:_0x175cc2[_0xb8f6('0x3e')];if(!_0x240edd[_0xb8f6('0x3d')][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x45addb[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x240edd[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0x45addb[_0xb8f6('0x23')]=qs[_0xb8f6('0x23')](_0x240edd[_0xb8f6('0x3d')]['offset']);}_0x45addb[_0xb8f6('0x45')]=qs[_0xb8f6('0x46')](_0x240edd['query'][_0xb8f6('0x46')]);_0x45addb[_0xb8f6('0x47')]=qs[_0xb8f6('0x49')](_[_0xb8f6('0x48')](_0x240edd['query'],_0x175cc2[_0xb8f6('0x49')]));_0x45addb[_0xb8f6('0x47')][_0xb8f6('0x66')]=_0x230f75['id'];if(_0x240edd['query']['filter']){_0x45addb[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x45addb[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x45addb['attributes'],function(_0x2a63ae){var _0xa4666f={};_0xa4666f[_0x2a63ae]={'$like':'%'+_0x240edd['query'][_0xb8f6('0x2f')]+'%'};return _0xa4666f;})});}_0x45addb=_['merge']({},_0x45addb,_0x240edd[_0xb8f6('0x4c')]);return db[_0xb8f6('0x6c')]['count']({'where':_0x45addb[_0xb8f6('0x47')]})['then'](function(_0x451740){_0x380191[_0xb8f6('0x22')]=_0x451740;if(_0x240edd[_0xb8f6('0x3d')]['includeAll']){_0x45addb[_0xb8f6('0x4e')]=[{'all':!![]}];}return db[_0xb8f6('0x6c')][_0xb8f6('0x67')](_0x45addb);})[_0xb8f6('0x2a')](function(_0x379f58){_0x380191[_0xb8f6('0x4f')]=_0x379f58;return _0x380191;});}})[_0xb8f6('0x2a')](respondWithFilteredResult(_0x590b72,_0x45addb))['catch'](handleError(_0x590b72,null));};exports[_0xb8f6('0x6d')]=function(_0x12b220,_0x49403d,_0x24a2ec){var _0xbab6b3={};var _0x18a0df={};var _0x2187c0;var _0x5677a6;return db[_0xb8f6('0x3a')][_0xb8f6('0x64')]({'where':{'id':_0x12b220['params']['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x49403d,null))[_0xb8f6('0x2a')](function(_0x4820ac){if(_0x4820ac){_0x2187c0=_0x4820ac;_0x18a0df[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x6e')][_0xb8f6('0x5e')]);_0x18a0df['query']=_[_0xb8f6('0x3c')](_0x12b220[_0xb8f6('0x3d')]);_0x18a0df[_0xb8f6('0x49')]=_[_0xb8f6('0x40')](_0x18a0df[_0xb8f6('0x3e')],_0x18a0df['query']);_0xbab6b3['attributes']=_[_0xb8f6('0x40')](_0x18a0df[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x12b220[_0xb8f6('0x3d')][_0xb8f6('0x41')]));_0xbab6b3['attributes']=_0xbab6b3[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0xbab6b3[_0xb8f6('0x3f')]:_0x18a0df[_0xb8f6('0x3e')];_0xbab6b3[_0xb8f6('0x45')]=qs['sort'](_0x12b220[_0xb8f6('0x3d')]['sort']);_0xbab6b3[_0xb8f6('0x47')]=qs[_0xb8f6('0x49')](_[_0xb8f6('0x48')](_0x12b220[_0xb8f6('0x3d')],_0x18a0df[_0xb8f6('0x49')]));if(_0x12b220['query'][_0xb8f6('0x2f')]){_0xbab6b3[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0xbab6b3[_0xb8f6('0x47')],{'$or':_['map'](_0xbab6b3[_0xb8f6('0x3f')],function(_0x566fea){var _0x5b402f={};_0x5b402f[_0x566fea]={'$like':'%'+_0x12b220['query'][_0xb8f6('0x2f')]+'%'};return _0x5b402f;})});}_0xbab6b3=_[_0xb8f6('0x4b')]({},_0xbab6b3,_0x12b220['options']);return _0x2187c0[_0xb8f6('0x6d')](_0xbab6b3);}})[_0xb8f6('0x2a')](function(_0x37109d){if(_0x37109d){_0x5677a6=_0x37109d['length'];if(!_0x12b220['query']['hasOwnProperty']('nolimit')){_0xbab6b3[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x12b220[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0xbab6b3[_0xb8f6('0x23')]=qs['offset'](_0x12b220[_0xb8f6('0x3d')]['offset']);}return _0x2187c0['getTeams'](_0xbab6b3);}})[_0xb8f6('0x2a')](function(_0xa80e81){if(_0xa80e81){return _0xa80e81?{'count':_0x5677a6,'rows':_0xa80e81}:null;}})[_0xb8f6('0x2a')](respondWithResult(_0x49403d,null))['catch'](handleError(_0x49403d,null));};exports[_0xb8f6('0x6f')]=function(_0x9c9558,_0x164f8a,_0x6e4170){var _0x3927e7=_0x9c9558[_0xb8f6('0x54')][_0xb8f6('0x70')];var _0x254e42=_[_0xb8f6('0x31')](_0x3927e7,'id');return db[_0xb8f6('0x6e')][_0xb8f6('0x67')]({'where':{'id':_0x254e42},'attributes':['id'],'include':[{'model':db[_0xb8f6('0x71')],'as':'Agents','attributes':['id',_0xb8f6('0x35'),_0xb8f6('0x72'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x41dfc0){if(_0x41dfc0){var _0x117c53=_[_0xb8f6('0x73')](_0x41dfc0,function(_0x4e1696){var _0x2e714b=_0x4e1696[_0xb8f6('0x57')]({'plain':!![]});_0x2e714b[_0xb8f6('0x74')]['forEach'](function(_0x1a3c91){_0x1a3c91[_0xb8f6('0x75')]=_[_0xb8f6('0x53')](_0x3927e7,{'id':_0x2e714b['id']})[_0xb8f6('0x75')];});return _0x2e714b[_0xb8f6('0x74')];});return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x9c9558[_0xb8f6('0x52')]['id']}})['then'](function(_0x1685fd){return db[_0xb8f6('0x76')][_0xb8f6('0x77')](function(_0x12f8a){return _0x1685fd[_0xb8f6('0x6f')](_0x254e42,{'transaction':_0x12f8a})['then'](function(){return BPromise[_0xb8f6('0x78')](_0x3927e7,function(_0x55b680){return db[_0xb8f6('0x79')][_0xb8f6('0x7a')]({'TeamId':_0x55b680['id'],'VoiceQueueId':_0x9c9558[_0xb8f6('0x52')]['id'],'penalty':_0x55b680['penalty']},{'transaction':_0x12f8a});});})[_0xb8f6('0x2a')](function(){return BPromise[_0xb8f6('0x78')](_0x117c53,function(_0x437491){return db[_0xb8f6('0x7b')][_0xb8f6('0x7c')]({'where':{'UserId':_0x437491['id'],'VoiceQueueId':_0x9c9558['params']['id']},'defaults':{'penalty':_0x437491[_0xb8f6('0x75')]},'transaction':_0x12f8a});});})['then'](function(){return BPromise[_0xb8f6('0x78')](_[_0xb8f6('0x2f')](_0x117c53,{'online':!![]}),function(_0x1ca744){return db[_0xb8f6('0x7d')][_0xb8f6('0x7a')]({'membername':_0x1ca744[_0xb8f6('0x35')],'UserId':_0x1ca744['id'],'queue_name':_0x1685fd[_0xb8f6('0x35')],'VoiceQueueId':_0x1685fd['id'],'interface':_[_0xb8f6('0x7e')](_0x1ca744[_0xb8f6('0x7f')])?util[_0xb8f6('0x80')](_0xb8f6('0x81'),_0x1ca744['name']):_0x1ca744[_0xb8f6('0x7f')],'paused':_0x1ca744[_0xb8f6('0x82')]||![],'penalty':_0x1ca744[_0xb8f6('0x75')]},{'transaction':_0x12f8a});});})[_0xb8f6('0x2a')](function(){_0x117c53['forEach'](function(_0x2ea673){socket[_0xb8f6('0x83')](_0xb8f6('0x84'),{'UserId':_0x2ea673['id'],'VoiceQueueId':_0x1685fd['id']});});});});});}})[_0xb8f6('0x2a')](respondWithStatusCode(_0x164f8a,null))[_0xb8f6('0x50')](handleError(_0x164f8a,null));};exports[_0xb8f6('0x85')]=function(_0x4c3e2a,_0x2f91cc,_0x5f1cb9){return db[_0xb8f6('0x6e')][_0xb8f6('0x67')]({'where':{'id':_0x4c3e2a[_0xb8f6('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0xb8f6('0x71')],'as':_0xb8f6('0x74'),'attributes':['id'],'raw':!![]}]})[_0xb8f6('0x2a')](handleEntityNotFound(_0x2f91cc,null))[_0xb8f6('0x2a')](function(_0x243b99){var _0x43111a=_[_0xb8f6('0x31')](_0x243b99,'id');var _0x2194c8=[];var _0x2dbbb2=[];var _0x2e585e=squel[_0xb8f6('0x86')]();_0x2e585e[_0xb8f6('0x87')](_0xb8f6('0x88'))[_0xb8f6('0x89')](_0xb8f6('0x8a'),'tq')[_0xb8f6('0x8b')](_0xb8f6('0x8c'),'ut',_0xb8f6('0x8d'))[_0xb8f6('0x47')](_0xb8f6('0x8e'),_0x4c3e2a[_0xb8f6('0x52')]['id']);for(var _0x272257=0x0;_0x272257<_0x243b99[_0xb8f6('0x42')];_0x272257+=0x1){let _0x4bdf28=_0x243b99[_0x272257];for(var _0x27bc7a=0x0;_0x27bc7a<_0x4bdf28[_0xb8f6('0x74')][_0xb8f6('0x42')];_0x27bc7a+=0x1){let _0x58f1c=_0x4bdf28[_0xb8f6('0x74')][_0x27bc7a];var _0x1260fe=_0x2e585e[_0xb8f6('0x5d')]();_0x1260fe['where'](_0xb8f6('0x8f'),_0x58f1c['id']);_0x2dbbb2['push'](db[_0xb8f6('0x76')][_0xb8f6('0x3d')](_0x1260fe['toString'](),{'type':db[_0xb8f6('0x76')][_0xb8f6('0x90')]['SELECT']})['then'](function(_0x24c879){if(_0x24c879[_0xb8f6('0x42')]===0x1){return _0x58f1c['id'];}else{var _0x4fbaa6=_[_0xb8f6('0x91')](_['map'](_0x24c879,_0xb8f6('0x92')),function(_0x4e8c0f){return _[_0xb8f6('0x32')](_0x43111a,_0x4e8c0f);});if(_0x4fbaa6){return _0x58f1c['id'];}}}));}}return BPromise[_0xb8f6('0x93')](_0x2dbbb2)['then'](function(_0x4164f5){_0x2194c8=_(_0x2194c8)[_0xb8f6('0x94')](_0x4164f5)['compact']()[_0xb8f6('0x33')]();return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x4c3e2a[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](function(_0x2ed3d7){return db['sequelize'][_0xb8f6('0x77')](function(_0xdc912f){return _0x2ed3d7[_0xb8f6('0x85')](_0x4c3e2a[_0xb8f6('0x3d')]['ids'],{'transaction':_0xdc912f})[_0xb8f6('0x2a')](function(){if(!_[_0xb8f6('0x95')](_0x2194c8)){return _0x2ed3d7['removeAgents'](_0x2194c8,{'transaction':_0xdc912f})[_0xb8f6('0x2a')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x4c3e2a['params']['id'],'UserId':_0x2194c8},'transaction':_0xdc912f});});}})[_0xb8f6('0x2a')](function(){_0x2194c8['forEach'](function(_0x4b5007){socket[_0xb8f6('0x83')](_0xb8f6('0x96'),{'UserId':_0x4b5007,'VoiceQueueId':_0x2ed3d7['id']});});});});});});})[_0xb8f6('0x2a')](respondWithStatusCode(_0x2f91cc,null))['catch'](handleError(_0x2f91cc,null));};exports[_0xb8f6('0x97')]=function(_0x2271d4,_0x49c3a6,_0x159c45){var _0x58330f,_0x568960;return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x2271d4[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x49c3a6,null))['then'](function(_0x5a7274){if(_0x5a7274){_0x568960=_0x5a7274;return _0x5a7274[_0xb8f6('0x97')](_0x2271d4[_0xb8f6('0x54')][_0xb8f6('0x98')],_[_0xb8f6('0x5f')](_0x2271d4[_0xb8f6('0x54')],[_0xb8f6('0x98'),'id'])||{})[_0xb8f6('0x99')](function(_0x2cc0f8){for(var _0x2f0270=0x0;_0x2f0270<_0x2271d4[_0xb8f6('0x54')]['ids'][_0xb8f6('0x42')];_0x2f0270+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x2271d4[_0xb8f6('0x54')][_0xb8f6('0x98')][_0x2f0270]),'VoiceQueueId':Number(_0x2271d4[_0xb8f6('0x52')]['id'])});}return _0x2cc0f8;});}})[_0xb8f6('0x2a')](function(_0x4c2b73){_0x58330f=_0x4c2b73||[];if(_0x568960){return db[_0xb8f6('0x71')]['findAll']({'where':{'id':_0x2271d4[_0xb8f6('0x54')]['ids']},'attributes':['id',_0xb8f6('0x35'),'online',_0xb8f6('0x82'),_0xb8f6('0x7f')],'raw':!![]});}})['then'](function(_0x30add6){if(!_[_0xb8f6('0x95')](_0x30add6)){var _0x10423b=[];for(var _0x365532=0x0;_0x365532<_0x30add6['length'];_0x365532++){if(_0x30add6[_0x365532][_0xb8f6('0x72')]){_0x10423b[_0xb8f6('0x9a')](db['UserVoiceQueueRt']['upsert']({'membername':_0x30add6[_0x365532]['name'],'UserId':_0x30add6[_0x365532]['id'],'queue_name':_0x568960[_0xb8f6('0x35')],'VoiceQueueId':_0x568960['id'],'interface':_[_0xb8f6('0x7e')](_0x30add6[_0x365532][_0xb8f6('0x7f')])?util[_0xb8f6('0x80')](_0xb8f6('0x81'),_0x30add6[_0x365532][_0xb8f6('0x35')]):_0x30add6[_0x365532][_0xb8f6('0x7f')],'paused':_0x30add6[_0x365532][_0xb8f6('0x82')]||![],'penalty':_0x2271d4[_0xb8f6('0x54')]['penalty']||0x0}));}}return BPromise[_0xb8f6('0x93')](_0x10423b);}})[_0xb8f6('0x2a')](function(){return _0x58330f;})['then'](respondWithResult(_0x49c3a6,null))['catch'](handleError(_0x49c3a6,null));};exports[_0xb8f6('0x9b')]=function(_0x3a234a,_0xa55633,_0x391b2e){return db['VoiceQueue'][_0xb8f6('0x53')]({'where':{'id':_0x3a234a[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0xa55633,null))[_0xb8f6('0x2a')](function(_0x49365a){if(_0x49365a){return _0x49365a[_0xb8f6('0x9b')](_0x3a234a[_0xb8f6('0x3d')][_0xb8f6('0x98')])[_0xb8f6('0x2a')](function(){if(_[_0xb8f6('0x9c')](_0x3a234a[_0xb8f6('0x3d')][_0xb8f6('0x98')])){for(var _0x801f2e=0x0;_0x801f2e<_0x3a234a[_0xb8f6('0x3d')][_0xb8f6('0x98')][_0xb8f6('0x42')];_0x801f2e+=0x1){socket[_0xb8f6('0x83')](_0xb8f6('0x96'),{'UserId':Number(_0x3a234a[_0xb8f6('0x3d')]['ids'][_0x801f2e]),'VoiceQueueId':Number(_0x3a234a[_0xb8f6('0x52')]['id'])});}}else{socket[_0xb8f6('0x83')](_0xb8f6('0x96'),{'UserId':Number(_0x3a234a['query']['ids']),'VoiceQueueId':Number(_0x3a234a[_0xb8f6('0x52')]['id'])});}});}})[_0xb8f6('0x2a')](function(_0xded28c){return db[_0xb8f6('0x7d')][_0xb8f6('0x2b')]({'where':{'VoiceQueueId':_0x3a234a[_0xb8f6('0x52')]['id'],'UserId':_0x3a234a[_0xb8f6('0x3d')]['ids']}})['then'](function(){return _0xded28c;});})[_0xb8f6('0x2a')](respondWithStatusCode(_0xa55633,null))[_0xb8f6('0x50')](handleError(_0xa55633,null));};exports['getAgents']=function(_0x302960,_0xf4e658,_0xc2d373){var _0x22dd7c={};var _0x2c0d95={};var _0x4c1e01;var _0x51d40e;return db[_0xb8f6('0x3a')][_0xb8f6('0x64')]({'where':{'id':_0x302960[_0xb8f6('0x52')]['id']}})['then'](handleEntityNotFound(_0xf4e658,null))[_0xb8f6('0x2a')](function(_0x3c8ed5){if(_0x3c8ed5){_0x4c1e01=_0x3c8ed5;_0x2c0d95[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x71')][_0xb8f6('0x5e')]);_0x2c0d95[_0xb8f6('0x3d')]=_['keys'](_0x302960[_0xb8f6('0x3d')]);_0x2c0d95['filters']=_['intersection'](_0x2c0d95[_0xb8f6('0x3e')],_0x2c0d95[_0xb8f6('0x3d')]);_0x22dd7c['attributes']=_[_0xb8f6('0x40')](_0x2c0d95['model'],qs[_0xb8f6('0x41')](_0x302960[_0xb8f6('0x3d')]['fields']));_0x22dd7c[_0xb8f6('0x3f')]=_0x22dd7c[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x22dd7c[_0xb8f6('0x3f')]:_0x2c0d95[_0xb8f6('0x3e')];_0x22dd7c['order']=qs[_0xb8f6('0x46')](_0x302960['query'][_0xb8f6('0x46')]);_0x22dd7c[_0xb8f6('0x47')]=qs['filters'](_[_0xb8f6('0x48')](_0x302960['query'],_0x2c0d95['filters']));if(_0x302960[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x22dd7c['where']=_[_0xb8f6('0x4b')](_0x22dd7c[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x22dd7c['attributes'],function(_0x43a6af){var _0x52d4df={};_0x52d4df[_0x43a6af]={'$like':'%'+_0x302960[_0xb8f6('0x3d')][_0xb8f6('0x2f')]+'%'};return _0x52d4df;})});}_0x22dd7c=_['merge']({},_0x22dd7c,_0x302960[_0xb8f6('0x4c')]);return _0x4c1e01['getAgents'](_0x22dd7c);}})[_0xb8f6('0x2a')](function(_0x52e0ef){if(_0x52e0ef){_0x51d40e=_0x52e0ef[_0xb8f6('0x42')];if(!_0x302960[_0xb8f6('0x3d')][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x22dd7c[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x302960[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0x22dd7c[_0xb8f6('0x23')]=qs[_0xb8f6('0x23')](_0x302960['query'][_0xb8f6('0x23')]);}return _0x4c1e01[_0xb8f6('0x9d')](_0x22dd7c);}})[_0xb8f6('0x2a')](function(_0x5ac6a8){if(_0x5ac6a8){return _0x5ac6a8?{'count':_0x51d40e,'rows':_0x5ac6a8}:null;}})[_0xb8f6('0x2a')](respondWithResult(_0xf4e658,null))[_0xb8f6('0x50')](handleError(_0xf4e658,null));};exports[_0xb8f6('0x9e')]=function(_0x550a63,_0x50dcbe,_0x4563b1){var _0x3f9b3d={};var _0x2d17f6={};var _0x3f0209;var _0x122e64;return db[_0xb8f6('0x3a')][_0xb8f6('0x64')]({'where':{'id':_0x550a63[_0xb8f6('0x52')]['id']}})['then'](handleEntityNotFound(_0x50dcbe,null))[_0xb8f6('0x2a')](function(_0x16f845){if(_0x16f845){_0x3f0209=_0x16f845;_0x2d17f6[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x7d')][_0xb8f6('0x5e')]);_0x2d17f6['query']=_[_0xb8f6('0x3c')](_0x550a63[_0xb8f6('0x3d')]);_0x2d17f6['filters']=_['intersection'](_0x2d17f6[_0xb8f6('0x3e')],_0x2d17f6['query']);_0x3f9b3d['attributes']=_[_0xb8f6('0x40')](_0x2d17f6[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x550a63[_0xb8f6('0x3d')][_0xb8f6('0x41')]));_0x3f9b3d[_0xb8f6('0x3f')]=_0x3f9b3d[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x3f9b3d[_0xb8f6('0x3f')]:_0x2d17f6['model'];_0x3f9b3d['order']=qs[_0xb8f6('0x46')](_0x550a63[_0xb8f6('0x3d')]['sort']);_0x3f9b3d[_0xb8f6('0x47')]=qs['filters'](_[_0xb8f6('0x48')](_0x550a63['query'],_0x2d17f6[_0xb8f6('0x49')]));if(_0x550a63[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x3f9b3d[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x3f9b3d[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x3f9b3d[_0xb8f6('0x3f')],function(_0x5d8a0b){var _0x20e569={};_0x20e569[_0x5d8a0b]={'$like':'%'+_0x550a63[_0xb8f6('0x3d')][_0xb8f6('0x2f')]+'%'};return _0x20e569;})});}_0x3f9b3d=_[_0xb8f6('0x4b')]({},_0x3f9b3d,_0x550a63[_0xb8f6('0x4c')]);return _0x3f0209[_0xb8f6('0x9e')](_0x3f9b3d);}})[_0xb8f6('0x2a')](function(_0x57edb5){if(_0x57edb5){_0x122e64=_0x57edb5[_0xb8f6('0x42')];if(!_0x550a63[_0xb8f6('0x3d')]['hasOwnProperty'](_0xb8f6('0x44'))){_0x3f9b3d[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x550a63[_0xb8f6('0x3d')][_0xb8f6('0x21')]);_0x3f9b3d['offset']=qs['offset'](_0x550a63[_0xb8f6('0x3d')][_0xb8f6('0x23')]);}return _0x3f0209[_0xb8f6('0x9e')](_0x3f9b3d);}})[_0xb8f6('0x2a')](function(_0x214b9a){return _0x214b9a?{'count':_0x122e64,'rows':_0x214b9a}:null;})[_0xb8f6('0x2a')](respondWithResult(_0x50dcbe,null))[_0xb8f6('0x50')](handleError(_0x50dcbe,null));};exports['getLists']=function(_0x475791,_0x4cfa57,_0x113a60){var _0x47ebea={};var _0x41db42={};var _0x3c9e30;var _0x2f5bf3;return db[_0xb8f6('0x3a')][_0xb8f6('0x64')]({'where':{'id':_0x475791[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x4cfa57,null))[_0xb8f6('0x2a')](function(_0x528156){if(_0x528156){_0x3c9e30=_0x528156;_0x41db42[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x9f')][_0xb8f6('0x5e')]);_0x41db42[_0xb8f6('0x3d')]=_[_0xb8f6('0x3c')](_0x475791[_0xb8f6('0x3d')]);_0x41db42['filters']=_[_0xb8f6('0x40')](_0x41db42['model'],_0x41db42['query']);_0x47ebea['attributes']=_[_0xb8f6('0x40')](_0x41db42[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x475791[_0xb8f6('0x3d')]['fields']));_0x47ebea[_0xb8f6('0x3f')]=_0x47ebea[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x47ebea[_0xb8f6('0x3f')]:_0x41db42[_0xb8f6('0x3e')];_0x47ebea['order']=qs[_0xb8f6('0x46')](_0x475791[_0xb8f6('0x3d')][_0xb8f6('0x46')]);_0x47ebea[_0xb8f6('0x47')]=qs[_0xb8f6('0x49')](_[_0xb8f6('0x48')](_0x475791[_0xb8f6('0x3d')],_0x41db42[_0xb8f6('0x49')]));if(_0x475791[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x47ebea[_0xb8f6('0x47')]=_['merge'](_0x47ebea[_0xb8f6('0x47')],{'$or':_['map'](_0x47ebea['attributes'],function(_0x32d87a){var _0x4cbc95={};_0x4cbc95[_0x32d87a]={'$like':'%'+_0x475791[_0xb8f6('0x3d')]['filter']+'%'};return _0x4cbc95;})});}_0x47ebea=_[_0xb8f6('0x4b')]({},_0x47ebea,_0x475791[_0xb8f6('0x4c')]);return _0x3c9e30['getLists'](_0x47ebea);}})[_0xb8f6('0x2a')](function(_0xf54ae9){if(_0xf54ae9){_0x2f5bf3=_0xf54ae9[_0xb8f6('0x42')];if(!_0x475791[_0xb8f6('0x3d')][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x47ebea[_0xb8f6('0x21')]=qs[_0xb8f6('0x21')](_0x475791[_0xb8f6('0x3d')]['limit']);_0x47ebea[_0xb8f6('0x23')]=qs['offset'](_0x475791['query']['offset']);}return _0x3c9e30[_0xb8f6('0xa0')](_0x47ebea);}})['then'](function(_0x1ad4a3){if(_0x1ad4a3){return _0x1ad4a3?{'count':_0x2f5bf3,'rows':_0x1ad4a3}:null;}})[_0xb8f6('0x2a')](respondWithResult(_0x4cfa57,null))[_0xb8f6('0x50')](handleError(_0x4cfa57,null));};exports[_0xb8f6('0xa1')]=function(_0x44d034,_0x5ba34a,_0xbafd08){var _0x20f45f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1ebb54,_0xcf5610;return db['VoiceQueue']['find']({'where':{'id':_0x44d034['params']['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x5ba34a,null))['then'](function(_0x154f01){if(_0x154f01){_0xcf5610=_0x154f01;return _0x154f01[_0xb8f6('0xa1')](_0x44d034[_0xb8f6('0x54')][_0xb8f6('0x98')],_[_0xb8f6('0x5f')](_0x44d034[_0xb8f6('0x54')],[_0xb8f6('0x98'),'id'])||{});}return null;})[_0xb8f6('0x99')](function(_0x2fb788){var _0x489313;_0x1ebb54=_0x2fb788||[];var _0x33ca2a=[];if(_0x2fb788){for(var _0x575018=0x0;_0x575018<_0x2fb788['length'];_0x575018+=0x1){var _0x2e57da=_0x2fb788[_0x575018][_0xb8f6('0x57')]({'plain':!![]});_0xcf5610[_0xb8f6('0xa2')]=_0x44d034['body']['dialCheckDuplicateType']?_0x44d034[_0xb8f6('0x54')][_0xb8f6('0xa2')]:_0xcf5610[_0xb8f6('0xa2')];switch(_0xcf5610['dialCheckDuplicateType']){case _0xb8f6('0xa3'):_0x489313=squel[_0xb8f6('0xa4')]()['into']('cm_hopper')[_0xb8f6('0xa5')]([_0xb8f6('0xa6'),_0xb8f6('0xa7'),_0xb8f6('0xa8'),_0xb8f6('0xa9'),_0xb8f6('0x66'),_0xb8f6('0x60'),_0xb8f6('0xaa')],squel[_0xb8f6('0x86')]()[_0xb8f6('0x87')](_0xb8f6('0xa6'),'phone')['field']('\x27'+_0x20f45f+'\x27',_0xb8f6('0xa7'))[_0xb8f6('0x87')]('id',_0xb8f6('0xa8'))['field'](_0x2e57da['CmListId'][_0xb8f6('0xab')](),'ListId')[_0xb8f6('0x87')](_0x44d034[_0xb8f6('0x52')]['id']['toString'](),_0xb8f6('0x66'))['field']('\x27'+_0x20f45f+'\x27',_0xb8f6('0x60'))['field']('\x27'+_0x20f45f+'\x27',_0xb8f6('0xaa'))[_0xb8f6('0x89')](_0xb8f6('0xac'))[_0xb8f6('0x47')](_0xb8f6('0xad'))[_0xb8f6('0x47')](_0xb8f6('0xae'),_0x2e57da[_0xb8f6('0xaf')][_0xb8f6('0xab')]())[_0xb8f6('0x47')](_0xb8f6('0xb0'))[_0xb8f6('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb8f6('0x86')]()[_0xb8f6('0x87')](_0xb8f6('0xb1'))[_0xb8f6('0x89')]('cm_hopper_final')[_0xb8f6('0x47')](_0xb8f6('0x8e'),_0x44d034[_0xb8f6('0x52')]['id'][_0xb8f6('0xab')]()))[_0xb8f6('0x47')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb8f6('0x86')]()['field']('COALESCE(phone,\x27\x27)')[_0xb8f6('0x89')](_0xb8f6('0xb2'))[_0xb8f6('0x47')](_0xb8f6('0x8e'),_0x44d034[_0xb8f6('0x52')]['id']['toString']())))[_0xb8f6('0xab')]();break;case _0xb8f6('0xb3'):_0x489313=squel[_0xb8f6('0xa4')]()[_0xb8f6('0xb4')](_0xb8f6('0xb2'))['fromQuery']([_0xb8f6('0xa6'),_0xb8f6('0xa7'),_0xb8f6('0xa8'),_0xb8f6('0xa9'),'VoiceQueueId',_0xb8f6('0x60'),_0xb8f6('0xaa')],squel['select']()[_0xb8f6('0x87')]('phone',_0xb8f6('0xa6'))[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27',_0xb8f6('0xa7'))[_0xb8f6('0x87')]('id',_0xb8f6('0xa8'))[_0xb8f6('0x87')](_0x2e57da[_0xb8f6('0xaf')]['toString'](),_0xb8f6('0xa9'))[_0xb8f6('0x87')](_0x44d034[_0xb8f6('0x52')]['id']['toString'](),'VoiceQueueId')[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27',_0xb8f6('0x60'))[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27','updatedAt')['from'](_0xb8f6('0xac'))[_0xb8f6('0x47')](_0xb8f6('0xad'))[_0xb8f6('0x47')]('ListId\x20=\x20?',_0x2e57da[_0xb8f6('0xaf')]['toString']())[_0xb8f6('0x47')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xb8f6('0x86')]()['field'](_0xb8f6('0xb5'))['from'](_0xb8f6('0xb2'))[_0xb8f6('0x47')](_0xb8f6('0x8e'),_0x44d034[_0xb8f6('0x52')]['id'][_0xb8f6('0xab')]())))[_0xb8f6('0xab')]();break;default:_0x489313=squel[_0xb8f6('0xa4')]()[_0xb8f6('0xb4')]('cm_hopper')['fromQuery'](['phone',_0xb8f6('0xa7'),_0xb8f6('0xa8'),'ListId',_0xb8f6('0x66'),_0xb8f6('0x60'),_0xb8f6('0xaa')],squel['select']()[_0xb8f6('0x87')](_0xb8f6('0xa6'),_0xb8f6('0xa6'))[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27','scheduledAt')[_0xb8f6('0x87')]('id',_0xb8f6('0xa8'))[_0xb8f6('0x87')](_0x2e57da[_0xb8f6('0xaf')][_0xb8f6('0xab')](),_0xb8f6('0xa9'))[_0xb8f6('0x87')](_0x44d034['params']['id'][_0xb8f6('0xab')](),'VoiceQueueId')[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27',_0xb8f6('0x60'))['field']('\x27'+_0x20f45f+'\x27',_0xb8f6('0xaa'))['from'](_0xb8f6('0xac'))[_0xb8f6('0x47')](_0xb8f6('0xad'))[_0xb8f6('0x47')]('ListId\x20=\x20?',_0x2e57da['CmListId'][_0xb8f6('0xab')]())['where'](_0xb8f6('0xb0')))[_0xb8f6('0xab')]();}_0x33ca2a[_0xb8f6('0x9a')](db[_0xb8f6('0x76')][_0xb8f6('0x3d')](_0x489313));}return BPromise['all'](_0x33ca2a);}})[_0xb8f6('0x2a')](function(){var _0x3a1dcc=[];var _0x41c30a=squel['insert']()['into']('cm_hopper_additional_phones')[_0xb8f6('0xa5')]([_0xb8f6('0xb6'),_0xb8f6('0xa6'),_0xb8f6('0xb7'),'createdAt',_0xb8f6('0xaa')],squel['select']()['field'](_0xb8f6('0xb8'))[_0xb8f6('0x87')](_0xb8f6('0xb9'))[_0xb8f6('0x87')]('ci.OrderBy+1')[_0xb8f6('0x87')]('\x27'+_0x20f45f+'\x27',_0xb8f6('0x60'))['field']('\x27'+_0x20f45f+'\x27',_0xb8f6('0xaa'))['from'](_0xb8f6('0xba'),'ci')[_0xb8f6('0x8b')]('cm_hopper','h',_0xb8f6('0xbb'))[_0xb8f6('0x47')](_0xb8f6('0xbc'),_0x20f45f)[_0xb8f6('0x47')](_0xb8f6('0xbd'),_0xb8f6('0xbe')))[_0xb8f6('0xab')]();_0x3a1dcc[_0xb8f6('0x9a')](db[_0xb8f6('0x76')][_0xb8f6('0x3d')](_0x41c30a));return BPromise[_0xb8f6('0x93')](_0x3a1dcc);})[_0xb8f6('0x2a')](function(){return _0x1ebb54;})[_0xb8f6('0x2a')](respondWithResult(_0x5ba34a,null))[_0xb8f6('0x50')](handleError(_0x5ba34a,null));};exports['removeLists']=function(_0x579e0e,_0x431240,_0x245f88){return db[_0xb8f6('0x3a')][_0xb8f6('0x53')]({'where':{'id':_0x579e0e['params']['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x431240,null))['then'](function(_0x2aaf49){if(_0x2aaf49){return _0x2aaf49[_0xb8f6('0xbf')](_0x579e0e[_0xb8f6('0x3d')][_0xb8f6('0x98')]);}})[_0xb8f6('0x2a')](function(_0x21c5b6){if(_0x21c5b6){return db[_0xb8f6('0x65')][_0xb8f6('0x2b')]({'where':{'ListId':_0x579e0e[_0xb8f6('0x3d')][_0xb8f6('0x98')],'VoiceQueueId':_0x579e0e['params']['id']}})[_0xb8f6('0x2a')](function(){return _0x21c5b6;});}})[_0xb8f6('0x2a')](respondWithStatusCode(_0x431240,null))['catch'](handleError(_0x431240,null));};exports[_0xb8f6('0xc0')]=function(_0x40d0f0,_0x22da7a,_0x2df9cb){var _0x50d060={};var _0x3cb302={};var _0x433956;var _0xd39fa4;return db['VoiceQueue'][_0xb8f6('0x64')]({'where':{'id':_0x40d0f0[_0xb8f6('0x52')]['id']}})['then'](handleEntityNotFound(_0x22da7a,null))[_0xb8f6('0x2a')](function(_0x239212){if(_0x239212){_0x433956=_0x239212;_0x3cb302[_0xb8f6('0x3e')]=_[_0xb8f6('0x3c')](db[_0xb8f6('0x9f')][_0xb8f6('0x5e')]);_0x3cb302[_0xb8f6('0x3d')]=_[_0xb8f6('0x3c')](_0x40d0f0['query']);_0x3cb302[_0xb8f6('0x49')]=_[_0xb8f6('0x40')](_0x3cb302[_0xb8f6('0x3e')],_0x3cb302[_0xb8f6('0x3d')]);_0x50d060[_0xb8f6('0x3f')]=_[_0xb8f6('0x40')](_0x3cb302[_0xb8f6('0x3e')],qs[_0xb8f6('0x41')](_0x40d0f0[_0xb8f6('0x3d')]['fields']));_0x50d060[_0xb8f6('0x3f')]=_0x50d060[_0xb8f6('0x3f')][_0xb8f6('0x42')]?_0x50d060[_0xb8f6('0x3f')]:_0x3cb302[_0xb8f6('0x3e')];_0x50d060[_0xb8f6('0x45')]=qs[_0xb8f6('0x46')](_0x40d0f0[_0xb8f6('0x3d')][_0xb8f6('0x46')]);_0x50d060[_0xb8f6('0x47')]=qs['filters'](_[_0xb8f6('0x48')](_0x40d0f0[_0xb8f6('0x3d')],_0x3cb302[_0xb8f6('0x49')]));if(_0x40d0f0[_0xb8f6('0x3d')][_0xb8f6('0x2f')]){_0x50d060[_0xb8f6('0x47')]=_[_0xb8f6('0x4b')](_0x50d060[_0xb8f6('0x47')],{'$or':_[_0xb8f6('0x31')](_0x50d060[_0xb8f6('0x3f')],function(_0x293261){var _0x4e41c7={};_0x4e41c7[_0x293261]={'$like':'%'+_0x40d0f0['query'][_0xb8f6('0x2f')]+'%'};return _0x4e41c7;})});}_0x50d060=_[_0xb8f6('0x4b')]({},_0x50d060,_0x40d0f0[_0xb8f6('0x4c')]);return _0x433956[_0xb8f6('0xc0')](_0x50d060);}})[_0xb8f6('0x2a')](function(_0x445fa2){if(_0x445fa2){_0xd39fa4=_0x445fa2[_0xb8f6('0x42')];if(!_0x40d0f0[_0xb8f6('0x3d')][_0xb8f6('0x43')](_0xb8f6('0x44'))){_0x50d060['limit']=qs[_0xb8f6('0x21')](_0x40d0f0[_0xb8f6('0x3d')]['limit']);_0x50d060[_0xb8f6('0x23')]=qs['offset'](_0x40d0f0['query'][_0xb8f6('0x23')]);}return _0x433956[_0xb8f6('0xc0')](_0x50d060);}})[_0xb8f6('0x2a')](function(_0x226d61){if(_0x226d61){return _0x226d61?{'count':_0xd39fa4,'rows':_0x226d61}:null;}})[_0xb8f6('0x2a')](respondWithResult(_0x22da7a,null))[_0xb8f6('0x50')](handleError(_0x22da7a,null));};exports[_0xb8f6('0xc1')]=function(_0x3f4148,_0x1c17d5,_0x33cee2){var _0x5cdd96,_0x15684a;return db['VoiceQueue']['find']({'where':{'id':_0x3f4148[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x1c17d5,null))['then'](function(_0x22c171){if(_0x22c171){_0x15684a=_0x22c171;return _0x22c171[_0xb8f6('0xc1')](_0x3f4148[_0xb8f6('0x54')][_0xb8f6('0x98')],_[_0xb8f6('0x5f')](_0x3f4148[_0xb8f6('0x54')],[_0xb8f6('0x98'),'id'])||{});}return null;})['spread'](function(_0xdc77d7){var _0x2a2c54;_0x5cdd96=_0xdc77d7||[];var _0x80606d=[];if(_0xdc77d7){for(var _0x40a393=0x0;_0x40a393<_0xdc77d7[_0xb8f6('0x42')];_0x40a393+=0x1){var _0x1c2a07=_0xdc77d7[_0x40a393][_0xb8f6('0x57')]({'plain':!![]});_0x2a2c54=squel['insert']()['into'](_0xb8f6('0xc2'))[_0xb8f6('0xa5')]([_0xb8f6('0xa6'),_0xb8f6('0xa8'),_0xb8f6('0xa9'),_0xb8f6('0x66'),_0xb8f6('0x60'),'updatedAt'],squel[_0xb8f6('0x86')]()[_0xb8f6('0x87')](_0xb8f6('0xa6'),'phone')['field']('id',_0xb8f6('0xa8'))[_0xb8f6('0x87')](_0x1c2a07[_0xb8f6('0xaf')][_0xb8f6('0xab')](),_0xb8f6('0xa9'))[_0xb8f6('0x87')](_0x3f4148[_0xb8f6('0x52')]['id'][_0xb8f6('0xab')](),_0xb8f6('0x66'))['field'](_0xb8f6('0xc3'),'createdAt')['field'](_0xb8f6('0xc3'),_0xb8f6('0xaa'))[_0xb8f6('0x89')](_0xb8f6('0xac'))[_0xb8f6('0x47')](_0xb8f6('0xad'))[_0xb8f6('0x47')](_0xb8f6('0xae'),_0x1c2a07[_0xb8f6('0xaf')][_0xb8f6('0xab')]())['where'](_0xb8f6('0xb0')))[_0xb8f6('0xab')]();_0x80606d[_0xb8f6('0x9a')](db[_0xb8f6('0x76')]['query'](_0x2a2c54));}return BPromise[_0xb8f6('0x93')](_0x80606d);}})[_0xb8f6('0x2a')](function(){return _0x5cdd96;})[_0xb8f6('0x2a')](respondWithResult(_0x1c17d5,null))[_0xb8f6('0x50')](handleError(_0x1c17d5,null));};exports['removeBlackLists']=function(_0x33e334,_0x3b7526,_0x1020d7){return db['VoiceQueue'][_0xb8f6('0x53')]({'where':{'id':_0x33e334[_0xb8f6('0x52')]['id']}})[_0xb8f6('0x2a')](handleEntityNotFound(_0x3b7526,null))[_0xb8f6('0x2a')](function(_0x246a2b){if(_0x246a2b){return _0x246a2b[_0xb8f6('0xc4')](_0x33e334['query'][_0xb8f6('0x98')]);}})[_0xb8f6('0x2a')](function(_0xf37127){if(_0xf37127){return db[_0xb8f6('0x6c')][_0xb8f6('0x2b')]({'where':{'ListId':_0x33e334[_0xb8f6('0x3d')][_0xb8f6('0x98')],'VoiceQueueId':_0x33e334[_0xb8f6('0x52')]['id']}})['then'](function(){return _0xf37127;});}})[_0xb8f6('0x2a')](respondWithStatusCode(_0x3b7526,null))['catch'](handleError(_0x3b7526,null));};
\ No newline at end of file