73 if (!lang_format_pair) {
88 char *lang_filter = arg;
90 if (strcmp(lang, lang_filter)) {
102 const char *description;
111 if (ast_strlen_zero(description)) {
126 if (!format_lang_list) {
136 if (args && !ast_strlen_zero(args->
lang)) {
168 struct ast_json *sounds_array = arg;
169 char *filename = obj;
189 .index = sounds_index,
228 ao2_cleanup(sounds_index);
struct ast_json * ast_json_ref(struct ast_json *value)
Increase refcount on value.
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.
struct ast_json * ast_json_pack(char const *format,...)
Helper for creating complex JSON values.
void ast_json_unref(struct ast_json *value)
Decrease refcount on value. If refcount reaches zero, value is freed.
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container, as described below.
void ast_ari_sounds_get(struct ast_variable *headers, struct ast_ari_sounds_get_args *args, struct ast_ari_response *response)
Get a sound's details.
void ast_ari_sounds_list(struct ast_variable *headers, struct ast_ari_sounds_list_args *args, struct ast_ari_response *response)
List all sounds.
Structure for variables, used for configurations and for channel variables.
Generated file - declares stubs to be implemented in res/ari/resource_sounds.c.
struct ast_media_index * ast_sounds_get_index(void)
Get the sounds index.
static struct ast_json * create_sound_blob(const char *filename, struct ast_ari_sounds_list_args *args, struct ast_media_index *sounds_index)
Generate a Sound structure as documented in sounds.json for the specified filename.
Asterisk JSON abstraction layer.
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ast_ari_response_ok(struct ast_ari_response *response, struct ast_json *message)
Fill in an OK (200) ast_ari_response.
static int filter_langs_cb(void *obj, void *arg, int flags)
Filter out all languages not matching the specified language.
struct ast_json * ast_json_array_create(void)
Create a empty JSON array.
int ast_json_array_append(struct ast_json *array, struct ast_json *value)
Append to an array.
Sound file format and description indexer.
void ast_ari_response_error(struct ast_ari_response *response, int response_code, const char *response_text, const char *message_fmt,...)
Fill in an error ast_ari_response.
struct ast_json * ast_json_object_get(struct ast_json *object, const char *key)
Get a field from a JSON object.
size_t ast_json_array_size(const struct ast_json *array)
Get the size of a JSON array.
Abstract JSON element (object, array, string, int, ...).
static int append_sound_cb(void *obj, void *arg, void *data, int flags)
Generate a Sound structure and append it to the output blob.
struct ast_media_index * ast_sounds_get_index_for_file(const char *filename)
Get the index for a specific sound file.
#define RAII_VAR(vartype, varname, initval, dtor)
Declare a variable that will call a destructor function when it goes out of scope.
static int add_format_information_cb(void *obj, void *arg, void *data, int flags)
Add format/lang pairs to the array embedded in the sound object.