[asterisk-commits] kmoore: branch kmoore/cel_backend_refactor r396838 - in /team/kmoore/cel_back...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 16 08:42:45 CDT 2013


Author: kmoore
Date: Fri Aug 16 08:42:44 2013
New Revision: 396838

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396838
Log:
Bring up to current

Modified:
    team/kmoore/cel_backend_refactor/   (props changed)
    team/kmoore/cel_backend_refactor/main/loader.c
    team/kmoore/cel_backend_refactor/main/sounds_index.c
    team/kmoore/cel_backend_refactor/main/utils.c

Propchange: team/kmoore/cel_backend_refactor/
------------------------------------------------------------------------------
--- cel_integrated (original)
+++ cel_integrated Fri Aug 16 08:42:44 2013
@@ -1,1 +1,1 @@
-/team/kmoore/event_system_strip:1-396829
+/team/kmoore/event_system_strip:1-396837

Modified: team/kmoore/cel_backend_refactor/main/loader.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/main/loader.c?view=diff&rev=396838&r1=396837&r2=396838
==============================================================================
--- team/kmoore/cel_backend_refactor/main/loader.c (original)
+++ team/kmoore/cel_backend_refactor/main/loader.c Fri Aug 16 08:42:44 2013
@@ -56,6 +56,7 @@
 #include "asterisk/heap.h"
 #include "asterisk/app.h"
 #include "asterisk/test.h"
+#include "asterisk/sounds_index.h"
 
 #include <dlfcn.h>
 
@@ -319,6 +320,7 @@
 	{ "indications", ast_indications_reload },
 	{ "cel",        ast_cel_engine_reload },
 	{ "plc",        ast_plc_reload },
+	{ "sounds",     ast_sounds_reindex },
 	{ NULL, 	NULL }
 };
 

Modified: team/kmoore/cel_backend_refactor/main/sounds_index.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/main/sounds_index.c?view=diff&rev=396838&r1=396837&r2=396838
==============================================================================
--- team/kmoore/cel_backend_refactor/main/sounds_index.c (original)
+++ team/kmoore/cel_backend_refactor/main/sounds_index.c Fri Aug 16 08:42:44 2013
@@ -162,20 +162,22 @@
 	int formats_shown = 0;
 	RAII_VAR(struct ast_media_index *, local_index, ast_sounds_get_index(), ao2_cleanup);
 	RAII_VAR(struct ast_format_cap *, cap, NULL, ast_format_cap_destroy);
-	const char *description = ast_media_get_description(local_index, a->argv[2], language);
+	const char *description = ast_media_get_description(local_index, a->argv[3], language);
 
 	ast_cli(a->fd, "  Language %s:\n", language);
 	if (!ast_strlen_zero(description)) {
 		ast_cli(a->fd, "    Description: %s\n", description);
 	}
 
-	cap = ast_media_get_format_cap(local_index, a->argv[2], language);
-        ast_format_cap_iter_start(cap);
-        while (!ast_format_cap_iter_next(cap, &format)) {
-		ast_cli(a->fd, "    Format: %s\n", ast_getformatname(&format));
-		formats_shown = 1;
-        }
-        ast_format_cap_iter_end(cap);
+	cap = ast_media_get_format_cap(local_index, a->argv[3], language);
+	if (cap) {
+	        ast_format_cap_iter_start(cap);
+	        while (!ast_format_cap_iter_next(cap, &format)) {
+			ast_cli(a->fd, "    Format: %s\n", ast_getformatname(&format));
+			formats_shown = 1;
+	        }
+	        ast_format_cap_iter_end(cap);
+	}
 
 	if (!formats_shown) {
 		ast_cli(a->fd, "    No Formats Available\n");
@@ -184,42 +186,43 @@
 	return 0;
 }
 
-/*! \brief Allow for reloading of sounds via the command line */
-static char *handle_cli_sounds_reload(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+/*! \brief Show a list of sounds available on the system */
+static char *handle_cli_sounds_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "sounds reload";
+		e->command = "core show sounds";
 		e->usage =
-			"Usage: sounds reload\n"
-			"       Reloads the index of sound files and their descriptions.\n";
+			"Usage: core show sounds\n"
+			"       Shows a listing of sound files available on the system.\n";
 		return NULL;
 	case CLI_GENERATE:
 		return NULL;
 	}
 
