summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorMark Michelson <mmichelson@digium.com>2013-08-02 14:05:07 +0000
committerMark Michelson <mmichelson@digium.com>2013-08-02 14:05:07 +0000
commitf8622e7c5cbdda91a5efad230a9e3af593378c7c (patch)
treeac2c4b5f2256fb55c84fb8915d82298d23c0e188 /main
parent57a8148ccd704f02f33c65d902b199f4205e5480 (diff)
Get rid of ast_bridged_channel() and the bridged_channel field on ast_channels.
This commit is smaller than the initial review placed on review board. This is because a change to allow for channel drivers to access parking functionality externally was committed and invalidated quite a few of the changes initially made. (closes issue ASTERISK-22039) reported by Matt Jordan Review: https://reviewboard.asterisk.org/r/2717 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396103 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main')
-rw-r--r--main/channel.c18
-rw-r--r--main/channel_internal_api.c16
-rw-r--r--main/rtp_engine.c2
3 files changed, 5 insertions, 31 deletions
diff --git a/main/channel.c b/main/channel.c
index 9c4a0ba7a..95d0a5dcc 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -2606,16 +2606,12 @@ static void free_translation(struct ast_channel *clonechan)
void ast_set_hangupsource(struct ast_channel *chan, const char *source, int force)
{
- struct ast_channel *bridge;
+ RAII_VAR(struct ast_channel *, bridge, ast_channel_bridge_peer(chan), ast_channel_cleanup);
ast_channel_lock(chan);
if (force || ast_strlen_zero(ast_channel_hangupsource(chan))) {
ast_channel_hangupsource_set(chan, source);
}
- bridge = ast_bridged_channel(chan);
- if (bridge) {
- ast_channel_ref(bridge);
- }
ast_channel_unlock(chan);
if (bridge) {
@@ -2624,7 +2620,6 @@ void ast_set_hangupsource(struct ast_channel *chan, const char *source, int forc
ast_channel_hangupsource_set(bridge, source);
}
ast_channel_unlock(bridge);
- ast_channel_unref(bridge);
}
}
@@ -3942,7 +3937,7 @@ static struct ast_frame *__ast_read(struct ast_channel *chan, int dropaudio)
ast_debug(1, "Ignoring answer on an inbound call!\n");
ast_frfree(f);
f = &ast_null_frame;
- } else if (prestate == AST_STATE_UP && ast_bridged_channel(chan)) {
+ } else if (prestate == AST_STATE_UP && ast_channel_is_bridged(chan)) {
ast_debug(1, "Dropping duplicate answer!\n");
ast_frfree(f);
f = &ast_null_frame;
@@ -6766,8 +6761,7 @@ void ast_do_masquerade(struct ast_channel *original)
ast_debug(1, "Done Masquerading %s (%d)\n", ast_channel_name(original), ast_channel_state(original));
- if ((bridged = ast_bridged_channel(original))) {
- ast_channel_ref(bridged);
+ if ((bridged = ast_channel_bridge_peer(original))) {
ast_channel_unlock(original);
ast_indicate(bridged, AST_CONTROL_SRCCHANGE);
ast_channel_unref(bridged);
@@ -6868,12 +6862,6 @@ int ast_setstate(struct ast_channel *chan, enum ast_channel_state state)
return 0;
}
-/*! BUGBUG ast_bridged_channel() is to be removed. */
-struct ast_channel *ast_bridged_channel(struct ast_channel *chan)
-{
- return NULL;
-}
-
/*! \brief Bridge two channels together (early) */
int ast_channel_early_bridge(struct ast_channel *c0, struct ast_channel *c1)
{
diff --git a/main/channel_internal_api.c b/main/channel_internal_api.c
index 35bcb187d..698783707 100644
--- a/main/channel_internal_api.c
+++ b/main/channel_internal_api.c
@@ -67,10 +67,6 @@ struct ast_channel {
void *music_state; /*!< Music State*/
void *generatordata; /*!< Current generator data if there is any */
struct ast_generator *generator; /*!< Current active data generator */
-/* BUGBUG bridged_channel must be eliminated from ast_channel */
- struct ast_channel * bridged_channel; /*!< Who are we bridged to, if we're bridged.
- * Who is proxying for us, if we are proxied (i.e. chan_agent).
- * Do not access directly, use ast_bridged_channel(chan) */
struct ast_channel *masq; /*!< Channel that will masquerade as us */
struct ast_channel *masqr; /*!< Who we are masquerading as */
const char *blockproc; /*!< Procedure causing blocking */
@@ -290,7 +286,6 @@ static void channel_data_add_flags(struct ast_data *tree,
int ast_channel_data_add_structure(struct ast_data *tree,
struct ast_channel *chan, int add_bridged)
{
- struct ast_channel *bc;
struct ast_data *data_bridged;
struct ast_data *data_cdr;
struct ast_data *data_flags;
@@ -309,7 +304,7 @@ int ast_channel_data_add_structure(struct ast_data *tree,
ast_data_add_structure(ast_channel, tree, chan);
if (add_bridged) {
- bc = ast_bridged_channel(chan);
+ RAII_VAR(struct ast_channel *, bc, ast_channel_bridge_peer(chan), ast_channel_cleanup);
if (bc) {
data_bridged = ast_data_add_node(tree, "bridged");
if (!data_bridged) {
@@ -1304,15 +1299,6 @@ void ast_channel_internal_bridge_channel_set(struct ast_channel *chan, struct as
chan->bridge_channel = value;
}
-struct ast_channel *ast_channel_internal_bridged_channel(const struct ast_channel *chan)
-{
- return chan->bridged_channel;
-}
-void ast_channel_internal_bridged_channel_set(struct ast_channel *chan, struct ast_channel *value)
-{
- chan->bridged_channel = value;
-}
-
struct ast_flags *ast_channel_flags(struct ast_channel *chan)
{
return &chan->flags;
diff --git a/main/rtp_engine.c b/main/rtp_engine.c
index 907cb271a..1a5333ebd 100644
--- a/main/rtp_engine.c
+++ b/main/rtp_engine.c
@@ -1298,7 +1298,7 @@ char *ast_rtp_instance_get_quality(struct ast_rtp_instance *instance, enum ast_r
void ast_rtp_instance_set_stats_vars(struct ast_channel *chan, struct ast_rtp_instance *instance)
{
char quality_buf[AST_MAX_USER_FIELD], *quality;
- struct ast_channel *bridge = ast_bridged_channel(chan);
+ RAII_VAR(struct ast_channel *, bridge, ast_channel_bridge_peer(chan), ast_channel_cleanup);
if ((quality = ast_rtp_instance_get_quality(instance, AST_RTP_INSTANCE_STAT_FIELD_QUALITY, quality_buf, sizeof(quality_buf)))) {
pbx_builtin_setvar_helper(chan, "RTPAUDIOQOS", quality);