Built motion from commit fe909640.|2.6.8
[motion2.git] / server / api / voiceExtension / voiceExtension.controller.js
index f84fcf6..4f6774a 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x8b94=['get','OutboundRoutes','outbound','internal','filter','ignore','map','value','includes','find','type','name','UserProfileResource','destroy','end','error','send','index','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','options','VoiceExtension','includeAll','include','findAll','rows','catch','params','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','inbound','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','socket.io-emitter','redis','./voiceExtension.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','then'];(function(_0x46b17c,_0x2f5eed){var _0x3507ae=function(_0x4aa95c){while(--_0x4aa95c){_0x46b17c['push'](_0x46b17c['shift']());}};_0x3507ae(++_0x2f5eed);}(_0x8b94,0xa2));var _0x48b9=function(_0x4ff97e,_0x2e4df0){_0x4ff97e=_0x4ff97e-0x0;var _0x14493a=_0x8b94[_0x4ff97e];return _0x14493a;};'use strict';var _=require(_0x48b9('0x0'));var Redis=require(_0x48b9('0x1'));var qs=require(_0x48b9('0x2'));var logger=require(_0x48b9('0x3'))('api');var config=require(_0x48b9('0x4'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x48b9('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x48b9('0x6'))(new Redis(config[_0x48b9('0x7')]));require(_0x48b9('0x8'))['register'](socket);function respondWithStatusCode(_0x282c7e,_0x2f78dd){_0x2f78dd=_0x2f78dd||0xcc;return function(_0x4a7f2f){if(_0x4a7f2f){return _0x282c7e[_0x48b9('0x9')](_0x2f78dd);}return _0x282c7e['status'](_0x2f78dd)['end']();};}function respondWithResult(_0xd4a061,_0x5de071){_0x5de071=_0x5de071||0xc8;return function(_0x19efd9){if(_0x19efd9){return _0xd4a061[_0x48b9('0xa')](_0x5de071)[_0x48b9('0xb')](_0x19efd9);}};}function respondWithFilteredResult(_0x2c7dd1,_0x18239a){return function(_0x308a8c){if(_0x308a8c){var _0x10c90f=typeof _0x18239a[_0x48b9('0xc')]===_0x48b9('0xd')&&typeof _0x18239a[_0x48b9('0xe')]===_0x48b9('0xd');var _0x2267ac=_0x308a8c[_0x48b9('0xf')];var _0x3ea1e1=_0x10c90f?0x0:_0x18239a[_0x48b9('0xc')];var _0xc82b99=_0x10c90f?_0x308a8c[_0x48b9('0xf')]:_0x18239a['offset']+_0x18239a[_0x48b9('0xe')];var _0x5b3052;if(_0xc82b99>=_0x2267ac){_0xc82b99=_0x2267ac;_0x5b3052=0xc8;}else{_0x5b3052=0xce;}_0x2c7dd1[_0x48b9('0xa')](_0x5b3052);return _0x2c7dd1['set'](_0x48b9('0x10'),_0x3ea1e1+'-'+_0xc82b99+'/'+_0x2267ac)[_0x48b9('0xb')](_0x308a8c);}return null;};}function removeEntity(_0x282193){return function(_0x1dce9a){if(_0x1dce9a){return _0x1dce9a['destroy']()[_0x48b9('0x11')](function(){var _0xc00c00=_0x1dce9a[_0x48b9('0x12')]({'plain':!![]});var _0x40f59e=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x48b9('0x13'),'value':_0x48b9('0x14'),'ignore':![]},{'name':'InternalRoutes','value':_0x48b9('0x15'),'ignore':![]}];var _0xdd0840=_(_0x40f59e)[_0x48b9('0x16')](_0x48b9('0x17'))[_0x48b9('0x18')](_0x48b9('0x19'))[_0x48b9('0x19')]();if(_[_0x48b9('0x1a')](_0xdd0840,_0xc00c00['type'])){return;}var _0x39e7e0=_[_0x48b9('0x1b')](_0x40f59e,['value',_0xc00c00[_0x48b9('0x1c')]])[_0x48b9('0x1d')];return db[_0x48b9('0x1e')][_0x48b9('0x1f')]({'where':{'type':_0x39e7e0,'resourceId':_0xc00c00['id']}})['then'](function(){return _0x1dce9a;});})[_0x48b9('0x11')](function(){_0x282193['status'](0xcc)[_0x48b9('0x20')]();});}};}function handleEntityNotFound(_0x28b25d){return function(_0x2e841a){if(!_0x2e841a){_0x28b25d['sendStatus'](0x194);}return _0x2e841a;};}function handleError(_0x159ca0,_0x5d6ce1){_0x5d6ce1=_0x5d6ce1||0x1f4;return function(_0x415474){logger[_0x48b9('0x21')](_0x415474['stack']);if(_0x415474['name']){delete _0x415474[_0x48b9('0x1d')];}_0x159ca0[_0x48b9('0xa')](_0x5d6ce1)[_0x48b9('0x22')](_0x415474);};}exports[_0x48b9('0x23')]=function(_0xf7d8db,_0x484429){var _0x1aad52={},_0x26d6da={},_0x3f5046={'count':0x0,'rows':[]};var _0x2b3d7f=_[_0x48b9('0x18')](db['VoiceExtension'][_0x48b9('0x24')],function(_0x16230e){return{'name':_0x16230e[_0x48b9('0x25')],'type':_0x16230e['type']['key']};});_0x26d6da[_0x48b9('0x26')]=_[_0x48b9('0x18')](_0x2b3d7f,_0x48b9('0x1d'));_0x26d6da['query']=_[_0x48b9('0x27')](_0xf7d8db[_0x48b9('0x28')]);_0x26d6da[_0x48b9('0x29')]=_[_0x48b9('0x2a')](_0x26d6da[_0x48b9('0x26')],_0x26d6da[_0x48b9('0x28')]);_0x1aad52['attributes']=_[_0x48b9('0x2a')](_0x26d6da[_0x48b9('0x26')],qs[_0x48b9('0x2b')](_0xf7d8db['query']['fields']));_0x1aad52[_0x48b9('0x2c')]=_0x1aad52[_0x48b9('0x2c')][_0x48b9('0x2d')]?_0x1aad52[_0x48b9('0x2c')]:_0x26d6da['model'];if(!_0xf7d8db[_0x48b9('0x28')][_0x48b9('0x2e')]('nolimit')){_0x1aad52['limit']=qs[_0x48b9('0xe')](_0xf7d8db[_0x48b9('0x28')][_0x48b9('0xe')]);_0x1aad52['offset']=qs[_0x48b9('0xc')](_0xf7d8db['query'][_0x48b9('0xc')]);}_0x1aad52[_0x48b9('0x2f')]=qs[_0x48b9('0x30')](_0xf7d8db['query'][_0x48b9('0x30')]);_0x1aad52['where']=qs[_0x48b9('0x29')](_[_0x48b9('0x31')](_0xf7d8db[_0x48b9('0x28')],_0x26d6da[_0x48b9('0x29')]),_0x2b3d7f);if(_0xf7d8db[_0x48b9('0x28')][_0x48b9('0x16')]){_0x1aad52[_0x48b9('0x32')]=_[_0x48b9('0x33')](_0x1aad52[_0x48b9('0x32')],{'$or':_[_0x48b9('0x18')](_0x2b3d7f,function(_0x2f2f8b){if(_0x2f2f8b[_0x48b9('0x1c')]!==_0x48b9('0x34')){var _0x197c5d={};_0x197c5d[_0x2f2f8b[_0x48b9('0x1d')]]={'$like':'%'+_0xf7d8db[_0x48b9('0x28')][_0x48b9('0x16')]+'%'};return _0x197c5d;}})});}_0x1aad52=_[_0x48b9('0x33')]({},_0x1aad52,_0xf7d8db[_0x48b9('0x35')]);var _0x3b6180={'where':_0x1aad52[_0x48b9('0x32')]};return db[_0x48b9('0x36')]['count'](_0x3b6180)['then'](function(_0x510e94){_0x3f5046[_0x48b9('0xf')]=_0x510e94;if(_0xf7d8db[_0x48b9('0x28')][_0x48b9('0x37')]){_0x1aad52[_0x48b9('0x38')]=[{'all':!![]}];}return db[_0x48b9('0x36')][_0x48b9('0x39')](_0x1aad52);})[_0x48b9('0x11')](function(_0x3d9214){_0x3f5046[_0x48b9('0x3a')]=_0x3d9214;return _0x3f5046;})['then'](respondWithFilteredResult(_0x484429,_0x1aad52))[_0x48b9('0x3b')](handleError(_0x484429,null));};exports['show']=function(_0x975ce5,_0x22a383){var _0x15ba79={'raw':![],'where':{'id':_0x975ce5['params']['id']}},_0x5bbe6c={};_0x5bbe6c[_0x48b9('0x26')]=_['keys'](db[_0x48b9('0x36')][_0x48b9('0x24')]);_0x5bbe6c[_0x48b9('0x28')]=_[_0x48b9('0x27')](_0x975ce5[_0x48b9('0x28')]);_0x5bbe6c[_0x48b9('0x29')]=_['intersection'](_0x5bbe6c[_0x48b9('0x26')],_0x5bbe6c[_0x48b9('0x28')]);_0x15ba79[_0x48b9('0x2c')]=_[_0x48b9('0x2a')](_0x5bbe6c['model'],qs[_0x48b9('0x2b')](_0x975ce5['query'][_0x48b9('0x2b')]));_0x15ba79[_0x48b9('0x2c')]=_0x15ba79[_0x48b9('0x2c')][_0x48b9('0x2d')]?_0x15ba79[_0x48b9('0x2c')]:_0x5bbe6c[_0x48b9('0x26')];if(_0x975ce5['query']['includeAll']){_0x15ba79['include']=[{'all':!![]}];}_0x15ba79=_[_0x48b9('0x33')]({},_0x15ba79,_0x975ce5[_0x48b9('0x35')]);return db[_0x48b9('0x36')][_0x48b9('0x1b')](_0x15ba79)['then'](handleEntityNotFound(_0x22a383,null))[_0x48b9('0x11')](respondWithResult(_0x22a383,null))[_0x48b9('0x3b')](handleError(_0x22a383,null));};exports[_0x48b9('0x1f')]=function(_0x5b6cb7,_0x3829a3){return db[_0x48b9('0x36')][_0x48b9('0x1b')]({'where':{'id':_0x5b6cb7[_0x48b9('0x3c')]['id']}})[_0x48b9('0x11')](handleEntityNotFound(_0x3829a3,null))[_0x48b9('0x11')](removeEntity(_0x3829a3,null))[_0x48b9('0x3b')](handleError(_0x3829a3,null));};exports[_0x48b9('0x3d')]=function(_0x47da07,_0x3344a2){if(_0x47da07[_0x48b9('0x3e')][_0x48b9('0x1c')]===_0x48b9('0x14')&&!_[_0x48b9('0x3f')](_0x47da07[_0x48b9('0x3e')]['exten'],'_')){_0x47da07[_0x48b9('0x3e')][_0x48b9('0x40')]='_'['concat'](_0x47da07[_0x48b9('0x3e')]['exten']);}return db['VoiceExtension']['create'](_0x47da07[_0x48b9('0x3e')],{'raw':![]})['then'](function(_0xece882){var _0x2722b1=_0x47da07[_0x48b9('0x41')][_0x48b9('0x12')]({'plain':!![]});if(!_0x2722b1)throw new Error(_0x48b9('0x42'));if(_0x2722b1['role']===_0x48b9('0x41')){var _0x1b5407=_0xece882[_0x48b9('0x12')]({'plain':!![]});var _0xcb567=[{'name':'InboundRoutes','value':_0x48b9('0x43')},{'name':_0x48b9('0x13'),'value':_0x48b9('0x14')},{'name':_0x48b9('0x44'),'value':_0x48b9('0x15')}];var _0xcef165=_['find'](_0xcb567,[_0x48b9('0x19'),_0x1b5407[_0x48b9('0x1c')]])[_0x48b9('0x1d')];return db[_0x48b9('0x45')][_0x48b9('0x1b')]({'where':{'name':_0xcef165,'userProfileId':_0x2722b1[_0x48b9('0x46')]},'raw':!![]})[_0x48b9('0x11')](function(_0x164972){if(_0x164972&&_0x164972[_0x48b9('0x47')]===0x0){return db[_0x48b9('0x1e')]['create']({'name':_0x1b5407['name'],'resourceId':_0x1b5407['id'],'type':_0x164972['name'],'sectionId':_0x164972['id']},{})[_0x48b9('0x11')](function(){return _0xece882;});}else{return _0xece882;}})[_0x48b9('0x3b')](function(_0x5433ae){logger['error'](_0x48b9('0x48'),_0x5433ae);throw _0x5433ae;});}return _0xece882;})[_0x48b9('0x11')](respondWithResult(_0x3344a2,0xc9))[_0x48b9('0x3b')](handleError(_0x3344a2,null));};exports['update']=function(_0x39f7f1,_0x33c6a6){if(_0x39f7f1[_0x48b9('0x3e')]['id']){delete _0x39f7f1['body']['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x39f7f1[_0x48b9('0x3c')]['id']}})['then'](handleEntityNotFound(_0x33c6a6,null))[_0x48b9('0x11')](function(_0x3cad9a){if(_0x3cad9a){return db[_0x48b9('0x36')]['update'](_[_0x48b9('0x31')](_0x39f7f1[_0x48b9('0x3e')],[_0x48b9('0x40'),_0x48b9('0x49'),_0x48b9('0x4a'),_0x48b9('0x4b'),'cutdigits',_0x48b9('0x4c'),_0x48b9('0x4d')]),{'where':{'context':_0x3cad9a['context'],'exten':_0x3cad9a[_0x48b9('0x40')]},'individualHooks':!![]})[_0x48b9('0x11')](function(_0x2b5a81){return _0x2b5a81;});}return null;})['then'](respondWithStatusCode(_0x33c6a6,null))[_0x48b9('0x3b')](handleError(_0x33c6a6,null));};exports[_0x48b9('0x4e')]=function(_0x37674b,_0x1a098b){var _0x4d75bd=_0x37674b[_0x48b9('0x3c')]['id'];var _0x119384=_0x37674b['body'];var _0x3be3b0=0xc8;var _0x141023=null;return db['sequelize'][_0x48b9('0x4f')]({'isolationLevel':db[_0x48b9('0x50')]['Transaction'][_0x48b9('0x51')][_0x48b9('0x52')]},function(_0x2bbf93){return db[_0x48b9('0x36')]['findOne']({'where':{'id':_0x4d75bd},'transaction':_0x2bbf93})[_0x48b9('0x11')](function(_0xd52350){if(_0xd52350){return db['VoiceExtension'][_0x48b9('0x1f')]({'where':{'VoiceExtensionId':_0x4d75bd},'transaction':_0x2bbf93})['then'](function(){var _0x4398d9=_[_0x48b9('0x18')](_0x119384,function(_0x5b4d97){_0x5b4d97[_0x48b9('0x53')]=_0x4d75bd;_0x5b4d97['isApp']=!![];return _0x5b4d97;});return _0xd52350[_0x48b9('0x54')](_0x4398d9);})[_0x48b9('0x11')](function(_0x273cb7){return db[_0x48b9('0x36')][_0x48b9('0x55')](_0x273cb7,{'transaction':_0x2bbf93});});}else{_0x3be3b0=0x194;_0x141023=[];}});})['then'](function(){if(_0x3be3b0!==0x194){return db[_0x48b9('0x36')][_0x48b9('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x4d75bd},'order':_0x48b9('0x57')})['then'](function(_0x299706){_0x141023=_0x299706;});}})['catch'](function(_0x4fee6d){_0x3be3b0=0x1f4;logger['error'](_0x4fee6d[_0x48b9('0x58')]);if(_0x4fee6d[_0x48b9('0x1d')]){delete _0x4fee6d[_0x48b9('0x1d')];}_0x141023=_0x4fee6d;})[_0x48b9('0x59')](function(){if(_0x141023===null){_0x1a098b[_0x48b9('0x9')](_0x3be3b0);}else{if(_0x3be3b0===0x1f4){_0x1a098b[_0x48b9('0xa')](_0x3be3b0)[_0x48b9('0x22')](_0x141023);}else{_0x1a098b[_0x48b9('0xa')](_0x3be3b0)[_0x48b9('0xb')](_0x141023);}}});};
\ No newline at end of file
+var _0x56cd=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','count','limit','set','Content-Range','then','get','InboundRoutes','OutboundRoutes','outbound','internal','filter','ignore','map','value','find','type','destroy','error','stack','name','send','index','VoiceExtension','rawAttributes','key','model','query','attributes','intersection','fields','length','order','sort','where','filters','pick','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','keys','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','inbound','UserProfileSection','autoAssociation','UserProfileResource','update','context','description','recordingFormat','cutdigits','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x4931f6,_0x434de8){var _0x4efb0d=function(_0x59e7eb){while(--_0x59e7eb){_0x4931f6['push'](_0x4931f6['shift']());}};_0x4efb0d(++_0x434de8);}(_0x56cd,0x10c));var _0xd56c=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x56cd[_0x565c49];return _0x20ca34;};'use strict';var _=require(_0xd56c('0x0'));var Redis=require(_0xd56c('0x1'));var qs=require(_0xd56c('0x2'));var logger=require(_0xd56c('0x3'))(_0xd56c('0x4'));var config=require(_0xd56c('0x5'));var db=require(_0xd56c('0x6'))['db'];config[_0xd56c('0x7')]=_[_0xd56c('0x8')](config[_0xd56c('0x7')],{'host':_0xd56c('0x9'),'port':0x18eb});var socket=require(_0xd56c('0xa'))(new Redis(config[_0xd56c('0x7')]));require(_0xd56c('0xb'))[_0xd56c('0xc')](socket);function respondWithStatusCode(_0x24bb11,_0x4504b9){_0x4504b9=_0x4504b9||0xcc;return function(_0x27eef2){if(_0x27eef2){return _0x24bb11[_0xd56c('0xd')](_0x4504b9);}return _0x24bb11[_0xd56c('0xe')](_0x4504b9)[_0xd56c('0xf')]();};}function respondWithResult(_0x3397a1,_0x273cba){_0x273cba=_0x273cba||0xc8;return function(_0x298d80){if(_0x298d80){return _0x3397a1[_0xd56c('0xe')](_0x273cba)[_0xd56c('0x10')](_0x298d80);}};}function respondWithFilteredResult(_0x4f7434,_0x50e94a){return function(_0x54c3ed){if(_0x54c3ed){var _0x44e5f8=typeof _0x50e94a[_0xd56c('0x11')]==='undefined'&&typeof _0x50e94a['limit']==='undefined';var _0x4c63e7=_0x54c3ed[_0xd56c('0x12')];var _0x278829=_0x44e5f8?0x0:_0x50e94a[_0xd56c('0x11')];var _0x4c68bf=_0x44e5f8?_0x54c3ed[_0xd56c('0x12')]:_0x50e94a[_0xd56c('0x11')]+_0x50e94a[_0xd56c('0x13')];var _0x3d7b42;if(_0x4c68bf>=_0x4c63e7){_0x4c68bf=_0x4c63e7;_0x3d7b42=0xc8;}else{_0x3d7b42=0xce;}_0x4f7434[_0xd56c('0xe')](_0x3d7b42);return _0x4f7434[_0xd56c('0x14')](_0xd56c('0x15'),_0x278829+'-'+_0x4c68bf+'/'+_0x4c63e7)[_0xd56c('0x10')](_0x54c3ed);}return null;};}function removeEntity(_0x322727){return function(_0x419f21){if(_0x419f21){return _0x419f21['destroy']()[_0xd56c('0x16')](function(){var _0x2a4304=_0x419f21[_0xd56c('0x17')]({'plain':!![]});var _0x1fb04e=[{'name':_0xd56c('0x18'),'value':'inbound','ignore':![]},{'name':_0xd56c('0x19'),'value':_0xd56c('0x1a'),'ignore':![]},{'name':'InternalRoutes','value':_0xd56c('0x1b'),'ignore':![]}];var _0x44392e=_(_0x1fb04e)[_0xd56c('0x1c')](_0xd56c('0x1d'))[_0xd56c('0x1e')](_0xd56c('0x1f'))[_0xd56c('0x1f')]();if(_['includes'](_0x44392e,_0x2a4304['type'])){return;}var _0x1718ee=_[_0xd56c('0x20')](_0x1fb04e,[_0xd56c('0x1f'),_0x2a4304[_0xd56c('0x21')]])['name'];return db['UserProfileResource'][_0xd56c('0x22')]({'where':{'type':_0x1718ee,'resourceId':_0x2a4304['id']}})[_0xd56c('0x16')](function(){return _0x419f21;});})[_0xd56c('0x16')](function(){_0x322727[_0xd56c('0xe')](0xcc)[_0xd56c('0xf')]();});}};}function handleEntityNotFound(_0x11f26f){return function(_0x1b9adb){if(!_0x1b9adb){_0x11f26f[_0xd56c('0xd')](0x194);}return _0x1b9adb;};}function handleError(_0x45a603,_0x1a2ca2){_0x1a2ca2=_0x1a2ca2||0x1f4;return function(_0x1e8f03){logger[_0xd56c('0x23')](_0x1e8f03[_0xd56c('0x24')]);if(_0x1e8f03[_0xd56c('0x25')]){delete _0x1e8f03[_0xd56c('0x25')];}_0x45a603['status'](_0x1a2ca2)[_0xd56c('0x26')](_0x1e8f03);};}exports[_0xd56c('0x27')]=function(_0xacc39b,_0x4095d7){var _0x21f1b5={},_0x291723={},_0x2cc45b={'count':0x0,'rows':[]};var _0x270303=_[_0xd56c('0x1e')](db[_0xd56c('0x28')][_0xd56c('0x29')],function(_0x283416){return{'name':_0x283416['fieldName'],'type':_0x283416['type'][_0xd56c('0x2a')]};});_0x291723[_0xd56c('0x2b')]=_['map'](_0x270303,_0xd56c('0x25'));_0x291723['query']=_['keys'](_0xacc39b[_0xd56c('0x2c')]);_0x291723['filters']=_['intersection'](_0x291723[_0xd56c('0x2b')],_0x291723[_0xd56c('0x2c')]);_0x21f1b5[_0xd56c('0x2d')]=_[_0xd56c('0x2e')](_0x291723[_0xd56c('0x2b')],qs[_0xd56c('0x2f')](_0xacc39b[_0xd56c('0x2c')][_0xd56c('0x2f')]));_0x21f1b5['attributes']=_0x21f1b5[_0xd56c('0x2d')][_0xd56c('0x30')]?_0x21f1b5[_0xd56c('0x2d')]:_0x291723['model'];if(!_0xacc39b[_0xd56c('0x2c')]['hasOwnProperty']('nolimit')){_0x21f1b5['limit']=qs['limit'](_0xacc39b[_0xd56c('0x2c')][_0xd56c('0x13')]);_0x21f1b5[_0xd56c('0x11')]=qs[_0xd56c('0x11')](_0xacc39b[_0xd56c('0x2c')][_0xd56c('0x11')]);}_0x21f1b5[_0xd56c('0x31')]=qs['sort'](_0xacc39b[_0xd56c('0x2c')][_0xd56c('0x32')]);_0x21f1b5[_0xd56c('0x33')]=qs[_0xd56c('0x34')](_[_0xd56c('0x35')](_0xacc39b[_0xd56c('0x2c')],_0x291723[_0xd56c('0x34')]),_0x270303);if(_0xacc39b[_0xd56c('0x2c')]['filter']){_0x21f1b5[_0xd56c('0x33')]=_['merge'](_0x21f1b5[_0xd56c('0x33')],{'$or':_[_0xd56c('0x1e')](_0x270303,function(_0x3eb072){if(_0x3eb072['type']!==_0xd56c('0x36')){var _0x2ed089={};_0x2ed089[_0x3eb072[_0xd56c('0x25')]]={'$like':'%'+_0xacc39b[_0xd56c('0x2c')][_0xd56c('0x1c')]+'%'};return _0x2ed089;}})});}_0x21f1b5=_[_0xd56c('0x37')]({},_0x21f1b5,_0xacc39b[_0xd56c('0x38')]);var _0x334a6c={'where':_0x21f1b5['where']};return db[_0xd56c('0x28')][_0xd56c('0x12')](_0x334a6c)[_0xd56c('0x16')](function(_0x3445e9){_0x2cc45b[_0xd56c('0x12')]=_0x3445e9;if(_0xacc39b[_0xd56c('0x2c')][_0xd56c('0x39')]){_0x21f1b5[_0xd56c('0x3a')]=[{'all':!![]}];}return db[_0xd56c('0x28')][_0xd56c('0x3b')](_0x21f1b5);})[_0xd56c('0x16')](function(_0x4c17a1){_0x2cc45b['rows']=_0x4c17a1;return _0x2cc45b;})[_0xd56c('0x16')](respondWithFilteredResult(_0x4095d7,_0x21f1b5))[_0xd56c('0x3c')](handleError(_0x4095d7,null));};exports[_0xd56c('0x3d')]=function(_0x468a9f,_0x9e2a57){var _0x100da3={'raw':![],'where':{'id':_0x468a9f[_0xd56c('0x3e')]['id']}},_0x5a0678={};_0x5a0678[_0xd56c('0x2b')]=_[_0xd56c('0x3f')](db['VoiceExtension'][_0xd56c('0x29')]);_0x5a0678[_0xd56c('0x2c')]=_[_0xd56c('0x3f')](_0x468a9f[_0xd56c('0x2c')]);_0x5a0678[_0xd56c('0x34')]=_[_0xd56c('0x2e')](_0x5a0678[_0xd56c('0x2b')],_0x5a0678['query']);_0x100da3[_0xd56c('0x2d')]=_['intersection'](_0x5a0678[_0xd56c('0x2b')],qs['fields'](_0x468a9f[_0xd56c('0x2c')][_0xd56c('0x2f')]));_0x100da3[_0xd56c('0x2d')]=_0x100da3[_0xd56c('0x2d')][_0xd56c('0x30')]?_0x100da3[_0xd56c('0x2d')]:_0x5a0678['model'];if(_0x468a9f[_0xd56c('0x2c')][_0xd56c('0x39')]){_0x100da3[_0xd56c('0x3a')]=[{'all':!![]}];}_0x100da3=_[_0xd56c('0x37')]({},_0x100da3,_0x468a9f['options']);return db[_0xd56c('0x28')][_0xd56c('0x20')](_0x100da3)[_0xd56c('0x16')](handleEntityNotFound(_0x9e2a57,null))[_0xd56c('0x16')](respondWithResult(_0x9e2a57,null))[_0xd56c('0x3c')](handleError(_0x9e2a57,null));};exports['destroy']=function(_0x2ab366,_0x100042){return db[_0xd56c('0x28')][_0xd56c('0x20')]({'where':{'id':_0x2ab366[_0xd56c('0x3e')]['id']}})[_0xd56c('0x16')](handleEntityNotFound(_0x100042,null))[_0xd56c('0x16')](removeEntity(_0x100042,null))[_0xd56c('0x3c')](handleError(_0x100042,null));};exports[_0xd56c('0x40')]=function(_0x7aa165,_0x1f40a3){if(_0x7aa165[_0xd56c('0x41')][_0xd56c('0x21')]===_0xd56c('0x1a')&&!_[_0xd56c('0x42')](_0x7aa165[_0xd56c('0x41')][_0xd56c('0x43')],'_')){_0x7aa165[_0xd56c('0x41')][_0xd56c('0x43')]='_'['concat'](_0x7aa165['body'][_0xd56c('0x43')]);}return db[_0xd56c('0x28')][_0xd56c('0x40')](_0x7aa165[_0xd56c('0x41')],{'raw':![]})['then'](function(_0x19f1ec){var _0x55af65=_0x7aa165[_0xd56c('0x44')][_0xd56c('0x17')]({'plain':!![]});if(!_0x55af65)throw new Error(_0xd56c('0x45'));if(_0x55af65[_0xd56c('0x46')]==='user'){var _0x58c39e=_0x19f1ec['get']({'plain':!![]});var _0x5d3b00=[{'name':_0xd56c('0x18'),'value':_0xd56c('0x47')},{'name':_0xd56c('0x19'),'value':_0xd56c('0x1a')},{'name':'InternalRoutes','value':_0xd56c('0x1b')}];var _0x1e039c=_[_0xd56c('0x20')](_0x5d3b00,[_0xd56c('0x1f'),_0x58c39e[_0xd56c('0x21')]])[_0xd56c('0x25')];return db[_0xd56c('0x48')][_0xd56c('0x20')]({'where':{'name':_0x1e039c,'userProfileId':_0x55af65['userProfileId']},'raw':!![]})[_0xd56c('0x16')](function(_0x603c6b){if(_0x603c6b&&_0x603c6b[_0xd56c('0x49')]===0x0){return db[_0xd56c('0x4a')]['create']({'name':_0x58c39e[_0xd56c('0x25')],'resourceId':_0x58c39e['id'],'type':_0x603c6b[_0xd56c('0x25')],'sectionId':_0x603c6b['id']},{})[_0xd56c('0x16')](function(){return _0x19f1ec;});}else{return _0x19f1ec;}})[_0xd56c('0x3c')](function(_0x11891e){logger[_0xd56c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x11891e);throw _0x11891e;});}return _0x19f1ec;})[_0xd56c('0x16')](respondWithResult(_0x1f40a3,0xc9))['catch'](handleError(_0x1f40a3,null));};exports[_0xd56c('0x4b')]=function(_0x14bb4d,_0x4fc0aa){if(_0x14bb4d[_0xd56c('0x41')]['id']){delete _0x14bb4d[_0xd56c('0x41')]['id'];}return db[_0xd56c('0x28')][_0xd56c('0x20')]({'where':{'id':_0x14bb4d['params']['id']}})[_0xd56c('0x16')](handleEntityNotFound(_0x4fc0aa,null))['then'](function(_0x4190bc){if(_0x4190bc){return db[_0xd56c('0x28')][_0xd56c('0x4b')](_[_0xd56c('0x35')](_0x14bb4d[_0xd56c('0x41')],[_0xd56c('0x43'),_0xd56c('0x4c'),_0xd56c('0x4d'),_0xd56c('0x4e'),_0xd56c('0x4f'),'mandatoryDisposition','alias']),{'where':{'context':_0x4190bc['context'],'exten':_0x4190bc[_0xd56c('0x43')]},'individualHooks':!![]})[_0xd56c('0x16')](function(_0x3399de){return _0x3399de;});}return null;})[_0xd56c('0x16')](respondWithStatusCode(_0x4fc0aa,null))['catch'](handleError(_0x4fc0aa,null));};exports[_0xd56c('0x50')]=function(_0xb5a717,_0x4c2806){var _0x29c8d3=_0xb5a717[_0xd56c('0x3e')]['id'];var _0x14b0e0=_0xb5a717['body'];var _0x27d179=0xc8;var _0x4dac25=null;return db[_0xd56c('0x51')][_0xd56c('0x52')]({'isolationLevel':db['sequelize'][_0xd56c('0x53')][_0xd56c('0x54')][_0xd56c('0x55')]},function(_0x1d580d){return db[_0xd56c('0x28')][_0xd56c('0x56')]({'where':{'id':_0x29c8d3},'transaction':_0x1d580d})[_0xd56c('0x16')](function(_0x1a60c6){if(_0x1a60c6){return db[_0xd56c('0x28')][_0xd56c('0x22')]({'where':{'VoiceExtensionId':_0x29c8d3},'transaction':_0x1d580d})[_0xd56c('0x16')](function(){var _0x2bb6b0=_[_0xd56c('0x1e')](_0x14b0e0,function(_0x2e1ad8){_0x2e1ad8['VoiceExtensionId']=_0x29c8d3;_0x2e1ad8[_0xd56c('0x57')]=!![];return _0x2e1ad8;});return _0x1a60c6[_0xd56c('0x58')](_0x2bb6b0);})[_0xd56c('0x16')](function(_0x40e270){return db[_0xd56c('0x28')][_0xd56c('0x59')](_0x40e270,{'transaction':_0x1d580d});});}else{_0x27d179=0x194;_0x4dac25=[];}});})[_0xd56c('0x16')](function(){if(_0x27d179!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x29c8d3},'order':'cast(priority\x20as\x20unsigned)'})['then'](function(_0x2735ea){_0x4dac25=_0x2735ea;});}})[_0xd56c('0x3c')](function(_0x2a18d6){_0x27d179=0x1f4;logger[_0xd56c('0x23')](_0x2a18d6[_0xd56c('0x24')]);if(_0x2a18d6[_0xd56c('0x25')]){delete _0x2a18d6[_0xd56c('0x25')];}_0x4dac25=_0x2a18d6;})[_0xd56c('0x5a')](function(){if(_0x4dac25===null){_0x4c2806['sendStatus'](_0x27d179);}else{if(_0x27d179===0x1f4){_0x4c2806[_0xd56c('0xe')](_0x27d179)['send'](_0x4dac25);}else{_0x4c2806[_0xd56c('0xe')](_0x27d179)[_0xd56c('0x10')](_0x4dac25);}}});};
\ No newline at end of file