From dc0f39a760c692e8e298e9cfafd845a1a21e2920 Mon Sep 17 00:00:00 2001 From: Date: Tue, 3 Aug 2010 19:05:50 +0000 Subject: [PATCH] Reverted r280706 and r280707. Will commit in branch 1.8 and merge to trunk properly. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@280745 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 46 +++++++++++------------------------------ configs/sip.conf.sample | 24 --------------------- 2 files changed, 12 insertions(+), 58 deletions(-) diff --git a/channels/chan_sip.c b/channels/chan_sip.c index bba34fb4e3..7ba2171863 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -9875,22 +9875,12 @@ static int get_domain(const char *str, char *domain, int len) from = NULL; if (from) { - int bracket = 0; - /* Strip any params or options from user */ if ((a = strchr(from, ';'))) *a = '\0'; /* Strip port from domain if present */ - for (a = from; *a != '\0'; ++a) { - if (*a == ':' && bracket == 0) { - *a = '\0'; - break; - } else if (*a == '[') { - ++bracket; - } else if (*a == ']') { - --bracket; - } - } + if ((a = strchr(from, ':'))) + *a = '\0'; if ((a = strchr(from, '@'))) { *a = '\0'; ast_copy_string(domain, a + 1, len); @@ -14486,27 +14476,17 @@ static int get_refer_info(struct sip_pvt *transferer, struct sip_request *outgoi if ((ptr = strchr(refer_to, '@'))) { /* Separate domain */ char *urioption = NULL, *domain; - int bracket = 0; *ptr++ = '\0'; if ((urioption = strchr(ptr, ';'))) { /* Separate urioptions */ *urioption++ = '\0'; } - + domain = ptr; - - /* Remove :port */ - for (; *ptr != '\0'; ++ptr) { - if (*ptr == ':' && bracket == 0) { - *ptr = '\0'; - break; - } else if (*ptr == '[') { - ++bracket; - } else if (*ptr == ']') { - --bracket; - } + if ((ptr = strchr(domain, ':'))) { /* Remove :port */ + *ptr = '\0'; } - + SIP_PEDANTIC_DECODE(domain); SIP_PEDANTIC_DECODE(urioption); @@ -27093,12 +27073,10 @@ static int reload_config(enum channelreloadreason reason) /* First our default IP address */ if (!ast_sockaddr_isnull(&bindaddr)) { - add_sip_domain(ast_sockaddr_stringify_addr(&bindaddr), - SIP_DOMAIN_AUTO, NULL); + add_sip_domain(ast_sockaddr_stringify(&bindaddr), SIP_DOMAIN_AUTO, NULL); } else if (!ast_sockaddr_isnull(&internip)) { /* Our internal IP address, if configured */ - add_sip_domain(ast_sockaddr_stringify_addr(&internip), - SIP_DOMAIN_AUTO, NULL); + add_sip_domain(ast_sockaddr_stringify(&internip), SIP_DOMAIN_AUTO, NULL); } else { ast_log(LOG_NOTICE, "Can't add wildcard IP address to domain list, please add IP address to domain manually.\n"); } @@ -27106,7 +27084,7 @@ static int reload_config(enum channelreloadreason reason) /* If TCP is running on a different IP than UDP, then add it too */ if (!ast_sockaddr_isnull(&sip_tcp_desc.local_address) && !ast_sockaddr_cmp(&bindaddr, &sip_tcp_desc.local_address)) { - add_sip_domain(ast_sockaddr_stringify_addr(&sip_tcp_desc.local_address), + add_sip_domain(ast_sockaddr_stringify(&sip_tcp_desc.local_address), SIP_DOMAIN_AUTO, NULL); } @@ -27115,14 +27093,14 @@ static int reload_config(enum channelreloadreason reason) !ast_sockaddr_cmp(&bindaddr, &sip_tls_desc.local_address) && !ast_sockaddr_cmp(&sip_tcp_desc.local_address, &sip_tls_desc.local_address)) { - add_sip_domain(ast_sockaddr_stringify_addr(&sip_tcp_desc.local_address), + add_sip_domain(ast_sockaddr_stringify(&sip_tcp_desc.local_address), SIP_DOMAIN_AUTO, NULL); } /* Our extern IP address, if configured */ if (!ast_sockaddr_isnull(&externaddr)) { - add_sip_domain(ast_sockaddr_stringify_addr(&externaddr), - SIP_DOMAIN_AUTO, NULL); + add_sip_domain(ast_sockaddr_stringify(&externaddr), SIP_DOMAIN_AUTO, + NULL); } /* Extern host name (NAT traversal support) */ diff --git a/configs/sip.conf.sample b/configs/sip.conf.sample index 01fd29b00f..6014163ee5 100644 --- a/configs/sip.conf.sample +++ b/configs/sip.conf.sample @@ -136,28 +136,6 @@ allowoverlap=no ; Disable overlap dialing support. (Default is y ; In this case Realm will be based on request 'From'/'To' header ; and should match one of domain names. ; Otherwise default 'realm=...' will be used. - -; With the current situation, you can do one of four things: -; a) Listen on a specific IPv4 address. Example: bindaddr=192.0.2.1 -; b) Listen on a specific IPv6 address. Example: bindaddr=2001:db8::1 -; c) Listen on the IPv4 wildcard. Example: bindaddr=0.0.0.0 -; d) Listen on the IPv4 and IPv6 wildcards. Example: bindaddr=:: -; (You can choose independently for UDP, TCP, and TLS, by specifying different values for -; "udpbindaddr", "tcpbindaddr", and "tlsbindaddr".) -; -; You may optionally add a port number. (The default is port 5060 for UDP and TCP, 5061 -; for TLS). -; IPv4 example: bindaddr=0.0.0.0:5062 -; IPv6 example: bindaddr=[::]:5062 -; -; The address family of the bound UDP address is used to determine how Asterisk performs -; DNS lookups. In cases a) and c) above, only A records are considered. In case b), only -; AAAA records are considered. In case d), both A and AAAA records are considered. Note, -; however, that Asterisk ignores all records except the first one. In case d), when both A -; and AAAA records are available, either an A or AAAA record will be first, and which one -; depends on the operating system. On systems using glibc, AAAA records are given -; priority. - udpbindaddr=0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all) ; Optionally add a port number, 192.168.1.1:5062 (default is port 5060) @@ -729,8 +707,6 @@ srvlookup=yes ; Enable DNS SRV lookups on outbound calls ; stunaddr = foo.stun.com:3478 ; externrefresh = 15 ; -; NOTE: STUN is only implemented for IPv4. -; ; Note that at the moment all these mechanism work only for the SIP socket. ; The IP address discovered with externaddr/externhost/STUN is reused for ; media sessions as well, but the port numbers are not remapped so you -- 2.47.2