103 .
type =
"bridge roles",
126 if (!(roles_datastore =
ast_calloc(1,
sizeof(*roles_datastore)))) {
133 datastore->
data = roles_datastore;
135 return roles_datastore;
159 return datastore->
data;
178 if (!roles_datastore) {
183 return roles_datastore;
202 if (!strcmp(role->
role, role_name)) {
242 if (!strcmp(role_option->
option, option)) {
274 ast_debug(3,
"Set role '%s'\n", role_name);
299 role_option =
ast_calloc(1,
sizeof(*role_option));
321 if (!roles_datastore) {
341 if (!roles_datastore) {
348 if (!strcmp(role->
role, role_name)) {
365 if (!roles_datastore) {
415 return role_option ? role_option->
value :
NULL;
444 return role_option ? role_option->
value :
NULL;
453 if (!bridge_channel->
chan) {
454 ast_debug(2,
"Attempted to set roles on a bridge channel that has no associated channel. That's a bad idea.\n");
459 ast_debug(2,
"Attempted to reset roles while roles were already established. Purge existing roles first.\n");
464 if (!roles_datastore) {
void ast_bridge_channel_clear_roles(struct ast_bridge_channel *bridge_channel)
Clear all roles from a bridge_channel's role list.
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
Asterisk main include file. File version handling, generic pbx functions.
static const struct ast_datastore_info bridge_role_info
const char * ast_channel_get_role_option(struct ast_channel *channel, const char *role_name, const char *option)
Retrieve the value of a requested role option from a channel.
int ast_bridge_channel_establish_roles(struct ast_bridge_channel *bridge_channel)
Clone the roles from a bridge_channel's attached ast_channel onto the bridge_channel's role list...
void ast_channel_remove_bridge_role(struct ast_channel *chan, const char *role_name)
Removes a bridge role from a channel.
static struct bridge_role * get_role_from_datastore(struct bridge_roles_datastore *roles_datastore, const char *role_name)
static struct bridge_roles_datastore * fetch_or_create_bridge_roles_datastore(struct ast_channel *chan)
static struct bridge_role * get_role_from_channel(struct ast_channel *channel, const char *role_name)
int ast_channel_add_bridge_role(struct ast_channel *chan, const char *role_name)
Adds a bridge role to a channel.
const char * ast_bridge_channel_get_role_option(struct ast_bridge_channel *bridge_channel, const char *role_name, const char *option)
Retrieve the value of a requested role option from a bridge channel.
struct bridge_roles_datastore::@358 role_list
Structure for a data store type.
#define AST_DECLARE_STRING_FIELDS(field_list)
Declare the fields needed in a structure.
Structure for a data store object.
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
int ast_channel_has_role(struct ast_channel *channel, const char *role_name)
Check if a role exists on a channel.
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
static struct bridge_roles_datastore * fetch_bridge_roles_datastore(struct ast_channel *chan)
Asterisk datastore objects.
#define ast_debug(level,...)
Log a DEBUG message.
Channel Bridging Roles API.
static void bridge_role_datastore_destroy(void *data)
General Asterisk PBX channel definitions.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
const ast_string_field value
#define AST_STRING_FIELD(name)
Declare a string field.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
A set of macros to manage forward-linked lists.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
static struct bridge_roles_datastore * setup_bridge_roles_datastore(struct ast_channel *chan)
struct bridge_roles_datastore * bridge_roles
static int setup_bridge_role(struct bridge_roles_datastore *roles_datastore, const char *role_name)
#define AST_LIST_LAST(head)
Returns the last entry contained in a list.
static void bridge_role_destroy(struct bridge_role *role)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
static struct bridge_role_option * get_role_option(struct bridge_role *role, const char *option)
#define ast_channel_unlock(chan)
#define ast_calloc(num, len)
A wrapper for calloc()
void ast_channel_clear_bridge_roles(struct ast_channel *chan)
Removes all bridge roles currently on a channel.
struct bridge_role::@357 options
Support for logging to various files, console and syslog Configuration in file logger.conf.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
struct ast_channel * chan
Structure that contains information regarding a channel in a bridge.
const ast_string_field option
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
const char * ast_channel_name(const struct ast_channel *chan)
#define ast_datastore_alloc(info, uid)
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
static int setup_bridge_role_option(struct bridge_role *role, const char *option, const char *value)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
struct bridge_role_option::@355 list
int ast_channel_set_bridge_role_option(struct ast_channel *channel, const char *role_name, const char *option, const char *value)
Set a role option on a channel.
int ast_bridge_channel_has_role(struct ast_bridge_channel *bridge_channel, const char *role_name)
Check to see if a bridge channel inherited a specific role from its channel.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.