mirror of
https://github.com/jambonz/sbc-outbound.git
synced 2025-12-19 04:27:45 +00:00
Fix/invite use realm to registered trunk (#144)
* special header X-Preferred-From-Host was ignored * when sending INVITE to registered trunk with a sip realm, use realm in the uri and send via proxy as defined in outbound gateway
This commit is contained in:
@@ -31,7 +31,7 @@ const createBLegFromHeader = ({
|
||||
if (teams) {
|
||||
host = req.get('X-MS-Teams-Tenant-FQDN');
|
||||
}
|
||||
else if (req.has('X-Preferred-From-User')) {
|
||||
else if (req.has('X-Preferred-From-Host')) {
|
||||
host = req.get('X-Preferred-From-Host');
|
||||
} else if (register_from_domain) {
|
||||
host = register_from_domain;
|
||||
@@ -312,7 +312,7 @@ class CallSession extends Emitter {
|
||||
const prependPlus = vc.e164_leading_plus && !this.req.calledNumber.startsWith('0') ? '+' : '';
|
||||
const scheme = transport === 'tls' && !process.env.JAMBONES_USE_BEST_EFFORT_TLS && o.use_sips_scheme ?
|
||||
'sips' : 'sip';
|
||||
const u = `${scheme}:${prefix}${prependPlus}${calledNumber}@${hostport};transport=${transport}`;
|
||||
let u = `${scheme}:${prefix}${prependPlus}${calledNumber}@${hostport};transport=${transport}`;
|
||||
const obj = {
|
||||
name: vc.name,
|
||||
diversion: vc.diversion,
|
||||
@@ -327,6 +327,11 @@ class CallSession extends Emitter {
|
||||
password: vc.register_password
|
||||
};
|
||||
}
|
||||
if (vc.requires_register && vc.register_sip_realm?.length > 0) {
|
||||
proxy = u;
|
||||
u = `${scheme}:${prefix}${prependPlus}${calledNumber}@${vc.register_sip_realm};transport=${transport}`;
|
||||
this.logger.debug({uri: u}, `using outbound proxy for this registered trunk: ${proxy}`);
|
||||
}
|
||||
mapGateways.set(u, obj);
|
||||
uris.push(u);
|
||||
this.logger.debug({gateway: o}, `pushed uri ${u}`);
|
||||
|
||||
Reference in New Issue
Block a user