diff options
author | Mark Michelson <mmichelson@digium.com> | 2012-08-03 21:52:57 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2012-08-03 21:52:57 +0000 |
commit | 9f0127f087109db116943ca7ba911f5e89036cfb (patch) | |
tree | 8c6e246772e0f989ee0750e71a575feb54ac2fca /channels/sip/config_parser.c | |
parent | e108a5777aa65da240a90d4dc153616a46e2b923 (diff) |
Multiple revisions 370769-370771
........
r370769 | mmichelson | 2012-08-03 16:35:00 -0500 (Fri, 03 Aug 2012) | 24 lines
Fix error in the "IPorHost" section of a SIP dialstring.
This is based on the review request posted by Walter Doekes
(referenced lower in the commit message)
The main fix here is to treat the IPorHost portion of the dial
string as a temporary outbound proxy. This ensures requests
get sent to the proper location.
Due to the age of the request, some parts were no longer relevant.
For instance, the request moved outbound proxy parsing code into
a single method. This is done in a previous commit, so it was not
necessary to do again.
Also, the review request fixed some errors with regards to request
routing for CANCEL and ACK requests. This has also been fixed in
more recent commits.
(closes issue ASTERISK-19677)
reported by Walter Doekes
Review https://reviewboard.asterisk.org/r/1859
........
r370770 | mmichelson | 2012-08-03 16:39:35 -0500 (Fri, 03 Aug 2012) | 3 lines
Remove unused variable.
........
r370771 | mmichelson | 2012-08-03 16:43:52 -0500 (Fri, 03 Aug 2012) | 5 lines
Seriously? Another compilation error fixed.
Somebody beat me.
........
Merged revisions 370769-370771 from http://svn.asterisk.org/svn/asterisk/branches/1.8
........
Merged revisions 370772 from http://svn.asterisk.org/svn/asterisk/branches/10
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@370773 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/sip/config_parser.c')
-rw-r--r-- | channels/sip/config_parser.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/channels/sip/config_parser.c b/channels/sip/config_parser.c index 6f23aafa9..fe34283af 100644 --- a/channels/sip/config_parser.c +++ b/channels/sip/config_parser.c @@ -652,14 +652,17 @@ int sip_parse_host(char *line, int lineno, char **hostname, int *portnum, enum s if ((*hostname = strstr(line, "://"))) { *hostname += 3; - if (!strncasecmp(line, "tcp", 3)) + if (!strncasecmp(line, "tcp", 3)) { *transport = SIP_TRANSPORT_TCP; - else if (!strncasecmp(line, "tls", 3)) + } else if (!strncasecmp(line, "tls", 3)) { *transport = SIP_TRANSPORT_TLS; - else if (!strncasecmp(line, "udp", 3)) + } else if (!strncasecmp(line, "udp", 3)) { *transport = SIP_TRANSPORT_UDP; - else + } else if (lineno) { ast_log(LOG_NOTICE, "'%.3s' is not a valid transport type on line %d of sip.conf. defaulting to udp.\n", line, lineno); + } else { + ast_log(LOG_NOTICE, "'%.3s' is not a valid transport type in sip config. defaulting to udp.\n", line); + } } else { *hostname = line; *transport = SIP_TRANSPORT_UDP; @@ -671,14 +674,22 @@ int sip_parse_host(char *line, int lineno, char **hostname, int *portnum, enum s line = *hostname; if (ast_sockaddr_split_hostport(line, hostname, &port, 0) == 0) { - ast_log(LOG_WARNING, "Cannot parse host '%s' on line %d of sip.conf.\n", - line, lineno); + if (lineno) { + ast_log(LOG_WARNING, "Cannot parse host '%s' on line %d of sip.conf.\n", + line, lineno); + } else { + ast_log(LOG_WARNING, "Cannot parse host '%s' in sip config.\n", line); + } return -1; } if (port) { if (!sscanf(port, "%5u", portnum)) { - ast_log(LOG_NOTICE, "'%s' is not a valid port number on line %d of sip.conf. using default.\n", port, lineno); + if (lineno) { + ast_log(LOG_NOTICE, "'%s' is not a valid port number on line %d of sip.conf. using default.\n", port, lineno); + } else { + ast_log(LOG_NOTICE, "'%s' is not a valid port number in sip config. using default.\n", port); + } port = NULL; } } |