merge support for X-Override-To feature back into main branch

This commit is contained in:
Dave Horton
2022-02-01 12:30:25 -05:00
parent 61ec935ab8
commit dd85ec762d
+10 -2
View File
@@ -124,14 +124,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)}`);
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}`);
}
const contact = this.req.locals.registration.contact;
if (contact.includes('transport=ws')) {
uris = [contact];
}
else {
proxy = this.req.locals.registration.proxy;
uris = [this.req.uri];
uris = [destUri];
}
}
else if (this.req.locals.target === 'forward') {