[Home]

Summary:ASTERISK-22107: Bridge API Enhancements - refactor and redesign ast_bridge_featuresremove interval hooks from ast_bridge_features
Reporter:Matt Jordan (mjordan)Labels:Asterisk12
Date Opened:2013-07-18 15:55:50Date Closed:2013-07-26 16:14:01
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/Bridging
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:This is sub-optimal:

{noformat}
/*!
* \brief Structure that contains features information
*/
struct ast_bridge_features {
/*! Attached DTMF feature hooks */
struct ao2_container *dtmf_hooks;
/*! Attached hangup interception hooks container */
struct ao2_container *hangup_hooks;
/*! Attached bridge channel join interception hooks container */
struct ao2_container *join_hooks;
/*! Attached bridge channel leave interception hooks container */
struct ao2_container *leave_hooks;
/*! Attached interval hooks */
struct ast_heap *interval_hooks;
/*! Used to determine when interval based features should be checked */
struct ast_timer *interval_timer;
/*! Limits feature data */
struct ast_bridge_features_limits *limits;
/*! Callback to indicate when a bridge channel has started and stopped talking */
ast_bridge_talking_indicate_callback talker_cb;
/*! Callback to destroy any pvt data stored for the talker. */
ast_bridge_talking_indicate_destructor talker_destructor_cb;
/*! Talker callback pvt data */
void *talker_pvt_data;
/*! Feature flags that are enabled */
struct ast_flags feature_flags;
/*! Used to assign the sequence number to the next interval hook added. */
unsigned int interval_sequence;
/*! TRUE if feature_flags is setup */
unsigned int usable:1;
/*! TRUE if the channel/bridge is muted. */
unsigned int mute:1;
/*! TRUE if DTMF should be passed into the bridge tech.  */
unsigned int dtmf_passthrough:1;
};
{noformat}

While {{ast_bridge_features}} should be the structure that holds a channel's features while it is in a bridge, there are better ways of structuring this data.
# It should structure specific information. Talk detection and other optional function callbacks should at least be put in a sub-structure.
# It should not have a different container for each type of feature. We will extend the types of features that are possible in a bridge - we should not break the ABI every time we do so. While this may mean having a few different containers, {{ao2_containers}} support selection of specific types of objects through {{ao2_callback}}. Given that these containers will not support many hooks, this should not be a major performance hit.
# {{ast_bridge_feature_limits}} is currently leaked in certain situations. If the lifetime of the limits object is not explicitly tied to the lifetime of the features object, it should be an ao2 object.

In general, the goal should be to have a features API that is flexible enough to allow for new feature hooks to be developed without being changed.

While the design of ConfBridge does currently limit this in certain ways, we should attempt to make this as robust as possible.

Comments: