summaryrefslogtreecommitdiff
path: root/channels/chan_mgcp.c
diff options
context:
space:
mode:
authorMatthew Jordan <mjordan@digium.com>2013-08-01 20:55:17 +0000
committerMatthew Jordan <mjordan@digium.com>2013-08-01 20:55:17 +0000
commit5c4b482471edb8a839d754dd654dc72605caac66 (patch)
treed164a3ebd03e7101a39929283b75d2318a2f6761 /channels/chan_mgcp.c
parentc8a91b5b013c568f3f99e8fb7abc662775c60520 (diff)
Support externally initiated parking requests; remove some dead code
This patch does the following: * It adds support for externally initiated parking requests. In particular, chan_skinny has a protocol level message that initiates a call park. This patch now supports that option, as well as the protocol specific mechanisms in chan_dahdi/sig_analog and chan_mgcp. * A parking bridge features virtual table has been added that provides access to the parking functionality that the Bridging API needs. This includes requests to park an entire 'call' (with little or no additional information, thank you chan_skinny), perform a blind transfer to a parking extension, determine if an extension is a parking extension, as well as the actual "do the parking" request from the Bridging API. * Refactoring in chan_mgcp, chan_skinny, and chan_dahdi to make use of the new functions * The removal of some - but not all - dead parking code from features.c This also fixed blind transferring a multi-party bridge to a parking lot (which was implemented, but had at least one code path where using the parking features kK might not have worked) Review: https://reviewboard.asterisk.org/r/2710 (closes issue ASTERISK-22134) Reported by: Matt Jordan git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396028 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_mgcp.c')
-rw-r--r--channels/chan_mgcp.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/channels/chan_mgcp.c b/channels/chan_mgcp.c
index 79208daa0..233d2c3ff 100644
--- a/channels/chan_mgcp.c
+++ b/channels/chan_mgcp.c
@@ -84,6 +84,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
#include "asterisk/stasis.h"
#include "asterisk/bridge.h"
#include "asterisk/features_config.h"
+#include "asterisk/parking.h"
/*
* Define to work around buggy dlink MGCP phone firmware which
@@ -2980,6 +2981,9 @@ static void *mgcp_ss(void *data)
int getforward = 0;
int loop_pause = 100;
RAII_VAR(struct ast_features_pickup_config *, pickup_cfg, NULL, ao2_cleanup);
+ RAII_VAR(struct ast_parking_bridge_feature_fn_table *, parking_provider,
+ ast_parking_get_bridge_features(),
+ ao2_cleanup);
const char *pickupexten;
len = strlen(p->dtmf_buf);
@@ -3148,13 +3152,17 @@ static void *mgcp_ss(void *data)
getforward = 0;
memset(p->dtmf_buf, 0, sizeof(p->dtmf_buf));
len = 0;
- } else if (ast_parking_ext_valid(p->dtmf_buf, chan, ast_channel_context(chan)) &&
- sub->next->owner && ast_bridged_channel(sub->next->owner)) {
+ } else if (parking_provider && parking_provider->parking_is_exten_park(ast_channel_context(chan), p->dtmf_buf) &&
+ sub->next->owner) {
+ RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup);
/* 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(sub->next->owner), chan,
- p->dtmf_buf, ast_channel_context(chan), 0, NULL);
- ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan));
+ and we're parking the first call. */
+ ast_channel_lock(chan);
+ bridge_channel = ast_channel_get_bridge_channel(chan);
+ ast_channel_unlock(chan);
+ if (bridge_channel && !parking_provider->parking_blind_transfer_park(bridge_channel, ast_channel_context(chan), p->dtmf_buf)) {
+ ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan));
+ }
break;
} else if (!ast_strlen_zero(p->lastcallerid) && !strcmp(p->dtmf_buf, "*60")) {
ast_verb(3, "Blacklisting number %s\n", p->lastcallerid);