[svn-commits] mmichelson: branch mmichelson/bridged_channel r395720 - /team/mmichelson/brid...
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Mon Jul 29 17:54:24 CDT 2013
Author: mmichelson
Date: Mon Jul 29 17:54:22 2013
New Revision: 395720
URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=395720
Log:
Get rid of ast_bridged_channel() calls in chan_dahdi and its cohorts.
Modified:
team/mmichelson/bridged_channel/channels/chan_dahdi.c
team/mmichelson/bridged_channel/channels/sig_analog.c
Modified: team/mmichelson/bridged_channel/channels/chan_dahdi.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/bridged_channel/channels/chan_dahdi.c?view=diff&rev=395720&r1=395719&r2=395720
==============================================================================
--- team/mmichelson/bridged_channel/channels/chan_dahdi.c (original)
+++ team/mmichelson/bridged_channel/channels/chan_dahdi.c Mon Jul 29 17:54:22 2013
@@ -1740,7 +1740,11 @@
static void *my_get_sigpvt_bridged_channel(struct ast_channel *chan)
{
- struct ast_channel *bridged = ast_bridged_channel(chan);
+ RAII_VAR(struct ast_channel *, bridged, NULL, ast_channel_cleanup);
+
+ ast_channel_lock(chan);
+ bridged = ast_channel_bridge_peer(chan);
+ ast_channel_unlock(chan);
if (bridged && ast_channel_tech(bridged) == &dahdi_tech) {
struct dahdi_pvt *p = ast_channel_tech_pvt(bridged);
@@ -9702,11 +9706,21 @@
len = 0;
} else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan, ast_channel_context(chan)) &&
p->subs[SUB_THREEWAY].owner &&
- ast_bridged_channel(p->subs[SUB_THREEWAY].owner)) {
+ ast_channel_is_bridged(p->subs[SUB_THREEWAY].owner)) {
+ RAII_VAR(struct ast_channel *, bridged, NULL, ast_channel_cleanup);
+
+ ast_channel_lock(p->subs[SUB_THREEWAY].owner);
+ bridged = ast_channel_bridge_peer(p->subs[SUB_THREEWAY].owner);
+ ast_channel_unlock(p->subs[SUB_THREEWAY].owner);
+
+ if (!bridged) {
+ /* Channel is in a bridge but with more than one bridged party */
+ break;
+ }
+
/* This is a three way call, the main call being a real channel,
and we're parking the first call. */
- ast_masq_park_call_exten(ast_bridged_channel(p->subs[SUB_THREEWAY].owner),
- chan, exten, ast_channel_context(chan), 0, NULL);
+ ast_masq_park_call_exten(bridged, chan, exten, ast_channel_context(chan), 0, NULL);
ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan));
break;
} else if (p->hidecallerid && !strcmp(exten, "*82")) {
@@ -9723,15 +9737,22 @@
memset(exten, 0, sizeof(exten));
timeout = firstdigittimeout;
} else if (!strcmp(exten, "*0")) {
+ RAII_VAR(struct ast_channel *, bridged, NULL, ast_channel_cleanup);
struct ast_channel *nbridge =
p->subs[SUB_THREEWAY].owner;
struct dahdi_pvt *pbridge = NULL;
+
+ ast_channel_lock(nbridge);
+ bridged = ast_channel_bridge_peer(nbridge);
+ ast_channel_unlock(nbridge);
+
/* set up the private struct of the bridged one, if any */
- if (nbridge && ast_bridged_channel(nbridge))
- pbridge = ast_channel_tech_pvt(ast_bridged_channel(nbridge));
+ if (nbridge && bridged) {
+ pbridge = ast_channel_tech_pvt(bridged);
+ }
if (nbridge && pbridge &&
(ast_channel_tech(nbridge) == &dahdi_tech) &&
- (ast_channel_tech(ast_bridged_channel(nbridge)) == &dahdi_tech) &&
+ (ast_channel_tech(bridged) == &dahdi_tech) &&
ISTRUNK(pbridge)) {
int func = DAHDI_FLASH;
/* Clear out the dial buffer */
Modified: team/mmichelson/bridged_channel/channels/sig_analog.c
URL: http://svnview.digium.com/svn/asterisk/team/mmichelson/bridged_channel/channels/sig_analog.c?view=diff&rev=395720&r1=395719&r2=395720
==============================================================================
--- team/mmichelson/bridged_channel/channels/sig_analog.c (original)
+++ team/mmichelson/bridged_channel/channels/sig_analog.c Mon Jul 29 17:54:22 2013
@@ -2240,12 +2240,20 @@
len = 0;
} else if ((p->transfer || p->canpark) && ast_parking_ext_valid(exten, chan, ast_channel_context(chan)) &&
p->subs[ANALOG_SUB_THREEWAY].owner &&
- ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner)) {
+ ast_channel_is_bridged(p->subs[ANALOG_SUB_THREEWAY].owner)) {
+ RAII_VAR(struct ast_channel *, bridged, NULL, ast_channel_cleanup);
+
+ ast_channel_lock(p->subs[ANALOG_SUB_THREEWAY].owner);
+ bridged = ast_channel_bridge_peer(p->subs[ANALOG_SUB_THREEWAY].owner);
+ ast_channel_unlock(p->subs[ANALOG_SUB_THREEWAY].owner);
+
+ if (!bridged) {
+ break;
+ }
+
/* This is a three way call, the main call being a real channel,
and we're parking the first call. */
- ast_masq_park_call_exten(
- ast_bridged_channel(p->subs[ANALOG_SUB_THREEWAY].owner), chan, exten,
- ast_channel_context(chan), 0, NULL);
+ ast_masq_park_call_exten(bridged, chan, exten, ast_channel_context(chan), 0, NULL);
ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan));
break;
} else if (!ast_strlen_zero(p->lastcid_num) && !strcmp(exten, "*60")) {
More information about the svn-commits
mailing list