[asterisk-commits] wdoekes: branch 10 r347167 - in /branches/10: ./ channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Tue Dec 6 13:42:58 CST 2011
Author: wdoekes
Date: Tue Dec 6 13:42:53 2011
New Revision: 347167
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=347167
Log:
Don't allow transport=tcp when tcpenable=no.
When tcpenable=no, sending to transport=tcp hosts was still allowed.
Resolving the source address wasn't possible and yielded the string
"(null)" in SIP messages. Fixed that and a couple of not-so-correct
log messages.
(closes issue ASTERISK-18837)
Reported by: Andreas Topp
Review: https://reviewboard.asterisk.org/r/1585
Reviewed by: Matt Jordan
........
Merged revisions 347166 from http://svn.asterisk.org/svn/asterisk/branches/1.8
Modified:
branches/10/ (props changed)
branches/10/channels/chan_sip.c
Propchange: branches/10/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.
Modified: branches/10/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/branches/10/channels/chan_sip.c?view=diff&rev=347167&r1=347166&r2=347167
==============================================================================
--- branches/10/channels/chan_sip.c (original)
+++ branches/10/channels/chan_sip.c Tue Dec 6 13:42:53 2011
@@ -27800,12 +27800,14 @@
if (!strncasecmp(trans, "udp", 3)) {
peer->transports |= SIP_TRANSPORT_UDP;
- } else if (!strncasecmp(trans, "tcp", 3)) {
+ } else if (sip_cfg.tcp_enabled && !strncasecmp(trans, "tcp", 3)) {
peer->transports |= SIP_TRANSPORT_TCP;
- } else if (!strncasecmp(trans, "tls", 3)) {
+ } else if (sip_cfg.tcp_enabled && !strncasecmp(trans, "tls", 3)) {
peer->transports |= SIP_TRANSPORT_TLS;
+ } else if (!sip_cfg.tcp_enabled && (!strncasecmp(trans, "tcp", 3) || !strncasecmp(trans, "tls", 3))) {
+ ast_log(LOG_WARNING, "'%s' is not a valid transport type when tcpenabled=no. if no other is specified, the defaults from general will be used.\n", trans);
} else {
- ast_log(LOG_NOTICE, "'%s' is not a valid transport type. if no other is specified, udp will be used.\n", trans);
+ ast_log(LOG_NOTICE, "'%s' is not a valid transport type. if no other is specified, the defaults from general will be used.\n", trans);
}
if (!peer->default_outbound_transport) { /*!< The first transport listed should be default outbound */
@@ -29194,8 +29196,11 @@
ast_log(LOG_WARNING, "To disallow external domains, you need to configure local SIP domains.\n");
sip_cfg.allow_external_domains = 1;
}
- /* If not configured, set default transports */
- if (default_transports == 0) {
+ /* If not or badly configured, set default transports */
+ if (!sip_cfg.tcp_enabled && ((default_transports & SIP_TRANSPORT_TCP) || (default_transports & SIP_TRANSPORT_TLS))) {
+ ast_log(LOG_WARNING, "Cannot use 'tcp' or 'tls' transport with tcpenable=no. Falling back to 'udp'.\n");
+ default_transports = default_primary_transport = SIP_TRANSPORT_UDP;
+ } else if (default_transports == 0) {
default_transports = default_primary_transport = SIP_TRANSPORT_UDP;
}
More information about the asterisk-commits
mailing list