From f8622e7c5cbdda91a5efad230a9e3af593378c7c Mon Sep 17 00:00:00 2001 From: Mark Michelson Date: Fri, 2 Aug 2013 14:05:07 +0000 Subject: 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 --- channels/chan_mgcp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'channels/chan_mgcp.c') diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c index b99064646..07d8434cb 100644 --- a/channels/chan_mgcp.c +++ b/channels/chan_mgcp.c @@ -922,7 +922,6 @@ static int mgcp_hangup(struct ast_channel *ast) { struct mgcp_subchannel *sub = ast_channel_tech_pvt(ast); struct mgcp_endpoint *p = sub->parent; - struct ast_channel *bridged; ast_debug(1, "mgcp_hangup(%s)\n", ast_channel_name(ast)); if (!ast_channel_tech_pvt(ast)) { @@ -969,10 +968,11 @@ static int mgcp_hangup(struct ast_channel *ast) } sub->cxident[0] = '\0'; if ((sub == p->sub) && sub->next->owner) { + RAII_VAR(struct ast_channel *, bridged, ast_channel_bridge_peer(sub->next->owner), ast_channel_cleanup); + if (p->hookstate == MGCP_OFFHOOK) { - if (sub->next->owner && ast_bridged_channel(sub->next->owner)) { + if (sub->next->owner && bridged) { /* ncs fix! */ - bridged = ast_bridged_channel(sub->next->owner); transmit_notify_request_with_callerid(p->sub, (p->ncs ? "L/wt1" : "L/wt"), S_COR(ast_channel_caller(bridged)->id.number.valid, ast_channel_caller(bridged)->id.number.str, ""), S_COR(ast_channel_caller(bridged)->id.name.valid, ast_channel_caller(bridged)->id.name.str, "")); @@ -982,8 +982,7 @@ static int mgcp_hangup(struct ast_channel *ast) p->sub = sub->next; p->sub->cxmode = MGCP_CX_RECVONLY; transmit_modify_request(p->sub); - if (sub->next->owner && ast_bridged_channel(sub->next->owner)) { - bridged = ast_bridged_channel(sub->next->owner); + if (sub->next->owner && bridged) { transmit_notify_request_with_callerid(p->sub, "L/rg", S_COR(ast_channel_caller(bridged)->id.number.valid, ast_channel_caller(bridged)->id.number.str, ""), S_COR(ast_channel_caller(bridged)->id.name.valid, ast_channel_caller(bridged)->id.name.str, "")); -- cgit v1.2.3