Built motion from commit d5e4af8c.|2.6.23
[motion2.git] / server / api / voiceExtension / voiceExtension.controller.js
index 92f2137..3f26344 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x4735=['name','UserProfileResource','error','stack','index','map','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','create','body','startsWith','exten','concat','get','role','user','internal','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','recordingFormat','cutdigits','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','send','lodash','ioredis','../../components/parsers/qs','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','destroy','then','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','value','includes','find','type'];(function(_0x296a34,_0x11dc78){var _0x2d668b=function(_0x3fc86e){while(--_0x3fc86e){_0x296a34['push'](_0x296a34['shift']());}};_0x2d668b(++_0x11dc78);}(_0x4735,0x14f));var _0x5473=function(_0x26cabe,_0x3fa64b){_0x26cabe=_0x26cabe-0x0;var _0x108aa1=_0x4735[_0x26cabe];return _0x108aa1;};'use strict';var _=require(_0x5473('0x0'));var Redis=require(_0x5473('0x1'));var qs=require(_0x5473('0x2'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require(_0x5473('0x3'))['db'];config['redis']=_[_0x5473('0x4')](config[_0x5473('0x5')],{'host':_0x5473('0x6'),'port':0x18eb});var socket=require(_0x5473('0x7'))(new Redis(config[_0x5473('0x5')]));require(_0x5473('0x8'))[_0x5473('0x9')](socket);function respondWithStatusCode(_0x3dc44a,_0x55da41){_0x55da41=_0x55da41||0xcc;return function(_0x336416){if(_0x336416){return _0x3dc44a[_0x5473('0xa')](_0x55da41);}return _0x3dc44a[_0x5473('0xb')](_0x55da41)[_0x5473('0xc')]();};}function respondWithResult(_0x63963c,_0x588f1f){_0x588f1f=_0x588f1f||0xc8;return function(_0x1bc243){if(_0x1bc243){return _0x63963c['status'](_0x588f1f)[_0x5473('0xd')](_0x1bc243);}};}function respondWithFilteredResult(_0x1e559f,_0x28183d){return function(_0x338f3b){if(_0x338f3b){var _0x504644=typeof _0x28183d[_0x5473('0xe')]===_0x5473('0xf')&&typeof _0x28183d[_0x5473('0x10')]===_0x5473('0xf');var _0x1caeb5=_0x338f3b['count'];var _0x18d9c8=_0x504644?0x0:_0x28183d['offset'];var _0x169d31=_0x504644?_0x338f3b[_0x5473('0x11')]:_0x28183d['offset']+_0x28183d['limit'];var _0x9dbfbf;if(_0x169d31>=_0x1caeb5){_0x169d31=_0x1caeb5;_0x9dbfbf=0xc8;}else{_0x9dbfbf=0xce;}_0x1e559f[_0x5473('0xb')](_0x9dbfbf);return _0x1e559f[_0x5473('0x12')](_0x5473('0x13'),_0x18d9c8+'-'+_0x169d31+'/'+_0x1caeb5)[_0x5473('0xd')](_0x338f3b);}return null;};}function removeEntity(_0x5dd791){return function(_0x3fdedf){if(_0x3fdedf){return _0x3fdedf[_0x5473('0x14')]()[_0x5473('0x15')](function(){var _0x2f3835=_0x3fdedf['get']({'plain':!![]});var _0x57c28a=[{'name':_0x5473('0x16'),'value':_0x5473('0x17'),'ignore':![]},{'name':_0x5473('0x18'),'value':_0x5473('0x19'),'ignore':![]},{'name':_0x5473('0x1a'),'value':'internal','ignore':![]}];var _0x265f2d=_(_0x57c28a)[_0x5473('0x1b')](_0x5473('0x1c'))['map'](_0x5473('0x1d'))['value']();if(_[_0x5473('0x1e')](_0x265f2d,_0x2f3835['type'])){return;}var _0x13ae39=_[_0x5473('0x1f')](_0x57c28a,[_0x5473('0x1d'),_0x2f3835[_0x5473('0x20')]])[_0x5473('0x21')];return db[_0x5473('0x22')][_0x5473('0x14')]({'where':{'type':_0x13ae39,'resourceId':_0x2f3835['id']}})[_0x5473('0x15')](function(){return _0x3fdedf;});})['then'](function(){_0x5dd791[_0x5473('0xb')](0xcc)[_0x5473('0xc')]();});}};}function handleEntityNotFound(_0xbe55e0){return function(_0x47a9c2){if(!_0x47a9c2){_0xbe55e0['sendStatus'](0x194);}return _0x47a9c2;};}function handleError(_0x25f55f,_0x5a262f){_0x5a262f=_0x5a262f||0x1f4;return function(_0x3df270){logger[_0x5473('0x23')](_0x3df270[_0x5473('0x24')]);if(_0x3df270[_0x5473('0x21')]){delete _0x3df270[_0x5473('0x21')];}_0x25f55f[_0x5473('0xb')](_0x5a262f)['send'](_0x3df270);};}exports[_0x5473('0x25')]=function(_0x2169e9,_0x4bb378){var _0x1d0ba6={},_0x73cdfb={},_0x226a83={'count':0x0,'rows':[]};var _0x28ed3c=_[_0x5473('0x26')](db[_0x5473('0x27')][_0x5473('0x28')],function(_0x3ac6d4){return{'name':_0x3ac6d4[_0x5473('0x29')],'type':_0x3ac6d4[_0x5473('0x20')][_0x5473('0x2a')]};});_0x73cdfb[_0x5473('0x2b')]=_[_0x5473('0x26')](_0x28ed3c,_0x5473('0x21'));_0x73cdfb[_0x5473('0x2c')]=_[_0x5473('0x2d')](_0x2169e9[_0x5473('0x2c')]);_0x73cdfb[_0x5473('0x2e')]=_[_0x5473('0x2f')](_0x73cdfb[_0x5473('0x2b')],_0x73cdfb['query']);_0x1d0ba6['attributes']=_[_0x5473('0x2f')](_0x73cdfb['model'],qs[_0x5473('0x30')](_0x2169e9[_0x5473('0x2c')]['fields']));_0x1d0ba6['attributes']=_0x1d0ba6[_0x5473('0x31')]['length']?_0x1d0ba6[_0x5473('0x31')]:_0x73cdfb[_0x5473('0x2b')];if(!_0x2169e9[_0x5473('0x2c')][_0x5473('0x32')]('nolimit')){_0x1d0ba6[_0x5473('0x10')]=qs[_0x5473('0x10')](_0x2169e9['query'][_0x5473('0x10')]);_0x1d0ba6[_0x5473('0xe')]=qs[_0x5473('0xe')](_0x2169e9[_0x5473('0x2c')][_0x5473('0xe')]);}_0x1d0ba6['order']=qs[_0x5473('0x33')](_0x2169e9[_0x5473('0x2c')][_0x5473('0x33')]);_0x1d0ba6[_0x5473('0x34')]=qs[_0x5473('0x2e')](_['pick'](_0x2169e9[_0x5473('0x2c')],_0x73cdfb[_0x5473('0x2e')]),_0x28ed3c);if(_0x2169e9[_0x5473('0x2c')][_0x5473('0x1b')]){_0x1d0ba6[_0x5473('0x34')]=_[_0x5473('0x35')](_0x1d0ba6['where'],{'$or':_['map'](_0x28ed3c,function(_0x5165ba){if(_0x5165ba['type']!==_0x5473('0x36')){var _0xc3716e={};_0xc3716e[_0x5165ba[_0x5473('0x21')]]={'$like':'%'+_0x2169e9[_0x5473('0x2c')][_0x5473('0x1b')]+'%'};return _0xc3716e;}})});}_0x1d0ba6=_[_0x5473('0x35')]({},_0x1d0ba6,_0x2169e9[_0x5473('0x37')]);var _0x5bede4={'where':_0x1d0ba6['where']};return db[_0x5473('0x27')]['count'](_0x5bede4)[_0x5473('0x15')](function(_0xbaad56){_0x226a83[_0x5473('0x11')]=_0xbaad56;if(_0x2169e9[_0x5473('0x2c')][_0x5473('0x38')]){_0x1d0ba6[_0x5473('0x39')]=[{'all':!![]}];}return db[_0x5473('0x27')][_0x5473('0x3a')](_0x1d0ba6);})[_0x5473('0x15')](function(_0x23b202){_0x226a83['rows']=_0x23b202;return _0x226a83;})[_0x5473('0x15')](respondWithFilteredResult(_0x4bb378,_0x1d0ba6))[_0x5473('0x3b')](handleError(_0x4bb378,null));};exports['show']=function(_0x2edb75,_0x182bcb){var _0x1cbe67={'raw':![],'where':{'id':_0x2edb75[_0x5473('0x3c')]['id']}},_0x3e85f5={};_0x3e85f5[_0x5473('0x2b')]=_[_0x5473('0x2d')](db[_0x5473('0x27')][_0x5473('0x28')]);_0x3e85f5[_0x5473('0x2c')]=_['keys'](_0x2edb75[_0x5473('0x2c')]);_0x3e85f5[_0x5473('0x2e')]=_['intersection'](_0x3e85f5[_0x5473('0x2b')],_0x3e85f5[_0x5473('0x2c')]);_0x1cbe67[_0x5473('0x31')]=_[_0x5473('0x2f')](_0x3e85f5[_0x5473('0x2b')],qs['fields'](_0x2edb75[_0x5473('0x2c')][_0x5473('0x30')]));_0x1cbe67[_0x5473('0x31')]=_0x1cbe67[_0x5473('0x31')]['length']?_0x1cbe67[_0x5473('0x31')]:_0x3e85f5[_0x5473('0x2b')];if(_0x2edb75[_0x5473('0x2c')][_0x5473('0x38')]){_0x1cbe67[_0x5473('0x39')]=[{'all':!![]}];}_0x1cbe67=_['merge']({},_0x1cbe67,_0x2edb75[_0x5473('0x37')]);return db[_0x5473('0x27')][_0x5473('0x1f')](_0x1cbe67)['then'](handleEntityNotFound(_0x182bcb,null))[_0x5473('0x15')](respondWithResult(_0x182bcb,null))[_0x5473('0x3b')](handleError(_0x182bcb,null));};exports[_0x5473('0x14')]=function(_0xfe913,_0x37c8e0){return db[_0x5473('0x27')][_0x5473('0x1f')]({'where':{'id':_0xfe913[_0x5473('0x3c')]['id']}})[_0x5473('0x15')](handleEntityNotFound(_0x37c8e0,null))[_0x5473('0x15')](removeEntity(_0x37c8e0,null))[_0x5473('0x3b')](handleError(_0x37c8e0,null));};exports[_0x5473('0x3d')]=function(_0x27b0ed,_0x42a124){if(_0x27b0ed[_0x5473('0x3e')][_0x5473('0x20')]===_0x5473('0x19')&&!_[_0x5473('0x3f')](_0x27b0ed[_0x5473('0x3e')][_0x5473('0x40')],'_')){_0x27b0ed[_0x5473('0x3e')]['exten']='_'[_0x5473('0x41')](_0x27b0ed[_0x5473('0x3e')][_0x5473('0x40')]);}return db[_0x5473('0x27')][_0x5473('0x3d')](_0x27b0ed[_0x5473('0x3e')],{'raw':![]})[_0x5473('0x15')](function(_0x526357){var _0xf4360b=_0x27b0ed['user'][_0x5473('0x42')]({'plain':!![]});if(!_0xf4360b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xf4360b[_0x5473('0x43')]===_0x5473('0x44')){var _0xa8e55f=_0x526357[_0x5473('0x42')]({'plain':!![]});var _0x51f4d7=[{'name':'InboundRoutes','value':_0x5473('0x17')},{'name':_0x5473('0x18'),'value':'outbound'},{'name':_0x5473('0x1a'),'value':_0x5473('0x45')}];var _0x3312c5=_[_0x5473('0x1f')](_0x51f4d7,[_0x5473('0x1d'),_0xa8e55f['type']])['name'];return db['UserProfileSection'][_0x5473('0x1f')]({'where':{'name':_0x3312c5,'userProfileId':_0xf4360b[_0x5473('0x46')]},'raw':!![]})[_0x5473('0x15')](function(_0x4f19b0){if(_0x4f19b0&&_0x4f19b0[_0x5473('0x47')]===0x0){return db[_0x5473('0x22')][_0x5473('0x3d')]({'name':_0xa8e55f['name'],'resourceId':_0xa8e55f['id'],'type':_0x4f19b0[_0x5473('0x21')],'sectionId':_0x4f19b0['id']},{})[_0x5473('0x15')](function(){return _0x526357;});}else{return _0x526357;}})['catch'](function(_0x5918ff){logger['error'](_0x5473('0x48'),_0x5918ff);throw _0x5918ff;});}return _0x526357;})[_0x5473('0x15')](respondWithResult(_0x42a124,0xc9))['catch'](handleError(_0x42a124,null));};exports[_0x5473('0x49')]=function(_0x38c5be,_0x4df165){if(_0x38c5be[_0x5473('0x3e')]['id']){delete _0x38c5be[_0x5473('0x3e')]['id'];}return db[_0x5473('0x27')][_0x5473('0x1f')]({'where':{'id':_0x38c5be[_0x5473('0x3c')]['id']}})[_0x5473('0x15')](handleEntityNotFound(_0x4df165,null))[_0x5473('0x15')](function(_0x5a96d8){if(_0x5a96d8){return db[_0x5473('0x27')][_0x5473('0x49')](_[_0x5473('0x4a')](_0x38c5be[_0x5473('0x3e')],[_0x5473('0x40'),'context','description',_0x5473('0x4b'),_0x5473('0x4c'),'mandatoryDisposition',_0x5473('0x4d')]),{'where':{'context':_0x5a96d8['context'],'exten':_0x5a96d8[_0x5473('0x40')]},'individualHooks':!![]})[_0x5473('0x15')](function(_0x58e8bb){return _0x58e8bb;});}return null;})['then'](respondWithStatusCode(_0x4df165,null))[_0x5473('0x3b')](handleError(_0x4df165,null));};exports[_0x5473('0x4e')]=function(_0x33482e,_0x253553){var _0x3151ad=_0x33482e[_0x5473('0x3c')]['id'];var _0x3d0b93=_0x33482e[_0x5473('0x3e')];var _0x528eac=0xc8;var _0x507a51=null;return db[_0x5473('0x4f')][_0x5473('0x50')]({'isolationLevel':db[_0x5473('0x4f')][_0x5473('0x51')][_0x5473('0x52')][_0x5473('0x53')]},function(_0x2f3a70){return db['VoiceExtension'][_0x5473('0x54')]({'where':{'id':_0x3151ad},'transaction':_0x2f3a70})[_0x5473('0x15')](function(_0x276581){if(_0x276581){return db['VoiceExtension']['destroy']({'where':{'VoiceExtensionId':_0x3151ad},'transaction':_0x2f3a70})['then'](function(){var _0x2ac37f=_['map'](_0x3d0b93,function(_0x3de2a4){_0x3de2a4[_0x5473('0x55')]=_0x3151ad;_0x3de2a4[_0x5473('0x56')]=!![];return _0x3de2a4;});return _0x276581[_0x5473('0x57')](_0x2ac37f);})[_0x5473('0x15')](function(_0x36bc1d){return db[_0x5473('0x27')][_0x5473('0x58')](_0x36bc1d,{'transaction':_0x2f3a70});});}else{_0x528eac=0x194;_0x507a51=[];}});})[_0x5473('0x15')](function(){if(_0x528eac!==0x194){return db[_0x5473('0x27')][_0x5473('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x3151ad},'order':_0x5473('0x5a')})[_0x5473('0x15')](function(_0x342fd8){_0x507a51=_0x342fd8;});}})[_0x5473('0x3b')](function(_0x5b7a8c){_0x528eac=0x1f4;logger[_0x5473('0x23')](_0x5b7a8c['stack']);if(_0x5b7a8c[_0x5473('0x21')]){delete _0x5b7a8c['name'];}_0x507a51=_0x5b7a8c;})['finally'](function(){if(_0x507a51===null){_0x253553['sendStatus'](_0x528eac);}else{if(_0x528eac===0x1f4){_0x253553[_0x5473('0xb')](_0x528eac)[_0x5473('0x5b')](_0x507a51);}else{_0x253553[_0x5473('0xb')](_0x528eac)['json'](_0x507a51);}}});};
\ No newline at end of file
+var _0x3844=['rows','catch','show','params','rawAttributes','options','create','body','startsWith','exten','concat','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','InboundRoutes','OutboundRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','addApplications','sequelize','transaction','Transaction','findOne','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','defaults','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','destroy','inbound','outbound','InternalRoutes','internal','map','value','includes','type','find','name','UserProfileResource','then','end','error','stack','send','index','VoiceExtension','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','findAll'];(function(_0x5db974,_0x45126b){var _0x32b019=function(_0x49ddd7){while(--_0x49ddd7){_0x5db974['push'](_0x5db974['shift']());}};_0x32b019(++_0x45126b);}(_0x3844,0x83));var _0x4384=function(_0x4e8c09,_0x38eae6){_0x4e8c09=_0x4e8c09-0x0;var _0x5aca42=_0x3844[_0x4e8c09];return _0x5aca42;};'use strict';var _=require(_0x4384('0x0'));var Redis=require('ioredis');var qs=require(_0x4384('0x1'));var logger=require(_0x4384('0x2'))('api');var config=require('../../config/environment');var db=require(_0x4384('0x3'))['db'];config[_0x4384('0x4')]=_[_0x4384('0x5')](config[_0x4384('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0x4384('0x6'))(new Redis(config[_0x4384('0x4')]));require(_0x4384('0x7'))[_0x4384('0x8')](socket);function respondWithStatusCode(_0x3bf52e,_0x967cdf){_0x967cdf=_0x967cdf||0xcc;return function(_0x4dd03f){if(_0x4dd03f){return _0x3bf52e[_0x4384('0x9')](_0x967cdf);}return _0x3bf52e[_0x4384('0xa')](_0x967cdf)['end']();};}function respondWithResult(_0x4ebb0c,_0x502b16){_0x502b16=_0x502b16||0xc8;return function(_0x3369a6){if(_0x3369a6){return _0x4ebb0c['status'](_0x502b16)[_0x4384('0xb')](_0x3369a6);}};}function respondWithFilteredResult(_0xf3f1af,_0x82b305){return function(_0x21deaa){if(_0x21deaa){var _0xcfa3ee=typeof _0x82b305[_0x4384('0xc')]===_0x4384('0xd')&&typeof _0x82b305[_0x4384('0xe')]==='undefined';var _0x83181=_0x21deaa[_0x4384('0xf')];var _0x48f453=_0xcfa3ee?0x0:_0x82b305[_0x4384('0xc')];var _0x8aa6da=_0xcfa3ee?_0x21deaa[_0x4384('0xf')]:_0x82b305[_0x4384('0xc')]+_0x82b305[_0x4384('0xe')];var _0x44c091;if(_0x8aa6da>=_0x83181){_0x8aa6da=_0x83181;_0x44c091=0xc8;}else{_0x44c091=0xce;}_0xf3f1af[_0x4384('0xa')](_0x44c091);return _0xf3f1af[_0x4384('0x10')](_0x4384('0x11'),_0x48f453+'-'+_0x8aa6da+'/'+_0x83181)['json'](_0x21deaa);}return null;};}function removeEntity(_0x50279d){return function(_0x4785e5){if(_0x4785e5){return _0x4785e5[_0x4384('0x12')]()['then'](function(){var _0x2edf33=_0x4785e5['get']({'plain':!![]});var _0x454bab=[{'name':'InboundRoutes','value':_0x4384('0x13'),'ignore':![]},{'name':'OutboundRoutes','value':_0x4384('0x14'),'ignore':![]},{'name':_0x4384('0x15'),'value':_0x4384('0x16'),'ignore':![]}];var _0x372a50=_(_0x454bab)['filter']('ignore')[_0x4384('0x17')](_0x4384('0x18'))[_0x4384('0x18')]();if(_[_0x4384('0x19')](_0x372a50,_0x2edf33[_0x4384('0x1a')])){return;}var _0x4cc7cb=_[_0x4384('0x1b')](_0x454bab,[_0x4384('0x18'),_0x2edf33['type']])[_0x4384('0x1c')];return db[_0x4384('0x1d')][_0x4384('0x12')]({'where':{'type':_0x4cc7cb,'resourceId':_0x2edf33['id']}})[_0x4384('0x1e')](function(){return _0x4785e5;});})[_0x4384('0x1e')](function(){_0x50279d[_0x4384('0xa')](0xcc)[_0x4384('0x1f')]();});}};}function handleEntityNotFound(_0x22f750){return function(_0x4cfce9){if(!_0x4cfce9){_0x22f750[_0x4384('0x9')](0x194);}return _0x4cfce9;};}function handleError(_0x3ce101,_0x1fa40e){_0x1fa40e=_0x1fa40e||0x1f4;return function(_0x234824){logger[_0x4384('0x20')](_0x234824[_0x4384('0x21')]);if(_0x234824[_0x4384('0x1c')]){delete _0x234824[_0x4384('0x1c')];}_0x3ce101[_0x4384('0xa')](_0x1fa40e)[_0x4384('0x22')](_0x234824);};}exports[_0x4384('0x23')]=function(_0x2835b9,_0x3bd58b){var _0x4351fc={},_0x28f295={},_0x4c2eee={'count':0x0,'rows':[]};var _0x2ec64a=_[_0x4384('0x17')](db[_0x4384('0x24')]['rawAttributes'],function(_0x5614bc){return{'name':_0x5614bc[_0x4384('0x25')],'type':_0x5614bc['type'][_0x4384('0x26')]};});_0x28f295[_0x4384('0x27')]=_[_0x4384('0x17')](_0x2ec64a,_0x4384('0x1c'));_0x28f295['query']=_[_0x4384('0x28')](_0x2835b9[_0x4384('0x29')]);_0x28f295[_0x4384('0x2a')]=_[_0x4384('0x2b')](_0x28f295['model'],_0x28f295[_0x4384('0x29')]);_0x4351fc['attributes']=_[_0x4384('0x2b')](_0x28f295[_0x4384('0x27')],qs[_0x4384('0x2c')](_0x2835b9[_0x4384('0x29')]['fields']));_0x4351fc[_0x4384('0x2d')]=_0x4351fc['attributes'][_0x4384('0x2e')]?_0x4351fc[_0x4384('0x2d')]:_0x28f295['model'];if(!_0x2835b9[_0x4384('0x29')]['hasOwnProperty'](_0x4384('0x2f'))){_0x4351fc[_0x4384('0xe')]=qs[_0x4384('0xe')](_0x2835b9[_0x4384('0x29')]['limit']);_0x4351fc[_0x4384('0xc')]=qs[_0x4384('0xc')](_0x2835b9[_0x4384('0x29')][_0x4384('0xc')]);}_0x4351fc[_0x4384('0x30')]=qs[_0x4384('0x31')](_0x2835b9[_0x4384('0x29')][_0x4384('0x31')]);_0x4351fc[_0x4384('0x32')]=qs[_0x4384('0x2a')](_['pick'](_0x2835b9[_0x4384('0x29')],_0x28f295['filters']),_0x2ec64a);if(_0x2835b9['query'][_0x4384('0x33')]){_0x4351fc[_0x4384('0x32')]=_[_0x4384('0x34')](_0x4351fc[_0x4384('0x32')],{'$or':_['map'](_0x2ec64a,function(_0x2dd033){if(_0x2dd033[_0x4384('0x1a')]!==_0x4384('0x35')){var _0x4a32d0={};_0x4a32d0[_0x2dd033['name']]={'$like':'%'+_0x2835b9[_0x4384('0x29')][_0x4384('0x33')]+'%'};return _0x4a32d0;}})});}_0x4351fc=_['merge']({},_0x4351fc,_0x2835b9['options']);var _0x5b97b4={'where':_0x4351fc[_0x4384('0x32')]};return db[_0x4384('0x24')]['count'](_0x5b97b4)['then'](function(_0x2a8eba){_0x4c2eee['count']=_0x2a8eba;if(_0x2835b9[_0x4384('0x29')]['includeAll']){_0x4351fc['include']=[{'all':!![]}];}return db['VoiceExtension'][_0x4384('0x36')](_0x4351fc);})[_0x4384('0x1e')](function(_0x5a4659){_0x4c2eee[_0x4384('0x37')]=_0x5a4659;return _0x4c2eee;})[_0x4384('0x1e')](respondWithFilteredResult(_0x3bd58b,_0x4351fc))[_0x4384('0x38')](handleError(_0x3bd58b,null));};exports[_0x4384('0x39')]=function(_0x2a156e,_0x5d7df1){var _0x5c9bde={'raw':![],'where':{'id':_0x2a156e[_0x4384('0x3a')]['id']}},_0x3c04f8={};_0x3c04f8[_0x4384('0x27')]=_['keys'](db[_0x4384('0x24')][_0x4384('0x3b')]);_0x3c04f8[_0x4384('0x29')]=_[_0x4384('0x28')](_0x2a156e['query']);_0x3c04f8['filters']=_[_0x4384('0x2b')](_0x3c04f8[_0x4384('0x27')],_0x3c04f8[_0x4384('0x29')]);_0x5c9bde[_0x4384('0x2d')]=_[_0x4384('0x2b')](_0x3c04f8[_0x4384('0x27')],qs[_0x4384('0x2c')](_0x2a156e[_0x4384('0x29')][_0x4384('0x2c')]));_0x5c9bde[_0x4384('0x2d')]=_0x5c9bde[_0x4384('0x2d')][_0x4384('0x2e')]?_0x5c9bde['attributes']:_0x3c04f8[_0x4384('0x27')];if(_0x2a156e['query']['includeAll']){_0x5c9bde['include']=[{'all':!![]}];}_0x5c9bde=_[_0x4384('0x34')]({},_0x5c9bde,_0x2a156e[_0x4384('0x3c')]);return db[_0x4384('0x24')]['find'](_0x5c9bde)[_0x4384('0x1e')](handleEntityNotFound(_0x5d7df1,null))[_0x4384('0x1e')](respondWithResult(_0x5d7df1,null))['catch'](handleError(_0x5d7df1,null));};exports[_0x4384('0x12')]=function(_0x21be65,_0x4672f5){return db['VoiceExtension'][_0x4384('0x1b')]({'where':{'id':_0x21be65['params']['id']}})[_0x4384('0x1e')](handleEntityNotFound(_0x4672f5,null))[_0x4384('0x1e')](removeEntity(_0x4672f5,null))[_0x4384('0x38')](handleError(_0x4672f5,null));};exports[_0x4384('0x3d')]=function(_0x5b7a31,_0x159750){if(_0x5b7a31[_0x4384('0x3e')][_0x4384('0x1a')]===_0x4384('0x14')&&!_[_0x4384('0x3f')](_0x5b7a31[_0x4384('0x3e')][_0x4384('0x40')],'_')){_0x5b7a31[_0x4384('0x3e')][_0x4384('0x40')]='_'[_0x4384('0x41')](_0x5b7a31[_0x4384('0x3e')][_0x4384('0x40')]);}return db[_0x4384('0x24')][_0x4384('0x3d')](_0x5b7a31[_0x4384('0x3e')],{'raw':![]})['then'](function(_0x2eba53){var _0x509ac5=_0x5b7a31['user'][_0x4384('0x42')]({'plain':!![]});if(!_0x509ac5)throw new Error(_0x4384('0x43'));if(_0x509ac5[_0x4384('0x44')]===_0x4384('0x45')){var _0x28352a=_0x2eba53[_0x4384('0x42')]({'plain':!![]});var _0x5249c6=[{'name':_0x4384('0x46'),'value':_0x4384('0x13')},{'name':_0x4384('0x47'),'value':_0x4384('0x14')},{'name':_0x4384('0x15'),'value':_0x4384('0x16')}];var _0x4083c2=_['find'](_0x5249c6,[_0x4384('0x18'),_0x28352a['type']])[_0x4384('0x1c')];return db[_0x4384('0x48')][_0x4384('0x1b')]({'where':{'name':_0x4083c2,'userProfileId':_0x509ac5[_0x4384('0x49')]},'raw':!![]})[_0x4384('0x1e')](function(_0x39f750){if(_0x39f750&&_0x39f750[_0x4384('0x4a')]===0x0){return db['UserProfileResource'][_0x4384('0x3d')]({'name':_0x28352a[_0x4384('0x1c')],'resourceId':_0x28352a['id'],'type':_0x39f750['name'],'sectionId':_0x39f750['id']},{})[_0x4384('0x1e')](function(){return _0x2eba53;});}else{return _0x2eba53;}})[_0x4384('0x38')](function(_0x2c0e53){logger[_0x4384('0x20')](_0x4384('0x4b'),_0x2c0e53);throw _0x2c0e53;});}return _0x2eba53;})[_0x4384('0x1e')](respondWithResult(_0x159750,0xc9))[_0x4384('0x38')](handleError(_0x159750,null));};exports[_0x4384('0x4c')]=function(_0x487f87,_0x7b46ad){if(_0x487f87[_0x4384('0x3e')]['id']){delete _0x487f87[_0x4384('0x3e')]['id'];}return db['VoiceExtension'][_0x4384('0x1b')]({'where':{'id':_0x487f87['params']['id']}})['then'](handleEntityNotFound(_0x7b46ad,null))['then'](function(_0x514391){if(_0x514391){return db['VoiceExtension'][_0x4384('0x4c')](_[_0x4384('0x4d')](_0x487f87[_0x4384('0x3e')],['exten',_0x4384('0x4e'),_0x4384('0x4f'),_0x4384('0x50'),_0x4384('0x51'),'mandatoryDisposition','alias']),{'where':{'context':_0x514391['context'],'exten':_0x514391[_0x4384('0x40')]},'individualHooks':!![]})[_0x4384('0x1e')](function(_0x4a91f0){return _0x4a91f0;});}return null;})[_0x4384('0x1e')](respondWithStatusCode(_0x7b46ad,null))[_0x4384('0x38')](handleError(_0x7b46ad,null));};exports[_0x4384('0x52')]=function(_0x493aa4,_0x353205){var _0x1ed6c0=_0x493aa4['params']['id'];var _0x1f6c7a=_0x493aa4[_0x4384('0x3e')];var _0x5f42d4=0xc8;var _0x2fc282=null;return db[_0x4384('0x53')][_0x4384('0x54')]({'isolationLevel':db[_0x4384('0x53')][_0x4384('0x55')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x3832ba){return db[_0x4384('0x24')][_0x4384('0x56')]({'where':{'id':_0x1ed6c0},'transaction':_0x3832ba})[_0x4384('0x1e')](function(_0x34cced){if(_0x34cced){return db[_0x4384('0x24')]['destroy']({'where':{'VoiceExtensionId':_0x1ed6c0},'transaction':_0x3832ba})['then'](function(){var _0x446ba0=_['map'](_0x1f6c7a,function(_0x271685){_0x271685[_0x4384('0x57')]=_0x1ed6c0;_0x271685[_0x4384('0x58')]=!![];return _0x271685;});return _0x34cced['createRouting'](_0x446ba0);})[_0x4384('0x1e')](function(_0x49d5c9){return db[_0x4384('0x24')][_0x4384('0x59')](_0x49d5c9,{'transaction':_0x3832ba});});}else{_0x5f42d4=0x194;_0x2fc282=[];}});})[_0x4384('0x1e')](function(){if(_0x5f42d4!==0x194){return db[_0x4384('0x24')][_0x4384('0x5a')]({'where':{'isApp':!![],'VoiceExtensionId':_0x1ed6c0},'order':_0x4384('0x5b')})[_0x4384('0x1e')](function(_0x1aac24){_0x2fc282=_0x1aac24;});}})['catch'](function(_0x3141ad){_0x5f42d4=0x1f4;logger['error'](_0x3141ad['stack']);if(_0x3141ad[_0x4384('0x1c')]){delete _0x3141ad[_0x4384('0x1c')];}_0x2fc282=_0x3141ad;})[_0x4384('0x5c')](function(){if(_0x2fc282===null){_0x353205[_0x4384('0x9')](_0x5f42d4);}else{if(_0x5f42d4===0x1f4){_0x353205[_0x4384('0xa')](_0x5f42d4)['send'](_0x2fc282);}else{_0x353205[_0x4384('0xa')](_0x5f42d4)['json'](_0x2fc282);}}});};
\ No newline at end of file