Asterisk - The Open Source Telephony Project
18.5.0
|
Channel Bridging Roles API. More...
#include "asterisk/linkedlists.h"
Go to the source code of this file.
Macros | |
#define | AST_ROLE_LEN 32 |
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... | |
Channel Bridging Roles API.
Definition in file bridge_roles.h.
#define AST_ROLE_LEN 32 |
Definition at line 33 of file bridge_roles.h.
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().