Built motion from commit 55091a5c.|2.6.30
[motion2.git] / server / api / voiceExtension / voiceExtension.controller.js
index 0603f42..9c3357e 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xb0a9=['order','sort','where','pick','filters','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','fields','options','create','body','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','cutdigits','alias','addApplications','transaction','Transaction','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./voiceExtension.socket','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','find','type','name','UserProfileResource','destroy','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','model','query','keys','intersection','attributes','length','hasOwnProperty','limit'];(function(_0x1c1011,_0x4876af){var _0x29b970=function(_0x3a5aa2){while(--_0x3a5aa2){_0x1c1011['push'](_0x1c1011['shift']());}};_0x29b970(++_0x4876af);}(_0xb0a9,0x13d));var _0x9b0a=function(_0x256422,_0x367394){_0x256422=_0x256422-0x0;var _0x55dddc=_0xb0a9[_0x256422];return _0x55dddc;};'use strict';var _=require(_0x9b0a('0x0'));var Redis=require(_0x9b0a('0x1'));var qs=require(_0x9b0a('0x2'));var logger=require(_0x9b0a('0x3'))(_0x9b0a('0x4'));var config=require(_0x9b0a('0x5'));var db=require(_0x9b0a('0x6'))['db'];config['redis']=_[_0x9b0a('0x7')](config[_0x9b0a('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x9b0a('0x9'))(new Redis(config['redis']));require(_0x9b0a('0xa'))['register'](socket);function respondWithStatusCode(_0x228cb0,_0x395467){_0x395467=_0x395467||0xcc;return function(_0x570ce8){if(_0x570ce8){return _0x228cb0[_0x9b0a('0xb')](_0x395467);}return _0x228cb0[_0x9b0a('0xc')](_0x395467)[_0x9b0a('0xd')]();};}function respondWithResult(_0x20342c,_0x14c29d){_0x14c29d=_0x14c29d||0xc8;return function(_0x1fdd29){if(_0x1fdd29){return _0x20342c[_0x9b0a('0xc')](_0x14c29d)[_0x9b0a('0xe')](_0x1fdd29);}};}function respondWithFilteredResult(_0x5c48e6,_0x3f037d){return function(_0x32d048){if(_0x32d048){var _0x4b95db=typeof _0x3f037d['offset']===_0x9b0a('0xf')&&typeof _0x3f037d['limit']===_0x9b0a('0xf');var _0x2270ef=_0x32d048[_0x9b0a('0x10')];var _0x37b231=_0x4b95db?0x0:_0x3f037d[_0x9b0a('0x11')];var _0x273eeb=_0x4b95db?_0x32d048[_0x9b0a('0x10')]:_0x3f037d[_0x9b0a('0x11')]+_0x3f037d['limit'];var _0x558a8f;if(_0x273eeb>=_0x2270ef){_0x273eeb=_0x2270ef;_0x558a8f=0xc8;}else{_0x558a8f=0xce;}_0x5c48e6['status'](_0x558a8f);return _0x5c48e6[_0x9b0a('0x12')](_0x9b0a('0x13'),_0x37b231+'-'+_0x273eeb+'/'+_0x2270ef)[_0x9b0a('0xe')](_0x32d048);}return null;};}function removeEntity(_0x11e999){return function(_0x92e270){if(_0x92e270){return _0x92e270['destroy']()[_0x9b0a('0x14')](function(){var _0x4b595b=_0x92e270[_0x9b0a('0x15')]({'plain':!![]});var _0x16a0c5=[{'name':_0x9b0a('0x16'),'value':_0x9b0a('0x17'),'ignore':![]},{'name':_0x9b0a('0x18'),'value':_0x9b0a('0x19'),'ignore':![]},{'name':_0x9b0a('0x1a'),'value':_0x9b0a('0x1b'),'ignore':![]}];var _0x38b4d7=_(_0x16a0c5)[_0x9b0a('0x1c')]('ignore')[_0x9b0a('0x1d')](_0x9b0a('0x1e'))[_0x9b0a('0x1e')]();if(_['includes'](_0x38b4d7,_0x4b595b['type'])){return;}var _0x308b3a=_[_0x9b0a('0x1f')](_0x16a0c5,[_0x9b0a('0x1e'),_0x4b595b[_0x9b0a('0x20')]])[_0x9b0a('0x21')];return db[_0x9b0a('0x22')][_0x9b0a('0x23')]({'where':{'type':_0x308b3a,'resourceId':_0x4b595b['id']}})[_0x9b0a('0x14')](function(){return _0x92e270;});})['then'](function(){_0x11e999['status'](0xcc)[_0x9b0a('0xd')]();});}};}function handleEntityNotFound(_0x328a79){return function(_0x2d8114){if(!_0x2d8114){_0x328a79[_0x9b0a('0xb')](0x194);}return _0x2d8114;};}function handleError(_0x1e569d,_0x48e547){_0x48e547=_0x48e547||0x1f4;return function(_0x2dae43){logger[_0x9b0a('0x24')](_0x2dae43[_0x9b0a('0x25')]);if(_0x2dae43['name']){delete _0x2dae43[_0x9b0a('0x21')];}_0x1e569d[_0x9b0a('0xc')](_0x48e547)[_0x9b0a('0x26')](_0x2dae43);};}exports[_0x9b0a('0x27')]=function(_0x9a518,_0x14696d){var _0x126bb5={},_0x4b5c6d={},_0x894f7b={'count':0x0,'rows':[]};var _0x60911d=_[_0x9b0a('0x1d')](db[_0x9b0a('0x28')][_0x9b0a('0x29')],function(_0x247996){return{'name':_0x247996[_0x9b0a('0x2a')],'type':_0x247996[_0x9b0a('0x20')]['key']};});_0x4b5c6d[_0x9b0a('0x2b')]=_[_0x9b0a('0x1d')](_0x60911d,_0x9b0a('0x21'));_0x4b5c6d[_0x9b0a('0x2c')]=_[_0x9b0a('0x2d')](_0x9a518[_0x9b0a('0x2c')]);_0x4b5c6d['filters']=_[_0x9b0a('0x2e')](_0x4b5c6d['model'],_0x4b5c6d['query']);_0x126bb5['attributes']=_[_0x9b0a('0x2e')](_0x4b5c6d[_0x9b0a('0x2b')],qs['fields'](_0x9a518['query']['fields']));_0x126bb5[_0x9b0a('0x2f')]=_0x126bb5[_0x9b0a('0x2f')][_0x9b0a('0x30')]?_0x126bb5[_0x9b0a('0x2f')]:_0x4b5c6d[_0x9b0a('0x2b')];if(!_0x9a518[_0x9b0a('0x2c')][_0x9b0a('0x31')]('nolimit')){_0x126bb5[_0x9b0a('0x32')]=qs[_0x9b0a('0x32')](_0x9a518['query'][_0x9b0a('0x32')]);_0x126bb5[_0x9b0a('0x11')]=qs[_0x9b0a('0x11')](_0x9a518['query'][_0x9b0a('0x11')]);}_0x126bb5[_0x9b0a('0x33')]=qs[_0x9b0a('0x34')](_0x9a518['query'][_0x9b0a('0x34')]);_0x126bb5[_0x9b0a('0x35')]=qs['filters'](_[_0x9b0a('0x36')](_0x9a518['query'],_0x4b5c6d[_0x9b0a('0x37')]),_0x60911d);if(_0x9a518['query']['filter']){_0x126bb5[_0x9b0a('0x35')]=_[_0x9b0a('0x38')](_0x126bb5['where'],{'$or':_['map'](_0x60911d,function(_0x35f7ef){if(_0x35f7ef[_0x9b0a('0x20')]!==_0x9b0a('0x39')){var _0x27c5a6={};_0x27c5a6[_0x35f7ef['name']]={'$like':'%'+_0x9a518['query'][_0x9b0a('0x1c')]+'%'};return _0x27c5a6;}})});}_0x126bb5=_[_0x9b0a('0x38')]({},_0x126bb5,_0x9a518['options']);var _0x4424af={'where':_0x126bb5[_0x9b0a('0x35')]};return db[_0x9b0a('0x28')][_0x9b0a('0x10')](_0x4424af)['then'](function(_0x29e8bd){_0x894f7b['count']=_0x29e8bd;if(_0x9a518[_0x9b0a('0x2c')][_0x9b0a('0x3a')]){_0x126bb5[_0x9b0a('0x3b')]=[{'all':!![]}];}return db['VoiceExtension'][_0x9b0a('0x3c')](_0x126bb5);})[_0x9b0a('0x14')](function(_0x5911c9){_0x894f7b[_0x9b0a('0x3d')]=_0x5911c9;return _0x894f7b;})[_0x9b0a('0x14')](respondWithFilteredResult(_0x14696d,_0x126bb5))[_0x9b0a('0x3e')](handleError(_0x14696d,null));};exports[_0x9b0a('0x3f')]=function(_0x3b08ec,_0x4bb23d){var _0x357a9c={'raw':![],'where':{'id':_0x3b08ec[_0x9b0a('0x40')]['id']}},_0x3a925b={};_0x3a925b['model']=_['keys'](db[_0x9b0a('0x28')][_0x9b0a('0x29')]);_0x3a925b[_0x9b0a('0x2c')]=_[_0x9b0a('0x2d')](_0x3b08ec['query']);_0x3a925b['filters']=_[_0x9b0a('0x2e')](_0x3a925b[_0x9b0a('0x2b')],_0x3a925b[_0x9b0a('0x2c')]);_0x357a9c[_0x9b0a('0x2f')]=_[_0x9b0a('0x2e')](_0x3a925b[_0x9b0a('0x2b')],qs['fields'](_0x3b08ec[_0x9b0a('0x2c')][_0x9b0a('0x41')]));_0x357a9c[_0x9b0a('0x2f')]=_0x357a9c['attributes'][_0x9b0a('0x30')]?_0x357a9c['attributes']:_0x3a925b[_0x9b0a('0x2b')];if(_0x3b08ec['query']['includeAll']){_0x357a9c['include']=[{'all':!![]}];}_0x357a9c=_['merge']({},_0x357a9c,_0x3b08ec[_0x9b0a('0x42')]);return db[_0x9b0a('0x28')][_0x9b0a('0x1f')](_0x357a9c)['then'](handleEntityNotFound(_0x4bb23d,null))['then'](respondWithResult(_0x4bb23d,null))['catch'](handleError(_0x4bb23d,null));};exports['destroy']=function(_0x4622e1,_0x340e66){return db[_0x9b0a('0x28')][_0x9b0a('0x1f')]({'where':{'id':_0x4622e1[_0x9b0a('0x40')]['id']}})[_0x9b0a('0x14')](handleEntityNotFound(_0x340e66,null))['then'](removeEntity(_0x340e66,null))[_0x9b0a('0x3e')](handleError(_0x340e66,null));};exports[_0x9b0a('0x43')]=function(_0x484474,_0x2d0e06){if(_0x484474[_0x9b0a('0x44')][_0x9b0a('0x20')]===_0x9b0a('0x19')&&!_['startsWith'](_0x484474['body'][_0x9b0a('0x45')],'_')){_0x484474[_0x9b0a('0x44')][_0x9b0a('0x45')]='_'['concat'](_0x484474['body'][_0x9b0a('0x45')]);}return db['VoiceExtension'][_0x9b0a('0x43')](_0x484474[_0x9b0a('0x44')],{'raw':![]})[_0x9b0a('0x14')](function(_0xaa550e){var _0x51ef0d=_0x484474[_0x9b0a('0x46')][_0x9b0a('0x15')]({'plain':!![]});if(!_0x51ef0d)throw new Error(_0x9b0a('0x47'));if(_0x51ef0d[_0x9b0a('0x48')]===_0x9b0a('0x46')){var _0x65b81=_0xaa550e[_0x9b0a('0x15')]({'plain':!![]});var _0x4b6a88=[{'name':'InboundRoutes','value':'inbound'},{'name':_0x9b0a('0x18'),'value':_0x9b0a('0x19')},{'name':'InternalRoutes','value':_0x9b0a('0x1b')}];var _0x2286c7=_['find'](_0x4b6a88,['value',_0x65b81[_0x9b0a('0x20')]])[_0x9b0a('0x21')];return db['UserProfileSection'][_0x9b0a('0x1f')]({'where':{'name':_0x2286c7,'userProfileId':_0x51ef0d[_0x9b0a('0x49')]},'raw':!![]})[_0x9b0a('0x14')](function(_0x47baa8){if(_0x47baa8&&_0x47baa8[_0x9b0a('0x4a')]===0x0){return db[_0x9b0a('0x22')]['create']({'name':_0x65b81[_0x9b0a('0x21')],'resourceId':_0x65b81['id'],'type':_0x47baa8['name'],'sectionId':_0x47baa8['id']},{})[_0x9b0a('0x14')](function(){return _0xaa550e;});}else{return _0xaa550e;}})[_0x9b0a('0x3e')](function(_0x57d46a){logger[_0x9b0a('0x24')](_0x9b0a('0x4b'),_0x57d46a);throw _0x57d46a;});}return _0xaa550e;})[_0x9b0a('0x14')](respondWithResult(_0x2d0e06,0xc9))[_0x9b0a('0x3e')](handleError(_0x2d0e06,null));};exports[_0x9b0a('0x4c')]=function(_0x362c54,_0x684957){if(_0x362c54[_0x9b0a('0x44')]['id']){delete _0x362c54[_0x9b0a('0x44')]['id'];}return db[_0x9b0a('0x28')][_0x9b0a('0x1f')]({'where':{'id':_0x362c54['params']['id']}})[_0x9b0a('0x14')](handleEntityNotFound(_0x684957,null))[_0x9b0a('0x14')](function(_0xa83939){if(_0xa83939){return db['VoiceExtension']['update'](_[_0x9b0a('0x36')](_0x362c54[_0x9b0a('0x44')],[_0x9b0a('0x45'),'context',_0x9b0a('0x4d'),'recordingFormat',_0x9b0a('0x4e'),'mandatoryDisposition',_0x9b0a('0x4f')]),{'where':{'context':_0xa83939['context'],'exten':_0xa83939[_0x9b0a('0x45')]},'individualHooks':!![]})[_0x9b0a('0x14')](function(_0x18319f){return _0x18319f;});}return null;})[_0x9b0a('0x14')](respondWithStatusCode(_0x684957,null))[_0x9b0a('0x3e')](handleError(_0x684957,null));};exports[_0x9b0a('0x50')]=function(_0x2ca97f,_0x4593ed){var _0x32d88b=_0x2ca97f[_0x9b0a('0x40')]['id'];var _0x5ac110=_0x2ca97f[_0x9b0a('0x44')];var _0x35bb32=0xc8;var _0x2f4dc2=null;return db['sequelize'][_0x9b0a('0x51')]({'isolationLevel':db['sequelize'][_0x9b0a('0x52')]['ISOLATION_LEVELS'][_0x9b0a('0x53')]},function(_0xba71e){return db[_0x9b0a('0x28')][_0x9b0a('0x54')]({'where':{'id':_0x32d88b},'transaction':_0xba71e})[_0x9b0a('0x14')](function(_0x4775d0){if(_0x4775d0){return db[_0x9b0a('0x28')]['destroy']({'where':{'VoiceExtensionId':_0x32d88b},'transaction':_0xba71e})['then'](function(){var _0x42bd76=_[_0x9b0a('0x1d')](_0x5ac110,function(_0x51db1a){_0x51db1a[_0x9b0a('0x55')]=_0x32d88b;_0x51db1a[_0x9b0a('0x56')]=!![];return _0x51db1a;});return _0x4775d0[_0x9b0a('0x57')](_0x42bd76);})['then'](function(_0x13bf4a){return db[_0x9b0a('0x28')][_0x9b0a('0x58')](_0x13bf4a,{'transaction':_0xba71e});});}else{_0x35bb32=0x194;_0x2f4dc2=[];}});})[_0x9b0a('0x14')](function(){if(_0x35bb32!==0x194){return db[_0x9b0a('0x28')][_0x9b0a('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x32d88b},'order':_0x9b0a('0x5a')})[_0x9b0a('0x14')](function(_0x17a7ae){_0x2f4dc2=_0x17a7ae;});}})[_0x9b0a('0x3e')](function(_0x321282){_0x35bb32=0x1f4;logger[_0x9b0a('0x24')](_0x321282['stack']);if(_0x321282[_0x9b0a('0x21')]){delete _0x321282[_0x9b0a('0x21')];}_0x2f4dc2=_0x321282;})[_0x9b0a('0x5b')](function(){if(_0x2f4dc2===null){_0x4593ed[_0x9b0a('0xb')](_0x35bb32);}else{if(_0x35bb32===0x1f4){_0x4593ed[_0x9b0a('0xc')](_0x35bb32)[_0x9b0a('0x26')](_0x2f4dc2);}else{_0x4593ed[_0x9b0a('0xc')](_0x35bb32)[_0x9b0a('0xe')](_0x2f4dc2);}}});};
\ No newline at end of file
+var _0xb2f3=['find','name','UserProfileResource','send','index','VoiceExtension','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','options','findAll','rows','show','rawAttributes','includeAll','include','catch','create','body','startsWith','exten','concat','user','role','UserProfileSection','userProfileId','autoAssociation','error','update','params','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','sendStatus','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','status','end','json','undefined','count','offset','limit','set','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','type'];(function(_0x2fc113,_0x45ec6e){var _0x5144ce=function(_0x47fd29){while(--_0x47fd29){_0x2fc113['push'](_0x2fc113['shift']());}};_0x5144ce(++_0x45ec6e);}(_0xb2f3,0x157));var _0x3b2f=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xb2f3[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x3b2f('0x0'));var Redis=require(_0x3b2f('0x1'));var qs=require(_0x3b2f('0x2'));var logger=require(_0x3b2f('0x3'))(_0x3b2f('0x4'));var config=require(_0x3b2f('0x5'));var db=require(_0x3b2f('0x6'))['db'];config[_0x3b2f('0x7')]=_[_0x3b2f('0x8')](config[_0x3b2f('0x7')],{'host':_0x3b2f('0x9'),'port':0x18eb});var socket=require(_0x3b2f('0xa'))(new Redis(config[_0x3b2f('0x7')]));require(_0x3b2f('0xb'))['register'](socket);function respondWithStatusCode(_0xaef66b,_0x528bb0){_0x528bb0=_0x528bb0||0xcc;return function(_0x1176c0){if(_0x1176c0){return _0xaef66b['sendStatus'](_0x528bb0);}return _0xaef66b[_0x3b2f('0xc')](_0x528bb0)[_0x3b2f('0xd')]();};}function respondWithResult(_0x4b1f3f,_0x137ebd){_0x137ebd=_0x137ebd||0xc8;return function(_0x133277){if(_0x133277){return _0x4b1f3f[_0x3b2f('0xc')](_0x137ebd)[_0x3b2f('0xe')](_0x133277);}};}function respondWithFilteredResult(_0x46f356,_0x5551dc){return function(_0x69daa6){if(_0x69daa6){var _0x361f7f=typeof _0x5551dc['offset']===_0x3b2f('0xf')&&typeof _0x5551dc['limit']===_0x3b2f('0xf');var _0x91d539=_0x69daa6[_0x3b2f('0x10')];var _0x272796=_0x361f7f?0x0:_0x5551dc[_0x3b2f('0x11')];var _0x386be1=_0x361f7f?_0x69daa6[_0x3b2f('0x10')]:_0x5551dc[_0x3b2f('0x11')]+_0x5551dc[_0x3b2f('0x12')];var _0x1fba53;if(_0x386be1>=_0x91d539){_0x386be1=_0x91d539;_0x1fba53=0xc8;}else{_0x1fba53=0xce;}_0x46f356[_0x3b2f('0xc')](_0x1fba53);return _0x46f356[_0x3b2f('0x13')]('Content-Range',_0x272796+'-'+_0x386be1+'/'+_0x91d539)[_0x3b2f('0xe')](_0x69daa6);}return null;};}function removeEntity(_0x3448ff){return function(_0x22cfb3){if(_0x22cfb3){return _0x22cfb3[_0x3b2f('0x14')]()[_0x3b2f('0x15')](function(){var _0x5e33ec=_0x22cfb3[_0x3b2f('0x16')]({'plain':!![]});var _0x2c38c4=[{'name':_0x3b2f('0x17'),'value':_0x3b2f('0x18'),'ignore':![]},{'name':_0x3b2f('0x19'),'value':_0x3b2f('0x1a'),'ignore':![]},{'name':_0x3b2f('0x1b'),'value':'internal','ignore':![]}];var _0x24d2f0=_(_0x2c38c4)[_0x3b2f('0x1c')](_0x3b2f('0x1d'))[_0x3b2f('0x1e')]('value')[_0x3b2f('0x1f')]();if(_['includes'](_0x24d2f0,_0x5e33ec[_0x3b2f('0x20')])){return;}var _0x46b23e=_[_0x3b2f('0x21')](_0x2c38c4,[_0x3b2f('0x1f'),_0x5e33ec[_0x3b2f('0x20')]])[_0x3b2f('0x22')];return db[_0x3b2f('0x23')][_0x3b2f('0x14')]({'where':{'type':_0x46b23e,'resourceId':_0x5e33ec['id']}})[_0x3b2f('0x15')](function(){return _0x22cfb3;});})[_0x3b2f('0x15')](function(){_0x3448ff['status'](0xcc)[_0x3b2f('0xd')]();});}};}function handleEntityNotFound(_0x59f162){return function(_0xdeb540){if(!_0xdeb540){_0x59f162['sendStatus'](0x194);}return _0xdeb540;};}function handleError(_0x33652c,_0x5bde54){_0x5bde54=_0x5bde54||0x1f4;return function(_0x285c87){logger['error'](_0x285c87['stack']);if(_0x285c87[_0x3b2f('0x22')]){delete _0x285c87[_0x3b2f('0x22')];}_0x33652c[_0x3b2f('0xc')](_0x5bde54)[_0x3b2f('0x24')](_0x285c87);};}exports[_0x3b2f('0x25')]=function(_0x5c387b,_0xfa0c99){var _0x59f148={},_0x462cb5={},_0xcc2ad5={'count':0x0,'rows':[]};var _0x1f3f72=_[_0x3b2f('0x1e')](db[_0x3b2f('0x26')]['rawAttributes'],function(_0x46e347){return{'name':_0x46e347['fieldName'],'type':_0x46e347[_0x3b2f('0x20')][_0x3b2f('0x27')]};});_0x462cb5[_0x3b2f('0x28')]=_[_0x3b2f('0x1e')](_0x1f3f72,_0x3b2f('0x22'));_0x462cb5[_0x3b2f('0x29')]=_[_0x3b2f('0x2a')](_0x5c387b['query']);_0x462cb5[_0x3b2f('0x2b')]=_[_0x3b2f('0x2c')](_0x462cb5[_0x3b2f('0x28')],_0x462cb5['query']);_0x59f148[_0x3b2f('0x2d')]=_['intersection'](_0x462cb5[_0x3b2f('0x28')],qs[_0x3b2f('0x2e')](_0x5c387b['query'][_0x3b2f('0x2e')]));_0x59f148[_0x3b2f('0x2d')]=_0x59f148[_0x3b2f('0x2d')][_0x3b2f('0x2f')]?_0x59f148['attributes']:_0x462cb5['model'];if(!_0x5c387b[_0x3b2f('0x29')]['hasOwnProperty'](_0x3b2f('0x30'))){_0x59f148['limit']=qs[_0x3b2f('0x12')](_0x5c387b['query'][_0x3b2f('0x12')]);_0x59f148[_0x3b2f('0x11')]=qs['offset'](_0x5c387b[_0x3b2f('0x29')][_0x3b2f('0x11')]);}_0x59f148['order']=qs[_0x3b2f('0x31')](_0x5c387b[_0x3b2f('0x29')]['sort']);_0x59f148['where']=qs[_0x3b2f('0x2b')](_[_0x3b2f('0x32')](_0x5c387b[_0x3b2f('0x29')],_0x462cb5[_0x3b2f('0x2b')]),_0x1f3f72);if(_0x5c387b[_0x3b2f('0x29')]['filter']){_0x59f148[_0x3b2f('0x33')]=_[_0x3b2f('0x34')](_0x59f148['where'],{'$or':_[_0x3b2f('0x1e')](_0x1f3f72,function(_0x5d23cc){if(_0x5d23cc[_0x3b2f('0x20')]!==_0x3b2f('0x35')){var _0x2f12d4={};_0x2f12d4[_0x5d23cc[_0x3b2f('0x22')]]={'$like':'%'+_0x5c387b[_0x3b2f('0x29')][_0x3b2f('0x1c')]+'%'};return _0x2f12d4;}})});}_0x59f148=_[_0x3b2f('0x34')]({},_0x59f148,_0x5c387b[_0x3b2f('0x36')]);var _0x314b8b={'where':_0x59f148['where']};return db['VoiceExtension']['count'](_0x314b8b)['then'](function(_0x13f7cf){_0xcc2ad5['count']=_0x13f7cf;if(_0x5c387b[_0x3b2f('0x29')]['includeAll']){_0x59f148['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x3b2f('0x37')](_0x59f148);})[_0x3b2f('0x15')](function(_0x5acf3d){_0xcc2ad5[_0x3b2f('0x38')]=_0x5acf3d;return _0xcc2ad5;})[_0x3b2f('0x15')](respondWithFilteredResult(_0xfa0c99,_0x59f148))['catch'](handleError(_0xfa0c99,null));};exports[_0x3b2f('0x39')]=function(_0x275254,_0x175d6e){var _0x166fa6={'raw':![],'where':{'id':_0x275254['params']['id']}},_0x3f82ee={};_0x3f82ee[_0x3b2f('0x28')]=_['keys'](db['VoiceExtension'][_0x3b2f('0x3a')]);_0x3f82ee[_0x3b2f('0x29')]=_['keys'](_0x275254[_0x3b2f('0x29')]);_0x3f82ee[_0x3b2f('0x2b')]=_[_0x3b2f('0x2c')](_0x3f82ee[_0x3b2f('0x28')],_0x3f82ee[_0x3b2f('0x29')]);_0x166fa6[_0x3b2f('0x2d')]=_[_0x3b2f('0x2c')](_0x3f82ee[_0x3b2f('0x28')],qs[_0x3b2f('0x2e')](_0x275254[_0x3b2f('0x29')][_0x3b2f('0x2e')]));_0x166fa6[_0x3b2f('0x2d')]=_0x166fa6[_0x3b2f('0x2d')][_0x3b2f('0x2f')]?_0x166fa6[_0x3b2f('0x2d')]:_0x3f82ee[_0x3b2f('0x28')];if(_0x275254[_0x3b2f('0x29')][_0x3b2f('0x3b')]){_0x166fa6[_0x3b2f('0x3c')]=[{'all':!![]}];}_0x166fa6=_[_0x3b2f('0x34')]({},_0x166fa6,_0x275254['options']);return db['VoiceExtension'][_0x3b2f('0x21')](_0x166fa6)[_0x3b2f('0x15')](handleEntityNotFound(_0x175d6e,null))['then'](respondWithResult(_0x175d6e,null))[_0x3b2f('0x3d')](handleError(_0x175d6e,null));};exports['destroy']=function(_0x17a872,_0x4db532){return db['VoiceExtension'][_0x3b2f('0x21')]({'where':{'id':_0x17a872['params']['id']}})['then'](handleEntityNotFound(_0x4db532,null))[_0x3b2f('0x15')](removeEntity(_0x4db532,null))[_0x3b2f('0x3d')](handleError(_0x4db532,null));};exports[_0x3b2f('0x3e')]=function(_0x41f9f4,_0x70c6ed){if(_0x41f9f4[_0x3b2f('0x3f')][_0x3b2f('0x20')]==='outbound'&&!_[_0x3b2f('0x40')](_0x41f9f4[_0x3b2f('0x3f')][_0x3b2f('0x41')],'_')){_0x41f9f4['body'][_0x3b2f('0x41')]='_'[_0x3b2f('0x42')](_0x41f9f4[_0x3b2f('0x3f')]['exten']);}return db[_0x3b2f('0x26')]['create'](_0x41f9f4[_0x3b2f('0x3f')],{'raw':![]})[_0x3b2f('0x15')](function(_0x1c199f){var _0x3165cd=_0x41f9f4[_0x3b2f('0x43')]['get']({'plain':!![]});if(!_0x3165cd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3165cd[_0x3b2f('0x44')]===_0x3b2f('0x43')){var _0x4a9a47=_0x1c199f['get']({'plain':!![]});var _0x24abaf=[{'name':_0x3b2f('0x17'),'value':'inbound'},{'name':_0x3b2f('0x19'),'value':_0x3b2f('0x1a')},{'name':'InternalRoutes','value':'internal'}];var _0x30c1ad=_[_0x3b2f('0x21')](_0x24abaf,[_0x3b2f('0x1f'),_0x4a9a47[_0x3b2f('0x20')]])[_0x3b2f('0x22')];return db[_0x3b2f('0x45')][_0x3b2f('0x21')]({'where':{'name':_0x30c1ad,'userProfileId':_0x3165cd[_0x3b2f('0x46')]},'raw':!![]})['then'](function(_0x58385a){if(_0x58385a&&_0x58385a[_0x3b2f('0x47')]===0x0){return db[_0x3b2f('0x23')]['create']({'name':_0x4a9a47[_0x3b2f('0x22')],'resourceId':_0x4a9a47['id'],'type':_0x58385a[_0x3b2f('0x22')],'sectionId':_0x58385a['id']},{})[_0x3b2f('0x15')](function(){return _0x1c199f;});}else{return _0x1c199f;}})['catch'](function(_0x3d153e){logger[_0x3b2f('0x48')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d153e);throw _0x3d153e;});}return _0x1c199f;})[_0x3b2f('0x15')](respondWithResult(_0x70c6ed,0xc9))[_0x3b2f('0x3d')](handleError(_0x70c6ed,null));};exports[_0x3b2f('0x49')]=function(_0x346366,_0x5dd914){if(_0x346366['body']['id']){delete _0x346366[_0x3b2f('0x3f')]['id'];}return db[_0x3b2f('0x26')][_0x3b2f('0x21')]({'where':{'id':_0x346366[_0x3b2f('0x4a')]['id']}})[_0x3b2f('0x15')](handleEntityNotFound(_0x5dd914,null))[_0x3b2f('0x15')](function(_0x37a691){if(_0x37a691){return db[_0x3b2f('0x26')][_0x3b2f('0x49')](_[_0x3b2f('0x32')](_0x346366[_0x3b2f('0x3f')],[_0x3b2f('0x41'),_0x3b2f('0x4b'),_0x3b2f('0x4c'),_0x3b2f('0x4d'),_0x3b2f('0x4e'),_0x3b2f('0x4f'),_0x3b2f('0x50')]),{'where':{'context':_0x37a691['context'],'exten':_0x37a691[_0x3b2f('0x41')]},'individualHooks':!![]})[_0x3b2f('0x15')](function(_0x5d45c9){return _0x5d45c9;});}return null;})[_0x3b2f('0x15')](respondWithStatusCode(_0x5dd914,null))[_0x3b2f('0x3d')](handleError(_0x5dd914,null));};exports[_0x3b2f('0x51')]=function(_0x4a9f3b,_0x303856){var _0x39f24e=_0x4a9f3b['params']['id'];var _0x351d4a=_0x4a9f3b['body'];var _0x21ecaf=0xc8;var _0x3a39d8=null;return db[_0x3b2f('0x52')][_0x3b2f('0x53')]({'isolationLevel':db[_0x3b2f('0x52')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x4b883b){return db[_0x3b2f('0x26')][_0x3b2f('0x54')]({'where':{'id':_0x39f24e},'transaction':_0x4b883b})[_0x3b2f('0x15')](function(_0x298ec4){if(_0x298ec4){return db[_0x3b2f('0x26')][_0x3b2f('0x14')]({'where':{'VoiceExtensionId':_0x39f24e},'transaction':_0x4b883b})[_0x3b2f('0x15')](function(){var _0x3db20e=_[_0x3b2f('0x1e')](_0x351d4a,function(_0x126980){_0x126980[_0x3b2f('0x55')]=_0x39f24e;_0x126980[_0x3b2f('0x56')]=!![];return _0x126980;});return _0x298ec4[_0x3b2f('0x57')](_0x3db20e);})[_0x3b2f('0x15')](function(_0x3d2d29){return db['VoiceExtension'][_0x3b2f('0x58')](_0x3d2d29,{'transaction':_0x4b883b});});}else{_0x21ecaf=0x194;_0x3a39d8=[];}});})[_0x3b2f('0x15')](function(){if(_0x21ecaf!==0x194){return db[_0x3b2f('0x26')][_0x3b2f('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x39f24e},'order':_0x3b2f('0x5a')})['then'](function(_0x4e93f6){_0x3a39d8=_0x4e93f6;});}})[_0x3b2f('0x3d')](function(_0x4587d4){_0x21ecaf=0x1f4;logger[_0x3b2f('0x48')](_0x4587d4[_0x3b2f('0x5b')]);if(_0x4587d4[_0x3b2f('0x22')]){delete _0x4587d4[_0x3b2f('0x22')];}_0x3a39d8=_0x4587d4;})[_0x3b2f('0x5c')](function(){if(_0x3a39d8===null){_0x303856[_0x3b2f('0x5d')](_0x21ecaf);}else{if(_0x21ecaf===0x1f4){_0x303856[_0x3b2f('0xc')](_0x21ecaf)[_0x3b2f('0x24')](_0x3a39d8);}else{_0x303856[_0x3b2f('0xc')](_0x21ecaf)['json'](_0x3a39d8);}}});};
\ No newline at end of file