Asterisk - The Open Source Telephony Project
18.5.0
|
Channel Bridging Roles API. More...
#include "asterisk.h"
#include <signal.h>
#include "asterisk/logger.h"
#include "asterisk/channel.h"
#include "asterisk/datastore.h"
#include "asterisk/linkedlists.h"
#include "asterisk/bridge.h"
#include "asterisk/bridge_roles.h"
#include "asterisk/stringfields.h"
Go to the source code of this file.
Data Structures | |
struct | bridge_role |
struct | bridge_role_option |
struct | bridge_roles_datastore |
Functions | |
void | ast_bridge_channel_clear_roles (struct ast_bridge_channel *bridge_channel) |
Clear all roles from a bridge_channel's role list. More... | |
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. More... | |
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. More... | |
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. More... | |
int | ast_channel_add_bridge_role (struct ast_channel *chan, const char *role_name) |
Adds a bridge role to a channel. More... | |
void | ast_channel_clear_bridge_roles (struct ast_channel *chan) |
Removes all bridge roles currently on a channel. More... | |
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. More... | |
int | ast_channel_has_role (struct ast_channel *channel, const char *role_name) |
Check if a role exists on a channel. More... | |
void | ast_channel_remove_bridge_role (struct ast_channel *chan, const char *role_name) |
Removes a bridge role from a channel. More... | |
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. More... | |
static void | bridge_role_datastore_destroy (void *data) |
static void | bridge_role_destroy (struct bridge_role *role) |
static struct bridge_roles_datastore * | fetch_bridge_roles_datastore (struct ast_channel *chan) |
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) |
static struct bridge_role * | get_role_from_datastore (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) |
static int | setup_bridge_role (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 struct bridge_roles_datastore * | setup_bridge_roles_datastore (struct ast_channel *chan) |
Variables | |
static const struct ast_datastore_info | bridge_role_info |
Channel Bridging Roles API.
Definition in file bridge_roles.c.
void ast_bridge_channel_clear_roles | ( | struct ast_bridge_channel * | bridge_channel | ) |
Clear all roles from a bridge_channel's role list.
bridge_channel | the bridge channel that we are scrubbing |
If roles are already established on a bridge channel, ast_bridge_channel_establish_roles will fail unconditionally without changing any roles. In order to update a bridge channel's roles, they must first be cleared from the bridge channel using this function.
Definition at line 495 of file bridge_roles.c.
References bridge_role_datastore_destroy(), ast_bridge_channel::bridge_roles, and NULL.
Referenced by agent_alert(), ast_bridge_channel_establish_roles(), and bridge_channel_internal_pull().
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.
bridge_channel | The bridge channel that we are preparing |
0 | on success |
-1 | on failure |
This function should always be called when the bridge_channel binds to an ast_channel at some point before the bridge_channel joins or is imparted onto a bridge. Failure to do so will result in an empty role list. While the list remains established, changes to roles on the ast_channel will not propogate to the bridge channel and roles can not be re-established on the bridge channel without first clearing the roles with ast_bridge_roles_bridge_channel_clear_roles.
Definition at line 447 of file bridge_roles.c.
References ast_bridge_channel_clear_roles(), ast_calloc, ast_debug, AST_LIST_LAST, AST_LIST_TRAVERSE, ast_bridge_channel::bridge_roles, ast_bridge_channel::chan, fetch_bridge_roles_datastore(), bridge_role_option::list, NULL, bridge_role_option::option, bridge_role::options, bridge_role::role, bridge_roles_datastore::role_list, setup_bridge_role(), setup_bridge_role_option(), and bridge_role_option::value.
Referenced by agent_alert(), and bridge_channel_internal_push_full().
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.
bridge_channel | The bridge channel we are retrieving the option from |
role_name | Name of the role the option will be retrieved from |
option | Name of the option we are retrieving the value of |
NULL | If either the role does not exist on the bridge_channel or the role does exist but the option has not been set |
The | value of the option |
Definition at line 427 of file bridge_roles.c.
References ast_bridge_channel::bridge_roles, get_role_from_datastore(), get_role_option(), NULL, bridge_role::role, and bridge_role_option::value.
Referenced by bridge_parking_push(), participant_entertainment_start(), and participant_idle_mode_setup().
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.
bridge_channel | The bridge channel being checked |
role_name | Name of the role being checked |
0 | The bridge channel does not have the requested role |
1 | The bridge channel does have the requested role |
Definition at line 418 of file bridge_roles.c.
References ast_bridge_channel::bridge_roles, and get_role_from_datastore().
Referenced by bridge_parking_push(), and holding_bridge_join().
int ast_channel_add_bridge_role | ( | struct ast_channel * | chan, |
const char * | role_name | ||
) |
Adds a bridge role to a channel.
chan | Acquirer of the requested role |
role_name | Name of the role being attached |
0 | on success |
-1 | on failure |
Definition at line 317 of file bridge_roles.c.
References ast_channel_name(), ast_debug, ast_log, fetch_or_create_bridge_roles_datastore(), get_role_from_datastore(), LOG_WARNING, and setup_bridge_role().
Referenced by add_transferer_role(), announce_request(), app_control_add_role(), bridge_agent_hold_push(), bridge_stasis_push(), media_request_helper(), parking_channel_set_roles(), process_options(), and rec_request().
void ast_channel_clear_bridge_roles | ( | struct ast_channel * | chan | ) |
Removes all bridge roles currently on a channel.
chan | Channel the roles are being removed from |
Definition at line 360 of file bridge_roles.c.
References ast_channel_name(), ast_debug, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, bridge_role_destroy(), fetch_bridge_roles_datastore(), bridge_role_option::list, bridge_role::role, and bridge_roles_datastore::role_list.
Referenced by app_control_clear_roles(), and bridge_stasis_pull().
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.
channel | The channel to retrieve the requested option from |
role_name | The role to which the option belongs |
option | The name of the option to retrieve |
NULL | The option does not exist |
non-NULL | The value of the option |
This is an alternative to ast_bridge_channel_get_role_option that is useful if bridge roles have not yet been esstablished on a channel's bridge_channel. A possible example of when this could be used is in a bridge v_table's push() callback.
Definition at line 403 of file bridge_roles.c.
References get_role_from_channel(), get_role_option(), NULL, bridge_role::role, and bridge_role_option::value.
Referenced by bridge_personality_atxfer_push().
int ast_channel_has_role | ( | struct ast_channel * | channel, |
const char * | role_name | ||
) |
Check if a role exists on a channel.
channel | The channel to check |
role_name | The name of the role to search for |
0 | The requested role does not exist on the channel |
1 | The requested role exists on the channel |
This is an alternative to ast_bridge_channel_has_role that is useful if bridge roles have not yet been established on a channel's bridge_channel. A possible example of when this could be used is in a bridge v_table's push() callback.
Definition at line 398 of file bridge_roles.c.
References get_role_from_channel().
Referenced by bridge_personality_atxfer_push(), bridge_stasis_push(), and handle_hangup().
void ast_channel_remove_bridge_role | ( | struct ast_channel * | chan, |
const char * | role_name | ||
) |
Removes a bridge role from a channel.
chan | Channel the role is being removed from |
role_name | Name of the role being removed |
Definition at line 336 of file bridge_roles.c.
References ast_channel_name(), ast_debug, AST_LIST_REMOVE_CURRENT, AST_LIST_TRAVERSE_SAFE_BEGIN, AST_LIST_TRAVERSE_SAFE_END, bridge_role_destroy(), fetch_bridge_roles_datastore(), bridge_role_option::list, bridge_role::role, and bridge_roles_datastore::role_list.
Referenced by attended_transfer_properties_shutdown(), bridge_agent_hold_pull(), and bridge_agent_hold_push().
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.
channel | Channel receiving the role option |
role_name | Role the role option is applied to |
option | Name of the option |
value | Value of the option |
0 | on success |
-1 | on failure |
Definition at line 379 of file bridge_roles.c.
References ast_string_field_set, get_role_from_channel(), get_role_option(), bridge_role::role, and setup_bridge_role_option().
Referenced by add_transferer_role(), agent_alert(), apply_option_entertainment(), apply_option_moh(), bridge_agent_hold_push(), bridge_stasis_push(), and parking_channel_set_roles().
|
static |
Definition at line 90 of file bridge_roles.c.
References ast_free, AST_LIST_REMOVE_HEAD, bridge_role_destroy(), bridge_role_option::list, bridge_role::role, and bridge_roles_datastore::role_list.
Referenced by ast_bridge_channel_clear_roles().
|
static |
Definition at line 71 of file bridge_roles.c.
References ast_free, AST_LIST_REMOVE_HEAD, ast_string_field_free_memory, bridge_role_option::list, and bridge_role::options.
Referenced by ast_channel_clear_bridge_roles(), ast_channel_remove_bridge_role(), and bridge_role_datastore_destroy().
|
static |
Definition at line 148 of file bridge_roles.c.
References ast_channel_datastore_find(), ast_channel_lock, ast_channel_unlock, ast_datastore::data, and NULL.
Referenced by ast_bridge_channel_establish_roles(), ast_channel_clear_bridge_roles(), ast_channel_remove_bridge_role(), fetch_or_create_bridge_roles_datastore(), and get_role_from_channel().
|
static |
Definition at line 172 of file bridge_roles.c.
References ast_channel_lock, ast_channel_unlock, fetch_bridge_roles_datastore(), and setup_bridge_roles_datastore().
Referenced by ast_channel_add_bridge_role().
|
static |
Definition at line 221 of file bridge_roles.c.
References fetch_bridge_roles_datastore(), get_role_from_datastore(), and NULL.
Referenced by ast_channel_get_role_option(), ast_channel_has_role(), and ast_channel_set_bridge_role_option().
|
static |
Definition at line 197 of file bridge_roles.c.
References AST_LIST_TRAVERSE, bridge_role_option::list, NULL, bridge_role::role, and bridge_roles_datastore::role_list.
Referenced by ast_bridge_channel_get_role_option(), ast_bridge_channel_has_role(), ast_channel_add_bridge_role(), and get_role_from_channel().
|
static |
Definition at line 238 of file bridge_roles.c.
References AST_LIST_TRAVERSE, bridge_role_option::list, NULL, bridge_role_option::option, and bridge_role::options.
Referenced by ast_bridge_channel_get_role_option(), ast_channel_get_role_option(), and ast_channel_set_bridge_role_option().
|
static |
Definition at line 260 of file bridge_roles.c.
References ast_calloc, ast_copy_string(), ast_debug, AST_LIST_HEAD_INIT_NOLOCK, AST_LIST_INSERT_TAIL, bridge_role_option::list, bridge_role::options, bridge_role::role, and bridge_roles_datastore::role_list.
Referenced by ast_bridge_channel_establish_roles(), and ast_channel_add_bridge_role().
|
static |
Definition at line 291 of file bridge_roles.c.
References ast_calloc, ast_free, AST_LIST_INSERT_TAIL, ast_string_field_init, ast_string_field_set, bridge_role_option::list, and bridge_role::options.
Referenced by ast_bridge_channel_establish_roles(), and ast_channel_set_bridge_role_option().
|
static |
Definition at line 117 of file bridge_roles.c.
References ast_calloc, ast_channel_datastore_add(), ast_datastore_alloc, ast_datastore_free(), AST_LIST_HEAD_INIT_NOLOCK, ast_datastore::data, NULL, and bridge_roles_datastore::role_list.
Referenced by fetch_or_create_bridge_roles_datastore().
|
static |
Definition at line 102 of file bridge_roles.c.