mirror of
https://github.com/jambonz/sbc-outbound.git
synced 2026-10-09 21:14:05 +00:00
support for X-Override-To
This commit is contained in:
+11
-3
@@ -2,7 +2,7 @@ const Emitter = require('events');
|
||||
const {makeRtpEngineOpts} = require('./utils');
|
||||
const {forwardInDialogRequests} = require('drachtio-fn-b2b-sugar');
|
||||
const {SipError} = require('drachtio-srf');
|
||||
const {parseUri} = require('drachtio-srf');
|
||||
const {parseUri, stringifyUri} = require('drachtio-srf');
|
||||
const debug = require('debug')('jambonz:sbc-outbound');
|
||||
|
||||
/**
|
||||
@@ -66,14 +66,22 @@ class CallSession extends Emitter {
|
||||
};
|
||||
|
||||
if (this.req.locals.registration) {
|
||||
debug(`sending call to user ${JSON.stringify(this.req.locals.registration)}`);
|
||||
debug(`sending call to registered user ${JSON.stringify(this.req.locals.registration)}`);
|
||||
const contact = this.req.locals.registration.contact;
|
||||
let destUri = this.req.uri;
|
||||
if (this.req.has('X-Override-To')) {
|
||||
const dest = this.req.get('X-Override-To');
|
||||
const uri = parseUri(contact);
|
||||
uri.user = dest;
|
||||
destUri = stringifyUri(uri);
|
||||
this.logger.info(`overriding destination user with ${dest}, so final uri is ${destUri}`);
|
||||
}
|
||||
if (contact.includes('transport=ws')) {
|
||||
uris = [contact];
|
||||
}
|
||||
else {
|
||||
proxy = this.req.locals.registration.contact;
|
||||
uris = [this.req.uri];
|
||||
uris = [destUri];
|
||||
}
|
||||
}
|
||||
else if (this.req.locals.target === 'forward') {
|
||||
|
||||
Reference in New Issue
Block a user