summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bridges/bridge_holding.c14
-rw-r--r--bridges/bridge_native_rtp.c13
-rw-r--r--bridges/bridge_simple.c14
-rw-r--r--bridges/bridge_softmix.c11
-rw-r--r--channels/dahdi/bridge_native_dahdi.c15
-rw-r--r--include/asterisk/bridge_technology.h5
-rw-r--r--main/bridge.c72
7 files changed, 27 insertions, 117 deletions
diff --git a/bridges/bridge_holding.c b/bridges/bridge_holding.c
index c343cc624..2fd79d09a 100644
--- a/bridges/bridge_holding.c
+++ b/bridges/bridge_holding.c
@@ -428,21 +428,17 @@ static void deferred_action(struct ast_bridge_channel *bridge_channel, const voi
static int unload_module(void)
{
- ao2_cleanup(holding_bridge.format_capabilities);
- holding_bridge.format_capabilities = NULL;
- return ast_bridge_technology_unregister(&holding_bridge);
+ ast_bridge_technology_unregister(&holding_bridge);
+ return 0;
}
static int load_module(void)
{
- if (!(holding_bridge.format_capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
+ if (ast_bridge_technology_register(&holding_bridge)) {
+ unload_module();
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_append_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO);
- ast_format_cap_append_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO);
- ast_format_cap_append_by_type(holding_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT);
-
- return ast_bridge_technology_register(&holding_bridge);
+ return AST_MODULE_LOAD_SUCCESS;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Holding bridge module");
diff --git a/bridges/bridge_native_rtp.c b/bridges/bridge_native_rtp.c
index a69a97f63..980f46716 100644
--- a/bridges/bridge_native_rtp.c
+++ b/bridges/bridge_native_rtp.c
@@ -474,20 +474,17 @@ static struct ast_bridge_technology native_rtp_bridge = {
static int unload_module(void)
{
- ao2_t_ref(native_rtp_bridge.format_capabilities, -1, "Dispose of capabilities in module unload");
- return ast_bridge_technology_unregister(&native_rtp_bridge);
+ ast_bridge_technology_unregister(&native_rtp_bridge);
+ return 0;
}
static int load_module(void)
{
- if (!(native_rtp_bridge.format_capabilities = ast_format_cap_alloc(0))) {
+ if (ast_bridge_technology_register(&native_rtp_bridge)) {
+ unload_module();
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_append_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO);
- ast_format_cap_append_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO);
- ast_format_cap_append_by_type(native_rtp_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT);
-
- return ast_bridge_technology_register(&native_rtp_bridge);
+ return AST_MODULE_LOAD_SUCCESS;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Native RTP bridging module");
diff --git a/bridges/bridge_simple.c b/bridges/bridge_simple.c
index 1626a3993..570453500 100644
--- a/bridges/bridge_simple.c
+++ b/bridges/bridge_simple.c
@@ -76,21 +76,17 @@ static struct ast_bridge_technology simple_bridge = {
static int unload_module(void)
{
- ao2_cleanup(simple_bridge.format_capabilities);
- simple_bridge.format_capabilities = NULL;
- return ast_bridge_technology_unregister(&simple_bridge);
+ ast_bridge_technology_unregister(&simple_bridge);
+ return 0;
}
static int load_module(void)
{
- if (!(simple_bridge.format_capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
+ if (ast_bridge_technology_register(&simple_bridge)) {
+ unload_module();
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_append_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_AUDIO);
- ast_format_cap_append_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_VIDEO);
- ast_format_cap_append_by_type(simple_bridge.format_capabilities, AST_MEDIA_TYPE_TEXT);
-
- return ast_bridge_technology_register(&simple_bridge);
+ return AST_MODULE_LOAD_SUCCESS;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Simple two channel bridging module");
diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c
index 53be7d975..72299209c 100644
--- a/bridges/bridge_softmix.c
+++ b/bridges/bridge_softmix.c
@@ -1194,18 +1194,17 @@ static struct ast_bridge_technology softmix_bridge = {
static int unload_module(void)
{
- ao2_cleanup(softmix_bridge.format_capabilities);
- softmix_bridge.format_capabilities = NULL;
- return ast_bridge_technology_unregister(&softmix_bridge);
+ ast_bridge_technology_unregister(&softmix_bridge);
+ return 0;
}
static int load_module(void)
{
- if (!(softmix_bridge.format_capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT))) {
+ if (ast_bridge_technology_register(&softmix_bridge)) {
+ unload_module();
return AST_MODULE_LOAD_DECLINE;
}
- ast_format_cap_append(softmix_bridge.format_capabilities, ast_format_slin, 0);
- return ast_bridge_technology_register(&softmix_bridge);
+ return AST_MODULE_LOAD_SUCCESS;
}
AST_MODULE_INFO_STANDARD(ASTERISK_GPL_KEY, "Multi-party software based channel mixing");
diff --git a/channels/dahdi/bridge_native_dahdi.c b/channels/dahdi/bridge_native_dahdi.c
index 85cb4bfef..9df82b29b 100644
--- a/channels/dahdi/bridge_native_dahdi.c
+++ b/channels/dahdi/bridge_native_dahdi.c
@@ -893,7 +893,6 @@ static struct ast_bridge_technology native_bridge = {
void dahdi_native_unload(void)
{
ast_bridge_technology_unregister(&native_bridge);
- ao2_cleanup(native_bridge.format_capabilities);
}
/*!
@@ -908,18 +907,10 @@ int dahdi_native_load(struct ast_module *mod, const struct ast_channel_tech *tec
{
dahdi_tech = tech;
- native_bridge.format_capabilities = ast_format_cap_alloc(AST_FORMAT_CAP_FLAG_DEFAULT);
- if (!native_bridge.format_capabilities) {
+ if (__ast_bridge_technology_register(&native_bridge, mod)) {
+ dahdi_native_unload();
return -1;
}
- /*
- * This is used to make channels compatible with the bridge
- * itself not with each other.
- */
- ast_format_cap_append(native_bridge.format_capabilities, ast_format_slin, 0);
- ast_format_cap_append(native_bridge.format_capabilities, ast_format_ulaw, 0);
- ast_format_cap_append(native_bridge.format_capabilities, ast_format_alaw, 0);
-
- return __ast_bridge_technology_register(&native_bridge, mod);
+ return 0;
}
diff --git a/include/asterisk/bridge_technology.h b/include/asterisk/bridge_technology.h
index 9c39f74c2..7de573a23 100644
--- a/include/asterisk/bridge_technology.h
+++ b/include/asterisk/bridge_technology.h
@@ -152,7 +152,10 @@ struct ast_bridge_technology {
* \note On entry, bridge is already locked.
*/
int (*write)(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel, struct ast_frame *frame);
- /*! Formats that the bridge technology supports */
+ /*!
+ * \brief Formats that the bridge technology supports
+ * \note This is no longer used. It remains for ABI compatibility.
+ */
struct ast_format_cap *format_capabilities;
/*! TRUE if the bridge technology is currently suspended. */
unsigned int suspended:1;
diff --git a/main/bridge.c b/main/bridge.c
index a76ac77cc..5bf674308 100644
--- a/main/bridge.c
+++ b/main/bridge.c
@@ -129,7 +129,6 @@ static unsigned int optimization_id;
#define ATTENDEDTRANSFER "ATTENDEDTRANSFER"
static void cleanup_video_mode(struct ast_bridge *bridge);
-static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel);
/*! Default DTMF keys for built in features */
static char builtin_features_dtmf[AST_BRIDGE_BUILTIN_END][MAXIMUM_DTMF_FEATURE_STRING];
@@ -415,9 +414,6 @@ static void bridge_reconfigured_connected_line_update(struct ast_bridge *bridge)
*/
static void bridge_channel_complete_join(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
{
- /* Make the channel compatible with the bridge */
- bridge_make_compatible(bridge, bridge_channel);
-
/* Tell the bridge technology we are joining so they set us up */
ast_debug(1, "Bridge %s: %p(%s) is joining %s technology\n",
bridge->uniqueid, bridge_channel, ast_channel_name(bridge_channel->chan),
@@ -957,74 +953,6 @@ int ast_bridge_destroy(struct ast_bridge *bridge, int cause)
return 0;
}
-static int bridge_make_compatible(struct ast_bridge *bridge, struct ast_bridge_channel *bridge_channel)
-{
- struct ast_str *codec_buf = ast_str_alloca(64);
- struct ast_format *best_format;
- RAII_VAR(struct ast_format *, read_format, NULL, ao2_cleanup);
- RAII_VAR(struct ast_format *, write_format, NULL, ao2_cleanup);
-
- ast_channel_lock(bridge_channel->chan);
- read_format = ao2_bump(ast_channel_readformat(bridge_channel->chan));
- write_format = ao2_bump(ast_channel_writeformat(bridge_channel->chan));
- ast_channel_unlock(bridge_channel->chan);
-
- /* Are the formats currently in use something this bridge can handle? */
- if (ast_format_cap_iscompatible_format(bridge->technology->format_capabilities, read_format) == AST_FORMAT_CMP_NOT_EQUAL) {
- best_format = ast_format_cap_get_format(bridge->technology->format_capabilities, 0);
-
- /* Read format is a no go... */
- ast_debug(1, "Bridge technology %s wants to read any of formats %s but channel has %s\n",
- bridge->technology->name,
- ast_format_cap_get_names(bridge->technology->format_capabilities, &codec_buf),
- ast_format_get_name(read_format));
-
- /* Switch read format to the best one chosen */
- if (ast_set_read_format(bridge_channel->chan, best_format)) {
- ast_log(LOG_WARNING, "Failed to set channel %s to read format %s\n",
- ast_channel_name(bridge_channel->chan), ast_format_get_name(best_format));
- ao2_cleanup(best_format);
- return -1;
- }
- ast_debug(1, "Bridge %s put channel %s into read format %s\n",
- bridge->uniqueid, ast_channel_name(bridge_channel->chan),
- ast_format_get_name(best_format));
- ao2_cleanup(best_format);
- } else {
- ast_debug(1, "Bridge %s is happy that channel %s already has read format %s\n",
- bridge->uniqueid, ast_channel_name(bridge_channel->chan),
- ast_format_get_name(read_format));
- }
-
- if (ast_format_cap_iscompatible_format(bridge->technology->format_capabilities, write_format) == AST_FORMAT_CMP_NOT_EQUAL) {
- best_format = ast_format_cap_get_format(bridge->technology->format_capabilities, 0);
-
- /* Write format is a no go... */
- ast_debug(1, "Bridge technology %s wants to write any of formats %s but channel has %s\n",
- bridge->technology->name,
- ast_format_cap_get_names(bridge->technology->format_capabilities, &codec_buf),
- ast_format_get_name(write_format));
-
- /* Switch write format to the best one chosen */
- if (ast_set_write_format(bridge_channel->chan, best_format)) {
- ast_log(LOG_WARNING, "Failed to set channel %s to write format %s\n",
- ast_channel_name(bridge_channel->chan), ast_format_get_name(best_format));
- ao2_cleanup(best_format);
- return -1;
- }
- ast_debug(1, "Bridge %s put channel %s into write format %s\n",
- bridge->uniqueid, ast_channel_name(bridge_channel->chan),
- ast_format_get_name(best_format));
- ao2_cleanup(best_format);
- } else {
- ast_debug(1, "Bridge %s is happy that channel %s already has write format %s\n",
- bridge->uniqueid, ast_channel_name(bridge_channel->chan),
- ast_format_get_name(write_format));
- }
-
- return 0;
-}
-
/*!
* \internal
* \brief Perform the smart bridge operation.