Built motion from commit (unavailable).|2.5.29
[motion2.git] / server / api / network / network.controller.js
index 74b0396..8a3fb3f 100644 (file)
@@ -15,4 +15,4 @@
 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                        *
 // *                                                                       *
 // *************************************************************************
-var _0x7008=['fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','Network','includeAll','include','findAll','rows','catch','params','length','options','sequelize','create','body','STUN','readFileSync','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','root','server/files/templates/turn_multiple.ejs','writeFileSync','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','transaction','find','join','server/files/templates/stun_multiple.ejs','/etc/asterisk/turn_xcally.conf','format','destroy','TURN','html-pdf','rimraf','zip-dir'];(function(_0x4f3621,_0x4fd5ab){var _0x20dd07=function(_0x3bff59){while(--_0x3bff59){_0x4f3621['push'](_0x4f3621['shift']());}};_0x20dd07(++_0x4fd5ab);}(_0x7008,0x1b1));var _0x8700=function(_0x7bd04b,_0x39b441){_0x7bd04b=_0x7bd04b-0x0;var _0x4239c1=_0x7008[_0x7bd04b];return _0x4239c1;};'use strict';var pdf=require(_0x8700('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8700('0x1'));var zipdir=require(_0x8700('0x2'));var jsonpatch=require(_0x8700('0x3'));var rp=require(_0x8700('0x4'));var moment=require(_0x8700('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8700('0x6'));var util=require(_0x8700('0x7'));var path=require('path');var sox=require(_0x8700('0x8'));var csv=require(_0x8700('0x9'));var ejs=require(_0x8700('0xa'));var fs=require('fs');var _=require(_0x8700('0xb'));var squel=require(_0x8700('0xc'));var crypto=require(_0x8700('0xd'));var jsforce=require(_0x8700('0xe'));var deskjs=require(_0x8700('0xf'));var toCsv=require(_0x8700('0x9'));var querystring=require(_0x8700('0x10'));var Papa=require(_0x8700('0x11'));var Redis=require(_0x8700('0x12'));var authService=require(_0x8700('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8700('0x14'));var hardwareService=require(_0x8700('0x15'));var logger=require(_0x8700('0x16'))('api');var utils=require(_0x8700('0x17'));var config=require(_0x8700('0x18'));var licenseUtil=require(_0x8700('0x19'));var db=require(_0x8700('0x1a'))['db'];var jayson=require(_0x8700('0x1b'));var client=jayson[_0x8700('0x1c')][_0x8700('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x39322a,_0x46fe3e,_0x9ecdc6,_0x21d0ed){return new BPromise(function(_0x493028,_0x5d4dcc){var _0x59c65f=_0x21d0ed||client;return _0x59c65f['request'](_0x39322a,_0x9ecdc6)[_0x8700('0x1e')](function(_0x9fa8b3){logger['info'](_0x8700('0x1f'),_0x46fe3e,'request\x20sent');logger['debug'](_0x8700('0x20'),_0x46fe3e,_0x8700('0x21'),JSON[_0x8700('0x22')](_0x9fa8b3));if(_0x9fa8b3['error']){if(_0x9fa8b3[_0x8700('0x23')][_0x8700('0x24')]===0x1f4){logger[_0x8700('0x23')](_0x8700('0x1f'),_0x46fe3e,_0x9fa8b3[_0x8700('0x23')]['message']);return _0x5d4dcc(_0x9fa8b3['error']['message']);}logger[_0x8700('0x23')](_0x8700('0x1f'),_0x46fe3e,_0x9fa8b3[_0x8700('0x23')][_0x8700('0x25')]);return _0x493028(_0x9fa8b3[_0x8700('0x23')]['message']);}else{logger[_0x8700('0x26')]('Network,\x20%s,\x20%s',_0x46fe3e,_0x8700('0x21'));_0x493028(_0x9fa8b3[_0x8700('0x27')]['message']);}})['catch'](function(_0x547e4a){logger[_0x8700('0x23')]('Network,\x20%s,\x20%s',_0x46fe3e,_0x547e4a);_0x5d4dcc(_0x547e4a);});});}function respondWithStatusCode(_0x317bab,_0x5e3a35){_0x5e3a35=_0x5e3a35||0xcc;return function(_0x14a4e5){if(_0x14a4e5){return _0x317bab[_0x8700('0x28')](_0x5e3a35);}return _0x317bab[_0x8700('0x29')](_0x5e3a35)[_0x8700('0x2a')]();};}function respondWithResult(_0x566f5c,_0xce0b2b){_0xce0b2b=_0xce0b2b||0xc8;return function(_0x42fc05){if(_0x42fc05){return _0x566f5c[_0x8700('0x29')](_0xce0b2b)[_0x8700('0x2b')](_0x42fc05);}};}function respondWithFilteredResult(_0x5724af,_0x5194fa){return function(_0x56d127){if(_0x56d127){var _0x395556=_0x56d127['count'],_0x2d42b2=_0x5194fa[_0x8700('0x2c')],_0x1a6117=_0x5194fa['offset']+_0x5194fa['limit'],_0x24e912;if(_0x1a6117>=_0x395556){_0x1a6117=_0x395556;_0x24e912=0xc8;}else{_0x24e912=0xce;}_0x5724af[_0x8700('0x29')](_0x24e912);return _0x5724af[_0x8700('0x2d')](_0x8700('0x2e'),_0x2d42b2+'-'+_0x1a6117+'/'+_0x395556)[_0x8700('0x2b')](_0x56d127);}return null;};}function patchUpdates(_0x41bd5a){return function(_0x3302df){try{jsonpatch[_0x8700('0x2f')](_0x3302df,_0x41bd5a,!![]);}catch(_0x5ffc4d){return BPromise[_0x8700('0x30')](_0x5ffc4d);}return _0x3302df['save']();};}function saveUpdates(_0x52aebe,_0xcb6f4c){return function(_0xbcc388){if(_0xbcc388){return _0xbcc388[_0x8700('0x31')](_0x52aebe)[_0x8700('0x1e')](function(_0x4e62fb){return _0x4e62fb;});}return null;};}function removeEntity(_0xaf1262,_0x475b77){return function(_0x4c7468){if(_0x4c7468){return _0x4c7468['destroy']()[_0x8700('0x1e')](function(){_0xaf1262[_0x8700('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe9a1fb,_0xdcfe5){return function(_0x195d04){if(!_0x195d04){_0xe9a1fb[_0x8700('0x28')](0x194);}return _0x195d04;};}function handleError(_0x5534fa,_0x58cea3){_0x58cea3=_0x58cea3||0x1f4;return function(_0x128d5c){logger['error'](_0x128d5c[_0x8700('0x32')]);if(_0x128d5c['name']){delete _0x128d5c[_0x8700('0x33')];}_0x5534fa[_0x8700('0x29')](_0x58cea3)['send'](_0x128d5c);};}exports[_0x8700('0x34')]=function(_0x4793b1,_0x3fa2fd){var _0x56e62a={},_0x3a656f={},_0x47b25f={'count':0x0,'rows':[]};var _0x3adc26=_[_0x8700('0x35')](db['Network'][_0x8700('0x36')],function(_0x4ba059){return{'name':_0x4ba059[_0x8700('0x37')],'type':_0x4ba059[_0x8700('0x38')][_0x8700('0x39')]};});_0x3a656f[_0x8700('0x3a')]=_[_0x8700('0x35')](_0x3adc26,_0x8700('0x33'));_0x3a656f[_0x8700('0x3b')]=_[_0x8700('0x3c')](_0x4793b1[_0x8700('0x3b')]);_0x3a656f[_0x8700('0x3d')]=_[_0x8700('0x3e')](_0x3a656f[_0x8700('0x3a')],_0x3a656f['query']);_0x56e62a[_0x8700('0x3f')]=_[_0x8700('0x3e')](_0x3a656f['model'],qs[_0x8700('0x40')](_0x4793b1['query'][_0x8700('0x40')]));_0x56e62a[_0x8700('0x3f')]=_0x56e62a['attributes']['length']?_0x56e62a[_0x8700('0x3f')]:_0x3a656f['model'];if(!_0x4793b1[_0x8700('0x3b')]['hasOwnProperty'](_0x8700('0x41'))){_0x56e62a['limit']=qs[_0x8700('0x42')](_0x4793b1[_0x8700('0x3b')][_0x8700('0x42')]);_0x56e62a[_0x8700('0x2c')]=qs[_0x8700('0x2c')](_0x4793b1['query'][_0x8700('0x2c')]);}_0x56e62a[_0x8700('0x43')]=qs['sort'](_0x4793b1['query'][_0x8700('0x44')]);_0x56e62a['where']=qs[_0x8700('0x3d')](_[_0x8700('0x45')](_0x4793b1['query'],_0x3a656f[_0x8700('0x3d')]),_0x3adc26);if(_0x4793b1[_0x8700('0x3b')][_0x8700('0x46')]){_0x56e62a[_0x8700('0x47')]=_[_0x8700('0x48')](_0x56e62a[_0x8700('0x47')],{'$or':_['map'](_0x3adc26,function(_0x3d37bb){if(_0x3d37bb['type']!==_0x8700('0x49')){var _0x431871={};_0x431871[_0x3d37bb[_0x8700('0x33')]]={'$like':'%'+_0x4793b1[_0x8700('0x3b')]['filter']+'%'};return _0x431871;}})});}_0x56e62a=_['merge']({},_0x56e62a,_0x4793b1['options']);var _0x291455={'where':_0x56e62a['where']};return db[_0x8700('0x4a')]['count'](_0x291455)['then'](function(_0x2ddbb4){_0x47b25f['count']=_0x2ddbb4;if(_0x4793b1[_0x8700('0x3b')][_0x8700('0x4b')]){_0x56e62a[_0x8700('0x4c')]=[{'all':!![]}];}return db[_0x8700('0x4a')][_0x8700('0x4d')](_0x56e62a);})[_0x8700('0x1e')](function(_0x131577){_0x47b25f[_0x8700('0x4e')]=_0x131577;return _0x47b25f;})[_0x8700('0x1e')](respondWithFilteredResult(_0x3fa2fd,_0x56e62a))[_0x8700('0x4f')](handleError(_0x3fa2fd,null));};exports['show']=function(_0x5e395c,_0xa0aaad){var _0x5a2908={'raw':!![],'where':{'id':_0x5e395c[_0x8700('0x50')]['id']}},_0x3177eb={};_0x3177eb[_0x8700('0x3a')]=_[_0x8700('0x3c')](db[_0x8700('0x4a')][_0x8700('0x36')]);_0x3177eb[_0x8700('0x3b')]=_[_0x8700('0x3c')](_0x5e395c[_0x8700('0x3b')]);_0x3177eb[_0x8700('0x3d')]=_[_0x8700('0x3e')](_0x3177eb[_0x8700('0x3a')],_0x3177eb['query']);_0x5a2908[_0x8700('0x3f')]=_['intersection'](_0x3177eb[_0x8700('0x3a')],qs['fields'](_0x5e395c[_0x8700('0x3b')][_0x8700('0x40')]));_0x5a2908[_0x8700('0x3f')]=_0x5a2908[_0x8700('0x3f')][_0x8700('0x51')]?_0x5a2908[_0x8700('0x3f')]:_0x3177eb['model'];if(_0x5e395c[_0x8700('0x3b')][_0x8700('0x4b')]){_0x5a2908['include']=[{'all':!![]}];}_0x5a2908=_[_0x8700('0x48')]({},_0x5a2908,_0x5e395c[_0x8700('0x52')]);return db[_0x8700('0x4a')]['find'](_0x5a2908)[_0x8700('0x1e')](handleEntityNotFound(_0xa0aaad,null))['then'](respondWithResult(_0xa0aaad,null))[_0x8700('0x4f')](handleError(_0xa0aaad,null));};exports['create']=function(_0x5cde88,_0x584183,_0x58f812){var _0x1b55cf;return db[_0x8700('0x53')]['transaction'](function(_0x3c8ea7){return db[_0x8700('0x4a')][_0x8700('0x54')](_0x5cde88['body'],{'raw':!![]})[_0x8700('0x1e')](function(_0x3452f5){_0x1b55cf=_0x3452f5;return db[_0x8700('0x4a')][_0x8700('0x4d')]({'where':{'type':_0x5cde88[_0x8700('0x55')]['type']},'raw':!![]});})[_0x8700('0x1e')](function(_0x27e8f8){if(_0x1b55cf['type']['toUpperCase']()==_0x8700('0x56')){var _0x35a667=fs[_0x8700('0x57')](path['join'](config['root'],'server/files/templates/stun_multiple.ejs'),_0x8700('0x58'));var _0x29978b=ejs[_0x8700('0x59')](_0x35a667,{'networks':_0x27e8f8||[]});fs['writeFileSync'](_0x8700('0x5a'),_0x29978b);return respondWithRpcPromise(_0x8700('0x5b'),'create',{'module':_0x8700('0x5c')});}else if(_0x1b55cf[_0x8700('0x38')][_0x8700('0x5d')]()=='TURN'){var _0x538e9c=fs[_0x8700('0x57')](path['join'](config[_0x8700('0x5e')],_0x8700('0x5f')),_0x8700('0x58'));var _0x315eaa=ejs[_0x8700('0x59')](_0x538e9c,{'networks':_0x27e8f8||[]});fs[_0x8700('0x60')]('/etc/asterisk/turn_xcally.conf',_0x315eaa);return respondWithRpcPromise(_0x8700('0x5b'),'create',{'module':_0x8700('0x5c')});}else{var _0x231783=fs[_0x8700('0x57')](path['join'](config[_0x8700('0x5e')],_0x8700('0x61')),'utf8');var _0x3e3283=ejs['render'](_0x231783,{'networks':_0x27e8f8||[]});fs[_0x8700('0x60')](util['format'](_0x8700('0x62'),_0x5cde88[_0x8700('0x55')][_0x8700('0x38')][_0x8700('0x63')]()),_0x3e3283);return respondWithRpcPromise('Reload',_0x8700('0x54'),{'module':_0x8700('0x64')});}return null;})[_0x8700('0x1e')](function(){return _0x1b55cf;});})[_0x8700('0x1e')](respondWithResult(_0x584183,0xc9))['catch'](handleError(_0x584183,null));};exports[_0x8700('0x31')]=function(_0x45376c,_0x44cab4,_0x60e9b1){var _0x4355f3;return db[_0x8700('0x53')][_0x8700('0x65')](function(_0x25336d){return db[_0x8700('0x4a')][_0x8700('0x66')]({'where':{'id':_0x45376c[_0x8700('0x50')]['id']}})[_0x8700('0x1e')](handleEntityNotFound(_0x44cab4,null))[_0x8700('0x1e')](saveUpdates(_0x45376c[_0x8700('0x55')],null))[_0x8700('0x1e')](function(_0x14b337){if(_0x14b337){_0x4355f3=_0x14b337;return db[_0x8700('0x4a')][_0x8700('0x4d')]({'where':{'type':_0x4355f3[_0x8700('0x38')]},'raw':!![]});}return null;})[_0x8700('0x1e')](function(_0x583c52){if(_0x4355f3[_0x8700('0x38')][_0x8700('0x5d')]()=='STUN'){var _0x26b75f=fs[_0x8700('0x57')](path[_0x8700('0x67')](config[_0x8700('0x5e')],_0x8700('0x68')),_0x8700('0x58'));var _0x274140=ejs['render'](_0x26b75f,{'networks':_0x583c52||[]});fs[_0x8700('0x60')]('/etc/asterisk/stun_xcally.conf',_0x274140);return respondWithRpcPromise(_0x8700('0x5b'),_0x8700('0x31'),{'module':_0x8700('0x5c')});}else if(_0x4355f3[_0x8700('0x38')]['toUpperCase']()=='TURN'){var _0x1f2486=fs[_0x8700('0x57')](path[_0x8700('0x67')](config[_0x8700('0x5e')],_0x8700('0x5f')),'utf8');var _0x1666f0=ejs[_0x8700('0x59')](_0x1f2486,{'networks':_0x583c52||[]});fs['writeFileSync'](_0x8700('0x69'),_0x1666f0);return respondWithRpcPromise(_0x8700('0x5b'),_0x8700('0x31'),{'module':_0x8700('0x5c')});}else{var _0xd647ff=fs[_0x8700('0x57')](path[_0x8700('0x67')](config[_0x8700('0x5e')],'server/files/templates/network.ejs'),_0x8700('0x58'));var _0x2eafcc=ejs[_0x8700('0x59')](_0xd647ff,{'networks':_0x583c52||[]});fs[_0x8700('0x60')](util[_0x8700('0x6a')]('/etc/asterisk/sip_xcally_%s.conf',_0x45376c['body'][_0x8700('0x38')][_0x8700('0x63')]()),_0x2eafcc);return respondWithRpcPromise('Reload',_0x8700('0x31'),{'module':_0x8700('0x64')});}return null;})['then'](function(_0xc2a39f){if(_0xc2a39f){return _0x4355f3;}return null;});})['then'](respondWithResult(_0x44cab4,null))['catch'](handleError(_0x44cab4,null));};exports[_0x8700('0x6b')]=function(_0x2aef26,_0x25ced9,_0x25d58d){var _0x2fde9b;return db['Network'][_0x8700('0x66')]({'where':{'id':_0x2aef26[_0x8700('0x50')]['id']}})[_0x8700('0x1e')](function(_0xc45a6a){_0x2fde9b=_0xc45a6a;return _0xc45a6a;})[_0x8700('0x1e')](handleEntityNotFound(_0x25ced9,null))[_0x8700('0x1e')](removeEntity(_0x25ced9,null))['then'](function(){if(_0x2fde9b){return db[_0x8700('0x4a')][_0x8700('0x4d')]({'where':{'type':_0x2fde9b[_0x8700('0x38')]},'raw':!![]});}})[_0x8700('0x1e')](function(_0x5b4b83){if(_0x2fde9b[_0x8700('0x38')][_0x8700('0x5d')]()==_0x8700('0x56')){var _0x2e8c9e=fs[_0x8700('0x57')](path[_0x8700('0x67')](config['root'],_0x8700('0x68')),_0x8700('0x58'));var _0xae1f74=ejs['render'](_0x2e8c9e,{'networks':_0x5b4b83||[]});fs['writeFileSync'](_0x8700('0x5a'),_0xae1f74);return respondWithRpcPromise(_0x8700('0x5b'),_0x8700('0x6b'),{'module':_0x8700('0x5c')});}else if(_0x2fde9b[_0x8700('0x38')][_0x8700('0x5d')]()==_0x8700('0x6c')){var _0x1cab27=fs[_0x8700('0x57')](path[_0x8700('0x67')](config['root'],_0x8700('0x5f')),_0x8700('0x58'));var _0x24775d=ejs['render'](_0x1cab27,{'networks':_0x5b4b83||[]});fs[_0x8700('0x60')](_0x8700('0x69'),_0x24775d);return respondWithRpcPromise('Reload',_0x8700('0x6b'),{'module':_0x8700('0x5c')});}else{var _0x36a162=fs['readFileSync'](path['join'](config[_0x8700('0x5e')],_0x8700('0x61')),_0x8700('0x58'));var _0xf81398=ejs[_0x8700('0x59')](_0x36a162,{'networks':_0x5b4b83||[]});fs[_0x8700('0x60')](util[_0x8700('0x6a')]('/etc/asterisk/sip_xcally_%s.conf',_0x2aef26[_0x8700('0x55')][_0x8700('0x38')][_0x8700('0x63')]()),_0xf81398);return respondWithRpcPromise('Reload',_0x8700('0x6b'),{'module':_0x8700('0x64')});}return null;})[_0x8700('0x4f')](handleError(_0x25ced9,null));};
\ No newline at end of file
+var _0x17ed=['render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','join','server/files/templates/turn_multiple.ejs','utf8','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','TURN','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','map','Network','rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','VIRTUAL','options','where','includeAll','include','rows','show','params','fields','find','create','sequelize','transaction','findAll','body','toUpperCase','STUN','readFileSync','root','server/files/templates/stun_multiple.ejs'];(function(_0x178668,_0x1ec300){var _0x26107d=function(_0x4c0aa8){while(--_0x4c0aa8){_0x178668['push'](_0x178668['shift']());}};_0x26107d(++_0x1ec300);}(_0x17ed,0x7f));var _0xd17e=function(_0x3772b,_0x5566a1){_0x3772b=_0x3772b-0x0;var _0x524c2e=_0x17ed[_0x3772b];return _0x524c2e;};'use strict';var emlformat=require(_0xd17e('0x0'));var rimraf=require(_0xd17e('0x1'));var zipdir=require(_0xd17e('0x2'));var jsonpatch=require(_0xd17e('0x3'));var rp=require(_0xd17e('0x4'));var moment=require(_0xd17e('0x5'));var BPromise=require(_0xd17e('0x6'));var Mustache=require(_0xd17e('0x7'));var util=require(_0xd17e('0x8'));var path=require(_0xd17e('0x9'));var sox=require('sox');var csv=require(_0xd17e('0xa'));var ejs=require(_0xd17e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd17e('0xc'));var squel=require(_0xd17e('0xd'));var crypto=require(_0xd17e('0xe'));var jsforce=require(_0xd17e('0xf'));var deskjs=require(_0xd17e('0x10'));var toCsv=require(_0xd17e('0xa'));var querystring=require(_0xd17e('0x11'));var Papa=require('papaparse');var Redis=require(_0xd17e('0x12'));var authService=require(_0xd17e('0x13'));var qs=require(_0xd17e('0x14'));var as=require(_0xd17e('0x15'));var hardwareService=require(_0xd17e('0x16'));var logger=require(_0xd17e('0x17'))(_0xd17e('0x18'));var utils=require(_0xd17e('0x19'));var config=require(_0xd17e('0x1a'));var licenseUtil=require(_0xd17e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd17e('0x1c'));var client=jayson[_0xd17e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x533ad6,_0x49dd31,_0xb07a0b,_0x4f5e9a){return new BPromise(function(_0x535cad,_0x38c338){var _0x2de86c=_0x4f5e9a||client;return _0x2de86c[_0xd17e('0x1e')](_0x533ad6,_0xb07a0b)['then'](function(_0x17e7b3){logger[_0xd17e('0x1f')](_0xd17e('0x20'),_0x49dd31,_0xd17e('0x21'));logger[_0xd17e('0x22')](_0xd17e('0x23'),_0x49dd31,_0xd17e('0x21'),JSON[_0xd17e('0x24')](_0x17e7b3));if(_0x17e7b3[_0xd17e('0x25')]){if(_0x17e7b3[_0xd17e('0x25')][_0xd17e('0x26')]===0x1f4){logger[_0xd17e('0x25')](_0xd17e('0x20'),_0x49dd31,_0x17e7b3['error']['message']);return _0x38c338(_0x17e7b3[_0xd17e('0x25')][_0xd17e('0x27')]);}logger[_0xd17e('0x25')](_0xd17e('0x20'),_0x49dd31,_0x17e7b3[_0xd17e('0x25')][_0xd17e('0x27')]);return _0x535cad(_0x17e7b3[_0xd17e('0x25')][_0xd17e('0x27')]);}else{logger[_0xd17e('0x1f')](_0xd17e('0x20'),_0x49dd31,_0xd17e('0x21'));_0x535cad(_0x17e7b3['result'][_0xd17e('0x27')]);}})[_0xd17e('0x28')](function(_0x1d9470){logger[_0xd17e('0x25')](_0xd17e('0x20'),_0x49dd31,_0x1d9470);_0x38c338(_0x1d9470);});});}function respondWithStatusCode(_0x3e302c,_0x2147b5){_0x2147b5=_0x2147b5||0xcc;return function(_0x2b12ca){if(_0x2b12ca){return _0x3e302c['sendStatus'](_0x2147b5);}return _0x3e302c['status'](_0x2147b5)[_0xd17e('0x29')]();};}function respondWithResult(_0x5126c1,_0x29e637){_0x29e637=_0x29e637||0xc8;return function(_0x2a8137){if(_0x2a8137){return _0x5126c1[_0xd17e('0x2a')](_0x29e637)[_0xd17e('0x2b')](_0x2a8137);}};}function respondWithFilteredResult(_0x201f23,_0x514495){return function(_0x24eba4){if(_0x24eba4){var _0x1d7058=typeof _0x514495[_0xd17e('0x2c')]===_0xd17e('0x2d')&&typeof _0x514495[_0xd17e('0x2e')]===_0xd17e('0x2d');var _0x5b6381=_0x24eba4[_0xd17e('0x2f')];var _0x3218aa=_0x1d7058?0x0:_0x514495[_0xd17e('0x2c')];var _0x16fc6e=_0x1d7058?_0x24eba4['count']:_0x514495['offset']+_0x514495['limit'];var _0x583d61;if(_0x16fc6e>=_0x5b6381){_0x16fc6e=_0x5b6381;_0x583d61=0xc8;}else{_0x583d61=0xce;}_0x201f23[_0xd17e('0x2a')](_0x583d61);return _0x201f23['set'](_0xd17e('0x30'),_0x3218aa+'-'+_0x16fc6e+'/'+_0x5b6381)[_0xd17e('0x2b')](_0x24eba4);}return null;};}function patchUpdates(_0x4aed99){return function(_0x3c7ebb){try{jsonpatch[_0xd17e('0x31')](_0x3c7ebb,_0x4aed99,!![]);}catch(_0x20d035){return BPromise[_0xd17e('0x32')](_0x20d035);}return _0x3c7ebb[_0xd17e('0x33')]();};}function saveUpdates(_0x546151,_0x3b2de2){return function(_0x1f50f7){if(_0x1f50f7){return _0x1f50f7[_0xd17e('0x34')](_0x546151)[_0xd17e('0x35')](function(_0xea45b7){return _0xea45b7;});}return null;};}function removeEntity(_0x21d60d,_0x2ecea2){return function(_0x456975){if(_0x456975){return _0x456975[_0xd17e('0x36')]()[_0xd17e('0x35')](function(){_0x21d60d[_0xd17e('0x2a')](0xcc)[_0xd17e('0x29')]();});}};}function handleEntityNotFound(_0x2a52e9,_0x22e388){return function(_0x37f302){if(!_0x37f302){_0x2a52e9[_0xd17e('0x37')](0x194);}return _0x37f302;};}function handleError(_0x20b4a3,_0x27fe39){_0x27fe39=_0x27fe39||0x1f4;return function(_0x1e9913){logger[_0xd17e('0x25')](_0x1e9913[_0xd17e('0x38')]);if(_0x1e9913['name']){delete _0x1e9913['name'];}_0x20b4a3[_0xd17e('0x2a')](_0x27fe39)['send'](_0x1e9913);};}exports['index']=function(_0x4a755c,_0x3af040){var _0x5b27dd={},_0x3fa6f5={},_0x42948e={'count':0x0,'rows':[]};var _0x2bb6f6=_[_0xd17e('0x39')](db[_0xd17e('0x3a')][_0xd17e('0x3b')],function(_0x1e0c4b){return{'name':_0x1e0c4b[_0xd17e('0x3c')],'type':_0x1e0c4b[_0xd17e('0x3d')][_0xd17e('0x3e')]};});_0x3fa6f5[_0xd17e('0x3f')]=_[_0xd17e('0x39')](_0x2bb6f6,_0xd17e('0x40'));_0x3fa6f5[_0xd17e('0x41')]=_[_0xd17e('0x42')](_0x4a755c[_0xd17e('0x41')]);_0x3fa6f5[_0xd17e('0x43')]=_[_0xd17e('0x44')](_0x3fa6f5[_0xd17e('0x3f')],_0x3fa6f5[_0xd17e('0x41')]);_0x5b27dd[_0xd17e('0x45')]=_[_0xd17e('0x44')](_0x3fa6f5['model'],qs['fields'](_0x4a755c['query']['fields']));_0x5b27dd[_0xd17e('0x45')]=_0x5b27dd[_0xd17e('0x45')][_0xd17e('0x46')]?_0x5b27dd['attributes']:_0x3fa6f5[_0xd17e('0x3f')];if(!_0x4a755c['query'][_0xd17e('0x47')](_0xd17e('0x48'))){_0x5b27dd['limit']=qs[_0xd17e('0x2e')](_0x4a755c[_0xd17e('0x41')][_0xd17e('0x2e')]);_0x5b27dd['offset']=qs['offset'](_0x4a755c[_0xd17e('0x41')][_0xd17e('0x2c')]);}_0x5b27dd[_0xd17e('0x49')]=qs[_0xd17e('0x4a')](_0x4a755c[_0xd17e('0x41')][_0xd17e('0x4a')]);_0x5b27dd['where']=qs['filters'](_['pick'](_0x4a755c[_0xd17e('0x41')],_0x3fa6f5[_0xd17e('0x43')]),_0x2bb6f6);if(_0x4a755c[_0xd17e('0x41')][_0xd17e('0x4b')]){_0x5b27dd['where']=_[_0xd17e('0x4c')](_0x5b27dd['where'],{'$or':_[_0xd17e('0x39')](_0x2bb6f6,function(_0x4181d8){if(_0x4181d8['type']!==_0xd17e('0x4d')){var _0x5ceb29={};_0x5ceb29[_0x4181d8[_0xd17e('0x40')]]={'$like':'%'+_0x4a755c[_0xd17e('0x41')][_0xd17e('0x4b')]+'%'};return _0x5ceb29;}})});}_0x5b27dd=_[_0xd17e('0x4c')]({},_0x5b27dd,_0x4a755c[_0xd17e('0x4e')]);var _0x39fe2d={'where':_0x5b27dd[_0xd17e('0x4f')]};return db[_0xd17e('0x3a')]['count'](_0x39fe2d)[_0xd17e('0x35')](function(_0x393138){_0x42948e[_0xd17e('0x2f')]=_0x393138;if(_0x4a755c[_0xd17e('0x41')][_0xd17e('0x50')]){_0x5b27dd[_0xd17e('0x51')]=[{'all':!![]}];}return db['Network']['findAll'](_0x5b27dd);})[_0xd17e('0x35')](function(_0x27f5b1){_0x42948e[_0xd17e('0x52')]=_0x27f5b1;return _0x42948e;})['then'](respondWithFilteredResult(_0x3af040,_0x5b27dd))[_0xd17e('0x28')](handleError(_0x3af040,null));};exports[_0xd17e('0x53')]=function(_0x248ab7,_0x3425b3){var _0x2bac10={'raw':!![],'where':{'id':_0x248ab7[_0xd17e('0x54')]['id']}},_0x4f8d70={};_0x4f8d70[_0xd17e('0x3f')]=_[_0xd17e('0x42')](db[_0xd17e('0x3a')][_0xd17e('0x3b')]);_0x4f8d70[_0xd17e('0x41')]=_['keys'](_0x248ab7['query']);_0x4f8d70[_0xd17e('0x43')]=_['intersection'](_0x4f8d70['model'],_0x4f8d70[_0xd17e('0x41')]);_0x2bac10[_0xd17e('0x45')]=_[_0xd17e('0x44')](_0x4f8d70[_0xd17e('0x3f')],qs[_0xd17e('0x55')](_0x248ab7[_0xd17e('0x41')][_0xd17e('0x55')]));_0x2bac10['attributes']=_0x2bac10[_0xd17e('0x45')][_0xd17e('0x46')]?_0x2bac10[_0xd17e('0x45')]:_0x4f8d70[_0xd17e('0x3f')];if(_0x248ab7[_0xd17e('0x41')][_0xd17e('0x50')]){_0x2bac10['include']=[{'all':!![]}];}_0x2bac10=_['merge']({},_0x2bac10,_0x248ab7[_0xd17e('0x4e')]);return db[_0xd17e('0x3a')][_0xd17e('0x56')](_0x2bac10)[_0xd17e('0x35')](handleEntityNotFound(_0x3425b3,null))[_0xd17e('0x35')](respondWithResult(_0x3425b3,null))[_0xd17e('0x28')](handleError(_0x3425b3,null));};exports[_0xd17e('0x57')]=function(_0x3a484d,_0xbc8788,_0x3726de){var _0x209afa;return db[_0xd17e('0x58')][_0xd17e('0x59')](function(_0x5adb58){return db[_0xd17e('0x3a')][_0xd17e('0x57')](_0x3a484d['body'],{'raw':!![]})[_0xd17e('0x35')](function(_0x3e61f8){_0x209afa=_0x3e61f8;return db[_0xd17e('0x3a')][_0xd17e('0x5a')]({'where':{'type':_0x3a484d[_0xd17e('0x5b')]['type']},'raw':!![]});})[_0xd17e('0x35')](function(_0x1a26ec){if(_0x209afa[_0xd17e('0x3d')][_0xd17e('0x5c')]()==_0xd17e('0x5d')){var _0xec64e4=fs[_0xd17e('0x5e')](path['join'](config[_0xd17e('0x5f')],_0xd17e('0x60')),'utf8');var _0x5a233c=ejs[_0xd17e('0x61')](_0xec64e4,{'networks':_0x1a26ec||[]});fs[_0xd17e('0x62')](_0xd17e('0x63'),_0x5a233c);return respondWithRpcPromise(_0xd17e('0x64'),'create',{'module':_0xd17e('0x65')});}else if(_0x209afa[_0xd17e('0x3d')]['toUpperCase']()=='TURN'){var _0x52ab88=fs[_0xd17e('0x5e')](path[_0xd17e('0x66')](config[_0xd17e('0x5f')],_0xd17e('0x67')),_0xd17e('0x68'));var _0x16e9a4=ejs[_0xd17e('0x61')](_0x52ab88,{'networks':_0x1a26ec||[]});fs[_0xd17e('0x62')](_0xd17e('0x69'),_0x16e9a4);return respondWithRpcPromise(_0xd17e('0x64'),'create',{'module':_0xd17e('0x65')});}else{var _0x29a913=fs[_0xd17e('0x5e')](path[_0xd17e('0x66')](config[_0xd17e('0x5f')],_0xd17e('0x6a')),_0xd17e('0x68'));var _0x16376c=ejs[_0xd17e('0x61')](_0x29a913,{'networks':_0x1a26ec||[]});fs[_0xd17e('0x62')](util[_0xd17e('0x6b')](_0xd17e('0x6c'),_0x3a484d[_0xd17e('0x5b')][_0xd17e('0x3d')]['toLowerCase']()),_0x16376c);return respondWithRpcPromise(_0xd17e('0x64'),_0xd17e('0x57'),{'module':_0xd17e('0x6d')});}return null;})[_0xd17e('0x35')](function(){return _0x209afa;});})[_0xd17e('0x35')](respondWithResult(_0xbc8788,0xc9))[_0xd17e('0x28')](handleError(_0xbc8788,null));};exports[_0xd17e('0x34')]=function(_0xa78c1f,_0x4406d6,_0x31c8e5){var _0x1ddefa;return db[_0xd17e('0x58')][_0xd17e('0x59')](function(_0x1a4ad2){return db[_0xd17e('0x3a')][_0xd17e('0x56')]({'where':{'id':_0xa78c1f['params']['id']}})['then'](handleEntityNotFound(_0x4406d6,null))[_0xd17e('0x35')](saveUpdates(_0xa78c1f[_0xd17e('0x5b')],null))[_0xd17e('0x35')](function(_0x4df3b7){if(_0x4df3b7){_0x1ddefa=_0x4df3b7;return db['Network']['findAll']({'where':{'type':_0x1ddefa['type']},'raw':!![]});}return null;})['then'](function(_0x5037c2){if(_0x1ddefa[_0xd17e('0x3d')]['toUpperCase']()==_0xd17e('0x5d')){var _0x3ec6fe=fs[_0xd17e('0x5e')](path['join'](config['root'],_0xd17e('0x60')),_0xd17e('0x68'));var _0x46255d=ejs[_0xd17e('0x61')](_0x3ec6fe,{'networks':_0x5037c2||[]});fs[_0xd17e('0x62')]('/etc/asterisk/stun_xcally.conf',_0x46255d);return respondWithRpcPromise(_0xd17e('0x64'),_0xd17e('0x34'),{'module':_0xd17e('0x65')});}else if(_0x1ddefa[_0xd17e('0x3d')]['toUpperCase']()==_0xd17e('0x6e')){var _0x252722=fs[_0xd17e('0x5e')](path[_0xd17e('0x66')](config[_0xd17e('0x5f')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x8682ce=ejs[_0xd17e('0x61')](_0x252722,{'networks':_0x5037c2||[]});fs['writeFileSync'](_0xd17e('0x69'),_0x8682ce);return respondWithRpcPromise(_0xd17e('0x64'),_0xd17e('0x34'),{'module':_0xd17e('0x65')});}else{var _0x1a10b8=fs[_0xd17e('0x5e')](path[_0xd17e('0x66')](config['root'],_0xd17e('0x6a')),_0xd17e('0x68'));var _0x1b86c7=ejs[_0xd17e('0x61')](_0x1a10b8,{'networks':_0x5037c2||[]});fs[_0xd17e('0x62')](util[_0xd17e('0x6b')](_0xd17e('0x6c'),_0xa78c1f[_0xd17e('0x5b')][_0xd17e('0x3d')][_0xd17e('0x6f')]()),_0x1b86c7);return respondWithRpcPromise(_0xd17e('0x64'),_0xd17e('0x34'),{'module':_0xd17e('0x6d')});}return null;})[_0xd17e('0x35')](function(_0x54d485){if(_0x54d485){return _0x1ddefa;}return null;});})[_0xd17e('0x35')](respondWithResult(_0x4406d6,null))[_0xd17e('0x28')](handleError(_0x4406d6,null));};exports[_0xd17e('0x36')]=function(_0x2565cb,_0x1e884a,_0x581773){var _0x40a839;return db[_0xd17e('0x3a')][_0xd17e('0x56')]({'where':{'id':_0x2565cb[_0xd17e('0x54')]['id']}})[_0xd17e('0x35')](function(_0xda471c){_0x40a839=_0xda471c;return _0xda471c;})[_0xd17e('0x35')](handleEntityNotFound(_0x1e884a,null))['then'](removeEntity(_0x1e884a,null))[_0xd17e('0x35')](function(){if(_0x40a839){return db[_0xd17e('0x3a')][_0xd17e('0x5a')]({'where':{'type':_0x40a839[_0xd17e('0x3d')]},'raw':!![]});}})[_0xd17e('0x35')](function(_0x4c9b54){if(_0x40a839[_0xd17e('0x3d')][_0xd17e('0x5c')]()==_0xd17e('0x5d')){var _0x124b28=fs['readFileSync'](path[_0xd17e('0x66')](config['root'],_0xd17e('0x60')),_0xd17e('0x68'));var _0x2a8d46=ejs[_0xd17e('0x61')](_0x124b28,{'networks':_0x4c9b54||[]});fs['writeFileSync'](_0xd17e('0x63'),_0x2a8d46);return respondWithRpcPromise('Reload','destroy',{'module':_0xd17e('0x65')});}else if(_0x40a839[_0xd17e('0x3d')]['toUpperCase']()=='TURN'){var _0x35d0d0=fs[_0xd17e('0x5e')](path[_0xd17e('0x66')](config[_0xd17e('0x5f')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x1d8b45=ejs[_0xd17e('0x61')](_0x35d0d0,{'networks':_0x4c9b54||[]});fs['writeFileSync'](_0xd17e('0x69'),_0x1d8b45);return respondWithRpcPromise(_0xd17e('0x64'),_0xd17e('0x36'),{'module':_0xd17e('0x65')});}else{var _0x4b0715=fs['readFileSync'](path['join'](config[_0xd17e('0x5f')],_0xd17e('0x6a')),_0xd17e('0x68'));var _0x1901f5=ejs['render'](_0x4b0715,{'networks':_0x4c9b54||[]});fs[_0xd17e('0x62')](util[_0xd17e('0x6b')](_0xd17e('0x6c'),_0x2565cb[_0xd17e('0x5b')][_0xd17e('0x3d')][_0xd17e('0x6f')]()),_0x1901f5);return respondWithRpcPromise(_0xd17e('0x64'),'destroy',{'module':'chan_sip.so'});}return null;})['catch'](handleError(_0x1e884a,null));};
\ No newline at end of file