use sip gateway host for DNS lookup of ephemeral gw and only if not an IP address

This commit is contained in:
Sam Machin
2025-11-05 17:21:21 +00:00
parent a14f020309
commit 8be13fadc5

View File

@@ -204,14 +204,14 @@ class Regbot {
})); }));
// for reg trunks, create ephemeral set of IP addresses for inbound gateways // for reg trunks, create ephemeral set of IP addresses for inbound gateways
if (this.trunk_type === 'reg') { if (this.trunk_type === 'reg' && !isValidIPv4(this.ipv4)) {
this.addresses = []; this.addresses = [];
if (this.port) { if (this.port) {
const addrs = await dnsResolverA(this.logger, this.sip_realm); const addrs = await dnsResolverA(this.logger, this.ipv4);
this.addresses.push(...addrs); this.addresses.push(...addrs);
} }
else { else {
const addrs = await dnsResolverSrv(this.logger, this.sip_realm, this.transport); const addrs = await dnsResolverSrv(this.logger, this.ipv4, this.transport);
this.addresses.push(...addrs); this.addresses.push(...addrs);
} }