99 .
type =
"bridge roles",
122 if (!(roles_datastore =
ast_calloc(1,
sizeof(*roles_datastore)))) {
129 datastore->
data = roles_datastore;
131 return roles_datastore;
155 return datastore->
data;
174 if (!roles_datastore) {
179 return roles_datastore;
198 if (!strcmp(
role->role, role_name)) {
270 ast_debug(3,
"Set role '%s'\n", role_name);
295 role_option =
ast_calloc(1,
sizeof(*role_option));
317 if (!roles_datastore) {
337 if (!roles_datastore) {
344 if (!strcmp(
role->role, role_name)) {
361 if (!roles_datastore) {
411 return role_option ? role_option->
value :
NULL;
440 return role_option ? role_option->
value :
NULL;
449 if (!bridge_channel->
chan) {
450 ast_debug(2,
"Attempted to set roles on a bridge channel that has no associated channel. That's a bad idea.\n");
455 ast_debug(2,
"Attempted to reset roles while roles were already established. Purge existing roles first.\n");
460 if (!roles_datastore) {
Asterisk main include file. File version handling, generic pbx functions.
#define ast_calloc(num, len)
A wrapper for calloc()
static void bridge_role_destroy(struct bridge_role *role)
static struct bridge_role * get_role_from_datastore(struct bridge_roles_datastore *roles_datastore, const char *role_name)
static int setup_bridge_role_option(struct bridge_role *role, const char *option, const char *value)
static void bridge_role_datastore_destroy(void *data)
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.
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_channel_has_role(struct ast_channel *channel, const char *role_name)
Check if a role exists on a channel.
static struct bridge_roles_datastore * setup_bridge_roles_datastore(struct ast_channel *chan)
static struct bridge_role * get_role_from_channel(struct ast_channel *channel, const char *role_name)
static struct bridge_roles_datastore * fetch_or_create_bridge_roles_datastore(struct ast_channel *chan)
void ast_channel_remove_bridge_role(struct ast_channel *chan, const char *role_name)
Removes a bridge role from a channel.
int ast_channel_add_bridge_role(struct ast_channel *chan, const char *role_name)
Adds a bridge role to a channel.
static struct bridge_roles_datastore * fetch_bridge_roles_datastore(struct ast_channel *chan)
void ast_channel_clear_bridge_roles(struct ast_channel *chan)
Removes all bridge roles currently on a channel.
static int setup_bridge_role(struct bridge_roles_datastore *roles_datastore, const char *role_name)
static struct bridge_role_option * get_role_option(struct bridge_role *role, const char *option)
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.
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.
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_bridge_channel_clear_roles(struct ast_bridge_channel *bridge_channel)
Clear all roles from a bridge_channel's role list.
static const struct ast_datastore_info bridge_role_info
Channel Bridging Roles API.
General Asterisk PBX channel definitions.
const char * ast_channel_name(const struct ast_channel *chan)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define ast_channel_lock(chan)
#define ast_channel_unlock(chan)
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.
Asterisk datastore objects.
#define ast_datastore_alloc(info, uid)
int ast_datastore_free(struct ast_datastore *datastore)
Free a data store object.
Support for logging to various files, console and syslog Configuration in file logger....
#define ast_debug(level,...)
Log a DEBUG message.
A set of macros to manage forward-linked lists.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_LAST(head)
Returns the last entry contained in a list.
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#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_set(x, field, data)
Set a field to a simple string value.
#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
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
Structure that contains information regarding a channel in a bridge.
struct bridge_roles_datastore * bridge_roles
struct ast_channel * chan
Main Channel structure associated with a channel.
Structure for a data store type.
Structure for a data store object.
struct bridge_role_option::@315 list
const ast_string_field option
const ast_string_field value
struct bridge_role::@317 options
struct bridge_role::@316 list
struct bridge_roles_datastore::@318 role_list