Built motion from commit d6d69adf.|2.6.33
[motion2.git] / server / api / voiceExtension / voiceExtension.controller.js
index 6ba21e2..a3f3f42 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0xaf98=['ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','undefined','limit','offset','count','set','Content-Range','json','destroy','then','OutboundRoutes','outbound','InternalRoutes','internal','ignore','map','value','includes','find','type','name','UserProfileResource','end','error','stack','send','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','VoiceExtension','includeAll','include','findAll','rows','catch','params','fields','create','body','startsWith','exten','concat','get','user','InboundRoutes','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction'];(function(_0x1227c0,_0x5d91ee){var _0x557d9d=function(_0xdd29c4){while(--_0xdd29c4){_0x1227c0['push'](_0x1227c0['shift']());}};_0x557d9d(++_0x5d91ee);}(_0xaf98,0x69));var _0x8af9=function(_0x259ac7,_0x3c65c6){_0x259ac7=_0x259ac7-0x0;var _0x185b01=_0xaf98[_0x259ac7];return _0x185b01;};'use strict';var _=require('lodash');var Redis=require(_0x8af9('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x8af9('0x1'))('api');var config=require(_0x8af9('0x2'));var db=require(_0x8af9('0x3'))['db'];config[_0x8af9('0x4')]=_[_0x8af9('0x5')](config[_0x8af9('0x4')],{'host':_0x8af9('0x6'),'port':0x18eb});var socket=require(_0x8af9('0x7'))(new Redis(config[_0x8af9('0x4')]));require('./voiceExtension.socket')[_0x8af9('0x8')](socket);function respondWithStatusCode(_0x578e82,_0x5b93db){_0x5b93db=_0x5b93db||0xcc;return function(_0x149343){if(_0x149343){return _0x578e82[_0x8af9('0x9')](_0x5b93db);}return _0x578e82[_0x8af9('0xa')](_0x5b93db)['end']();};}function respondWithResult(_0x1f0a3d,_0x1a0882){_0x1a0882=_0x1a0882||0xc8;return function(_0x4ff400){if(_0x4ff400){return _0x1f0a3d[_0x8af9('0xa')](_0x1a0882)['json'](_0x4ff400);}};}function respondWithFilteredResult(_0x4a5c12,_0x1f9523){return function(_0x831ffa){if(_0x831ffa){var _0x5171c4=typeof _0x1f9523['offset']===_0x8af9('0xb')&&typeof _0x1f9523[_0x8af9('0xc')]===_0x8af9('0xb');var _0x2ac93f=_0x831ffa['count'];var _0x4234dd=_0x5171c4?0x0:_0x1f9523[_0x8af9('0xd')];var _0x5d5794=_0x5171c4?_0x831ffa[_0x8af9('0xe')]:_0x1f9523[_0x8af9('0xd')]+_0x1f9523[_0x8af9('0xc')];var _0x3baf3a;if(_0x5d5794>=_0x2ac93f){_0x5d5794=_0x2ac93f;_0x3baf3a=0xc8;}else{_0x3baf3a=0xce;}_0x4a5c12[_0x8af9('0xa')](_0x3baf3a);return _0x4a5c12[_0x8af9('0xf')](_0x8af9('0x10'),_0x4234dd+'-'+_0x5d5794+'/'+_0x2ac93f)[_0x8af9('0x11')](_0x831ffa);}return null;};}function removeEntity(_0x12afbf){return function(_0x16b0d7){if(_0x16b0d7){return _0x16b0d7[_0x8af9('0x12')]()[_0x8af9('0x13')](function(){var _0x4d46e2=_0x16b0d7['get']({'plain':!![]});var _0x5a20bb=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x8af9('0x14'),'value':_0x8af9('0x15'),'ignore':![]},{'name':_0x8af9('0x16'),'value':_0x8af9('0x17'),'ignore':![]}];var _0x385b16=_(_0x5a20bb)['filter'](_0x8af9('0x18'))[_0x8af9('0x19')](_0x8af9('0x1a'))[_0x8af9('0x1a')]();if(_[_0x8af9('0x1b')](_0x385b16,_0x4d46e2['type'])){return;}var _0x4b8c1f=_[_0x8af9('0x1c')](_0x5a20bb,['value',_0x4d46e2[_0x8af9('0x1d')]])[_0x8af9('0x1e')];return db[_0x8af9('0x1f')][_0x8af9('0x12')]({'where':{'type':_0x4b8c1f,'resourceId':_0x4d46e2['id']}})['then'](function(){return _0x16b0d7;});})[_0x8af9('0x13')](function(){_0x12afbf[_0x8af9('0xa')](0xcc)[_0x8af9('0x20')]();});}};}function handleEntityNotFound(_0x4242c5){return function(_0x2f02ed){if(!_0x2f02ed){_0x4242c5[_0x8af9('0x9')](0x194);}return _0x2f02ed;};}function handleError(_0x13d2a0,_0xa7547){_0xa7547=_0xa7547||0x1f4;return function(_0x4be93b){logger[_0x8af9('0x21')](_0x4be93b[_0x8af9('0x22')]);if(_0x4be93b[_0x8af9('0x1e')]){delete _0x4be93b[_0x8af9('0x1e')];}_0x13d2a0[_0x8af9('0xa')](_0xa7547)[_0x8af9('0x23')](_0x4be93b);};}exports[_0x8af9('0x24')]=function(_0x39ace3,_0x9bcb21){var _0x1d7d57={},_0x44c7ad={},_0x267764={'count':0x0,'rows':[]};var _0x31950b=_['map'](db['VoiceExtension'][_0x8af9('0x25')],function(_0x51f541){return{'name':_0x51f541[_0x8af9('0x26')],'type':_0x51f541['type'][_0x8af9('0x27')]};});_0x44c7ad[_0x8af9('0x28')]=_[_0x8af9('0x19')](_0x31950b,_0x8af9('0x1e'));_0x44c7ad[_0x8af9('0x29')]=_[_0x8af9('0x2a')](_0x39ace3['query']);_0x44c7ad[_0x8af9('0x2b')]=_[_0x8af9('0x2c')](_0x44c7ad[_0x8af9('0x28')],_0x44c7ad[_0x8af9('0x29')]);_0x1d7d57[_0x8af9('0x2d')]=_[_0x8af9('0x2c')](_0x44c7ad['model'],qs['fields'](_0x39ace3[_0x8af9('0x29')]['fields']));_0x1d7d57[_0x8af9('0x2d')]=_0x1d7d57[_0x8af9('0x2d')][_0x8af9('0x2e')]?_0x1d7d57[_0x8af9('0x2d')]:_0x44c7ad[_0x8af9('0x28')];if(!_0x39ace3['query'][_0x8af9('0x2f')](_0x8af9('0x30'))){_0x1d7d57[_0x8af9('0xc')]=qs['limit'](_0x39ace3[_0x8af9('0x29')][_0x8af9('0xc')]);_0x1d7d57[_0x8af9('0xd')]=qs[_0x8af9('0xd')](_0x39ace3[_0x8af9('0x29')][_0x8af9('0xd')]);}_0x1d7d57['order']=qs[_0x8af9('0x31')](_0x39ace3[_0x8af9('0x29')][_0x8af9('0x31')]);_0x1d7d57['where']=qs[_0x8af9('0x2b')](_[_0x8af9('0x32')](_0x39ace3[_0x8af9('0x29')],_0x44c7ad[_0x8af9('0x2b')]),_0x31950b);if(_0x39ace3['query']['filter']){_0x1d7d57['where']=_[_0x8af9('0x33')](_0x1d7d57[_0x8af9('0x34')],{'$or':_[_0x8af9('0x19')](_0x31950b,function(_0x5d7498){if(_0x5d7498['type']!==_0x8af9('0x35')){var _0x4ab3a7={};_0x4ab3a7[_0x5d7498[_0x8af9('0x1e')]]={'$like':'%'+_0x39ace3[_0x8af9('0x29')][_0x8af9('0x36')]+'%'};return _0x4ab3a7;}})});}_0x1d7d57=_[_0x8af9('0x33')]({},_0x1d7d57,_0x39ace3[_0x8af9('0x37')]);var _0x13ed1e={'where':_0x1d7d57[_0x8af9('0x34')]};return db[_0x8af9('0x38')][_0x8af9('0xe')](_0x13ed1e)[_0x8af9('0x13')](function(_0x54a240){_0x267764[_0x8af9('0xe')]=_0x54a240;if(_0x39ace3[_0x8af9('0x29')][_0x8af9('0x39')]){_0x1d7d57[_0x8af9('0x3a')]=[{'all':!![]}];}return db[_0x8af9('0x38')][_0x8af9('0x3b')](_0x1d7d57);})[_0x8af9('0x13')](function(_0x6d52e2){_0x267764[_0x8af9('0x3c')]=_0x6d52e2;return _0x267764;})[_0x8af9('0x13')](respondWithFilteredResult(_0x9bcb21,_0x1d7d57))[_0x8af9('0x3d')](handleError(_0x9bcb21,null));};exports['show']=function(_0x1e0853,_0x307f3a){var _0x3e50e8={'raw':![],'where':{'id':_0x1e0853[_0x8af9('0x3e')]['id']}},_0x4b37cc={};_0x4b37cc[_0x8af9('0x28')]=_[_0x8af9('0x2a')](db['VoiceExtension']['rawAttributes']);_0x4b37cc[_0x8af9('0x29')]=_[_0x8af9('0x2a')](_0x1e0853[_0x8af9('0x29')]);_0x4b37cc[_0x8af9('0x2b')]=_[_0x8af9('0x2c')](_0x4b37cc[_0x8af9('0x28')],_0x4b37cc['query']);_0x3e50e8['attributes']=_[_0x8af9('0x2c')](_0x4b37cc[_0x8af9('0x28')],qs['fields'](_0x1e0853[_0x8af9('0x29')][_0x8af9('0x3f')]));_0x3e50e8[_0x8af9('0x2d')]=_0x3e50e8['attributes'][_0x8af9('0x2e')]?_0x3e50e8[_0x8af9('0x2d')]:_0x4b37cc['model'];if(_0x1e0853[_0x8af9('0x29')][_0x8af9('0x39')]){_0x3e50e8[_0x8af9('0x3a')]=[{'all':!![]}];}_0x3e50e8=_[_0x8af9('0x33')]({},_0x3e50e8,_0x1e0853['options']);return db[_0x8af9('0x38')][_0x8af9('0x1c')](_0x3e50e8)['then'](handleEntityNotFound(_0x307f3a,null))[_0x8af9('0x13')](respondWithResult(_0x307f3a,null))[_0x8af9('0x3d')](handleError(_0x307f3a,null));};exports['destroy']=function(_0x145c9a,_0x18b2db){return db[_0x8af9('0x38')][_0x8af9('0x1c')]({'where':{'id':_0x145c9a[_0x8af9('0x3e')]['id']}})[_0x8af9('0x13')](handleEntityNotFound(_0x18b2db,null))[_0x8af9('0x13')](removeEntity(_0x18b2db,null))[_0x8af9('0x3d')](handleError(_0x18b2db,null));};exports[_0x8af9('0x40')]=function(_0x4131aa,_0x2c2441){if(_0x4131aa[_0x8af9('0x41')][_0x8af9('0x1d')]==='outbound'&&!_[_0x8af9('0x42')](_0x4131aa[_0x8af9('0x41')][_0x8af9('0x43')],'_')){_0x4131aa['body']['exten']='_'[_0x8af9('0x44')](_0x4131aa[_0x8af9('0x41')][_0x8af9('0x43')]);}return db[_0x8af9('0x38')][_0x8af9('0x40')](_0x4131aa['body'],{'raw':![]})[_0x8af9('0x13')](function(_0x3a99ca){var _0x15cc26=_0x4131aa['user'][_0x8af9('0x45')]({'plain':!![]});if(!_0x15cc26)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x15cc26['role']===_0x8af9('0x46')){var _0x7600cd=_0x3a99ca[_0x8af9('0x45')]({'plain':!![]});var _0x49162b=[{'name':_0x8af9('0x47'),'value':_0x8af9('0x48')},{'name':_0x8af9('0x14'),'value':_0x8af9('0x15')},{'name':_0x8af9('0x16'),'value':'internal'}];var _0x3b05c8=_['find'](_0x49162b,[_0x8af9('0x1a'),_0x7600cd[_0x8af9('0x1d')]])[_0x8af9('0x1e')];return db[_0x8af9('0x49')][_0x8af9('0x1c')]({'where':{'name':_0x3b05c8,'userProfileId':_0x15cc26[_0x8af9('0x4a')]},'raw':!![]})[_0x8af9('0x13')](function(_0x5c0b4b){if(_0x5c0b4b&&_0x5c0b4b[_0x8af9('0x4b')]===0x0){return db[_0x8af9('0x1f')]['create']({'name':_0x7600cd[_0x8af9('0x1e')],'resourceId':_0x7600cd['id'],'type':_0x5c0b4b[_0x8af9('0x1e')],'sectionId':_0x5c0b4b['id']},{})['then'](function(){return _0x3a99ca;});}else{return _0x3a99ca;}})[_0x8af9('0x3d')](function(_0x209c99){logger[_0x8af9('0x21')](_0x8af9('0x4c'),_0x209c99);throw _0x209c99;});}return _0x3a99ca;})[_0x8af9('0x13')](respondWithResult(_0x2c2441,0xc9))[_0x8af9('0x3d')](handleError(_0x2c2441,null));};exports[_0x8af9('0x4d')]=function(_0x26b0fd,_0x490b0a){if(_0x26b0fd[_0x8af9('0x41')]['id']){delete _0x26b0fd[_0x8af9('0x41')]['id'];}return db['VoiceExtension']['find']({'where':{'id':_0x26b0fd['params']['id']}})[_0x8af9('0x13')](handleEntityNotFound(_0x490b0a,null))[_0x8af9('0x13')](function(_0x464919){if(_0x464919){return db[_0x8af9('0x38')]['update'](_[_0x8af9('0x32')](_0x26b0fd[_0x8af9('0x41')],[_0x8af9('0x43'),_0x8af9('0x4e'),_0x8af9('0x4f'),_0x8af9('0x50'),'cutdigits',_0x8af9('0x51'),_0x8af9('0x52')]),{'where':{'context':_0x464919[_0x8af9('0x4e')],'exten':_0x464919[_0x8af9('0x43')]},'individualHooks':!![]})[_0x8af9('0x13')](function(_0x536853){return _0x536853;});}return null;})[_0x8af9('0x13')](respondWithStatusCode(_0x490b0a,null))[_0x8af9('0x3d')](handleError(_0x490b0a,null));};exports[_0x8af9('0x53')]=function(_0x248552,_0xd72267){var _0x24698c=_0x248552[_0x8af9('0x3e')]['id'];var _0x1a987e=_0x248552[_0x8af9('0x41')];var _0x56c11c=0xc8;var _0x3914e3=null;return db[_0x8af9('0x54')][_0x8af9('0x55')]({'isolationLevel':db[_0x8af9('0x54')][_0x8af9('0x56')][_0x8af9('0x57')]['READ_COMMITTED']},function(_0x2b31cf){return db['VoiceExtension'][_0x8af9('0x58')]({'where':{'id':_0x24698c},'transaction':_0x2b31cf})[_0x8af9('0x13')](function(_0x53670d){if(_0x53670d){return db[_0x8af9('0x38')][_0x8af9('0x12')]({'where':{'VoiceExtensionId':_0x24698c},'transaction':_0x2b31cf})[_0x8af9('0x13')](function(){var _0x2f5bdf=_[_0x8af9('0x19')](_0x1a987e,function(_0x24596b){_0x24596b[_0x8af9('0x59')]=_0x24698c;_0x24596b[_0x8af9('0x5a')]=!![];return _0x24596b;});return _0x53670d[_0x8af9('0x5b')](_0x2f5bdf);})[_0x8af9('0x13')](function(_0x9cf09a){return db[_0x8af9('0x38')][_0x8af9('0x5c')](_0x9cf09a,{'transaction':_0x2b31cf});});}else{_0x56c11c=0x194;_0x3914e3=[];}});})[_0x8af9('0x13')](function(){if(_0x56c11c!==0x194){return db[_0x8af9('0x38')][_0x8af9('0x5d')]({'where':{'isApp':!![],'VoiceExtensionId':_0x24698c},'order':_0x8af9('0x5e')})[_0x8af9('0x13')](function(_0x2d9305){_0x3914e3=_0x2d9305;});}})[_0x8af9('0x3d')](function(_0x10c102){_0x56c11c=0x1f4;logger[_0x8af9('0x21')](_0x10c102[_0x8af9('0x22')]);if(_0x10c102[_0x8af9('0x1e')]){delete _0x10c102['name'];}_0x3914e3=_0x10c102;})[_0x8af9('0x5f')](function(){if(_0x3914e3===null){_0xd72267['sendStatus'](_0x56c11c);}else{if(_0x56c11c===0x1f4){_0xd72267[_0x8af9('0xa')](_0x56c11c)[_0x8af9('0x23')](_0x3914e3);}else{_0xd72267[_0x8af9('0xa')](_0x56c11c)['json'](_0x3914e3);}}});};
\ No newline at end of file
+var _0x27f4=['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','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','name','UserProfileResource','destroy','error','stack','send','index','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','options','VoiceExtension','include','findAll','rows','params','includeAll','catch','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction'];(function(_0x3e74f7,_0x17b946){var _0xfd6763=function(_0x5e6185){while(--_0x5e6185){_0x3e74f7['push'](_0x3e74f7['shift']());}};_0xfd6763(++_0x17b946);}(_0x27f4,0xd0));var _0x427f=function(_0x5c8628,_0x2fc5f5){_0x5c8628=_0x5c8628-0x0;var _0xcbd50e=_0x27f4[_0x5c8628];return _0xcbd50e;};'use strict';var _=require(_0x427f('0x0'));var Redis=require(_0x427f('0x1'));var qs=require(_0x427f('0x2'));var logger=require(_0x427f('0x3'))(_0x427f('0x4'));var config=require(_0x427f('0x5'));var db=require(_0x427f('0x6'))['db'];config[_0x427f('0x7')]=_['defaults'](config[_0x427f('0x7')],{'host':_0x427f('0x8'),'port':0x18eb});var socket=require(_0x427f('0x9'))(new Redis(config[_0x427f('0x7')]));require('./voiceExtension.socket')[_0x427f('0xa')](socket);function respondWithStatusCode(_0x1a603c,_0x2d3c26){_0x2d3c26=_0x2d3c26||0xcc;return function(_0x5e398a){if(_0x5e398a){return _0x1a603c[_0x427f('0xb')](_0x2d3c26);}return _0x1a603c[_0x427f('0xc')](_0x2d3c26)[_0x427f('0xd')]();};}function respondWithResult(_0x7949e7,_0x5dc7a2){_0x5dc7a2=_0x5dc7a2||0xc8;return function(_0x2dfd83){if(_0x2dfd83){return _0x7949e7['status'](_0x5dc7a2)[_0x427f('0xe')](_0x2dfd83);}};}function respondWithFilteredResult(_0x44b953,_0x3cbca3){return function(_0x35c7df){if(_0x35c7df){var _0x3f7103=typeof _0x3cbca3[_0x427f('0xf')]===_0x427f('0x10')&&typeof _0x3cbca3['limit']===_0x427f('0x10');var _0x499d58=_0x35c7df['count'];var _0x1abac7=_0x3f7103?0x0:_0x3cbca3[_0x427f('0xf')];var _0x4172a2=_0x3f7103?_0x35c7df[_0x427f('0x11')]:_0x3cbca3[_0x427f('0xf')]+_0x3cbca3[_0x427f('0x12')];var _0x3879b0;if(_0x4172a2>=_0x499d58){_0x4172a2=_0x499d58;_0x3879b0=0xc8;}else{_0x3879b0=0xce;}_0x44b953['status'](_0x3879b0);return _0x44b953[_0x427f('0x13')]('Content-Range',_0x1abac7+'-'+_0x4172a2+'/'+_0x499d58)['json'](_0x35c7df);}return null;};}function removeEntity(_0x299db1){return function(_0x50162c){if(_0x50162c){return _0x50162c['destroy']()[_0x427f('0x14')](function(){var _0x23b672=_0x50162c[_0x427f('0x15')]({'plain':!![]});var _0x4a8d85=[{'name':_0x427f('0x16'),'value':'inbound','ignore':![]},{'name':_0x427f('0x17'),'value':_0x427f('0x18'),'ignore':![]},{'name':_0x427f('0x19'),'value':_0x427f('0x1a'),'ignore':![]}];var _0x290a96=_(_0x4a8d85)[_0x427f('0x1b')](_0x427f('0x1c'))[_0x427f('0x1d')](_0x427f('0x1e'))[_0x427f('0x1e')]();if(_['includes'](_0x290a96,_0x23b672['type'])){return;}var _0x3ef807=_[_0x427f('0x1f')](_0x4a8d85,['value',_0x23b672['type']])[_0x427f('0x20')];return db[_0x427f('0x21')][_0x427f('0x22')]({'where':{'type':_0x3ef807,'resourceId':_0x23b672['id']}})[_0x427f('0x14')](function(){return _0x50162c;});})['then'](function(){_0x299db1[_0x427f('0xc')](0xcc)[_0x427f('0xd')]();});}};}function handleEntityNotFound(_0x2684ce){return function(_0x93a8e9){if(!_0x93a8e9){_0x2684ce['sendStatus'](0x194);}return _0x93a8e9;};}function handleError(_0x4dd0f9,_0x25f47f){_0x25f47f=_0x25f47f||0x1f4;return function(_0x4cecc9){logger[_0x427f('0x23')](_0x4cecc9[_0x427f('0x24')]);if(_0x4cecc9[_0x427f('0x20')]){delete _0x4cecc9[_0x427f('0x20')];}_0x4dd0f9['status'](_0x25f47f)[_0x427f('0x25')](_0x4cecc9);};}exports[_0x427f('0x26')]=function(_0x5e65d5,_0x137cf0){var _0x40d482={},_0x101c9b={},_0x1b63a2={'count':0x0,'rows':[]};var _0xe5c736=_[_0x427f('0x1d')](db['VoiceExtension'][_0x427f('0x27')],function(_0x1a900b){return{'name':_0x1a900b[_0x427f('0x28')],'type':_0x1a900b[_0x427f('0x29')][_0x427f('0x2a')]};});_0x101c9b[_0x427f('0x2b')]=_[_0x427f('0x1d')](_0xe5c736,'name');_0x101c9b['query']=_[_0x427f('0x2c')](_0x5e65d5[_0x427f('0x2d')]);_0x101c9b['filters']=_[_0x427f('0x2e')](_0x101c9b[_0x427f('0x2b')],_0x101c9b['query']);_0x40d482[_0x427f('0x2f')]=_['intersection'](_0x101c9b[_0x427f('0x2b')],qs[_0x427f('0x30')](_0x5e65d5['query'][_0x427f('0x30')]));_0x40d482[_0x427f('0x2f')]=_0x40d482['attributes'][_0x427f('0x31')]?_0x40d482['attributes']:_0x101c9b[_0x427f('0x2b')];if(!_0x5e65d5['query'][_0x427f('0x32')](_0x427f('0x33'))){_0x40d482[_0x427f('0x12')]=qs['limit'](_0x5e65d5[_0x427f('0x2d')]['limit']);_0x40d482['offset']=qs[_0x427f('0xf')](_0x5e65d5[_0x427f('0x2d')][_0x427f('0xf')]);}_0x40d482['order']=qs[_0x427f('0x34')](_0x5e65d5['query'][_0x427f('0x34')]);_0x40d482[_0x427f('0x35')]=qs[_0x427f('0x36')](_[_0x427f('0x37')](_0x5e65d5[_0x427f('0x2d')],_0x101c9b[_0x427f('0x36')]),_0xe5c736);if(_0x5e65d5[_0x427f('0x2d')]['filter']){_0x40d482[_0x427f('0x35')]=_[_0x427f('0x38')](_0x40d482[_0x427f('0x35')],{'$or':_['map'](_0xe5c736,function(_0x337b98){if(_0x337b98[_0x427f('0x29')]!==_0x427f('0x39')){var _0x1446e9={};_0x1446e9[_0x337b98[_0x427f('0x20')]]={'$like':'%'+_0x5e65d5[_0x427f('0x2d')][_0x427f('0x1b')]+'%'};return _0x1446e9;}})});}_0x40d482=_[_0x427f('0x38')]({},_0x40d482,_0x5e65d5[_0x427f('0x3a')]);var _0x16f872={'where':_0x40d482[_0x427f('0x35')]};return db[_0x427f('0x3b')][_0x427f('0x11')](_0x16f872)[_0x427f('0x14')](function(_0x2851a5){_0x1b63a2[_0x427f('0x11')]=_0x2851a5;if(_0x5e65d5[_0x427f('0x2d')]['includeAll']){_0x40d482[_0x427f('0x3c')]=[{'all':!![]}];}return db[_0x427f('0x3b')][_0x427f('0x3d')](_0x40d482);})[_0x427f('0x14')](function(_0x44fe13){_0x1b63a2[_0x427f('0x3e')]=_0x44fe13;return _0x1b63a2;})[_0x427f('0x14')](respondWithFilteredResult(_0x137cf0,_0x40d482))['catch'](handleError(_0x137cf0,null));};exports['show']=function(_0x245704,_0x11be85){var _0x4a3511={'raw':![],'where':{'id':_0x245704[_0x427f('0x3f')]['id']}},_0x2bb168={};_0x2bb168['model']=_[_0x427f('0x2c')](db[_0x427f('0x3b')][_0x427f('0x27')]);_0x2bb168[_0x427f('0x2d')]=_[_0x427f('0x2c')](_0x245704[_0x427f('0x2d')]);_0x2bb168[_0x427f('0x36')]=_[_0x427f('0x2e')](_0x2bb168[_0x427f('0x2b')],_0x2bb168[_0x427f('0x2d')]);_0x4a3511[_0x427f('0x2f')]=_[_0x427f('0x2e')](_0x2bb168['model'],qs[_0x427f('0x30')](_0x245704[_0x427f('0x2d')][_0x427f('0x30')]));_0x4a3511[_0x427f('0x2f')]=_0x4a3511[_0x427f('0x2f')][_0x427f('0x31')]?_0x4a3511[_0x427f('0x2f')]:_0x2bb168[_0x427f('0x2b')];if(_0x245704[_0x427f('0x2d')][_0x427f('0x40')]){_0x4a3511['include']=[{'all':!![]}];}_0x4a3511=_[_0x427f('0x38')]({},_0x4a3511,_0x245704[_0x427f('0x3a')]);return db[_0x427f('0x3b')][_0x427f('0x1f')](_0x4a3511)[_0x427f('0x14')](handleEntityNotFound(_0x11be85,null))['then'](respondWithResult(_0x11be85,null))[_0x427f('0x41')](handleError(_0x11be85,null));};exports[_0x427f('0x22')]=function(_0x47304c,_0x109ebe){return db[_0x427f('0x3b')][_0x427f('0x1f')]({'where':{'id':_0x47304c[_0x427f('0x3f')]['id']}})[_0x427f('0x14')](handleEntityNotFound(_0x109ebe,null))[_0x427f('0x14')](removeEntity(_0x109ebe,null))[_0x427f('0x41')](handleError(_0x109ebe,null));};exports[_0x427f('0x42')]=function(_0xf9cbad,_0x4b1ec5){if(_0xf9cbad[_0x427f('0x43')][_0x427f('0x29')]===_0x427f('0x18')&&!_[_0x427f('0x44')](_0xf9cbad[_0x427f('0x43')][_0x427f('0x45')],'_')){_0xf9cbad['body'][_0x427f('0x45')]='_'[_0x427f('0x46')](_0xf9cbad[_0x427f('0x43')]['exten']);}return db[_0x427f('0x3b')][_0x427f('0x42')](_0xf9cbad['body'],{'raw':![]})[_0x427f('0x14')](function(_0x2ec2aa){var _0x4c8076=_0xf9cbad['user']['get']({'plain':!![]});if(!_0x4c8076)throw new Error(_0x427f('0x47'));if(_0x4c8076[_0x427f('0x48')]===_0x427f('0x49')){var _0x3c901c=_0x2ec2aa[_0x427f('0x15')]({'plain':!![]});var _0x22c90f=[{'name':_0x427f('0x16'),'value':_0x427f('0x4a')},{'name':_0x427f('0x17'),'value':_0x427f('0x18')},{'name':_0x427f('0x19'),'value':_0x427f('0x1a')}];var _0x4861a4=_[_0x427f('0x1f')](_0x22c90f,[_0x427f('0x1e'),_0x3c901c['type']])[_0x427f('0x20')];return db[_0x427f('0x4b')][_0x427f('0x1f')]({'where':{'name':_0x4861a4,'userProfileId':_0x4c8076[_0x427f('0x4c')]},'raw':!![]})[_0x427f('0x14')](function(_0x544deb){if(_0x544deb&&_0x544deb[_0x427f('0x4d')]===0x0){return db[_0x427f('0x21')][_0x427f('0x42')]({'name':_0x3c901c[_0x427f('0x20')],'resourceId':_0x3c901c['id'],'type':_0x544deb['name'],'sectionId':_0x544deb['id']},{})['then'](function(){return _0x2ec2aa;});}else{return _0x2ec2aa;}})[_0x427f('0x41')](function(_0x66f091){logger[_0x427f('0x23')](_0x427f('0x4e'),_0x66f091);throw _0x66f091;});}return _0x2ec2aa;})['then'](respondWithResult(_0x4b1ec5,0xc9))[_0x427f('0x41')](handleError(_0x4b1ec5,null));};exports[_0x427f('0x4f')]=function(_0x4250d8,_0x481eb9){if(_0x4250d8[_0x427f('0x43')]['id']){delete _0x4250d8[_0x427f('0x43')]['id'];}return db[_0x427f('0x3b')][_0x427f('0x1f')]({'where':{'id':_0x4250d8[_0x427f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x481eb9,null))['then'](function(_0x1c301c){if(_0x1c301c){return db['VoiceExtension'][_0x427f('0x4f')](_[_0x427f('0x37')](_0x4250d8[_0x427f('0x43')],[_0x427f('0x45'),_0x427f('0x50'),_0x427f('0x51'),_0x427f('0x52'),_0x427f('0x53'),_0x427f('0x54'),_0x427f('0x55')]),{'where':{'context':_0x1c301c['context'],'exten':_0x1c301c[_0x427f('0x45')]},'individualHooks':!![]})[_0x427f('0x14')](function(_0x3bd695){return _0x3bd695;});}return null;})[_0x427f('0x14')](respondWithStatusCode(_0x481eb9,null))[_0x427f('0x41')](handleError(_0x481eb9,null));};exports[_0x427f('0x56')]=function(_0x50b36b,_0x5184b5){var _0x22a0c7=_0x50b36b[_0x427f('0x3f')]['id'];var _0x1f6083=_0x50b36b[_0x427f('0x43')];var _0x556d5d=0xc8;var _0x4791e8=null;return db[_0x427f('0x57')][_0x427f('0x58')]({'isolationLevel':db[_0x427f('0x57')][_0x427f('0x59')]['ISOLATION_LEVELS'][_0x427f('0x5a')]},function(_0x15eb43){return db[_0x427f('0x3b')][_0x427f('0x5b')]({'where':{'id':_0x22a0c7},'transaction':_0x15eb43})[_0x427f('0x14')](function(_0x3ba2c9){if(_0x3ba2c9){return db[_0x427f('0x3b')]['destroy']({'where':{'VoiceExtensionId':_0x22a0c7},'transaction':_0x15eb43})['then'](function(){var _0x58e9a5=_[_0x427f('0x1d')](_0x1f6083,function(_0x3ce2f8){_0x3ce2f8[_0x427f('0x5c')]=_0x22a0c7;_0x3ce2f8[_0x427f('0x5d')]=!![];return _0x3ce2f8;});return _0x3ba2c9[_0x427f('0x5e')](_0x58e9a5);})[_0x427f('0x14')](function(_0x19235f){return db[_0x427f('0x3b')][_0x427f('0x5f')](_0x19235f,{'transaction':_0x15eb43});});}else{_0x556d5d=0x194;_0x4791e8=[];}});})['then'](function(){if(_0x556d5d!==0x194){return db[_0x427f('0x3b')][_0x427f('0x60')]({'where':{'isApp':!![],'VoiceExtensionId':_0x22a0c7},'order':_0x427f('0x61')})[_0x427f('0x14')](function(_0x14cbce){_0x4791e8=_0x14cbce;});}})[_0x427f('0x41')](function(_0x4037d6){_0x556d5d=0x1f4;logger[_0x427f('0x23')](_0x4037d6[_0x427f('0x24')]);if(_0x4037d6[_0x427f('0x20')]){delete _0x4037d6[_0x427f('0x20')];}_0x4791e8=_0x4037d6;})[_0x427f('0x62')](function(){if(_0x4791e8===null){_0x5184b5[_0x427f('0xb')](_0x556d5d);}else{if(_0x556d5d===0x1f4){_0x5184b5[_0x427f('0xc')](_0x556d5d)[_0x427f('0x25')](_0x4791e8);}else{_0x5184b5[_0x427f('0xc')](_0x556d5d)[_0x427f('0xe')](_0x4791e8);}}});};
\ No newline at end of file