Built motion from commit 1fa89557.|2.6.10
[motion2.git] / server / api / voiceExtension / voiceExtension.controller.js
index 68c1c17..d1f9154 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x49b7=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','destroy','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','error','send','index','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','VIRTUAL','merge','options','VoiceExtension','includeAll','include','findAll','catch','keys','params','create','startsWith','body','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','InboundRoutes','UserProfileSection','userProfileId','autoAssociation','UserProfileResource'];(function(_0x353660,_0x48b645){var _0x339760=function(_0x5ee4d8){while(--_0x5ee4d8){_0x353660['push'](_0x353660['shift']());}};_0x339760(++_0x48b645);}(_0x49b7,0x1da));var _0x749b=function(_0x10aa73,_0xc744f4){_0x10aa73=_0x10aa73-0x0;var _0x3496d9=_0x49b7[_0x10aa73];return _0x3496d9;};'use strict';var _=require(_0x749b('0x0'));var Redis=require(_0x749b('0x1'));var qs=require(_0x749b('0x2'));var logger=require(_0x749b('0x3'))('api');var config=require('../../config/environment');var db=require(_0x749b('0x4'))['db'];config[_0x749b('0x5')]=_[_0x749b('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x749b('0x5')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x5040ff,_0x261301){_0x261301=_0x261301||0xcc;return function(_0x4e04cb){if(_0x4e04cb){return _0x5040ff[_0x749b('0x7')](_0x261301);}return _0x5040ff['status'](_0x261301)[_0x749b('0x8')]();};}function respondWithResult(_0x55069f,_0x28b89c){_0x28b89c=_0x28b89c||0xc8;return function(_0x5d1881){if(_0x5d1881){return _0x55069f[_0x749b('0x9')](_0x28b89c)[_0x749b('0xa')](_0x5d1881);}};}function respondWithFilteredResult(_0x1ab1c3,_0x50f921){return function(_0x2f6a3d){if(_0x2f6a3d){var _0x35186a=typeof _0x50f921[_0x749b('0xb')]===_0x749b('0xc')&&typeof _0x50f921[_0x749b('0xd')]===_0x749b('0xc');var _0xcfb41d=_0x2f6a3d[_0x749b('0xe')];var _0x5838e9=_0x35186a?0x0:_0x50f921[_0x749b('0xb')];var _0x5c627d=_0x35186a?_0x2f6a3d['count']:_0x50f921[_0x749b('0xb')]+_0x50f921[_0x749b('0xd')];var _0x285aaa;if(_0x5c627d>=_0xcfb41d){_0x5c627d=_0xcfb41d;_0x285aaa=0xc8;}else{_0x285aaa=0xce;}_0x1ab1c3[_0x749b('0x9')](_0x285aaa);return _0x1ab1c3['set'](_0x749b('0xf'),_0x5838e9+'-'+_0x5c627d+'/'+_0xcfb41d)[_0x749b('0xa')](_0x2f6a3d);}return null;};}function removeEntity(_0x490642){return function(_0x331f48){if(_0x331f48){return _0x331f48[_0x749b('0x10')]()[_0x749b('0x11')](function(){var _0x498771=_0x331f48[_0x749b('0x12')]({'plain':!![]});var _0x2b6454=[{'name':'InboundRoutes','value':_0x749b('0x13'),'ignore':![]},{'name':_0x749b('0x14'),'value':_0x749b('0x15'),'ignore':![]},{'name':_0x749b('0x16'),'value':_0x749b('0x17'),'ignore':![]}];var _0x241fc6=_(_0x2b6454)[_0x749b('0x18')](_0x749b('0x19'))[_0x749b('0x1a')](_0x749b('0x1b'))['value']();if(_[_0x749b('0x1c')](_0x241fc6,_0x498771[_0x749b('0x1d')])){return;}var _0x303eeb=_[_0x749b('0x1e')](_0x2b6454,[_0x749b('0x1b'),_0x498771[_0x749b('0x1d')]])[_0x749b('0x1f')];return db['UserProfileResource'][_0x749b('0x10')]({'where':{'type':_0x303eeb,'resourceId':_0x498771['id']}})[_0x749b('0x11')](function(){return _0x331f48;});})[_0x749b('0x11')](function(){_0x490642[_0x749b('0x9')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4fa06f){return function(_0x4783a0){if(!_0x4783a0){_0x4fa06f[_0x749b('0x7')](0x194);}return _0x4783a0;};}function handleError(_0x4d84cd,_0x3cbea6){_0x3cbea6=_0x3cbea6||0x1f4;return function(_0x5cbd80){logger[_0x749b('0x20')](_0x5cbd80['stack']);if(_0x5cbd80[_0x749b('0x1f')]){delete _0x5cbd80[_0x749b('0x1f')];}_0x4d84cd[_0x749b('0x9')](_0x3cbea6)[_0x749b('0x21')](_0x5cbd80);};}exports[_0x749b('0x22')]=function(_0x132c90,_0x143ab1){var _0x4dcd0f={},_0x46d4aa={},_0x2f5888={'count':0x0,'rows':[]};var _0x321b13=_[_0x749b('0x1a')](db['VoiceExtension'][_0x749b('0x23')],function(_0x4fa486){return{'name':_0x4fa486[_0x749b('0x24')],'type':_0x4fa486['type']['key']};});_0x46d4aa[_0x749b('0x25')]=_[_0x749b('0x1a')](_0x321b13,_0x749b('0x1f'));_0x46d4aa['query']=_['keys'](_0x132c90[_0x749b('0x26')]);_0x46d4aa['filters']=_[_0x749b('0x27')](_0x46d4aa['model'],_0x46d4aa[_0x749b('0x26')]);_0x4dcd0f[_0x749b('0x28')]=_[_0x749b('0x27')](_0x46d4aa[_0x749b('0x25')],qs[_0x749b('0x29')](_0x132c90['query'][_0x749b('0x29')]));_0x4dcd0f[_0x749b('0x28')]=_0x4dcd0f['attributes'][_0x749b('0x2a')]?_0x4dcd0f['attributes']:_0x46d4aa[_0x749b('0x25')];if(!_0x132c90[_0x749b('0x26')][_0x749b('0x2b')]('nolimit')){_0x4dcd0f[_0x749b('0xd')]=qs['limit'](_0x132c90[_0x749b('0x26')][_0x749b('0xd')]);_0x4dcd0f['offset']=qs['offset'](_0x132c90['query'][_0x749b('0xb')]);}_0x4dcd0f[_0x749b('0x2c')]=qs[_0x749b('0x2d')](_0x132c90[_0x749b('0x26')][_0x749b('0x2d')]);_0x4dcd0f[_0x749b('0x2e')]=qs[_0x749b('0x2f')](_[_0x749b('0x30')](_0x132c90[_0x749b('0x26')],_0x46d4aa[_0x749b('0x2f')]),_0x321b13);if(_0x132c90[_0x749b('0x26')][_0x749b('0x18')]){_0x4dcd0f[_0x749b('0x2e')]=_['merge'](_0x4dcd0f['where'],{'$or':_[_0x749b('0x1a')](_0x321b13,function(_0x23cc1d){if(_0x23cc1d[_0x749b('0x1d')]!==_0x749b('0x31')){var _0x54c01b={};_0x54c01b[_0x23cc1d[_0x749b('0x1f')]]={'$like':'%'+_0x132c90['query']['filter']+'%'};return _0x54c01b;}})});}_0x4dcd0f=_[_0x749b('0x32')]({},_0x4dcd0f,_0x132c90[_0x749b('0x33')]);var _0x45881d={'where':_0x4dcd0f[_0x749b('0x2e')]};return db[_0x749b('0x34')][_0x749b('0xe')](_0x45881d)[_0x749b('0x11')](function(_0x495320){_0x2f5888[_0x749b('0xe')]=_0x495320;if(_0x132c90[_0x749b('0x26')][_0x749b('0x35')]){_0x4dcd0f[_0x749b('0x36')]=[{'all':!![]}];}return db[_0x749b('0x34')][_0x749b('0x37')](_0x4dcd0f);})[_0x749b('0x11')](function(_0x2ef62c){_0x2f5888['rows']=_0x2ef62c;return _0x2f5888;})[_0x749b('0x11')](respondWithFilteredResult(_0x143ab1,_0x4dcd0f))[_0x749b('0x38')](handleError(_0x143ab1,null));};exports['show']=function(_0x4859bb,_0x1b0a04){var _0x488937={'raw':![],'where':{'id':_0x4859bb['params']['id']}},_0x4e7d8e={};_0x4e7d8e['model']=_[_0x749b('0x39')](db[_0x749b('0x34')][_0x749b('0x23')]);_0x4e7d8e[_0x749b('0x26')]=_[_0x749b('0x39')](_0x4859bb[_0x749b('0x26')]);_0x4e7d8e[_0x749b('0x2f')]=_['intersection'](_0x4e7d8e['model'],_0x4e7d8e[_0x749b('0x26')]);_0x488937[_0x749b('0x28')]=_[_0x749b('0x27')](_0x4e7d8e[_0x749b('0x25')],qs['fields'](_0x4859bb[_0x749b('0x26')][_0x749b('0x29')]));_0x488937[_0x749b('0x28')]=_0x488937[_0x749b('0x28')][_0x749b('0x2a')]?_0x488937[_0x749b('0x28')]:_0x4e7d8e[_0x749b('0x25')];if(_0x4859bb['query'][_0x749b('0x35')]){_0x488937[_0x749b('0x36')]=[{'all':!![]}];}_0x488937=_[_0x749b('0x32')]({},_0x488937,_0x4859bb['options']);return db[_0x749b('0x34')][_0x749b('0x1e')](_0x488937)['then'](handleEntityNotFound(_0x1b0a04,null))[_0x749b('0x11')](respondWithResult(_0x1b0a04,null))[_0x749b('0x38')](handleError(_0x1b0a04,null));};exports[_0x749b('0x10')]=function(_0x4e5bc4,_0x450dec){return db[_0x749b('0x34')]['find']({'where':{'id':_0x4e5bc4[_0x749b('0x3a')]['id']}})[_0x749b('0x11')](handleEntityNotFound(_0x450dec,null))[_0x749b('0x11')](removeEntity(_0x450dec,null))['catch'](handleError(_0x450dec,null));};exports[_0x749b('0x3b')]=function(_0x3dcba3,_0x2fd636){if(_0x3dcba3['body'][_0x749b('0x1d')]==='outbound'&&!_[_0x749b('0x3c')](_0x3dcba3['body']['exten'],'_')){_0x3dcba3[_0x749b('0x3d')][_0x749b('0x3e')]='_'[_0x749b('0x3f')](_0x3dcba3[_0x749b('0x3d')]['exten']);}return db[_0x749b('0x34')][_0x749b('0x3b')](_0x3dcba3[_0x749b('0x3d')],{'raw':![]})[_0x749b('0x11')](function(_0x45a319){var _0x20232e=_0x3dcba3['user'][_0x749b('0x12')]({'plain':!![]});if(!_0x20232e)throw new Error(_0x749b('0x40'));if(_0x20232e[_0x749b('0x41')]===_0x749b('0x42')){var _0x41f7e1=_0x45a319[_0x749b('0x12')]({'plain':!![]});var _0xdda48=[{'name':_0x749b('0x43'),'value':_0x749b('0x13')},{'name':_0x749b('0x14'),'value':_0x749b('0x15')},{'name':_0x749b('0x16'),'value':_0x749b('0x17')}];var _0x3553f6=_['find'](_0xdda48,[_0x749b('0x1b'),_0x41f7e1['type']])[_0x749b('0x1f')];return db[_0x749b('0x44')][_0x749b('0x1e')]({'where':{'name':_0x3553f6,'userProfileId':_0x20232e[_0x749b('0x45')]},'raw':!![]})[_0x749b('0x11')](function(_0x10f3e5){if(_0x10f3e5&&_0x10f3e5[_0x749b('0x46')]===0x0){return db[_0x749b('0x47')][_0x749b('0x3b')]({'name':_0x41f7e1['name'],'resourceId':_0x41f7e1['id'],'type':_0x10f3e5['name'],'sectionId':_0x10f3e5['id']},{})[_0x749b('0x11')](function(){return _0x45a319;});}else{return _0x45a319;}})[_0x749b('0x38')](function(_0x2ee4a0){logger['error'](_0x749b('0x48'),_0x2ee4a0);throw _0x2ee4a0;});}return _0x45a319;})[_0x749b('0x11')](respondWithResult(_0x2fd636,0xc9))['catch'](handleError(_0x2fd636,null));};exports[_0x749b('0x49')]=function(_0x2975ef,_0x2762ba){if(_0x2975ef[_0x749b('0x3d')]['id']){delete _0x2975ef[_0x749b('0x3d')]['id'];}return db[_0x749b('0x34')][_0x749b('0x1e')]({'where':{'id':_0x2975ef[_0x749b('0x3a')]['id']}})[_0x749b('0x11')](handleEntityNotFound(_0x2762ba,null))[_0x749b('0x11')](function(_0x3395cf){if(_0x3395cf){return db['VoiceExtension']['update'](_['pick'](_0x2975ef[_0x749b('0x3d')],[_0x749b('0x3e'),'context',_0x749b('0x4a'),_0x749b('0x4b'),_0x749b('0x4c'),_0x749b('0x4d'),_0x749b('0x4e')]),{'where':{'context':_0x3395cf[_0x749b('0x4f')],'exten':_0x3395cf[_0x749b('0x3e')]},'individualHooks':!![]})[_0x749b('0x11')](function(_0x5c7b0b){return _0x5c7b0b;});}return null;})[_0x749b('0x11')](respondWithStatusCode(_0x2762ba,null))[_0x749b('0x38')](handleError(_0x2762ba,null));};exports[_0x749b('0x50')]=function(_0x29681a,_0x298faa){var _0x2183fb=_0x29681a['params']['id'];var _0x553722=_0x29681a[_0x749b('0x3d')];var _0x4a085b=0xc8;var _0x2295f7=null;return db[_0x749b('0x51')][_0x749b('0x52')]({'isolationLevel':db[_0x749b('0x51')]['Transaction'][_0x749b('0x53')][_0x749b('0x54')]},function(_0x2758af){return db[_0x749b('0x34')]['findOne']({'where':{'id':_0x2183fb},'transaction':_0x2758af})['then'](function(_0x4a5978){if(_0x4a5978){return db['VoiceExtension'][_0x749b('0x10')]({'where':{'VoiceExtensionId':_0x2183fb},'transaction':_0x2758af})[_0x749b('0x11')](function(){var _0x450ef7=_['map'](_0x553722,function(_0x49b0ad){_0x49b0ad['VoiceExtensionId']=_0x2183fb;_0x49b0ad[_0x749b('0x55')]=!![];return _0x49b0ad;});return _0x4a5978[_0x749b('0x56')](_0x450ef7);})['then'](function(_0x35e565){return db[_0x749b('0x34')][_0x749b('0x57')](_0x35e565,{'transaction':_0x2758af});});}else{_0x4a085b=0x194;_0x2295f7=[];}});})[_0x749b('0x11')](function(){if(_0x4a085b!==0x194){return db[_0x749b('0x34')][_0x749b('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2183fb},'order':_0x749b('0x59')})[_0x749b('0x11')](function(_0xda7da9){_0x2295f7=_0xda7da9;});}})[_0x749b('0x38')](function(_0x43c4b4){_0x4a085b=0x1f4;logger[_0x749b('0x20')](_0x43c4b4['stack']);if(_0x43c4b4[_0x749b('0x1f')]){delete _0x43c4b4[_0x749b('0x1f')];}_0x2295f7=_0x43c4b4;})[_0x749b('0x5a')](function(){if(_0x2295f7===null){_0x298faa[_0x749b('0x7')](_0x4a085b);}else{if(_0x4a085b===0x1f4){_0x298faa[_0x749b('0x9')](_0x4a085b)[_0x749b('0x21')](_0x2295f7);}else{_0x298faa[_0x749b('0x9')](_0x4a085b)['json'](_0x2295f7);}}});};
\ No newline at end of file
+var _0x1b31=['createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../mysqldb','localhost','redis','./voiceExtension.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','destroy','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','filter','ignore','map','value','includes','type','find','name','UserProfileResource','then','stack','send','VoiceExtension','rawAttributes','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','pick','where','merge','options','includeAll','include','rows','catch','show','params','create','body','outbound','startsWith','exten','concat','user','internal','error','update','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','Transaction','findOne','VoiceExtensionId'];(function(_0x2a20d1,_0x10d8f2){var _0x1d29af=function(_0x118fa6){while(--_0x118fa6){_0x2a20d1['push'](_0x2a20d1['shift']());}};_0x1d29af(++_0x10d8f2);}(_0x1b31,0x1a4));var _0x11b3=function(_0xf15641,_0x515f15){_0xf15641=_0xf15641-0x0;var _0x47595a=_0x1b31[_0xf15641];return _0x47595a;};'use strict';var _=require(_0x11b3('0x0'));var Redis=require(_0x11b3('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x11b3('0x2'))(_0x11b3('0x3'));var config=require('../../config/environment');var db=require(_0x11b3('0x4'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x11b3('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x11b3('0x6')]));require(_0x11b3('0x7'))[_0x11b3('0x8')](socket);function respondWithStatusCode(_0xaa3975,_0x479530){_0x479530=_0x479530||0xcc;return function(_0x190e22){if(_0x190e22){return _0xaa3975[_0x11b3('0x9')](_0x479530);}return _0xaa3975[_0x11b3('0xa')](_0x479530)[_0x11b3('0xb')]();};}function respondWithResult(_0x961e66,_0x321756){_0x321756=_0x321756||0xc8;return function(_0x5886e6){if(_0x5886e6){return _0x961e66[_0x11b3('0xa')](_0x321756)[_0x11b3('0xc')](_0x5886e6);}};}function respondWithFilteredResult(_0x597a8a,_0x57cabb){return function(_0xce99de){if(_0xce99de){var _0x215885=typeof _0x57cabb['offset']==='undefined'&&typeof _0x57cabb[_0x11b3('0xd')]===_0x11b3('0xe');var _0x5d301c=_0xce99de[_0x11b3('0xf')];var _0x5e4f29=_0x215885?0x0:_0x57cabb['offset'];var _0x22d817=_0x215885?_0xce99de[_0x11b3('0xf')]:_0x57cabb[_0x11b3('0x10')]+_0x57cabb[_0x11b3('0xd')];var _0x54f391;if(_0x22d817>=_0x5d301c){_0x22d817=_0x5d301c;_0x54f391=0xc8;}else{_0x54f391=0xce;}_0x597a8a['status'](_0x54f391);return _0x597a8a[_0x11b3('0x11')](_0x11b3('0x12'),_0x5e4f29+'-'+_0x22d817+'/'+_0x5d301c)[_0x11b3('0xc')](_0xce99de);}return null;};}function removeEntity(_0x18191e){return function(_0x3577ea){if(_0x3577ea){return _0x3577ea[_0x11b3('0x13')]()['then'](function(){var _0x1e1d1a=_0x3577ea[_0x11b3('0x14')]({'plain':!![]});var _0x54bd51=[{'name':_0x11b3('0x15'),'value':_0x11b3('0x16'),'ignore':![]},{'name':_0x11b3('0x17'),'value':'outbound','ignore':![]},{'name':_0x11b3('0x18'),'value':'internal','ignore':![]}];var _0x1c2035=_(_0x54bd51)[_0x11b3('0x19')](_0x11b3('0x1a'))[_0x11b3('0x1b')](_0x11b3('0x1c'))[_0x11b3('0x1c')]();if(_[_0x11b3('0x1d')](_0x1c2035,_0x1e1d1a[_0x11b3('0x1e')])){return;}var _0x277dc4=_[_0x11b3('0x1f')](_0x54bd51,['value',_0x1e1d1a[_0x11b3('0x1e')]])[_0x11b3('0x20')];return db[_0x11b3('0x21')]['destroy']({'where':{'type':_0x277dc4,'resourceId':_0x1e1d1a['id']}})['then'](function(){return _0x3577ea;});})[_0x11b3('0x22')](function(){_0x18191e[_0x11b3('0xa')](0xcc)[_0x11b3('0xb')]();});}};}function handleEntityNotFound(_0xa6f777){return function(_0x164f7a){if(!_0x164f7a){_0xa6f777[_0x11b3('0x9')](0x194);}return _0x164f7a;};}function handleError(_0x31aa8b,_0x24b391){_0x24b391=_0x24b391||0x1f4;return function(_0x137581){logger['error'](_0x137581[_0x11b3('0x23')]);if(_0x137581[_0x11b3('0x20')]){delete _0x137581[_0x11b3('0x20')];}_0x31aa8b['status'](_0x24b391)[_0x11b3('0x24')](_0x137581);};}exports['index']=function(_0x20728c,_0x319bcc){var _0x555d7d={},_0x2469e6={},_0x38dff9={'count':0x0,'rows':[]};var _0x599b5c=_[_0x11b3('0x1b')](db[_0x11b3('0x25')][_0x11b3('0x26')],function(_0x439e39){return{'name':_0x439e39['fieldName'],'type':_0x439e39[_0x11b3('0x1e')]['key']};});_0x2469e6[_0x11b3('0x27')]=_[_0x11b3('0x1b')](_0x599b5c,'name');_0x2469e6[_0x11b3('0x28')]=_[_0x11b3('0x29')](_0x20728c[_0x11b3('0x28')]);_0x2469e6[_0x11b3('0x2a')]=_[_0x11b3('0x2b')](_0x2469e6[_0x11b3('0x27')],_0x2469e6[_0x11b3('0x28')]);_0x555d7d[_0x11b3('0x2c')]=_[_0x11b3('0x2b')](_0x2469e6[_0x11b3('0x27')],qs[_0x11b3('0x2d')](_0x20728c[_0x11b3('0x28')][_0x11b3('0x2d')]));_0x555d7d[_0x11b3('0x2c')]=_0x555d7d['attributes']['length']?_0x555d7d['attributes']:_0x2469e6[_0x11b3('0x27')];if(!_0x20728c[_0x11b3('0x28')]['hasOwnProperty'](_0x11b3('0x2e'))){_0x555d7d[_0x11b3('0xd')]=qs[_0x11b3('0xd')](_0x20728c[_0x11b3('0x28')]['limit']);_0x555d7d[_0x11b3('0x10')]=qs['offset'](_0x20728c['query'][_0x11b3('0x10')]);}_0x555d7d['order']=qs[_0x11b3('0x2f')](_0x20728c[_0x11b3('0x28')]['sort']);_0x555d7d['where']=qs[_0x11b3('0x2a')](_[_0x11b3('0x30')](_0x20728c['query'],_0x2469e6['filters']),_0x599b5c);if(_0x20728c[_0x11b3('0x28')][_0x11b3('0x19')]){_0x555d7d[_0x11b3('0x31')]=_[_0x11b3('0x32')](_0x555d7d[_0x11b3('0x31')],{'$or':_[_0x11b3('0x1b')](_0x599b5c,function(_0x49224e){if(_0x49224e[_0x11b3('0x1e')]!=='VIRTUAL'){var _0x607f16={};_0x607f16[_0x49224e[_0x11b3('0x20')]]={'$like':'%'+_0x20728c[_0x11b3('0x28')][_0x11b3('0x19')]+'%'};return _0x607f16;}})});}_0x555d7d=_[_0x11b3('0x32')]({},_0x555d7d,_0x20728c[_0x11b3('0x33')]);var _0x4ee3b6={'where':_0x555d7d[_0x11b3('0x31')]};return db['VoiceExtension'][_0x11b3('0xf')](_0x4ee3b6)[_0x11b3('0x22')](function(_0x3f6f77){_0x38dff9[_0x11b3('0xf')]=_0x3f6f77;if(_0x20728c[_0x11b3('0x28')][_0x11b3('0x34')]){_0x555d7d[_0x11b3('0x35')]=[{'all':!![]}];}return db[_0x11b3('0x25')]['findAll'](_0x555d7d);})[_0x11b3('0x22')](function(_0x7afc1){_0x38dff9[_0x11b3('0x36')]=_0x7afc1;return _0x38dff9;})['then'](respondWithFilteredResult(_0x319bcc,_0x555d7d))[_0x11b3('0x37')](handleError(_0x319bcc,null));};exports[_0x11b3('0x38')]=function(_0x1aff8e,_0x16b3e0){var _0x4f22e0={'raw':![],'where':{'id':_0x1aff8e['params']['id']}},_0x2012fe={};_0x2012fe[_0x11b3('0x27')]=_[_0x11b3('0x29')](db[_0x11b3('0x25')]['rawAttributes']);_0x2012fe[_0x11b3('0x28')]=_[_0x11b3('0x29')](_0x1aff8e[_0x11b3('0x28')]);_0x2012fe[_0x11b3('0x2a')]=_[_0x11b3('0x2b')](_0x2012fe['model'],_0x2012fe[_0x11b3('0x28')]);_0x4f22e0[_0x11b3('0x2c')]=_[_0x11b3('0x2b')](_0x2012fe[_0x11b3('0x27')],qs['fields'](_0x1aff8e['query'][_0x11b3('0x2d')]));_0x4f22e0[_0x11b3('0x2c')]=_0x4f22e0[_0x11b3('0x2c')]['length']?_0x4f22e0[_0x11b3('0x2c')]:_0x2012fe['model'];if(_0x1aff8e[_0x11b3('0x28')][_0x11b3('0x34')]){_0x4f22e0[_0x11b3('0x35')]=[{'all':!![]}];}_0x4f22e0=_['merge']({},_0x4f22e0,_0x1aff8e['options']);return db['VoiceExtension']['find'](_0x4f22e0)[_0x11b3('0x22')](handleEntityNotFound(_0x16b3e0,null))[_0x11b3('0x22')](respondWithResult(_0x16b3e0,null))[_0x11b3('0x37')](handleError(_0x16b3e0,null));};exports['destroy']=function(_0x25e469,_0x32068b){return db['VoiceExtension'][_0x11b3('0x1f')]({'where':{'id':_0x25e469[_0x11b3('0x39')]['id']}})[_0x11b3('0x22')](handleEntityNotFound(_0x32068b,null))[_0x11b3('0x22')](removeEntity(_0x32068b,null))[_0x11b3('0x37')](handleError(_0x32068b,null));};exports[_0x11b3('0x3a')]=function(_0xfc5294,_0xa8436a){if(_0xfc5294[_0x11b3('0x3b')]['type']===_0x11b3('0x3c')&&!_[_0x11b3('0x3d')](_0xfc5294[_0x11b3('0x3b')][_0x11b3('0x3e')],'_')){_0xfc5294[_0x11b3('0x3b')]['exten']='_'[_0x11b3('0x3f')](_0xfc5294[_0x11b3('0x3b')][_0x11b3('0x3e')]);}return db[_0x11b3('0x25')]['create'](_0xfc5294[_0x11b3('0x3b')],{'raw':![]})[_0x11b3('0x22')](function(_0x4af8a0){var _0x57c4c6=_0xfc5294['user']['get']({'plain':!![]});if(!_0x57c4c6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57c4c6['role']===_0x11b3('0x40')){var _0x311671=_0x4af8a0['get']({'plain':!![]});var _0x444c91=[{'name':_0x11b3('0x15'),'value':_0x11b3('0x16')},{'name':_0x11b3('0x17'),'value':_0x11b3('0x3c')},{'name':_0x11b3('0x18'),'value':_0x11b3('0x41')}];var _0xcff3d0=_['find'](_0x444c91,[_0x11b3('0x1c'),_0x311671[_0x11b3('0x1e')]])[_0x11b3('0x20')];return db['UserProfileSection'][_0x11b3('0x1f')]({'where':{'name':_0xcff3d0,'userProfileId':_0x57c4c6['userProfileId']},'raw':!![]})[_0x11b3('0x22')](function(_0x19a17f){if(_0x19a17f&&_0x19a17f['autoAssociation']===0x0){return db[_0x11b3('0x21')][_0x11b3('0x3a')]({'name':_0x311671[_0x11b3('0x20')],'resourceId':_0x311671['id'],'type':_0x19a17f[_0x11b3('0x20')],'sectionId':_0x19a17f['id']},{})[_0x11b3('0x22')](function(){return _0x4af8a0;});}else{return _0x4af8a0;}})[_0x11b3('0x37')](function(_0x1016fd){logger[_0x11b3('0x42')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1016fd);throw _0x1016fd;});}return _0x4af8a0;})[_0x11b3('0x22')](respondWithResult(_0xa8436a,0xc9))[_0x11b3('0x37')](handleError(_0xa8436a,null));};exports[_0x11b3('0x43')]=function(_0x527590,_0x126274){if(_0x527590['body']['id']){delete _0x527590[_0x11b3('0x3b')]['id'];}return db['VoiceExtension'][_0x11b3('0x1f')]({'where':{'id':_0x527590[_0x11b3('0x39')]['id']}})[_0x11b3('0x22')](handleEntityNotFound(_0x126274,null))[_0x11b3('0x22')](function(_0x3bebf6){if(_0x3bebf6){return db['VoiceExtension'][_0x11b3('0x43')](_[_0x11b3('0x30')](_0x527590['body'],[_0x11b3('0x3e'),_0x11b3('0x44'),_0x11b3('0x45'),_0x11b3('0x46'),_0x11b3('0x47'),_0x11b3('0x48'),_0x11b3('0x49')]),{'where':{'context':_0x3bebf6[_0x11b3('0x44')],'exten':_0x3bebf6[_0x11b3('0x3e')]},'individualHooks':!![]})['then'](function(_0x1fe8c7){return _0x1fe8c7;});}return null;})[_0x11b3('0x22')](respondWithStatusCode(_0x126274,null))[_0x11b3('0x37')](handleError(_0x126274,null));};exports['addApplications']=function(_0x4c67e3,_0x5d4437){var _0x2552c8=_0x4c67e3[_0x11b3('0x39')]['id'];var _0x289307=_0x4c67e3['body'];var _0xd44abc=0xc8;var _0x5526ae=null;return db[_0x11b3('0x4a')]['transaction']({'isolationLevel':db['sequelize'][_0x11b3('0x4b')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x31cdcb){return db['VoiceExtension'][_0x11b3('0x4c')]({'where':{'id':_0x2552c8},'transaction':_0x31cdcb})[_0x11b3('0x22')](function(_0x1ffb32){if(_0x1ffb32){return db[_0x11b3('0x25')][_0x11b3('0x13')]({'where':{'VoiceExtensionId':_0x2552c8},'transaction':_0x31cdcb})[_0x11b3('0x22')](function(){var _0x380311=_[_0x11b3('0x1b')](_0x289307,function(_0x2e03c5){_0x2e03c5[_0x11b3('0x4d')]=_0x2552c8;_0x2e03c5['isApp']=!![];return _0x2e03c5;});return _0x1ffb32[_0x11b3('0x4e')](_0x380311);})['then'](function(_0x42401a){return db[_0x11b3('0x25')][_0x11b3('0x4f')](_0x42401a,{'transaction':_0x31cdcb});});}else{_0xd44abc=0x194;_0x5526ae=[];}});})['then'](function(){if(_0xd44abc!==0x194){return db[_0x11b3('0x25')][_0x11b3('0x50')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2552c8},'order':_0x11b3('0x51')})[_0x11b3('0x22')](function(_0x5e3b4e){_0x5526ae=_0x5e3b4e;});}})['catch'](function(_0x199194){_0xd44abc=0x1f4;logger[_0x11b3('0x42')](_0x199194[_0x11b3('0x23')]);if(_0x199194[_0x11b3('0x20')]){delete _0x199194['name'];}_0x5526ae=_0x199194;})[_0x11b3('0x52')](function(){if(_0x5526ae===null){_0x5d4437[_0x11b3('0x9')](_0xd44abc);}else{if(_0xd44abc===0x1f4){_0x5d4437[_0x11b3('0xa')](_0xd44abc)[_0x11b3('0x24')](_0x5526ae);}else{_0x5d4437[_0x11b3('0xa')](_0xd44abc)[_0x11b3('0xc')](_0x5526ae);}}});};
\ No newline at end of file