diff options
author | Matthew Nicholson <mnicholson@digium.com> | 2010-06-22 14:54:58 +0000 |
---|---|---|
committer | Matthew Nicholson <mnicholson@digium.com> | 2010-06-22 14:54:58 +0000 |
commit | 01507f4ab7ad66a677fc1f0e4f08e4a0c4f1409b (patch) | |
tree | 286e166fac6b94ec6420617e451b9cf524201f5e | |
parent | 9bbeb945e86e60ee64e7252c8d565a1840f9ff79 (diff) |
Merged revisions 271761 via svnmerge from
https://origsvn.digium.com/svn/asterisk/branches/1.4
........
r271761 | mnicholson | 2010-06-22 09:49:36 -0500 (Tue, 22 Jun 2010) | 9 lines
Allow users to specify a port for dundi peers.
(closes issue #17056)
Reported by: klaus3000
Patches:
dundi-peerport-patch-trunk.txt uploaded by klaus3000 (license 65)
Tested by: klaus3000
........
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@271762 65c4cc65-6c06-0410-ace0-fbb531ad65f3
-rw-r--r-- | configs/dundi.conf.sample | 2 | ||||
-rw-r--r-- | pbx/pbx_dundi.c | 13 |
2 files changed, 10 insertions, 5 deletions
diff --git a/configs/dundi.conf.sample b/configs/dundi.conf.sample index 1b6a174c0..a3713412e 100644 --- a/configs/dundi.conf.sample +++ b/configs/dundi.conf.sample @@ -163,6 +163,8 @@ autokill=yes ; ; host - What their host is ; +; port - The port where their host is listening (default: 4520) +; ; order - What search order to use. May be 'primary', 'secondary', ; 'tertiary' or 'quartiary'. In large systems, it is beneficial ; to only query one up-stream host in order to maximize caching diff --git a/pbx/pbx_dundi.c b/pbx/pbx_dundi.c index 3aa17000c..420af27f8 100644 --- a/pbx/pbx_dundi.c +++ b/pbx/pbx_dundi.c @@ -2605,6 +2605,7 @@ static char *dundi_show_peer(struct ast_cli_entry *e, int cmd, struct ast_cli_ar ast_cli(a->fd, "Peer: %s\n", ast_eid_to_str(eid_str, sizeof(eid_str), &peer->eid)); ast_cli(a->fd, "Model: %s\n", model2str(peer->model)); ast_cli(a->fd, "Host: %s\n", peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "<Unspecified>"); + ast_cli(a->fd, "Port: %d\n", ntohs(peer->addr.sin_port)); ast_cli(a->fd, "Dynamic: %s\n", peer->dynamic ? "yes" : "no"); ast_cli(a->fd, "Reg: %s\n", peer->registerid < 0 ? "No" : "Yes"); ast_cli(a->fd, "In Key: %s\n", ast_strlen_zero(peer->inkey) ? "<None>" : peer->inkey); @@ -2636,8 +2637,8 @@ static char *dundi_show_peer(struct ast_cli_entry *e, int cmd, struct ast_cli_ar static char *dundi_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a) { -#define FORMAT2 "%-20.20s %-15.15s %-10.10s %-8.8s %-15.15s\n" -#define FORMAT "%-20.20s %-15.15s %s %-10.10s %-8.8s %-15.15s\n" +#define FORMAT2 "%-20.20s %-15.15s %-6.6s %-10.10s %-8.8s %-15.15s\n" +#define FORMAT "%-20.20s %-15.15s %s %-6d %-10.10s %-8.8s %-15.15s\n" struct dundi_peer *peer; int registeredonly=0; char avgms[20]; @@ -2667,7 +2668,7 @@ static char *dundi_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_a return CLI_SHOWUSAGE; } AST_LIST_LOCK(&peers); - ast_cli(a->fd, FORMAT2, "EID", "Host", "Model", "AvgTime", "Status"); + ast_cli(a->fd, FORMAT2, "EID", "Host", "Port", "Model", "AvgTime", "Status"); AST_LIST_TRAVERSE(&peers, peer, list) { char status[20]; int print_line = -1; @@ -2702,7 +2703,7 @@ static char *dundi_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_a strcpy(avgms, "Unavail"); snprintf(srch, sizeof(srch), FORMAT, ast_eid_to_str(eid_str, sizeof(eid_str), &peer->eid), peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "(Unspecified)", - peer->dynamic ? "(D)" : "(S)", model2str(peer->model), avgms, status); + peer->dynamic ? "(D)" : "(S)", ntohs(peer->addr.sin_port), model2str(peer->model), avgms, status); if (a->argc == 5) { if (!strcasecmp(a->argv[3],"include") && strstr(srch,a->argv[4])) { @@ -2719,7 +2720,7 @@ static char *dundi_show_peers(struct ast_cli_entry *e, int cmd, struct ast_cli_a if (print_line) { ast_cli(a->fd, FORMAT, ast_eid_to_str(eid_str, sizeof(eid_str), &peer->eid), peer->addr.sin_addr.s_addr ? ast_inet_ntoa(peer->addr.sin_addr) : "(Unspecified)", - peer->dynamic ? "(D)" : "(S)", model2str(peer->model), avgms, status); + peer->dynamic ? "(D)" : "(S)", ntohs(peer->addr.sin_port), model2str(peer->model), avgms, status); } } ast_cli(a->fd, "%d dundi peers [%d online, %d offline, %d unmonitored]\n", total_peers, online_peers, offline_peers, unmonitored_peers); @@ -4409,6 +4410,8 @@ static void build_peer(dundi_eid *eid, struct ast_variable *v, int *globalpcmode ast_copy_string(peer->inkey, v->value, sizeof(peer->inkey)); } else if (!strcasecmp(v->name, "outkey")) { ast_copy_string(peer->outkey, v->value, sizeof(peer->outkey)); + } else if (!strcasecmp(v->name, "port")) { + peer->addr.sin_port = htons(atoi(v->value)); } else if (!strcasecmp(v->name, "host")) { if (!strcasecmp(v->value, "dynamic")) { peer->dynamic = 1; |