diff options
author | Mark Michelson <mmichelson@digium.com> | 2013-08-02 14:05:07 +0000 |
---|---|---|
committer | Mark Michelson <mmichelson@digium.com> | 2013-08-02 14:05:07 +0000 |
commit | f8622e7c5cbdda91a5efad230a9e3af593378c7c (patch) | |
tree | ac2c4b5f2256fb55c84fb8915d82298d23c0e188 /channels/chan_misdn.c | |
parent | 57a8148ccd704f02f33c65d902b199f4205e5480 (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 'channels/chan_misdn.c')
-rw-r--r-- | channels/chan_misdn.c | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/channels/chan_misdn.c b/channels/chan_misdn.c index 34a134eb4..8eaf19600 100644 --- a/channels/chan_misdn.c +++ b/channels/chan_misdn.c @@ -104,6 +104,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$") #include "asterisk/format_cap.h" #include "asterisk/features_config.h" #include "asterisk/bridge.h" +#include "asterisk/pickup.h" #include "chan_misdn_config.h" #include "isdn_lib.h" @@ -3442,6 +3443,7 @@ static void misdn_add_number_prefix(int port, enum mISDN_NUMBER_TYPE number_type static void export_aoc_vars(int originator, struct ast_channel *ast, struct misdn_bchannel *bc) { + RAII_VAR(struct ast_channel *, chan, NULL, ast_channel_cleanup); char buf[128]; if (!bc->AOCD_need_export || !ast) { @@ -3449,46 +3451,48 @@ static void export_aoc_vars(int originator, struct ast_channel *ast, struct misd } if (originator == ORG_AST) { - ast = ast_bridged_channel(ast); - if (!ast) { + chan = ast_channel_bridge_peer(ast); + if (!chan) { return; } + } else { + chan = ast_channel_ref(ast); } switch (bc->AOCDtype) { case Fac_AOCDCurrency: - pbx_builtin_setvar_helper(ast, "AOCD_Type", "currency"); + pbx_builtin_setvar_helper(chan, "AOCD_Type", "currency"); if (bc->AOCD.currency.chargeNotAvailable) { - pbx_builtin_setvar_helper(ast, "AOCD_ChargeAvailable", "no"); + pbx_builtin_setvar_helper(chan, "AOCD_ChargeAvailable", "no"); } else { - pbx_builtin_setvar_helper(ast, "AOCD_ChargeAvailable", "yes"); + pbx_builtin_setvar_helper(chan, "AOCD_ChargeAvailable", "yes"); if (bc->AOCD.currency.freeOfCharge) { - pbx_builtin_setvar_helper(ast, "AOCD_FreeOfCharge", "yes"); + pbx_builtin_setvar_helper(chan, "AOCD_FreeOfCharge", "yes"); } else { - pbx_builtin_setvar_helper(ast, "AOCD_FreeOfCharge", "no"); + pbx_builtin_setvar_helper(chan, "AOCD_FreeOfCharge", "no"); if (snprintf(buf, sizeof(buf), "%d %s", bc->AOCD.currency.currencyAmount * bc->AOCD.currency.multiplier, bc->AOCD.currency.currency) < sizeof(buf)) { - pbx_builtin_setvar_helper(ast, "AOCD_Amount", buf); + pbx_builtin_setvar_helper(chan, "AOCD_Amount", buf); if (bc->AOCD.currency.billingId >= 0 && snprintf(buf, sizeof(buf), "%d", bc->AOCD.currency.billingId) < sizeof(buf)) { - pbx_builtin_setvar_helper(ast, "AOCD_BillingId", buf); + pbx_builtin_setvar_helper(chan, "AOCD_BillingId", buf); } } } } break; case Fac_AOCDChargingUnit: - pbx_builtin_setvar_helper(ast, "AOCD_Type", "charging_unit"); + pbx_builtin_setvar_helper(chan, "AOCD_Type", "charging_unit"); if (bc->AOCD.chargingUnit.chargeNotAvailable) { - pbx_builtin_setvar_helper(ast, "AOCD_ChargeAvailable", "no"); + pbx_builtin_setvar_helper(chan, "AOCD_ChargeAvailable", "no"); } else { - pbx_builtin_setvar_helper(ast, "AOCD_ChargeAvailable", "yes"); + pbx_builtin_setvar_helper(chan, "AOCD_ChargeAvailable", "yes"); if (bc->AOCD.chargingUnit.freeOfCharge) { - pbx_builtin_setvar_helper(ast, "AOCD_FreeOfCharge", "yes"); + pbx_builtin_setvar_helper(chan, "AOCD_FreeOfCharge", "yes"); } else { - pbx_builtin_setvar_helper(ast, "AOCD_FreeOfCharge", "no"); + pbx_builtin_setvar_helper(chan, "AOCD_FreeOfCharge", "no"); if (snprintf(buf, sizeof(buf), "%d", bc->AOCD.chargingUnit.recordedUnits) < sizeof(buf)) { - pbx_builtin_setvar_helper(ast, "AOCD_RecordedUnits", buf); + pbx_builtin_setvar_helper(chan, "AOCD_RecordedUnits", buf); if (bc->AOCD.chargingUnit.billingId >= 0 && snprintf(buf, sizeof(buf), "%d", bc->AOCD.chargingUnit.billingId) < sizeof(buf)) { - pbx_builtin_setvar_helper(ast, "AOCD_BillingId", buf); + pbx_builtin_setvar_helper(chan, "AOCD_BillingId", buf); } } } @@ -10943,7 +10947,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) case EVENT_HOLD: { int hold_allowed; - struct ast_channel *bridged; + RAII_VAR(struct ast_channel *, bridged, NULL, ast_channel_cleanup); misdn_cfg_get(bc->port, MISDN_CFG_HOLD_ALLOWED, &hold_allowed, sizeof(hold_allowed)); if (!hold_allowed) { @@ -10952,7 +10956,7 @@ cb_events(enum event_e event, struct misdn_bchannel *bc, void *user_data) break; } - bridged = ast_bridged_channel(ch->ast); + bridged = ast_channel_bridge_peer(ch->ast); if (bridged) { chan_misdn_log(2, bc->port, "Bridge Partner is of type: %s\n", ast_channel_tech(bridged)->type); ch->l3id = bc->l3_id; |