[asterisk-commits] dvossel: branch dvossel/hd_confbridge r311474 - /team/dvossel/hd_confbridge/a...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 21 11:26:41 CDT 2011


Author: dvossel
Date: Mon Mar 21 11:26:37 2011
New Revision: 311474

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=311474
Log:
CLI commands to show all configured menus, users profiles, and bridge profiles.

Modified:
    team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c

Modified: team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c
URL: http://svnview.digium.com/svn/asterisk/team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c?view=diff&rev=311474&r1=311473&r2=311474
==============================================================================
--- team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c (original)
+++ team/dvossel/hd_confbridge/apps/confbridge/conf_config_parser.c Mon Mar 21 11:26:37 2011
@@ -550,7 +550,35 @@
 
 	return res;
 }
-static char *handle_cli_confbridge_list_user_profiles(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+
+static char *handle_cli_confbridge_show_user_profiles(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct ao2_iterator it;
+	struct user_profile *u_profile;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "confbridge show profile users";
+		e->usage =
+			"Usage confbridge show profile users\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	ast_cli(a->fd,"--------- User Profiles -----------\n");
+	ao2_lock(user_profiles);
+	it = ao2_iterator_init(user_profiles, 0);
+	while ((u_profile = ao2_iterator_next(&it))) {
+		ast_cli(a->fd,"%s\n", u_profile->name);
+		ao2_ref(u_profile, -1);
+	}
+	ao2_iterator_destroy(&it);
+	ao2_unlock(user_profiles);
+
+	return CLI_SUCCESS;
+}
+static char *handle_cli_confbridge_show_user_profile(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct user_profile u_profile;
 
@@ -651,7 +679,36 @@
 
 	return res;
 }
-static char *handle_cli_confbridge_list_bridge_profiles(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+
+static char *handle_cli_confbridge_show_bridge_profiles(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct ao2_iterator it;
+	struct bridge_profile *b_profile;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "confbridge show profile bridges";
+		e->usage =
+			"Usage confbridge show profile bridges\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	ast_cli(a->fd,"--------- Bridge Profiles -----------\n");
+	ao2_lock(bridge_profiles);
+	it = ao2_iterator_init(bridge_profiles, 0);
+	while ((b_profile = ao2_iterator_next(&it))) {
+		ast_cli(a->fd,"%s\n", b_profile->name);
+		ao2_ref(b_profile, -1);
+	}
+	ao2_iterator_destroy(&it);
+	ao2_unlock(bridge_profiles);
+
+	return CLI_SUCCESS;
+}
+
+static char *handle_cli_confbridge_show_bridge_profile(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct bridge_profile b_profile;
 	char tmp[64];
@@ -739,7 +796,35 @@
 	return res;
 }
 
-static char *handle_cli_confbridge_list_menus(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+static char *handle_cli_confbridge_show_menus(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+{
+	struct ao2_iterator it;
+	struct conf_menu *menu;
+
+	switch (cmd) {
+	case CLI_INIT:
+		e->command = "confbridge show menus";
+		e->usage =
+			"Usage confbridge show profile menus\n";
+		return NULL;
+	case CLI_GENERATE:
+		return NULL;
+	}
+
+	ast_cli(a->fd,"--------- Menus -----------\n");
+	ao2_lock(menus);
+	it = ao2_iterator_init(menus, 0);
+	while ((menu = ao2_iterator_next(&it))) {
+		ast_cli(a->fd,"%s\n", menu->name);
+		ao2_ref(menu, -1);
+	}
+	ao2_iterator_destroy(&it);
+	ao2_unlock(menus);
+
+	return CLI_SUCCESS;
+}
+
+static char *handle_cli_confbridge_show_menu(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	struct conf_menu tmp;
 	struct conf_menu *menu;
@@ -828,9 +913,13 @@
 }
 
 static struct ast_cli_entry cli_confbridge_parser[] = {
-	AST_CLI_DEFINE(handle_cli_confbridge_list_user_profiles, "List conference user profiles."),
-	AST_CLI_DEFINE(handle_cli_confbridge_list_bridge_profiles, "List conference bridge profiles."),
-	AST_CLI_DEFINE(handle_cli_confbridge_list_menus, "List conference menus"),
+	AST_CLI_DEFINE(handle_cli_confbridge_show_user_profile, "Show a conference user profile."),
+	AST_CLI_DEFINE(handle_cli_confbridge_show_bridge_profile, "Show a conference bridge profile."),
+	AST_CLI_DEFINE(handle_cli_confbridge_show_menu, "Show a conference menu"),
+	AST_CLI_DEFINE(handle_cli_confbridge_show_user_profiles, "Show a list of conference user profiles."),
+	AST_CLI_DEFINE(handle_cli_confbridge_show_bridge_profiles, "Show a list of conference bridge profiles."),
+	AST_CLI_DEFINE(handle_cli_confbridge_show_menus, "Show a list of conference menus"),
+
 };
 
 static int conf_parse_init(void)




More information about the asterisk-commits mailing list