mirror of
https://github.com/asterisk/asterisk.git
synced 2026-01-06 18:13:45 +00:00
Introdue 'ooh323 show gk' cli command that show status of connection
to H.323 Gatekeeper (GkClient state) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@371043 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -3371,6 +3371,65 @@ static int ooh323_show_channels(int fd, int argc, char *argv[])
|
||||
}
|
||||
#endif
|
||||
|
||||
static char *handle_cli_ooh323_show_gk(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
char value[FORMAT_STRING_SIZE];
|
||||
extern OOH323EndPoint gH323ep;
|
||||
|
||||
switch (cmd) {
|
||||
case CLI_INIT:
|
||||
e->command = "ooh323 show gk";
|
||||
e->usage =
|
||||
"Usage: ooh323 show gk\n"
|
||||
" Shows Gatekeeper connection state\n";
|
||||
return NULL;
|
||||
case CLI_GENERATE:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (a->argc != 3)
|
||||
return CLI_SHOWUSAGE;
|
||||
|
||||
ast_cli(a->fd, "\nGateKeeper connection state:\n");
|
||||
if (!gH323ep.gkClient) {
|
||||
ast_cli(a->fd, "No Gatekeeper is configured\n");
|
||||
return CLI_SUCCESS;
|
||||
}
|
||||
|
||||
if (gRasGkMode == RasNoGatekeeper) {
|
||||
snprintf(value, sizeof(value), "%s", "No Gatekeeper");
|
||||
} else if (gRasGkMode == RasDiscoverGatekeeper) {
|
||||
snprintf(value, sizeof(value), "%s", "Discover");
|
||||
} else {
|
||||
snprintf(value, sizeof(value), "%s", gGatekeeper);
|
||||
}
|
||||
ast_cli(a->fd, "%-20s%s\n", "Gatekeeper:", value);
|
||||
switch(gH323ep.gkClient->state) {
|
||||
case GkClientIdle:
|
||||
ast_cli(a->fd, "%-20s%s\n", "GK state:", "Idle");
|
||||
break;
|
||||
case GkClientDiscovered:
|
||||
ast_cli(a->fd, "%-20s%s\n", "GK state:", "Discovered");
|
||||
break;
|
||||
case GkClientRegistered:
|
||||
ast_cli(a->fd, "%-20s%s\n", "GK state:", "Registered");
|
||||
break;
|
||||
case GkClientUnregistered:
|
||||
ast_cli(a->fd, "%-20s%s\n", "GK state:", "Unregistered");
|
||||
break;
|
||||
case GkClientGkErr:
|
||||
ast_cli(a->fd, "%-20s%s\n", "GK state:", "Error");
|
||||
break;
|
||||
case GkClientFailed:
|
||||
ast_cli(a->fd, "%-20s%s\n", "GK state:", "Failed");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return CLI_SUCCESS;
|
||||
}
|
||||
|
||||
static char *handle_cli_ooh323_show_config(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
|
||||
{
|
||||
char value[FORMAT_STRING_SIZE];
|
||||
@@ -3488,6 +3547,7 @@ static char *handle_cli_ooh323_show_config(struct ast_cli_entry *e, int cmd, str
|
||||
static struct ast_cli_entry cli_ooh323[] = {
|
||||
AST_CLI_DEFINE(handle_cli_ooh323_set_debug, "Enable/Disable OOH323 debugging"),
|
||||
AST_CLI_DEFINE(handle_cli_ooh323_show_config, "Show details on global configuration of H.323 channel driver"),
|
||||
AST_CLI_DEFINE(handle_cli_ooh323_show_gk, "Show OOH323 Gatekeeper connection status"),
|
||||
AST_CLI_DEFINE(handle_cli_ooh323_show_peer, "Show details on specific OOH323 peer"),
|
||||
AST_CLI_DEFINE(handle_cli_ooh323_show_peers, "Show defined OOH323 peers"),
|
||||
AST_CLI_DEFINE(handle_cli_ooh323_show_user, "Show details on specific OOH323 user"),
|
||||
|
||||
Reference in New Issue
Block a user