[asterisk-commits] jpdionne: branch group/v6-new r273272 - /team/group/v6-new/channels/chan_sip.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Jun 30 14:06:54 CDT 2010
Author: jpdionne
Date: Wed Jun 30 14:06:50 2010
New Revision: 273272
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=273272
Log:
Support 'bindport' in sip.conf for retrocompatibily.
Modified:
team/group/v6-new/channels/chan_sip.c
Modified: team/group/v6-new/channels/chan_sip.c
URL: http://svnview.digium.com/svn/asterisk/team/group/v6-new/channels/chan_sip.c?view=diff&rev=273272&r1=273271&r2=273272
==============================================================================
--- team/group/v6-new/channels/chan_sip.c (original)
+++ team/group/v6-new/channels/chan_sip.c Wed Jun 30 14:06:50 2010
@@ -25794,6 +25794,7 @@
int registry_count = 0, peer_count = 0, timerb_set = 0, timert1_set = 0;
time_t run_start, run_end;
struct sockaddr_in externip_sin;
+ int bindport = 0;
run_start = time(0);
ast_unload_realtime("sipregs");
@@ -25894,7 +25895,7 @@
ast_clear_flag(&global_flags[1], AST_FLAGS_ALL);
/* Reset IP addresses */
- ast_sockaddr_parse(&bindaddr, "0.0.0.0:5060", 0);
+ ast_sockaddr_parse(&bindaddr, "0.0.0.0:0", 0);
memset(&stunaddr, 0, sizeof(stunaddr));
memset(&internip, 0, sizeof(internip));
@@ -26280,9 +26281,6 @@
if (ast_parse_arg(v->value, PARSE_ADDR, &bindaddr)) {
ast_log(LOG_WARNING, "Invalid address: %s\n", v->value);
}
- if (!ast_sockaddr_port(&bindaddr)) {
- ast_sockaddr_set_port(&bindaddr, STANDARD_SIP_PORT);
- }
} else if (!strcasecmp(v->name, "localnet")) {
struct ast_ha *na;
int ha_error = 0;
@@ -26381,6 +26379,10 @@
} else if (!strcasecmp(v->name, "cos_text")) {
if (ast_str2cos(v->value, &global_cos_text))
ast_log(LOG_WARNING, "Invalid cos_text value at line %d, refer to QoS documentation\n", v->lineno);
+ } else if (!strcasecmp(v->name, "bindport")) {
+ int i;
+ if (sscanf(v->value, "%5d", &bindport) != 1)
+ ast_log(LOG_WARNING, "Invalid port number '%s' at line %d of %s\n", v->value, v->lineno, config);
} else if (!strcasecmp(v->name, "qualify")) {
if (!strcasecmp(v->value, "no")) {
default_qualify = 0;
@@ -26597,7 +26599,17 @@
}
}
}
-
+
+ if (bindport) {
+ if (ast_sockaddr_port(&bindaddr))
+ ast_log(LOG_WARNING, "bindport is also specified in bindaddr. Using %d.\n", bindport);
+ ast_sockaddr_set_port(&bindaddr, bindport);
+ }
+
+ if (!ast_sockaddr_port(&bindaddr)) {
+ ast_sockaddr_set_port(&bindaddr, STANDARD_SIP_PORT);
+ }
+
/* Set UDP address and open socket */
ast_sockaddr_copy(&internip, &bindaddr);
if (ast_find_ourip(&internip, &bindaddr)) {
More information about the asterisk-commits
mailing list