46#define LANGUAGE_BUCKETS 7
58 if (!media_dir || !lang_dirs) {
71 while((dent = readdir(srcdir)) !=
NULL) {
74 if(!strcmp(dent->d_name,
".") || !strcmp(dent->d_name,
"..")) {
86 if (S_ISDIR(st.st_mode)) {
109 int formats_shown = 0;
116 ast_cli(
a->fd,
" Description: %s\n", description);
131 if (!formats_shown) {
132 ast_cli(
a->fd,
" No Formats Available\n");
138static int sound_sorter(
const void *obj_left,
const void *obj_right,
int flags)
140 return strcmp(obj_left, obj_right);
148 e->
command =
"core show sounds";
150 "Usage: core show sounds\n"
151 " Shows a listing of sound files available on the system.\n";
181 ast_cli(
a->fd,
"Available audio files:\n");
203 e->
command =
"core show sound";
205 "Usage: core show sound [soundid]\n"
206 " Shows information about the specified sound.\n";
224 length = strlen(
a->word);
227 if (!strncasecmp(
a->word, filename, length)) {
254 ast_cli(
a->fd,
"ERROR: File %s not found in index\n",
a->argv[3]);
258 ast_cli(
a->fd,
"Indexed Information for %s:\n",
a->argv[3]);
298 char *filename = data;
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
int ao2_container_dup(struct ao2_container *dest, struct ao2_container *src, enum search_flags flags)
Copy all object references in the src container into the dest container.
#define ao2_iterator_next(iter)
@ AO2_ALLOC_OPT_LOCK_NOLOCK
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
#define ao2_callback_data(container, flags, cb_fn, arg, data)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn)
Allocate and initialize a red-black tree container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
static char language[MAX_LANGUAGE]
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
Generic File Format Support. Should be included by clients of the file handling routines....
Asterisk locking-related definitions:
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_DATA_DIR
struct ast_media_index * ast_sounds_get_index(void)
Get the sounds index.
static int show_sounds_cb(void *obj, void *arg, int flags)
struct ast_media_index * ast_sounds_get_index_for_file(const char *filename)
Get the index for a specific sound file.
static struct ao2_container * get_languages(void)
Get the languages in which sound files are available.
static int sound_sorter(const void *obj_left, const void *obj_right, int flags)
static char * handle_cli_sound_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Show details about a sound available in the system.
static int show_sound_info_cb(void *obj, void *arg, void *data, int flags)
static int update_index_cb(void *obj, void *arg, void *data, int flags)
Callback to process an individual language directory or subdirectory.
static int load_module(void)
static struct ast_cli_entry cli_sounds[]
Struct for registering CLI commands.
static int unload_module(void)
static char * handle_cli_sounds_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
Show a list of sounds available on the system.
#define LANGUAGE_BUCKETS
The number of buckets to be used for storing language-keyed objects.
Sound file format and description indexer.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_container_alloc(buckets)
Allocates a hash container for bare strings.
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
int ast_str_container_add(struct ao2_container *str_container, const char *add)
Adds a string to a string container allocated by ast_str_container_alloc.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
descriptor for a cli entry.
Support for dynamic strings.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.