mirror of
https://github.com/jambonz/jambonz-feature-server.git
synced 2025-12-20 16:50:39 +00:00
add support for speechmatics asr (#920)
* update to verb specs with speechmatics support * discover local ip using os module
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const Mrf = require('drachtio-fsmrf');
|
||||
const ip = require('ip');
|
||||
const os = require('os');
|
||||
const {
|
||||
JAMBONES_MYSQL_HOST,
|
||||
JAMBONES_MYSQL_USER,
|
||||
@@ -18,6 +18,19 @@ const {
|
||||
const Registrar = require('@jambonz/mw-registrar');
|
||||
const assert = require('assert');
|
||||
|
||||
function getLocalIp() {
|
||||
const interfaces = os.networkInterfaces();
|
||||
for (const interfaceName in interfaces) {
|
||||
const interface = interfaces[interfaceName];
|
||||
for (const iface of interface) {
|
||||
if (iface.family === 'IPv4' && !iface.internal) {
|
||||
return iface.address;
|
||||
}
|
||||
}
|
||||
}
|
||||
return '127.0.0.1'; // Fallback to localhost if no suitable interface found
|
||||
}
|
||||
|
||||
function initMS(logger, wrapper, ms) {
|
||||
Object.assign(wrapper, {ms, active: true, connects: 1});
|
||||
logger.info(`connected to freeswitch at ${ms.address}`);
|
||||
@@ -195,8 +208,8 @@ function installSrfLocals(srf, logger) {
|
||||
|
||||
let localIp;
|
||||
try {
|
||||
// Either use the configured IP address or call ip.address() to find it
|
||||
localIp = HTTP_IP || ip.address();
|
||||
// Either use the configured IP address or discover it
|
||||
localIp = HTTP_IP || getLocalIp();
|
||||
} catch (err) {
|
||||
logger.error({err}, 'installSrfLocals - error detecting local ipv4 address');
|
||||
}
|
||||
|
||||
25
package-lock.json
generated
25
package-lock.json
generated
@@ -18,7 +18,7 @@
|
||||
"@jambonz/speech-utils": "^0.1.18",
|
||||
"@jambonz/stats-collector": "^0.1.10",
|
||||
"@jambonz/time-series": "^0.2.9",
|
||||
"@jambonz/verb-specifications": "^0.0.81",
|
||||
"@jambonz/verb-specifications": "^0.0.82",
|
||||
"@opentelemetry/api": "^1.8.0",
|
||||
"@opentelemetry/exporter-jaeger": "^1.23.0",
|
||||
"@opentelemetry/exporter-trace-otlp-http": "^0.50.0",
|
||||
@@ -35,7 +35,6 @@
|
||||
"drachtio-srf": "^4.5.35",
|
||||
"express": "^4.19.2",
|
||||
"express-validator": "^7.0.1",
|
||||
"ip": "^2.0.1",
|
||||
"moment": "^2.30.1",
|
||||
"parse-url": "^9.2.0",
|
||||
"pino": "^8.20.0",
|
||||
@@ -1575,9 +1574,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@jambonz/verb-specifications": {
|
||||
"version": "0.0.81",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.81.tgz",
|
||||
"integrity": "sha512-lufYMLpwaejF3zl8FNy1SvmsxFHXNXU8p7I+GoiwbgOHmFeOX4bQla4RD7bNLFvfjSXPRc2u9h5fceicVa9dcg==",
|
||||
"version": "0.0.82",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.82.tgz",
|
||||
"integrity": "sha512-jgbu0nUXQOGz9Kd0h7gBOrykl2FoZkS7fg5MdNbvnMGO+D4bboBsNTYwGk0k+OSm0D8I7JUQoaFbuKBo8Cj0RA==",
|
||||
"dependencies": {
|
||||
"debug": "^4.3.4",
|
||||
"pino": "^8.8.0"
|
||||
@@ -5632,11 +5631,6 @@
|
||||
"url": "https://opencollective.com/ioredis"
|
||||
}
|
||||
},
|
||||
"node_modules/ip": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz",
|
||||
"integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ=="
|
||||
},
|
||||
"node_modules/ip6addr": {
|
||||
"version": "0.2.5",
|
||||
"resolved": "https://registry.npmjs.org/ip6addr/-/ip6addr-0.2.5.tgz",
|
||||
@@ -10538,9 +10532,9 @@
|
||||
}
|
||||
},
|
||||
"@jambonz/verb-specifications": {
|
||||
"version": "0.0.81",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.81.tgz",
|
||||
"integrity": "sha512-lufYMLpwaejF3zl8FNy1SvmsxFHXNXU8p7I+GoiwbgOHmFeOX4bQla4RD7bNLFvfjSXPRc2u9h5fceicVa9dcg==",
|
||||
"version": "0.0.82",
|
||||
"resolved": "https://registry.npmjs.org/@jambonz/verb-specifications/-/verb-specifications-0.0.82.tgz",
|
||||
"integrity": "sha512-jgbu0nUXQOGz9Kd0h7gBOrykl2FoZkS7fg5MdNbvnMGO+D4bboBsNTYwGk0k+OSm0D8I7JUQoaFbuKBo8Cj0RA==",
|
||||
"requires": {
|
||||
"debug": "^4.3.4",
|
||||
"pino": "^8.8.0"
|
||||
@@ -13645,11 +13639,6 @@
|
||||
"standard-as-callback": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"ip": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/ip/-/ip-2.0.1.tgz",
|
||||
"integrity": "sha512-lJUL9imLTNi1ZfXT+DU6rBBdbiKGBuay9B6xGSPVjUeQwaH1RIGqef8RZkUtHioLmSNpPR5M4HVKJGm1j8FWVQ=="
|
||||
},
|
||||
"ip6addr": {
|
||||
"version": "0.2.5",
|
||||
"resolved": "https://registry.npmjs.org/ip6addr/-/ip6addr-0.2.5.tgz",
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
"@jambonz/speech-utils": "^0.1.18",
|
||||
"@jambonz/stats-collector": "^0.1.10",
|
||||
"@jambonz/time-series": "^0.2.9",
|
||||
"@jambonz/verb-specifications": "^0.0.81",
|
||||
"@jambonz/verb-specifications": "^0.0.82",
|
||||
"@opentelemetry/api": "^1.8.0",
|
||||
"@opentelemetry/exporter-jaeger": "^1.23.0",
|
||||
"@opentelemetry/exporter-trace-otlp-http": "^0.50.0",
|
||||
@@ -51,7 +51,6 @@
|
||||
"drachtio-srf": "^4.5.35",
|
||||
"express": "^4.19.2",
|
||||
"express-validator": "^7.0.1",
|
||||
"ip": "^2.0.1",
|
||||
"moment": "^2.30.1",
|
||||
"parse-url": "^9.2.0",
|
||||
"pino": "^8.20.0",
|
||||
|
||||
Reference in New Issue
Block a user