-	if (a->argc != 2) {
-		return CLI_SHOWUSAGE;
-	}
-
-	if (ast_sounds_reindex()) {
-		ast_cli(a->fd, "Sound re-indexing failed.\n");
-		return CLI_FAILURE;
-	}
-
-	ast_cli(a->fd, "Sound files re-indexed.\n");
-	return CLI_SUCCESS;
-}
-
-/*! \brief Allow for reloading of sounds via the command line */
-static char *handle_cli_sounds_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
+	if (a->argc == 3) {
+		RAII_VAR(struct ao2_container *, sound_files, ast_media_get_media(sounds_index), ao2_cleanup);
+		if (!sound_files) {
+			return CLI_FAILURE;
+		}
+
+		ast_cli(a->fd, "Available audio files:\n");
+		ao2_callback(sound_files, OBJ_MULTIPLE | OBJ_NODATA, show_sounds_cb, a);
+		return CLI_SUCCESS;
+	}
+
+	return CLI_SHOWUSAGE;
+}
+
+/*! \brief Show details about a sound available in the system */
+static char *handle_cli_sound_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
 {
 	switch (cmd) {
 	case CLI_INIT:
-		e->command = "sounds show";
+		e->command = "core show sound";
 		e->usage =
-			"Usage: sounds show [soundid]\n"
-			"       Shows a listing of sound files or information about the specified sound.\n";
+			"Usage: core show sound [soundid]\n"
+			"       Shows information about the specified sound.\n";
 		return NULL;
 	case CLI_GENERATE:
 	{
@@ -247,25 +250,14 @@
 	}
 	}
 
-	if (a->argc == 2) {
-		RAII_VAR(struct ao2_container *, sound_files, ast_media_get_media(sounds_index), ao2_cleanup);
-		if (!sound_files) {
+	if (a->argc == 4) {
+		RAII_VAR(struct ao2_container *, variants, ast_media_get_variants(sounds_index, a->argv[3]), ao2_cleanup);
+		if (!variants || !ao2_container_count(variants)) {
+			ast_cli(a->fd, "ERROR: File %s not found in index\n", a->argv[3]);
 			return CLI_FAILURE;
 		}
 
-		ast_cli(a->fd, "Available audio files:\n");
-		ao2_callback(sound_files, OBJ_MULTIPLE | OBJ_NODATA, show_sounds_cb, a);
-		return CLI_SUCCESS;
-	}
-
-	if (a->argc == 3) {
-		RAII_VAR(struct ao2_container *, variants, ast_media_get_variants(sounds_index, a->argv[2]), ao2_cleanup);
-		if (!variants || !ao2_container_count(variants)) {
-			ast_cli(a->fd, "ERROR: File %s not found in index\n", a->argv[2]);
-			return CLI_FAILURE;
-		}
-
-		ast_cli(a->fd, "Indexed Information for %s:\n", a->argv[2]);
+		ast_cli(a->fd, "Indexed Information for %s:\n", a->argv[3]);
 		ao2_callback(variants, OBJ_MULTIPLE | OBJ_NODATA, show_sound_info_cb, a);
 		return CLI_SUCCESS;
 	}
@@ -276,7 +268,7 @@
 /*! \brief Struct for registering CLI commands */
 static struct ast_cli_entry cli_sounds[] = {
 	AST_CLI_DEFINE(handle_cli_sounds_show, "Shows available sounds"),
-	AST_CLI_DEFINE(handle_cli_sounds_reload, "Reload sounds index"),
+	AST_CLI_DEFINE(handle_cli_sound_show, "Shows details about a specific sound"),
 };
 
 static void sounds_cleanup(void)

Modified: team/kmoore/cel_backend_refactor/main/utils.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_backend_refactor/main/utils.c?view=diff&rev=396838&r1=396837&r2=396838
==============================================================================
--- team/kmoore/cel_backend_refactor/main/utils.c (original)
+++ team/kmoore/cel_backend_refactor/main/utils.c Fri Aug 16 08:42:44 2013
@@ -74,7 +74,9 @@
 static char base64[64];
 static char b2a[256];
 
+#ifndef __AST_DEBUG_MALLOC
 void *_ast_mem_backtrace_buffer[_AST_MEM_BACKTRACE_BUFLEN];
+#endif
 
 AST_THREADSTORAGE(inet_ntoa_buf);
 




More information about the asterisk-commits mailing list