137 const char *protocol)
139 return !strcmp(protocol, cfg->
protocol);
166 int wordlen = strlen(
word);
194 ast_cli(
a->fd,
"No AEAP configuration found\n");
223 e->
command =
"aeap show client";
225 "Usage: aeap show client <id>\n"
226 " Show the AEAP settings for a given client\n";
253 e->
command =
"aeap show clients";
255 "Usage: aeap show clients\n"
256 " Show all configured AEAP clients\n";
268 ast_cli(
a->fd,
"No AEAP clients found\n");
285 int connect,
int timeout)
290 const char *protocol =
NULL;
300 url =
"ws://127.0.0.1:8088/ws";
305 if (!
url && !protocol) {
397 "Asterisk External Application Protocol Module for Asterisk",
403 .
requires =
"res_http_websocket",
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ao2_iterator_next(iter)
#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.
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a 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.
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.
static struct ao2_container * codecs
Registered codecs.
#define STRFLDSET(type,...)
Convert a struct and a list of stringfield fields to an argument list of field offsets.
#define FLDSET(type,...)
Convert a struct and list of fields to an argument list of field offsets.
@ OPT_NOOP_T
Type for a default handler that should do nothing.
@ OPT_CODEC_T
Type for default option handler for format capabilities.
@ OPT_STRINGFIELD_T
Type for default option handler for stringfields.
int aeap_general_initialize(void)
Initialize general/common AEAP facilities.
void aeap_general_finalize(void)
Finalize/cleanup general AEAP facilities.
struct ast_variable * ast_variable_list_sort(struct ast_variable *head)
Performs an in-place sort on the variable list by ascending name.
#define ast_variable_new(name, value, filename)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_CHANNEL_DEPEND
@ AST_MODULE_SUPPORT_CORE
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
static char * aeap_tab_complete_name(const char *word, struct ao2_container *container)
struct ast_aeap * ast_aeap_create_and_connect_by_id(const char *id, const struct ast_aeap_params *params, int timeout)
Create and connect to an Asterisk external application by sorcery id.
static void * client_config_alloc(const char *name)
static char * client_config_show_all(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
int ast_aeap_client_config_has_protocol(const struct ast_aeap_client_config *cfg, const char *protocol)
Check a given protocol against that in an Asterisk external application configuration.
static struct ast_cli_entry aeap_cli[]
static int reload_module(void)
static void client_config_destructor(void *obj)
struct ast_variable * ast_aeap_custom_fields_get(const char *id)
Retrieve a list of custom configuration fields.
static char * client_config_show(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
struct ast_sorcery * ast_aeap_sorcery(void)
Retrieve the AEAP sorcery object.
struct ast_aeap * ast_aeap_create_by_id(const char *id, const struct ast_aeap_params *params)
Create an Asterisk external application object by sorcery id.
static int aeap_cli_show(void *obj, void *arg, int flags)
struct ao2_container * ast_aeap_client_configs_get(const char *protocol)
Retrieve a listing of all client configuration objects by protocol.
static struct ast_aeap * aeap_create(const char *id, const struct ast_aeap_params *params, int connect, int timeout)
static struct ast_sorcery * aeap_sorcery
static int load_module(void)
static struct ast_aeap_client_config * client_config_get(const char *id)
static int client_config_apply(const struct ast_sorcery *sorcery, void *obj)
static int unload_module(void)
const struct ast_format_cap * ast_aeap_client_config_codecs(const struct ast_aeap_client_config *cfg)
Retrieve codec capabilities from the configuration.
Asterisk External Application Protocol API.
struct ast_aeap * ast_aeap_create(const char *type, const struct ast_aeap_params *params)
Create an Asterisk external application object.
#define AEAP_CONFIG_CLIENT
struct ast_aeap * ast_aeap_create_and_connect(const char *type, const struct ast_aeap_params *params, const char *url, const char *protocol, int timeout)
Create and connect to an Asterisk external application.
struct ao2_container * container
static struct ast_sorcery * sorcery
Sorcery Data Access Layer API.
#define ast_sorcery_unref(sorcery)
Decrease the reference count of a sorcery structure.
const char * ast_sorcery_object_get_id(const void *object)
Get the unique identifier of a sorcery object.
#define ast_sorcery_objectset_create(sorcery, object)
Create an object set (KVP list) for an object.
@ AST_RETRIEVE_FLAG_MULTIPLE
Return all matching objects.
@ AST_RETRIEVE_FLAG_ALL
Perform no matching, return all objects.
void ast_sorcery_load(const struct ast_sorcery *sorcery)
Inform any wizards to load persistent objects.
const char * ast_sorcery_object_get_type(const void *object)
Get the type of a sorcery object.
void * ast_sorcery_retrieve_by_id(const struct ast_sorcery *sorcery, const char *type, const char *id)
Retrieve an object using its unique identifier.
#define ast_sorcery_object_register(sorcery, type, alloc, transform, apply)
Register an object type.
void ast_sorcery_reload(const struct ast_sorcery *sorcery)
Inform any wizards to reload persistent objects.
void * ast_sorcery_generic_alloc(size_t size, ao2_destructor_fn destructor)
Allocate a generic sorcery capable object.
#define ast_sorcery_object_field_register(sorcery, type, name, default_val, opt_type, flags,...)
Register a field within an object.
#define ast_sorcery_apply_default(sorcery, type, name, data)
#define ast_sorcery_open()
Open a new sorcery structure.
void * ast_sorcery_retrieve_by_fields(const struct ast_sorcery *sorcery, const char *type, unsigned int flags, struct ast_variable *fields)
Retrieve an object or multiple objects using specific fields.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
#define AST_STRING_FIELD(name)
Declare a string field.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
static force_inline int attribute_pure ast_strlen_zero(const char *s)
static int force_inline attribute_pure ast_begins_with(const char *str, const char *prefix)
Checks whether a string begins with another.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
const ast_string_field url
struct ast_format_cap * codecs
const ast_string_field protocol
Callbacks and other parameters used by an Asterisk external application object.
const struct ast_aeap_params * params
descriptor for a cli entry.
Full structure for sorcery.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next