fix #61, contact header should have port 5061 when registering over tls (#69)

This commit is contained in:
Dave Horton
2024-06-24 09:36:50 -04:00
committed by GitHub
parent 0ff39724e4
commit 8f59ecbe4a
3 changed files with 14 additions and 5 deletions

9
app.js
View File

@@ -122,6 +122,7 @@ srf.on('connect', (err, hp) => {
// Add SBC Public IP to Database
srf.locals.sbcPublicIpAddress = {};
let defaultIp;
const map = new Map();
const hostports = hp.split(',');
for (const hp of hostports) {
@@ -137,6 +138,7 @@ srf.on('connect', (err, hp) => {
udp: `${ipv4}:${port}`
};
map.set(ipv4, {...addr, port: port});
defaultIp = ipv4;
break;
case 'tls':
map.set(ipv4, {...addr, tls_port: port});
@@ -156,6 +158,13 @@ srf.on('connect', (err, hp) => {
}
}
// if drachtio server does not tell us the tls ip and port default to standard 5061
if (!srf.locals.sbcPublicIpAddress.tls) {
srf.locals.sbcPublicIpAddress.tls = `${defaultIp}:5061`;
}
logger.info({sbcPublicIpAddress: srf.locals.sbcPublicIpAddress}, 'sbc public ip addresses');
// Function to check if the IP address is in a private subnet (RFC 1918)
const isPrivateSubnet = (ip) => {
const [firstOctet, secondOctet] = ip.split('.').map(Number);

8
package-lock.json generated
View File

@@ -18,7 +18,7 @@
"debug": "^4.3.4",
"drachtio-mw-registration-parser": "^0.1.0",
"drachtio-mw-response-time": "^1.0.2",
"drachtio-srf": "^4.5.31",
"drachtio-srf": "^4.5.38",
"pino": "^8.20.0",
"short-uuid": "^4.2.2"
},
@@ -1631,9 +1631,9 @@
"integrity": "sha512-d+DtKuqhpkSBBkRfwcgS3x26T3lrdgo86yVWZ4wy+K8RtS1faT3hgLBq9EPEYSDkcw76r4klvdDWPhTrPqGAQw=="
},
"node_modules/drachtio-srf": {
"version": "4.5.31",
"resolved": "https://registry.npmjs.org/drachtio-srf/-/drachtio-srf-4.5.31.tgz",
"integrity": "sha512-/M4J8h2aqHtMXWr8/UHngKQsY9sQQxjdd23jDTSpNVpCwgZ2/xZFhbg/B/UCjrarSRzbyDCvuluOAtaPRSw7Hw==",
"version": "4.5.38",
"resolved": "https://registry.npmjs.org/drachtio-srf/-/drachtio-srf-4.5.38.tgz",
"integrity": "sha512-dEafgn1OPfkc30Gq3JwJBF4Q7O96fsuqMnE2OO1NqRG0DkwworMIPsusWDo0ePbi+NH74rMjLPmVyC/owA0HXg==",
"dependencies": {
"debug": "^3.2.7",
"delegates": "^0.1.0",

View File

@@ -36,7 +36,7 @@
"debug": "^4.3.4",
"drachtio-mw-registration-parser": "^0.1.0",
"drachtio-mw-response-time": "^1.0.2",
"drachtio-srf": "^4.5.31",
"drachtio-srf": "^4.5.38",
"pino": "^8.20.0",
"short-uuid": "^4.2.2"
},