Archived
14
0
Fork 0

two small fixes when using stun (reported by Marta Carbone):

+ externexpire was not initialized properly;
+ stunaddr was not handled properly on a sip reload



git-svn-id: http://svn.digium.com/svn/asterisk/trunk@76770 f38db490-d61c-443f-a65b-d21fe96a405b
This commit is contained in:
rizzo 2007-07-24 14:49:49 +00:00
parent f435e63b8d
commit 8fbdf6a98c

View file

@ -17623,6 +17623,7 @@ static int reload_config(enum channelreloadreason reason)
stunaddr.sin_port = htons(3478);
if (ast_parse_arg(v->value, PARSE_INADDR, &stunaddr))
ast_log(LOG_WARNING, "Invalid STUN server address: %s\n", v->value);
externexpire = time(NULL);
} else if (!strcasecmp(v->name, "bindaddr")) {
if (ast_parse_arg(v->value, PARSE_INADDR, &bindaddr))
ast_log(LOG_WARNING, "Invalid address: %s\n", v->value);
@ -17868,18 +17869,18 @@ static int reload_config(enum channelreloadreason reason)
if (option_verbose > 1)
ast_verbose(VERBOSE_PREFIX_2 "SIP Listening on %s:%d\n",
ast_inet_ntoa(bindaddr.sin_addr), ntohs(bindaddr.sin_port));
if (stunaddr.sin_addr.s_addr != 0) {
ast_debug(1, "stun to %s:%d\n",
ast_inet_ntoa(stunaddr.sin_addr) , ntohs(stunaddr.sin_port));
ast_stun_request(sipsock, &stunaddr,
NULL, &externip);
ast_debug(1, "STUN sees us at %s:%d\n",
ast_inet_ntoa(externip.sin_addr) , ntohs(externip.sin_port));
}
ast_netsock_set_qos(sipsock, global_tos_sip, global_cos_sip);
}
}
}
if (stunaddr.sin_addr.s_addr != 0) {
ast_debug(1, "stun to %s:%d\n",
ast_inet_ntoa(stunaddr.sin_addr) , ntohs(stunaddr.sin_port));
ast_stun_request(sipsock, &stunaddr,
NULL, &externip);
ast_debug(1, "STUN sees us at %s:%d\n",
ast_inet_ntoa(externip.sin_addr) , ntohs(externip.sin_port));
}
ast_mutex_unlock(&netlock);
/* Add default domains - host name, IP address and IP:port */