[asterisk-commits] may: trunk r371043 - /trunk/addons/chan_ooh323.c
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Aug 9 16:35:28 CDT 2012
Author: may
Date: Thu Aug 9 16:35:24 2012
New Revision: 371043
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=371043
Log:
Introdue 'ooh323 show gk' cli command that show status of connection
to H.323 Gatekeeper (GkClient state)
Modified:
trunk/addons/chan_ooh323.c
Modified: trunk/addons/chan_ooh323.c
URL: http://svnview.digium.com/svn/asterisk/trunk/addons/chan_ooh323.c?view=diff&rev=371043&r1=371042&r2=371043
==============================================================================
--- trunk/addons/chan_ooh323.c (original)
+++ trunk/addons/chan_ooh323.c Thu Aug 9 16:35:24 2012
@@ -3371,6 +3371,65 @@
}
#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 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"),
More information about the asterisk-commits
mailing list