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;
114 ast_cli(a->
fd,
" Language %s:\n", language);
116 ast_cli(a->
fd,
" Description: %s\n", description);
131 if (!formats_shown) {
132 ast_cli(a->
fd,
" No Formats Available\n");
138 static 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]);
298 char *filename = data;
#define AST_CLI_DEFINE(fn, txt,...)
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
int ao2_container_count(struct ao2_container *c)
Returns the number of elements in a container.
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.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
descriptor for a cli entry.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define ao2_callback(c, flags, cb_fn, arg)
static int update_index_cb(void *obj, void *arg, void *data, int flags)
Callback to process an individual language directory or subdirectory.
struct ast_media_index * ast_sounds_get_index_for_file(const char *filename)
Get the index for a specific sound file.
#define ast_str_container_alloc(buckets)
Allocates a hash container for bare strings.
#define ast_cli_register_multiple(e, len)
Register multiple commands.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ast_strdup(str)
A wrapper for strdup()
Generic File Format Support. Should be included by clients of the file handling routines. File service providers should instead include mod_format.h.
void ast_cli(int fd, const char *fmt,...)
static int show_sounds_cb(void *obj, void *arg, int flags)
#define ast_strlen_zero(foo)
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
Asterisk file paths, configured in asterisk.conf.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static int unload_module(void)
#define LANGUAGE_BUCKETS
The number of buckets to be used for storing language-keyed objects.
static struct ao2_container * get_languages(void)
Get the languages in which sound files are available.
#define ao2_ref(o, delta)
static char language[MAX_LANGUAGE]
const char * ast_config_AST_DATA_DIR
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.
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
Sound file format and description indexer.
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_callback_data(container, flags, cb_fn, arg, data)
static int show_sound_info_cb(void *obj, void *arg, void *data, int flags)
#define ao2_iterator_next(iter)
static int sound_sorter(const void *obj_left, const void *obj_right, int flags)
Module has failed to load, may be in an inconsistent state.
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
static int load_module(void)
void ast_str_reset(struct ast_str *buf)
Reset the content of a dynamic string. Useful before a series of ast_str_append.
struct ast_media_index * ast_sounds_get_index(void)
Get the sounds index.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Standard Command Line Interface.
#define ao2_container_alloc_rbtree(ao2_options, container_options, sort_fn, cmp_fn)
static struct ast_cli_entry cli_sounds[]
Struct for registering CLI commands.
int ast_cli_completion_add(char *value)
Add a result to a request for completion options.
#define ASTERISK_GPL_KEY
The text the key() function should return.
Asterisk module definitions.
static snd_pcm_format_t format
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
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.
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.