Skip to content

Commit a14f020

Browse files
committed
restore only use port if proxy is IPv4 address
broke in this commit 543f52d
1 parent 1f7980d commit a14f020

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/regbot.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const {
66
REGISTER_RESPONSE_REMOVE,
77
JAMBONES_REGBOT_USER_AGENT
88
} = require('./config');
9-
const {isValidDomainOrIP} = require('./utils');
9+
const {isValidDomainOrIP, isValidIPv4} = require('./utils');
1010
const DEFAULT_EXPIRES = (parseInt(JAMBONES_REGBOT_DEFAULT_EXPIRES_INTERVAL) || 3600);
1111
const MIN_EXPIRES = (parseInt(JAMBONES_REGBOT_MIN_EXPIRES_INTERVAL) || 30);
1212
const assert = require('assert');
@@ -119,7 +119,8 @@ class Regbot {
119119
proxy = `sip:${this.outbound_sip_proxy};transport=${transport}`;
120120
this.logger.debug(`sending via proxy ${proxy}`);
121121
} else {
122-
proxy = `sip:${this.ipv4}:${this.port};transport=${transport}`;
122+
const isIPv4 = isValidIPv4(this.ipv4);
123+
proxy = `sip:${this.ipv4}${isIPv4 ? `:${this.port}` : ''};transport=${transport}`;
123124
this.logger.debug(`sending to registrar ${proxy}`);
124125
}
125126
const req = await srf.request(`${scheme}:${this.sip_realm}`, {

0 commit comments

Comments
 (0)