Built motion from commit 4a18b36e645f5fa4a517d36f9783bde259878164. Version 3.0.0...
[motion-next.git] / server / api / network / network.controller.js
index 284bcab..9379488 100644 (file)
@@ -1 +1 @@
-const a457_0x4410=['like','sort','filter','files/templates/network.ejs','root','filters','client','api','send','lodash','create','findOne','/etc/asterisk/sip_xcally_%s.conf','params','key','transaction','end','status','length','request','utf8','nolimit','TURN','body','fields','destroy','attributes','undefined','type','keys','chan_sip.so','findAll','limit','includeAll','Network','res_stun_monitor.so','util','name','catch','stringify','/etc/asterisk/turn_xcally.conf','readFileSync','join','http','where','toUpperCase','offset','count','request\x20sent','json','info','writeFileSync','include','server/files/templates/turn_multiple.ejs','Network,\x20%s,\x20%s,\x20%s','format','merge','debug','order','Reload','update','../../components/parsers/qs','then','files/templates/stun_multiple.ejs','path','query','pick','show','index','toLowerCase','/etc/asterisk/stun_xcally.conf','code','ejs','options','render','intersection','message','error','model','Network,\x20%s,\x20%s','map','STUN'];(function(_0x11d432,_0x441046){const _0x42e1d3=function(_0x55e119){while(--_0x55e119){_0x11d432['push'](_0x11d432['shift']());}};_0x42e1d3(++_0x441046);}(a457_0x4410,0x17c));const a457_0x42e1=function(_0x11d432,_0x441046){_0x11d432=_0x11d432-0x0;let _0x42e1d3=a457_0x4410[_0x11d432];return _0x42e1d3;};const _0x54bebc=a457_0x42e1;'use strict';const util=require(_0x54bebc('0x42')),path=require(_0x54bebc('0xc')),ejs=require(_0x54bebc('0x14')),fs=require('fs'),_=require(_0x54bebc('0x27')),qs=require(_0x54bebc('0x9')),logger=require('../../config/logger')(_0x54bebc('0x25')),config=require('../../config/environment'),db=require('../../mysqldb')['db'],{Op}=require('sequelize'),jayson=require('jayson/promise'),client=jayson[_0x54bebc('0x24')][_0x54bebc('0x49')]({'port':0x232a});function respondWithRpcPromise(_0x55e119,_0x511d43,_0x326eb0,_0xd17e2a){return new Promise(function(_0x32b5b4,_0x7d1d04){const _0x5cf6c7=a457_0x42e1,_0x25de0b=_0xd17e2a||client;return _0x25de0b[_0x5cf6c7('0x31')](_0x55e119,_0x326eb0)[_0x5cf6c7('0xa')](function(_0x184949){const _0x4633dd=_0x5cf6c7;logger[_0x4633dd('0x50')](_0x4633dd('0x1b'),_0x511d43,'request\x20sent'),logger[_0x4633dd('0x5')](_0x4633dd('0x2'),_0x511d43,_0x4633dd('0x4e'),JSON[_0x4633dd('0x45')](_0x184949));if(_0x184949[_0x4633dd('0x19')]){if(_0x184949['error'][_0x4633dd('0x13')]===0x1f4)return logger[_0x4633dd('0x19')](_0x4633dd('0x1b'),_0x511d43,_0x184949[_0x4633dd('0x19')][_0x4633dd('0x18')]),_0x7d1d04(_0x184949['error'][_0x4633dd('0x18')]);return logger['error'](_0x4633dd('0x1b'),_0x511d43,_0x184949[_0x4633dd('0x19')][_0x4633dd('0x18')]),_0x32b5b4(_0x184949[_0x4633dd('0x19')]['message']);}else logger[_0x4633dd('0x50')](_0x4633dd('0x1b'),_0x511d43,_0x4633dd('0x4e')),_0x32b5b4(_0x184949['result'][_0x4633dd('0x18')]);})[_0x5cf6c7('0x44')](function(_0x26d0c){logger['error']('Network,\x20%s,\x20%s',_0x511d43,_0x26d0c),_0x7d1d04(_0x26d0c);});});}function respondWithResult(_0x2fca09,_0x1314bb){return _0x1314bb=_0x1314bb||0xc8,function(_0x41dee3){const _0xa51c5d=a457_0x42e1;if(_0x41dee3)return _0x2fca09[_0xa51c5d('0x2f')](_0x1314bb)[_0xa51c5d('0x4f')](_0x41dee3);};}function respondWithFilteredResult(_0x2d338c,_0x2b3d9f){return function(_0x512a64){const _0x29bf61=a457_0x42e1;if(_0x512a64){const _0x2548c4=_0x512a64[_0x29bf61('0x4d')],_0x51b790=_0x2b3d9f[_0x29bf61('0x4c')];let _0x354df6=_0x2b3d9f[_0x29bf61('0x4c')]+_0x2b3d9f['limit'],_0x5ae6f8;return _0x354df6>=_0x2548c4?(_0x354df6=_0x2548c4,_0x5ae6f8=0xc8):_0x5ae6f8=0xce,_0x2d338c['status'](_0x5ae6f8),_0x2d338c['set']('Content-Range',_0x51b790+'-'+_0x354df6+'/'+_0x2548c4)['json'](_0x512a64);}return null;};}function saveUpdates(_0xf2da49){return function(_0x26640f){const _0xd465a0=a457_0x42e1;if(_0x26640f)return _0x26640f[_0xd465a0('0x8')](_0xf2da49)[_0xd465a0('0xa')](function(_0xb83da8){return _0xb83da8;});return null;};}function removeEntity(_0x23f1b9){return function(_0x2525e3){const _0x5a6ddc=a457_0x42e1;if(_0x2525e3)return _0x2525e3[_0x5a6ddc('0x37')]()[_0x5a6ddc('0xa')](function(){const _0x19d994=_0x5a6ddc;_0x23f1b9['status'](0xcc)[_0x19d994('0x2e')]();});};}function handleEntityNotFound(_0x52a325){return function(_0x5af7a8){return!_0x5af7a8&&_0x52a325['sendStatus'](0x194),_0x5af7a8;};}function handleError(_0x2f9ca8,_0x4fd996){return _0x4fd996=_0x4fd996||0x1f4,function(_0xbc15cf){const _0x3b756e=a457_0x42e1;logger[_0x3b756e('0x19')](_0xbc15cf['stack']),_0xbc15cf[_0x3b756e('0x43')]&&delete _0xbc15cf[_0x3b756e('0x43')],_0x2f9ca8[_0x3b756e('0x2f')](_0x4fd996)[_0x3b756e('0x26')](_0xbc15cf);};}exports[_0x54bebc('0x10')]=function(_0x488bc0,_0x4ee496){const _0xcd891e=_0x54bebc;let _0x534ad7={};const _0x1fc8d3={},_0x136a1c={'count':0x0,'rows':[]},_0xc1f456=_['map'](db['Network']['rawAttributes'],function(_0xd991a0){const _0x5c07d7=a457_0x42e1;return{'name':_0xd991a0['fieldName'],'type':_0xd991a0['type'][_0x5c07d7('0x2c')]};});_0x1fc8d3['model']=_[_0xcd891e('0x1c')](_0xc1f456,_0xcd891e('0x43')),_0x1fc8d3[_0xcd891e('0xd')]=_[_0xcd891e('0x3b')](_0x488bc0['query']),_0x1fc8d3['filters']=_[_0xcd891e('0x17')](_0x1fc8d3[_0xcd891e('0x1a')],_0x1fc8d3[_0xcd891e('0xd')]),_0x534ad7['attributes']=_['intersection'](_0x1fc8d3[_0xcd891e('0x1a')],qs[_0xcd891e('0x36')](_0x488bc0[_0xcd891e('0xd')][_0xcd891e('0x36')])),_0x534ad7['attributes']=_0x534ad7[_0xcd891e('0x38')][_0xcd891e('0x30')]?_0x534ad7[_0xcd891e('0x38')]:_0x1fc8d3[_0xcd891e('0x1a')];typeof _0x488bc0[_0xcd891e('0xd')][_0xcd891e('0x33')]===_0xcd891e('0x39')&&(_0x534ad7[_0xcd891e('0x3e')]=qs[_0xcd891e('0x3e')](_0x488bc0[_0xcd891e('0xd')]['limit']),_0x534ad7['offset']=qs[_0xcd891e('0x4c')](_0x488bc0[_0xcd891e('0xd')][_0xcd891e('0x4c')]));_0x534ad7[_0xcd891e('0x6')]=qs[_0xcd891e('0x1f')](_0x488bc0[_0xcd891e('0xd')]['sort']),_0x534ad7[_0xcd891e('0x4a')]=qs['filters'](_[_0xcd891e('0xe')](_0x488bc0['query'],_0x1fc8d3[_0xcd891e('0x23')]),_0xc1f456);_0x488bc0[_0xcd891e('0xd')]['filter']&&(_0x534ad7[_0xcd891e('0x4a')]=_['merge'](_0x534ad7[_0xcd891e('0x4a')],{[Op['or']]:_[_0xcd891e('0x1c')](_0xc1f456,function(_0x2c4a49){const _0x2f8610=_0xcd891e;if(_0x2c4a49[_0x2f8610('0x3a')]!=='VIRTUAL'){const _0x21489a={};return _0x21489a[_0x2c4a49['name']]={[Op[_0x2f8610('0x1e')]]:'%'+_0x488bc0[_0x2f8610('0xd')][_0x2f8610('0x20')]+'%'},_0x21489a;}})}));_0x534ad7=_[_0xcd891e('0x4')]({},_0x534ad7,_0x488bc0[_0xcd891e('0x15')]);const _0x16a22d={'where':_0x534ad7['where']};return db[_0xcd891e('0x40')][_0xcd891e('0x4d')](_0x16a22d)[_0xcd891e('0xa')](function(_0x364860){const _0x4bf266=_0xcd891e;return _0x136a1c[_0x4bf266('0x4d')]=_0x364860,_0x488bc0[_0x4bf266('0xd')]['includeAll']&&(_0x534ad7[_0x4bf266('0x0')]=[{'all':!![]}]),db[_0x4bf266('0x40')]['findAll'](_0x534ad7);})[_0xcd891e('0xa')](function(_0x34eb1b){return _0x136a1c['rows']=_0x34eb1b,_0x136a1c;})[_0xcd891e('0xa')](respondWithFilteredResult(_0x4ee496,_0x534ad7))[_0xcd891e('0x44')](handleError(_0x4ee496,null));},exports[_0x54bebc('0xf')]=function(_0x592001,_0x58bca1){const _0x389920=_0x54bebc;let _0x5c4478={'raw':!![],'where':{'id':_0x592001['params']['id']}};const _0x550299={};return _0x550299[_0x389920('0x1a')]=_[_0x389920('0x3b')](db[_0x389920('0x40')]['rawAttributes']),_0x550299[_0x389920('0xd')]=_[_0x389920('0x3b')](_0x592001[_0x389920('0xd')]),_0x550299[_0x389920('0x23')]=_[_0x389920('0x17')](_0x550299[_0x389920('0x1a')],_0x550299[_0x389920('0xd')]),_0x5c4478[_0x389920('0x38')]=_[_0x389920('0x17')](_0x550299[_0x389920('0x1a')],qs['fields'](_0x592001[_0x389920('0xd')][_0x389920('0x36')])),_0x5c4478['attributes']=_0x5c4478[_0x389920('0x38')][_0x389920('0x30')]?_0x5c4478[_0x389920('0x38')]:_0x550299[_0x389920('0x1a')],_0x592001[_0x389920('0xd')][_0x389920('0x3f')]&&(_0x5c4478['include']=[{'all':!![]}]),_0x5c4478=_[_0x389920('0x4')]({},_0x5c4478,_0x592001[_0x389920('0x15')]),db[_0x389920('0x40')][_0x389920('0x29')](_0x5c4478)[_0x389920('0xa')](handleEntityNotFound(_0x58bca1,null))['then'](respondWithResult(_0x58bca1,null))[_0x389920('0x44')](handleError(_0x58bca1,null));},exports[_0x54bebc('0x28')]=function(_0x5da237,_0x3f066e){const _0x20d014=_0x54bebc;let _0x592c16;return db['sequelize'][_0x20d014('0x2d')](function(){const _0x283ecd=_0x20d014;return db[_0x283ecd('0x40')][_0x283ecd('0x28')](_0x5da237[_0x283ecd('0x35')],{'raw':!![]})[_0x283ecd('0xa')](function(_0x4bc783){const _0x4e7321=_0x283ecd;return _0x592c16=_0x4bc783,db[_0x4e7321('0x40')]['findAll']({'where':{'type':_0x5da237[_0x4e7321('0x35')][_0x4e7321('0x3a')]},'raw':!![]});})['then'](function(_0x2a18a5){const _0xea763d=_0x283ecd;if(_0x592c16[_0xea763d('0x3a')]['toUpperCase']()==_0xea763d('0x1d')){const _0xe63b84=fs[_0xea763d('0x47')](path[_0xea763d('0x48')](config[_0xea763d('0x22')],'server/files/templates/stun_multiple.ejs'),'utf8'),_0x2c34d5=ejs[_0xea763d('0x16')](_0xe63b84,{'networks':_0x2a18a5||[]});return fs[_0xea763d('0x51')]('/etc/asterisk/stun_xcally.conf',_0x2c34d5),respondWithRpcPromise(_0xea763d('0x7'),'create',{'module':_0xea763d('0x41')});}else{if(_0x592c16[_0xea763d('0x3a')][_0xea763d('0x4b')]()=='TURN'){const _0x33495a=fs[_0xea763d('0x47')](path[_0xea763d('0x48')](config[_0xea763d('0x22')],_0xea763d('0x1')),_0xea763d('0x32')),_0x521b87=ejs[_0xea763d('0x16')](_0x33495a,{'networks':_0x2a18a5||[]});return fs['writeFileSync'](_0xea763d('0x46'),_0x521b87),respondWithRpcPromise(_0xea763d('0x7'),_0xea763d('0x28'),{'module':_0xea763d('0x41')});}else{const _0x11f486=fs[_0xea763d('0x47')](path[_0xea763d('0x48')](config[_0xea763d('0x22')],_0xea763d('0x21')),_0xea763d('0x32')),_0x13a196=ejs[_0xea763d('0x16')](_0x11f486,{'networks':_0x2a18a5||[]});return fs[_0xea763d('0x51')](util[_0xea763d('0x3')](_0xea763d('0x2a'),_0x5da237[_0xea763d('0x35')]['type'][_0xea763d('0x11')]()),_0x13a196),respondWithRpcPromise('Reload',_0xea763d('0x28'),{'module':_0xea763d('0x3c')});}}})[_0x283ecd('0xa')](function(){return _0x592c16;});})[_0x20d014('0xa')](respondWithResult(_0x3f066e,0xc9))['catch'](handleError(_0x3f066e,null));},exports[_0x54bebc('0x8')]=function(_0x323bf5,_0x5cf5f8){const _0x25c11d=_0x54bebc;let _0x1c68a0;return db['sequelize'][_0x25c11d('0x2d')](function(){const _0x3a0785=_0x25c11d;return db['Network'][_0x3a0785('0x29')]({'where':{'id':_0x323bf5['params']['id']}})[_0x3a0785('0xa')](handleEntityNotFound(_0x5cf5f8,null))['then'](saveUpdates(_0x323bf5[_0x3a0785('0x35')],null))[_0x3a0785('0xa')](function(_0x485453){const _0x3b2f1c=_0x3a0785;if(_0x485453)return _0x1c68a0=_0x485453,db[_0x3b2f1c('0x40')][_0x3b2f1c('0x3d')]({'where':{'type':_0x1c68a0['type']},'raw':!![]});return null;})[_0x3a0785('0xa')](function(_0x27f69f){const _0x2cbde8=_0x3a0785;if(_0x1c68a0['type'][_0x2cbde8('0x4b')]()==_0x2cbde8('0x1d')){const _0x5bb4dc=fs[_0x2cbde8('0x47')](path[_0x2cbde8('0x48')](config[_0x2cbde8('0x22')],'server/files/templates/stun_multiple.ejs'),_0x2cbde8('0x32')),_0xbc3793=ejs[_0x2cbde8('0x16')](_0x5bb4dc,{'networks':_0x27f69f||[]});return fs[_0x2cbde8('0x51')]('/etc/asterisk/stun_xcally.conf',_0xbc3793),respondWithRpcPromise(_0x2cbde8('0x7'),_0x2cbde8('0x8'),{'module':'res_stun_monitor.so'});}else{if(_0x1c68a0[_0x2cbde8('0x3a')][_0x2cbde8('0x4b')]()==_0x2cbde8('0x34')){const _0x355bb3=fs[_0x2cbde8('0x47')](path[_0x2cbde8('0x48')](config[_0x2cbde8('0x22')],'server/files/templates/turn_multiple.ejs'),_0x2cbde8('0x32')),_0x2de846=ejs[_0x2cbde8('0x16')](_0x355bb3,{'networks':_0x27f69f||[]});return fs[_0x2cbde8('0x51')]('/etc/asterisk/turn_xcally.conf',_0x2de846),respondWithRpcPromise(_0x2cbde8('0x7'),_0x2cbde8('0x8'),{'module':_0x2cbde8('0x41')});}else{const _0x43bb15=fs[_0x2cbde8('0x47')](path[_0x2cbde8('0x48')](config[_0x2cbde8('0x22')],_0x2cbde8('0x21')),_0x2cbde8('0x32')),_0x50fc16=ejs['render'](_0x43bb15,{'networks':_0x27f69f||[]});return fs[_0x2cbde8('0x51')](util[_0x2cbde8('0x3')](_0x2cbde8('0x2a'),_0x323bf5[_0x2cbde8('0x35')][_0x2cbde8('0x3a')][_0x2cbde8('0x11')]()),_0x50fc16),respondWithRpcPromise(_0x2cbde8('0x7'),_0x2cbde8('0x8'),{'module':_0x2cbde8('0x3c')});}}})[_0x3a0785('0xa')](function(_0x1df576){if(_0x1df576)return _0x1c68a0;return null;});})[_0x25c11d('0xa')](respondWithResult(_0x5cf5f8,null))['catch'](handleError(_0x5cf5f8,null));},exports[_0x54bebc('0x37')]=function(_0x232766,_0x28eb18){const _0x5e4c20=_0x54bebc;let _0x4ec5f4;return db[_0x5e4c20('0x40')]['findOne']({'where':{'id':_0x232766[_0x5e4c20('0x2b')]['id']}})[_0x5e4c20('0xa')](function(_0x26e37d){return _0x4ec5f4=_0x26e37d,_0x26e37d;})[_0x5e4c20('0xa')](handleEntityNotFound(_0x28eb18,null))[_0x5e4c20('0xa')](removeEntity(_0x28eb18,null))['then'](function(){const _0x465ffb=_0x5e4c20;if(_0x4ec5f4)return db[_0x465ffb('0x40')][_0x465ffb('0x3d')]({'where':{'type':_0x4ec5f4['type']},'raw':!![]});})[_0x5e4c20('0xa')](function(_0x3a8f6c){const _0x611584=_0x5e4c20;if(_0x4ec5f4[_0x611584('0x3a')][_0x611584('0x4b')]()=='STUN'){const _0x149123=fs['readFileSync'](path[_0x611584('0x48')](config[_0x611584('0x22')],_0x611584('0xb')),_0x611584('0x32')),_0x789ac4=ejs[_0x611584('0x16')](_0x149123,{'networks':_0x3a8f6c||[]});return fs[_0x611584('0x51')](_0x611584('0x12'),_0x789ac4),respondWithRpcPromise(_0x611584('0x7'),_0x611584('0x37'),{'module':_0x611584('0x41')});}else{if(_0x4ec5f4['type']['toUpperCase']()==_0x611584('0x34')){const _0x546633=fs[_0x611584('0x47')](path[_0x611584('0x48')](config[_0x611584('0x22')],'files/templates/turn_multiple.ejs'),'utf8'),_0x78623c=ejs[_0x611584('0x16')](_0x546633,{'networks':_0x3a8f6c||[]});return fs['writeFileSync'](_0x611584('0x46'),_0x78623c),respondWithRpcPromise(_0x611584('0x7'),_0x611584('0x37'),{'module':_0x611584('0x41')});}else{const _0x5183f5=fs['readFileSync'](path['join'](config['root'],'files/templates/network.ejs'),_0x611584('0x32')),_0x114a24=ejs['render'](_0x5183f5,{'networks':_0x3a8f6c||[]});return fs[_0x611584('0x51')](util['format'](_0x611584('0x2a'),_0x232766[_0x611584('0x35')][_0x611584('0x3a')][_0x611584('0x11')]()),_0x114a24),respondWithRpcPromise(_0x611584('0x7'),_0x611584('0x37'),{'module':_0x611584('0x3c')});}}})['catch'](handleError(_0x28eb18,null));};
\ No newline at end of file
+const a457_0x5e5a=['writeFileSync','STUN','sequelize','path','filters','name','sendStatus','limit','debug','params','util','format','model','res_stun_monitor.so','files/templates/turn_multiple.ejs','toUpperCase','order','render','send','body','options','client','Network','utf8','code','../../config/environment','ejs','http','sort','show','where','files/templates/network.ejs','request\x20sent','info','keys','stringify','Reload','findOne','join','result','json','api','then','status','root','end','../../mysqldb','stack','count','Network,\x20%s,\x20%s','index','TURN','type','rawAttributes','set','like','findAll','../../components/parsers/qs','map','includeAll','attributes','include','update','fields','destroy','query','chan_sip.so','merge','files/templates/stun_multiple.ejs','transaction','length','filter','pick','message','create','intersection','error','/etc/asterisk/sip_xcally_%s.conf','/etc/asterisk/stun_xcally.conf','Network,\x20%s,\x20%s,\x20%s','toLowerCase','undefined','catch','readFileSync','offset','jayson/promise','/etc/asterisk/turn_xcally.conf','server/files/templates/turn_multiple.ejs','fieldName'];(function(_0x1eca20,_0x5e5ac4){const _0x6ae6e=function(_0x5bdb05){while(--_0x5bdb05){_0x1eca20['push'](_0x1eca20['shift']());}};_0x6ae6e(++_0x5e5ac4);}(a457_0x5e5a,0x6c));const a457_0x6ae6=function(_0x1eca20,_0x5e5ac4){_0x1eca20=_0x1eca20-0x0;let _0x6ae6e=a457_0x5e5a[_0x1eca20];return _0x6ae6e;};const _0x1a777e=a457_0x6ae6;'use strict';const util=require(_0x1a777e('0x50')),path=require(_0x1a777e('0x49')),ejs=require(_0x1a777e('0x7')),fs=require('fs'),_=require('lodash'),qs=require(_0x1a777e('0x26')),logger=require('../../config/logger')(_0x1a777e('0x16')),config=require(_0x1a777e('0x6')),db=require(_0x1a777e('0x1b'))['db'],{Op}=require(_0x1a777e('0x48')),jayson=require(_0x1a777e('0x42')),client=jayson[_0x1a777e('0x2')][_0x1a777e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5bdb05,_0x14d7d5,_0x1bf991,_0xbc3a0b){return new Promise(function(_0x59e599,_0x42dabe){const _0x3e73d4=a457_0x6ae6,_0x3d498f=_0xbc3a0b||client;return _0x3d498f['request'](_0x5bdb05,_0x1bf991)[_0x3e73d4('0x17')](function(_0x1be081){const _0x1ed6cf=_0x3e73d4;logger[_0x1ed6cf('0xe')]('Network,\x20%s,\x20%s',_0x14d7d5,_0x1ed6cf('0xd')),logger[_0x1ed6cf('0x4e')](_0x1ed6cf('0x3c'),_0x14d7d5,_0x1ed6cf('0xd'),JSON[_0x1ed6cf('0x10')](_0x1be081));if(_0x1be081[_0x1ed6cf('0x39')]){if(_0x1be081['error'][_0x1ed6cf('0x5')]===0x1f4)return logger[_0x1ed6cf('0x39')]('Network,\x20%s,\x20%s',_0x14d7d5,_0x1be081[_0x1ed6cf('0x39')][_0x1ed6cf('0x36')]),_0x42dabe(_0x1be081[_0x1ed6cf('0x39')][_0x1ed6cf('0x36')]);return logger[_0x1ed6cf('0x39')](_0x1ed6cf('0x1e'),_0x14d7d5,_0x1be081[_0x1ed6cf('0x39')][_0x1ed6cf('0x36')]),_0x59e599(_0x1be081[_0x1ed6cf('0x39')][_0x1ed6cf('0x36')]);}else logger[_0x1ed6cf('0xe')]('Network,\x20%s,\x20%s',_0x14d7d5,_0x1ed6cf('0xd')),_0x59e599(_0x1be081[_0x1ed6cf('0x14')][_0x1ed6cf('0x36')]);})[_0x3e73d4('0x3f')](function(_0x232175){const _0x230a9b=_0x3e73d4;logger[_0x230a9b('0x39')](_0x230a9b('0x1e'),_0x14d7d5,_0x232175),_0x42dabe(_0x232175);});});}function respondWithResult(_0x54c1a7,_0x25021c){return _0x25021c=_0x25021c||0xc8,function(_0x5f06e1){if(_0x5f06e1)return _0x54c1a7['status'](_0x25021c)['json'](_0x5f06e1);};}function respondWithFilteredResult(_0x5440fb,_0xc3f30a){return function(_0x1a8393){const _0x57c5da=a457_0x6ae6;if(_0x1a8393){const _0x4f88c4=_0x1a8393[_0x57c5da('0x1d')],_0xec24cd=_0xc3f30a[_0x57c5da('0x41')];let _0x1b4537=_0xc3f30a[_0x57c5da('0x41')]+_0xc3f30a[_0x57c5da('0x4d')],_0x308d2d;return _0x1b4537>=_0x4f88c4?(_0x1b4537=_0x4f88c4,_0x308d2d=0xc8):_0x308d2d=0xce,_0x5440fb[_0x57c5da('0x18')](_0x308d2d),_0x5440fb[_0x57c5da('0x23')]('Content-Range',_0xec24cd+'-'+_0x1b4537+'/'+_0x4f88c4)[_0x57c5da('0x15')](_0x1a8393);}return null;};}function saveUpdates(_0x2dba4d){return function(_0x11eb2c){const _0x4277a8=a457_0x6ae6;if(_0x11eb2c)return _0x11eb2c[_0x4277a8('0x2b')](_0x2dba4d)[_0x4277a8('0x17')](function(_0x5c296a){return _0x5c296a;});return null;};}function removeEntity(_0x4c084f){return function(_0x2d3b32){const _0x2b50ad=a457_0x6ae6;if(_0x2d3b32)return _0x2d3b32[_0x2b50ad('0x2d')]()[_0x2b50ad('0x17')](function(){const _0x521f85=_0x2b50ad;_0x4c084f['status'](0xcc)[_0x521f85('0x1a')]();});};}function handleEntityNotFound(_0x5832c8){return function(_0x53090a){const _0x1e0341=a457_0x6ae6;return!_0x53090a&&_0x5832c8[_0x1e0341('0x4c')](0x194),_0x53090a;};}function handleError(_0x293e7d,_0x2cdc66){return _0x2cdc66=_0x2cdc66||0x1f4,function(_0x192fee){const _0x675144=a457_0x6ae6;logger['error'](_0x192fee[_0x675144('0x1c')]),_0x192fee['name']&&delete _0x192fee[_0x675144('0x4b')],_0x293e7d[_0x675144('0x18')](_0x2cdc66)[_0x675144('0x58')](_0x192fee);};}exports[_0x1a777e('0x1f')]=function(_0x2ab87b,_0x4bc2c0){const _0x374266=_0x1a777e;let _0x4a5917={};const _0x4ea0a8={},_0x54eaac={'count':0x0,'rows':[]},_0x5c90c7=_[_0x374266('0x27')](db['Network'][_0x374266('0x22')],function(_0x4f817c){const _0x1b2e74=_0x374266;return{'name':_0x4f817c[_0x1b2e74('0x45')],'type':_0x4f817c[_0x1b2e74('0x21')]['key']};});_0x4ea0a8[_0x374266('0x52')]=_[_0x374266('0x27')](_0x5c90c7,'name'),_0x4ea0a8[_0x374266('0x2e')]=_[_0x374266('0xf')](_0x2ab87b[_0x374266('0x2e')]),_0x4ea0a8[_0x374266('0x4a')]=_['intersection'](_0x4ea0a8[_0x374266('0x52')],_0x4ea0a8[_0x374266('0x2e')]),_0x4a5917[_0x374266('0x29')]=_[_0x374266('0x38')](_0x4ea0a8['model'],qs[_0x374266('0x2c')](_0x2ab87b[_0x374266('0x2e')][_0x374266('0x2c')])),_0x4a5917[_0x374266('0x29')]=_0x4a5917['attributes'][_0x374266('0x33')]?_0x4a5917['attributes']:_0x4ea0a8['model'];typeof _0x2ab87b[_0x374266('0x2e')]['nolimit']===_0x374266('0x3e')&&(_0x4a5917['limit']=qs[_0x374266('0x4d')](_0x2ab87b['query'][_0x374266('0x4d')]),_0x4a5917[_0x374266('0x41')]=qs[_0x374266('0x41')](_0x2ab87b['query'][_0x374266('0x41')]));_0x4a5917[_0x374266('0x56')]=qs[_0x374266('0x9')](_0x2ab87b[_0x374266('0x2e')][_0x374266('0x9')]),_0x4a5917[_0x374266('0xb')]=qs[_0x374266('0x4a')](_[_0x374266('0x35')](_0x2ab87b[_0x374266('0x2e')],_0x4ea0a8['filters']),_0x5c90c7);_0x2ab87b[_0x374266('0x2e')][_0x374266('0x34')]&&(_0x4a5917[_0x374266('0xb')]=_['merge'](_0x4a5917[_0x374266('0xb')],{[Op['or']]:_[_0x374266('0x27')](_0x5c90c7,function(_0x249b04){const _0x2d9400=_0x374266;if(_0x249b04[_0x2d9400('0x21')]!=='VIRTUAL'){const _0x56803d={};return _0x56803d[_0x249b04[_0x2d9400('0x4b')]]={[Op[_0x2d9400('0x24')]]:'%'+_0x2ab87b[_0x2d9400('0x2e')][_0x2d9400('0x34')]+'%'},_0x56803d;}})}));_0x4a5917=_[_0x374266('0x30')]({},_0x4a5917,_0x2ab87b[_0x374266('0x1')]);const _0x5df19e={'where':_0x4a5917[_0x374266('0xb')]};return db[_0x374266('0x3')]['count'](_0x5df19e)['then'](function(_0x2674a3){const _0x591319=_0x374266;return _0x54eaac[_0x591319('0x1d')]=_0x2674a3,_0x2ab87b[_0x591319('0x2e')][_0x591319('0x28')]&&(_0x4a5917['include']=[{'all':!![]}]),db[_0x591319('0x3')][_0x591319('0x25')](_0x4a5917);})['then'](function(_0x53bfe9){return _0x54eaac['rows']=_0x53bfe9,_0x54eaac;})[_0x374266('0x17')](respondWithFilteredResult(_0x4bc2c0,_0x4a5917))[_0x374266('0x3f')](handleError(_0x4bc2c0,null));},exports[_0x1a777e('0xa')]=function(_0x372b9d,_0x23385c){const _0x58effc=_0x1a777e;let _0x1385b5={'raw':!![],'where':{'id':_0x372b9d['params']['id']}};const _0x3fc0f6={};return _0x3fc0f6[_0x58effc('0x52')]=_[_0x58effc('0xf')](db[_0x58effc('0x3')][_0x58effc('0x22')]),_0x3fc0f6[_0x58effc('0x2e')]=_[_0x58effc('0xf')](_0x372b9d[_0x58effc('0x2e')]),_0x3fc0f6[_0x58effc('0x4a')]=_[_0x58effc('0x38')](_0x3fc0f6[_0x58effc('0x52')],_0x3fc0f6['query']),_0x1385b5['attributes']=_[_0x58effc('0x38')](_0x3fc0f6['model'],qs[_0x58effc('0x2c')](_0x372b9d[_0x58effc('0x2e')][_0x58effc('0x2c')])),_0x1385b5[_0x58effc('0x29')]=_0x1385b5[_0x58effc('0x29')]['length']?_0x1385b5['attributes']:_0x3fc0f6[_0x58effc('0x52')],_0x372b9d['query'][_0x58effc('0x28')]&&(_0x1385b5[_0x58effc('0x2a')]=[{'all':!![]}]),_0x1385b5=_[_0x58effc('0x30')]({},_0x1385b5,_0x372b9d[_0x58effc('0x1')]),db[_0x58effc('0x3')]['findOne'](_0x1385b5)[_0x58effc('0x17')](handleEntityNotFound(_0x23385c,null))['then'](respondWithResult(_0x23385c,null))[_0x58effc('0x3f')](handleError(_0x23385c,null));},exports[_0x1a777e('0x37')]=function(_0x164078,_0x3276eb){const _0x5e456a=_0x1a777e;let _0x25c6ff;return db['sequelize'][_0x5e456a('0x32')](function(){const _0x53019a=_0x5e456a;return db[_0x53019a('0x3')][_0x53019a('0x37')](_0x164078[_0x53019a('0x0')],{'raw':!![]})[_0x53019a('0x17')](function(_0x12ef49){const _0x507cbf=_0x53019a;return _0x25c6ff=_0x12ef49,db[_0x507cbf('0x3')]['findAll']({'where':{'type':_0x164078['body'][_0x507cbf('0x21')]},'raw':!![]});})['then'](function(_0x2396cd){const _0x23723e=_0x53019a;if(_0x25c6ff[_0x23723e('0x21')][_0x23723e('0x55')]()=='STUN'){const _0x29e5e1=fs[_0x23723e('0x40')](path[_0x23723e('0x13')](config[_0x23723e('0x19')],'server/files/templates/stun_multiple.ejs'),_0x23723e('0x4')),_0x1129e8=ejs[_0x23723e('0x57')](_0x29e5e1,{'networks':_0x2396cd||[]});return fs[_0x23723e('0x46')](_0x23723e('0x3b'),_0x1129e8),respondWithRpcPromise(_0x23723e('0x11'),_0x23723e('0x37'),{'module':_0x23723e('0x53')});}else{if(_0x25c6ff[_0x23723e('0x21')]['toUpperCase']()==_0x23723e('0x20')){const _0x36cbb8=fs[_0x23723e('0x40')](path[_0x23723e('0x13')](config[_0x23723e('0x19')],_0x23723e('0x44')),_0x23723e('0x4')),_0x1fdce7=ejs['render'](_0x36cbb8,{'networks':_0x2396cd||[]});return fs[_0x23723e('0x46')](_0x23723e('0x43'),_0x1fdce7),respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else{const _0x3b5212=fs[_0x23723e('0x40')](path[_0x23723e('0x13')](config[_0x23723e('0x19')],_0x23723e('0xc')),_0x23723e('0x4')),_0x7f1c8e=ejs[_0x23723e('0x57')](_0x3b5212,{'networks':_0x2396cd||[]});return fs[_0x23723e('0x46')](util[_0x23723e('0x51')](_0x23723e('0x3a'),_0x164078[_0x23723e('0x0')][_0x23723e('0x21')]['toLowerCase']()),_0x7f1c8e),respondWithRpcPromise(_0x23723e('0x11'),_0x23723e('0x37'),{'module':_0x23723e('0x2f')});}}})[_0x53019a('0x17')](function(){return _0x25c6ff;});})[_0x5e456a('0x17')](respondWithResult(_0x3276eb,0xc9))[_0x5e456a('0x3f')](handleError(_0x3276eb,null));},exports['update']=function(_0x109e5e,_0x523ade){const _0x218340=_0x1a777e;let _0x37f848;return db['sequelize'][_0x218340('0x32')](function(){const _0x51a333=_0x218340;return db[_0x51a333('0x3')][_0x51a333('0x12')]({'where':{'id':_0x109e5e[_0x51a333('0x4f')]['id']}})[_0x51a333('0x17')](handleEntityNotFound(_0x523ade,null))['then'](saveUpdates(_0x109e5e['body'],null))[_0x51a333('0x17')](function(_0x14b89d){const _0x55c079=_0x51a333;if(_0x14b89d)return _0x37f848=_0x14b89d,db[_0x55c079('0x3')][_0x55c079('0x25')]({'where':{'type':_0x37f848['type']},'raw':!![]});return null;})[_0x51a333('0x17')](function(_0x490b90){const _0xafa75d=_0x51a333;if(_0x37f848[_0xafa75d('0x21')]['toUpperCase']()==_0xafa75d('0x47')){const _0x1cb8a1=fs[_0xafa75d('0x40')](path['join'](config[_0xafa75d('0x19')],'server/files/templates/stun_multiple.ejs'),'utf8'),_0x5e7895=ejs[_0xafa75d('0x57')](_0x1cb8a1,{'networks':_0x490b90||[]});return fs['writeFileSync'](_0xafa75d('0x3b'),_0x5e7895),respondWithRpcPromise('Reload',_0xafa75d('0x2b'),{'module':'res_stun_monitor.so'});}else{if(_0x37f848[_0xafa75d('0x21')][_0xafa75d('0x55')]()=='TURN'){const _0x24ba3d=fs['readFileSync'](path[_0xafa75d('0x13')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xafa75d('0x4')),_0x5c2e74=ejs[_0xafa75d('0x57')](_0x24ba3d,{'networks':_0x490b90||[]});return fs[_0xafa75d('0x46')](_0xafa75d('0x43'),_0x5c2e74),respondWithRpcPromise('Reload',_0xafa75d('0x2b'),{'module':_0xafa75d('0x53')});}else{const _0xc2c9f6=fs[_0xafa75d('0x40')](path['join'](config[_0xafa75d('0x19')],_0xafa75d('0xc')),_0xafa75d('0x4')),_0x3591e9=ejs[_0xafa75d('0x57')](_0xc2c9f6,{'networks':_0x490b90||[]});return fs['writeFileSync'](util[_0xafa75d('0x51')](_0xafa75d('0x3a'),_0x109e5e[_0xafa75d('0x0')][_0xafa75d('0x21')][_0xafa75d('0x3d')]()),_0x3591e9),respondWithRpcPromise(_0xafa75d('0x11'),_0xafa75d('0x2b'),{'module':'chan_sip.so'});}}})[_0x51a333('0x17')](function(_0x4e49d4){if(_0x4e49d4)return _0x37f848;return null;});})[_0x218340('0x17')](respondWithResult(_0x523ade,null))['catch'](handleError(_0x523ade,null));},exports['destroy']=function(_0x30b014,_0x4d92b1){const _0x2bf512=_0x1a777e;let _0x24998b;return db['Network']['findOne']({'where':{'id':_0x30b014['params']['id']}})['then'](function(_0x5285f4){return _0x24998b=_0x5285f4,_0x5285f4;})[_0x2bf512('0x17')](handleEntityNotFound(_0x4d92b1,null))[_0x2bf512('0x17')](removeEntity(_0x4d92b1,null))[_0x2bf512('0x17')](function(){const _0x3dc1dd=_0x2bf512;if(_0x24998b)return db['Network'][_0x3dc1dd('0x25')]({'where':{'type':_0x24998b[_0x3dc1dd('0x21')]},'raw':!![]});})[_0x2bf512('0x17')](function(_0x5911cf){const _0x1533e2=_0x2bf512;if(_0x24998b[_0x1533e2('0x21')]['toUpperCase']()==_0x1533e2('0x47')){const _0x540d83=fs['readFileSync'](path['join'](config[_0x1533e2('0x19')],_0x1533e2('0x31')),_0x1533e2('0x4')),_0x1d3de5=ejs[_0x1533e2('0x57')](_0x540d83,{'networks':_0x5911cf||[]});return fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x1d3de5),respondWithRpcPromise('Reload',_0x1533e2('0x2d'),{'module':_0x1533e2('0x53')});}else{if(_0x24998b[_0x1533e2('0x21')]['toUpperCase']()=='TURN'){const _0x4b5610=fs[_0x1533e2('0x40')](path[_0x1533e2('0x13')](config[_0x1533e2('0x19')],_0x1533e2('0x54')),'utf8'),_0x372fbe=ejs['render'](_0x4b5610,{'networks':_0x5911cf||[]});return fs[_0x1533e2('0x46')](_0x1533e2('0x43'),_0x372fbe),respondWithRpcPromise('Reload','destroy',{'module':_0x1533e2('0x53')});}else{const _0x17418a=fs['readFileSync'](path['join'](config[_0x1533e2('0x19')],_0x1533e2('0xc')),'utf8'),_0x4e2d8b=ejs[_0x1533e2('0x57')](_0x17418a,{'networks':_0x5911cf||[]});return fs[_0x1533e2('0x46')](util[_0x1533e2('0x51')](_0x1533e2('0x3a'),_0x30b014['body'][_0x1533e2('0x21')][_0x1533e2('0x3d')]()),_0x4e2d8b),respondWithRpcPromise('Reload','destroy',{'module':_0x1533e2('0x2f')});}}})[_0x2bf512('0x3f')](handleError(_0x4d92b1,null));};
\ No newline at end of file