summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorLuigi Rizzo <rizzo@icir.org>2007-07-20 14:54:01 +0000
committerLuigi Rizzo <rizzo@icir.org>2007-07-20 14:54:01 +0000
commitb2fec9ad1675496c0ac59674fa4acf00beecec4b (patch)
tree58a94bf3c471cd540524135ade78c7e77e2f4f6e /channels
parent925ebbb2b31865c80c4d92985b7d6e80dd6dbc4a (diff)
Extend the 'network settings' section with indication on the
localnet settings (requires the change in SVN 76034), and also give an indication on whether/why/how the remapping of addresses in SIP message is done or not. I think this is especially useful for debugging the configuration, as the address remapping depends on a combination of at least 3 parameters (localnet, externhost, externip) and successful DNS lookup. An example of the output of this section is below: Network Settings: --------------------------- SIP address remapping: Enabled using externhost Externhost: foo.dyndns.net Externip: 80.64.128.23:0 Externrefresh: 10 Internal IP: 12.34.56.78:5060 Localnet: 192.168.0.0/255.255.0.0 10.0.0.0/255.0.0.0 I leave to the community the judgement if the above info is a useful addition for 1.4. It is not a bugfix, but it is neither a new feature, only a useful diagnostic tool. Note that I would like to move there also the bindaddress/port information, in the usual addr:port format e.g. Bindaddress: 0.0.0.0:5060 so that network information is all in one place. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76035 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_sip.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index b0b7bda15..04e03c7f1 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11139,6 +11139,7 @@ static int sip_show_settings(int fd, int argc, char *argv[])
int realtimeusers;
int realtimeregs;
char codec_buf[BUFSIZ];
+ const char *msg; /* temporary msg pointer */
realtimepeers = ast_check_realtime("sippeers");
realtimeusers = ast_check_realtime("sipusers");
@@ -11201,11 +11202,32 @@ static int sip_show_settings(int fd, int argc, char *argv[])
ast_cli(fd, "\nNetwork Settings:\n");
ast_cli(fd, "---------------------------\n");
- ast_cli(fd, " Externhost: %s\n", externhost);
+ /* determine if/how SIP address can be remapped */
+ if (localaddr == NULL)
+ msg = "Disabled, no localnet list";
+ else if (externip.sin_addr.s_addr == 0)
+ msg = "Disabled, externip is 0.0.0.0";
+ else if (externhost)
+ msg = "Enabled using externhost";
+ else
+ msg = "Enabled using externip";
+ ast_cli(fd, " SIP address remapping: %s\n", msg);
+ ast_cli(fd, " Externhost: %s\n", S_OR(externhost, "<none>"));
ast_cli(fd, " Externip: %s:%d\n", ast_inet_ntoa(externip.sin_addr), ntohs(externip.sin_port));
ast_cli(fd, " Externrefresh: %d\n", externrefresh);
ast_cli(fd, " Internal IP: %s:%d\n", ast_inet_ntoa(__ourip), ntohs(bindaddr.sin_port));
+ {
+ struct ast_ha *a;
+ const char *prefix = "Localnet:";
+ char buf[INET_ADDRSTRLEN]; /* need to print two addresses */
+ for (a = localaddr; a ; prefix = "", a = a->next) {
+ ast_cli(fd, " %-24s%s/%s\n",
+ prefix, ast_inet_ntoa(a->netaddr),
+ inet_ntop(AF_INET, &a->netmask, buf, sizeof(buf)) );
+ }
+ }
+
ast_cli(fd, "\nGlobal Signalling Settings:\n");
ast_cli(fd, "---------------------------\n");
ast_cli(fd, " Codecs: ");