support OPTIONS ping to SBCs

This commit is contained in:
Dave Horton
2020-02-17 21:41:35 -05:00
parent 3c89b7fd76
commit 162dfff5a3
9 changed files with 109 additions and 77 deletions

View File

@@ -5,6 +5,8 @@ const PORT = process.env.HTTP_PORT || 3000;
function installSrfLocals(srf, logger) {
if (srf.locals.dbHelpers) return;
const {getSBC, getSrf} = require('./sbc-pinger')(logger);
const freeswitch = process.env.JAMBONES_FREESWITCH
.split(',')
.map((fs) => {
@@ -13,19 +15,6 @@ function installSrfLocals(srf, logger) {
});
logger.info({freeswitch}, 'freeswitch inventory');
const sbcs = process.env.JAMBONES_SBCS
.split(',')
.map((sbc) => sbc.trim());
logger.info({sbcs}, 'SBC inventory');
const drachtio = process.env.JAMBONES_FEATURE_SERVERS
.split(',')
.map((fs) => {
const arr = /^(.*):(.*):(.*)/.exec(fs);
if (arr) return {host: arr[1], port: arr[2], secret: arr[3]};
});
logger.info({drachtio}, 'drachtio feature server inventory');
const {
lookupAppByPhoneNumber,
lookupAppBySid,
@@ -60,9 +49,9 @@ function installSrfLocals(srf, logger) {
parentLogger: logger,
ipv4: localIp,
serviceUrl: `http://${localIp}:${PORT}`,
freeswitch: freeswitch[0],
sbcs,
drachtio
getSBC,
getSrf,
getFreeswitch: () => freeswitch[0]
});
}