summaryrefslogtreecommitdiff
path: root/channels/chan_sip.c
diff options
context:
space:
mode:
authorJonathan Rose <jrose@digium.com>2012-02-28 18:23:02 +0000
committerJonathan Rose <jrose@digium.com>2012-02-28 18:23:02 +0000
commit565f411868288d911b63944e4c8410b8e2951b7b (patch)
tree5e3e8a10e2af3f4abfbcf77a84af786a1cf4f88c /channels/chan_sip.c
parent2e834f7d36be6b7fd2531f4e4ac3dcbb050a2bdc (diff)
Changes transport option in sip.conf so that using multiple instances doesn't stack.
Prior to this patch, Using "transport=" multiple times would cause them to add to one another like allow/deny. This patch changes that behavior to simply use the transport option specified last. Also, if no transport option is applied now, the default will automatically be UDP. (closes ASTERISK-19352) Reported by: jamicque Patches: asterisk-19352-transport-warning-message-v1.patch uploaded by Michael L. Young (license 5026) issueA19352_no_transport_is_udp.patch uploaded by Walter Doekes (license 5674) Review: https://reviewboard.asterisk.org/r/1745/diff/#index_header ........ Merged revisions 357266 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 357271 from http://svn.asterisk.org/svn/asterisk/branches/10 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@357288 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_sip.c')
-rw-r--r--channels/chan_sip.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 657844ddd..e2dcafc27 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -28380,10 +28380,11 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
if (handle_t38_options(&peerflags[0], &mask[0], v, &peer->t38_maxdatagram)) {
continue;
}
- if (!strcasecmp(v->name, "transport") && !ast_strlen_zero(v->value)) {
+ if (!strcasecmp(v->name, "transport")) {
char *val = ast_strdupa(v->value);
char *trans;
+ peer->transports = peer->default_outbound_transport = 0;
while ((trans = strsep(&val, ","))) {
trans = ast_skip_blanks(trans);
@@ -28394,7 +28395,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
} else if (default_tls_cfg.enabled && !strncasecmp(trans, "tls", 3)) {
peer->transports |= SIP_TRANSPORT_TLS;
} else if (!strncasecmp(trans, "tcp", 3) || !strncasecmp(trans, "tls", 3)) {
- ast_log(LOG_WARNING, "'%.3s' is not a valid transport type when %.3senabled=no. If no other is specified, the defaults from general will be used.\n", trans, trans);
+ ast_log(LOG_WARNING, "'%.3s' is not a valid transport type when %.3senable=no. If no other is specified, the defaults from general will be used.\n", trans, trans);
} else {
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);
}
@@ -29146,8 +29147,8 @@ static int reload_config(enum channelreloadreason reason)
memset(&default_prefs, 0 , sizeof(default_prefs));
memset(&sip_cfg.outboundproxy, 0, sizeof(struct sip_proxy));
sip_cfg.outboundproxy.force = FALSE; /*!< Don't force proxy usage, use route: headers */
- default_transports = 0; /*!< Reset default transport to zero here, default value later on */
- default_primary_transport = 0; /*!< Reset default primary transport to zero here, default value later on */
+ default_transports = SIP_TRANSPORT_UDP;
+ default_primary_transport = SIP_TRANSPORT_UDP;
ourport_tcp = STANDARD_SIP_PORT;
ourport_tls = STANDARD_TLS_PORT;
externtcpport = STANDARD_SIP_PORT;
@@ -29345,10 +29346,11 @@ static int reload_config(enum channelreloadreason reason)
timerb_set = 1;
} else if (!strcasecmp(v->name, "t1min")) {
global_t1min = atoi(v->value);
- } else if (!strcasecmp(v->name, "transport") && !ast_strlen_zero(v->value)) {
+ } else if (!strcasecmp(v->name, "transport")) {
char *val = ast_strdupa(v->value);
char *trans;
+ default_transports = default_primary_transport = 0;
while ((trans = strsep(&val, ","))) {
trans = ast_skip_blanks(trans);