[Asterisk-code-review] chan_sip: externhost/externaddr with non-default TCP/TLS ports. (asterisk[13])
George Joseph
asteriskteam at digium.com
Tue Apr 21 10:18:57 CDT 2020
George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/asterisk/+/14297 )
Change subject: chan_sip: externhost/externaddr with non-default TCP/TLS ports.
......................................................................
chan_sip: externhost/externaddr with non-default TCP/TLS ports.
ASTERISK-28372
Reported by: Anton Satskiy
ASTERISK-24428
Reported by: sstream
Change-Id: I2b7432a9bf3b09dc8515297ff955636db7a6224c
---
M channels/chan_sip.c
1 file changed, 15 insertions(+), 4 deletions(-)
Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved; Approved for Submit
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index cc25a43..edb08e9 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -3864,9 +3864,21 @@
/* for consistency, default to the externaddr port */
externtcpport = ast_sockaddr_port(&externaddr);
}
+ if (!externtcpport) {
+ externtcpport = ast_sockaddr_port(&sip_tcp_desc.local_address);
+ }
+ if (!externtcpport) {
+ externtcpport = STANDARD_SIP_PORT;
+ }
ast_sockaddr_set_port(us, externtcpport);
break;
case AST_TRANSPORT_TLS:
+ if (!externtlsport) {
+ externtlsport = ast_sockaddr_port(&sip_tls_desc.local_address);
+ }
+ if (!externtlsport) {
+ externtlsport = STANDARD_TLS_PORT;
+ }
ast_sockaddr_set_port(us, externtlsport);
break;
case AST_TRANSPORT_UDP:
@@ -32386,8 +32398,8 @@
default_primary_transport = AST_TRANSPORT_UDP;
ourport_tcp = STANDARD_SIP_PORT;
ourport_tls = STANDARD_TLS_PORT;
- externtcpport = STANDARD_SIP_PORT;
- externtlsport = STANDARD_TLS_PORT;
+ externtcpport = 0;
+ externtlsport = 0;
sip_cfg.srvlookup = DEFAULT_SRVLOOKUP;
global_tos_sip = DEFAULT_TOS_SIP;
global_tos_audio = DEFAULT_TOS_AUDIO;
@@ -32866,10 +32878,9 @@
} else if (!strcasecmp(v->name, "externtcpport")) {
if (!(externtcpport = port_str2int(v->value, 0))) {
ast_log(LOG_WARNING, "Invalid externtcpport value, must be a positive integer between 1 and 65535 at line %d\n", v->lineno);
- externtcpport = 0;
}
} else if (!strcasecmp(v->name, "externtlsport")) {
- if (!(externtlsport = port_str2int(v->value, STANDARD_TLS_PORT))) {
+ if (!(externtlsport = port_str2int(v->value, 0))) {
ast_log(LOG_WARNING, "Invalid externtlsport value, must be a positive integer between 1 and 65535 at line %d\n", v->lineno);
}
} else if (!strcasecmp(v->name, "allow")) {
--
To view, visit https://gerrit.asterisk.org/c/asterisk/+/14297
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Change-Id: I2b7432a9bf3b09dc8515297ff955636db7a6224c
Gerrit-Change-Number: 14297
Gerrit-PatchSet: 1
Gerrit-Owner: Alexander Traud <pabstraud at compuserve.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20200421/4d763702/attachment.html>
More information about the asterisk-code-review
mailing list