mirror of
https://github.com/asterisk/asterisk.git
synced 2025-11-06 18:03:34 +00:00
Merged revisions 128524 via svnmerge from
https://origsvn.digium.com/svn/asterisk/trunk ........ r128524 | oej | 2008-07-06 22:11:37 +0200 (Sön, 06 Jul 2008) | 5 lines - Fixing issues with "sip show settings" - Adding IP address for TCP and/or TLS too if auto-domain is enabled and binding to a different IP address - Fixing documentation in sip.conf.sample ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.6.0@128539 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -13011,13 +13011,14 @@ static char *sip_show_settings(struct ast_cli_entry *e, int cmd, struct ast_cli_
|
||||
ast_cli(a->fd, "%d\n", ntohs(sip_tcp_desc.sin.sin_port));
|
||||
ast_cli(a->fd, " TCP Bindaddress: %s\n", ast_inet_ntoa(sip_tcp_desc.sin.sin_addr));
|
||||
} else {
|
||||
ast_cli(a->fd, "Disabled");
|
||||
ast_cli(a->fd, "Disabled\n");
|
||||
}
|
||||
ast_cli(a->fd, " TLS SIP Port: ");
|
||||
if (default_tls_cfg.enabled != FALSE) {
|
||||
ast_cli(a->fd, "%d\n", ntohs(sip_tls_desc.sin.sin_port));
|
||||
ast_cli(a->fd, " TLS Bindaddress: %s\n", ast_inet_ntoa(sip_tls_desc.sin.sin_addr));
|
||||
} else {
|
||||
ast_cli(a->fd, "Disabled");
|
||||
ast_cli(a->fd, "Disabled\n");
|
||||
}
|
||||
ast_cli(a->fd, " Videosupport: %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_VIDEOSUPPORT)));
|
||||
ast_cli(a->fd, " Textsupport: %s\n", cli_yesno(ast_test_flag(&global_flags[1], SIP_PAGE2_TEXTSUPPORT)));
|
||||
@@ -20477,7 +20478,6 @@ static int reload_config(enum channelreloadreason reason)
|
||||
if (!ast_jb_read_conf(&global_jbconf, v->name, v->value))
|
||||
continue;
|
||||
|
||||
/* Create the dialogs list */
|
||||
if (!strcasecmp(v->name, "context")) {
|
||||
ast_copy_string(default_context, v->value, sizeof(default_context));
|
||||
} else if (!strcasecmp(v->name, "subscribecontext")) {
|
||||
@@ -20520,9 +20520,11 @@ static int reload_config(enum channelreloadreason reason)
|
||||
global_t1min = atoi(v->value);
|
||||
} else if (!strcasecmp(v->name, "tcpenable")) {
|
||||
sip_tcp_desc.sin.sin_family = ast_false(v->value) ? 0 : AF_INET;
|
||||
ast_debug(2, "Enabling TCP socket for listening\n");
|
||||
} else if (!strcasecmp(v->name, "tcpbindaddr")) {
|
||||
if (ast_parse_arg(v->value, PARSE_INADDR, &sip_tcp_desc.sin))
|
||||
ast_log(LOG_WARNING, "Invalid %s '%s' at line %d of %s\n", v->name, v->value, v->lineno, config);
|
||||
ast_debug(2, "Setting TCP socket address to %s\n", v->value);
|
||||
} else if (!strcasecmp(v->name, "tlsenable")) {
|
||||
default_tls_cfg.enabled = ast_true(v->value) ? TRUE : FALSE;
|
||||
sip_tls_desc.sin.sin_family = AF_INET;
|
||||
@@ -20935,6 +20937,7 @@ static int reload_config(enum channelreloadreason reason)
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Set UDP address and open socket */
|
||||
bindaddr.sin_family = AF_INET;
|
||||
internip = bindaddr;
|
||||
if (ast_find_ourip(&internip.sin_addr, bindaddr)) {
|
||||
@@ -20986,6 +20989,20 @@ static int reload_config(enum channelreloadreason reason)
|
||||
}
|
||||
ast_mutex_unlock(&netlock);
|
||||
|
||||
/* Start TCP server */
|
||||
ast_tcptls_server_start(&sip_tcp_desc);
|
||||
|
||||
/* Start TLS server if needed */
|
||||
memcpy(sip_tls_desc.tls_cfg, &default_tls_cfg, sizeof(default_tls_cfg));
|
||||
|
||||
if (ast_ssl_setup(sip_tls_desc.tls_cfg))
|
||||
ast_tcptls_server_start(&sip_tls_desc);
|
||||
else if (sip_tls_desc.tls_cfg->enabled) {
|
||||
sip_tls_desc.tls_cfg = NULL;
|
||||
ast_log(LOG_WARNING, "SIP TLS server did not load because of errors.\n");
|
||||
}
|
||||
|
||||
|
||||
/* Add default domains - host name, IP address and IP:port
|
||||
* Only do this if user added any sip domain with "localdomains"
|
||||
* In order to *not* break backwards compatibility
|
||||
@@ -21000,6 +21017,14 @@ static int reload_config(enum channelreloadreason reason)
|
||||
else
|
||||
ast_log(LOG_NOTICE, "Can't add wildcard IP address to domain list, please add IP address to domain manually.\n");
|
||||
|
||||
/* If TCP is running on a different IP than UDP, then add it too */
|
||||
if (sip_tcp_desc.sin.sin_addr.s_addr && !inaddrcmp(&bindaddr, &sip_tcp_desc.sin))
|
||||
add_sip_domain(ast_inet_ntoa(sip_tcp_desc.sin.sin_addr), SIP_DOMAIN_AUTO, NULL);
|
||||
|
||||
/* If TLS is running on a differen IP than UDP and TCP, then add that too */
|
||||
if (sip_tls_desc.sin.sin_addr.s_addr && !inaddrcmp(&bindaddr, &sip_tls_desc.sin) && inaddrcmp(&sip_tcp_desc.sin, &sip_tls_desc.sin))
|
||||
add_sip_domain(ast_inet_ntoa(sip_tls_desc.sin.sin_addr), SIP_DOMAIN_AUTO, NULL);
|
||||
|
||||
/* Our extern IP address, if configured */
|
||||
if (externip.sin_addr.s_addr)
|
||||
add_sip_domain(ast_inet_ntoa(externip.sin_addr), SIP_DOMAIN_AUTO, NULL);
|
||||
@@ -21021,16 +21046,6 @@ static int reload_config(enum channelreloadreason reason)
|
||||
ast_config_destroy(notify_types);
|
||||
notify_types = ast_config_load(notify_config, config_flags);
|
||||
|
||||
memcpy(sip_tls_desc.tls_cfg, &default_tls_cfg, sizeof(default_tls_cfg));
|
||||
ast_tcptls_server_start(&sip_tcp_desc);
|
||||
|
||||
if (ast_ssl_setup(sip_tls_desc.tls_cfg))
|
||||
ast_tcptls_server_start(&sip_tls_desc);
|
||||
else if (sip_tls_desc.tls_cfg->enabled) {
|
||||
sip_tls_desc.tls_cfg = NULL;
|
||||
ast_log(LOG_WARNING, "SIP TLS server did not load because of errors.\n");
|
||||
}
|
||||
|
||||
/* Done, tell the manager */
|
||||
manager_event(EVENT_FLAG_SYSTEM, "ChannelReload", "ChannelType: SIP\r\nReloadReason: %s\r\nRegistry_Count: %d\r\nPeer_Count: %d\r\nUser_Count: %d\r\n", channelreloadreason2txt(reason), registry_count, peer_count, user_count);
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ bindport=5060 ; UDP Port to bind to (SIP standard port for unencrypted UDP
|
||||
; and TCP sessions is 5060)
|
||||
; bindport is the local UDP port that Asterisk will listen on
|
||||
bindaddr=0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
|
||||
; You can specify port here too, like 123.123.123.123:5080
|
||||
|
||||
;
|
||||
; Note that the TCP and TLS support for chan_sip is currently considered
|
||||
@@ -86,7 +87,7 @@ bindaddr=0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to al
|
||||
; subject to change in any release. If they are changed, the changes will
|
||||
; be reflected in this sample configuration file, as well as in the UPGRADE.txt file.
|
||||
;
|
||||
tcpenable=no ; Enable server for incoming TCP connections (default is yes)
|
||||
tcpenable=no ; Enable server for incoming TCP connections (default is no)
|
||||
tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
|
||||
; Optionally add a port number, 192.168.1.1:5062 (default is port 5060)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user