summaryrefslogtreecommitdiff
path: root/addons/chan_ooh323.c
diff options
context:
space:
mode:
Diffstat (limited to 'addons/chan_ooh323.c')
-rw-r--r--addons/chan_ooh323.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/addons/chan_ooh323.c b/addons/chan_ooh323.c
index 40cd86561..dc7fd2dcb 100644
--- a/addons/chan_ooh323.c
+++ b/addons/chan_ooh323.c
@@ -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"),