include source port in X-Forwarded-For

This commit is contained in:
Dave Horton
2020-01-17 09:11:51 -05:00
parent be5a143876
commit b500d676e4
4 changed files with 4 additions and 3 deletions

View File

@@ -17,7 +17,7 @@
"database": "jambones"
},
"trunks": {
"appserver": ["sip:172.38.0.11"]
"appserver": ["172.38.0.11"]
},
"transcoding": {
"rtpCharacteristics" : {

View File

@@ -49,7 +49,7 @@ class CallSession extends Emitter {
}
// now send the INVITE in towards the feature servers
const headers = {'X-Forwarded-For': this.req.source_address};
const headers = {'X-Forwarded-For': `${this.req.source_address}:${this.req.source_port}`};
if (this.req.locals.carrier) Object.assign(headers, {'X-Originating-Carrier': this.req.locals.carrier});
debug(`sending INVITE to ${proxy} with ${uri}`);

View File

@@ -9,6 +9,7 @@ module.exports = function(srf, logger) {
try {
const gateway = await lookupSipGatewayBySignalingAddress(req.source_address, req.source_port);
if (!gateway) {
// TODO: if uri.host is not a domain, just reject
req.locals.originator = 'device';
return authenticator(req, res, next);
}

View File

@@ -1,6 +1,6 @@
{
"name": "sbc-inbound",
"version": "0.1.0",
"version": "0.1.1",
"main": "app.js",
"engines": {
"node": ">= 10.16.0"