summaryrefslogtreecommitdiff
path: root/channels
diff options
context:
space:
mode:
authorKinsey Moore <kmoore@digium.com>2013-08-17 15:01:54 +0000
committerKinsey Moore <kmoore@digium.com>2013-08-17 15:01:54 +0000
commit56aea1c030a6ee322446b5c687da164246b0c0d5 (patch)
tree5c7729fcff1c8660d559f68a78f07d0fde579516 /channels
parentd7f1f3127084e4b7b204141c0b40c28c327f74b0 (diff)
Allow res_parking to be unloadable
This change protects accesses of res_parking such that it can unload safely once transient uses of its registered functions are complete. The parking API has been restructured such that its consumers do not have access to the vtable exposed by the parking provider, but instead route through stubs to prevent consumers from holding on to function pointers. This adds calls to all the parking unload functions and moves application loading and unloading into functions in parking_applications.c similar to the rest of the parts of res_parking. Review: https://reviewboard.asterisk.org/r/2763/ (closes issue ASTERISK-22142) git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@396890 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r--channels/chan_dahdi.c12
-rw-r--r--channels/chan_skinny.c14
-rw-r--r--channels/sig_analog.c12
3 files changed, 16 insertions, 22 deletions
diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index f2af6d918..b4078b15f 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -9245,10 +9245,6 @@ static void *analog_ss_thread(void *data)
int idx;
struct ast_format tmpfmt;
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);
- int is_exten_parking;
const char *pickupexten;
ast_mutex_lock(&ss_thread_lock);
@@ -9562,6 +9558,8 @@ static void *analog_ss_thread(void *data)
if (p->subs[SUB_THREEWAY].owner)
timeout = 999999;
while (len < AST_MAX_EXTENSION-1) {
+ int is_exten_parking = 0;
+
/* Read digit unless it's supposed to be immediate, in which case the
only answer is 's' */
if (p->immediate)
@@ -9584,7 +9582,9 @@ static void *analog_ss_thread(void *data)
} else {
tone_zone_play_tone(p->subs[idx].dfd, DAHDI_TONE_DIALTONE);
}
- is_exten_parking = (parking_provider ? parking_provider->parking_is_exten_park(ast_channel_context(chan), exten) : 0);
+ if (ast_parking_provider_registered()) {
+ is_exten_parking = ast_parking_is_exten_park(ast_channel_context(chan), exten);
+ }
if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num) && !is_exten_parking) {
if (!res || !ast_matchmore_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num)) {
if (getforward) {
@@ -9729,7 +9729,7 @@ static void *analog_ss_thread(void *data)
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), exten)) {
+ if (bridge_channel && !ast_parking_blind_transfer_park(bridge_channel, ast_channel_context(chan), exten)) {
ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan));
}
break;
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index 78e34450f..b62079616 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -6408,14 +6408,11 @@ static int handle_stimulus_message(struct skinny_req *req, struct skinnysession
{
char extout[AST_MAX_EXTENSION];
char message[32];
- RAII_VAR(struct ast_parking_bridge_feature_fn_table *, parking_provider,
- ast_parking_get_bridge_features(),
- ao2_cleanup);
RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup);
SKINNY_DEBUG(DEBUG_PACKET, 3, "Received STIMULUS_CALLPARK from %s, inst %d, callref %d\n",
d->name, instance, callreference);
- if (!parking_provider) {
+ if (!ast_parking_provider_registered()) {
transmit_displaynotify(d, "Call Park not available", 10);
break;
}
@@ -6431,7 +6428,7 @@ static int handle_stimulus_message(struct skinny_req *req, struct skinnysession
break;
}
- if (!parking_provider->parking_park_call(bridge_channel, extout, sizeof(extout))) {
+ if (!ast_parking_park_call(bridge_channel, extout, sizeof(extout))) {
snprintf(message, sizeof(message), "Call Parked at: %s", extout);
transmit_displaynotify(d, message, 10);
break;
@@ -7158,14 +7155,11 @@ static int handle_soft_key_event_message(struct skinny_req *req, struct skinnyse
{
char extout[AST_MAX_EXTENSION];
char message[32];
- RAII_VAR(struct ast_parking_bridge_feature_fn_table *, parking_provider,
- ast_parking_get_bridge_features(),
- ao2_cleanup);
RAII_VAR(struct ast_bridge_channel *, bridge_channel, NULL, ao2_cleanup);
SKINNY_DEBUG(DEBUG_PACKET, 3, "Received SOFTKEY_PARK from %s, inst %d, callref %d\n",
d->name, instance, callreference);
- if (!parking_provider) {
+ if (!ast_parking_provider_registered()) {
transmit_displaynotify(d, "Call Park not available", 10);
break;
}
@@ -7183,7 +7177,7 @@ static int handle_soft_key_event_message(struct skinny_req *req, struct skinnyse
break;
}
- if (!parking_provider->parking_park_call(bridge_channel, extout, sizeof(extout))) {
+ if (!ast_parking_park_call(bridge_channel, extout, sizeof(extout))) {
snprintf(message, sizeof(message), "Call Parked at: %s", extout);
transmit_displaynotify(d, message, 10);
break;
diff --git a/channels/sig_analog.c b/channels/sig_analog.c
index 77df5cdc6..c7885403f 100644
--- a/channels/sig_analog.c
+++ b/channels/sig_analog.c
@@ -1715,11 +1715,7 @@ static void *__analog_ss_thread(void *data)
int idx;
struct ast_callid *callid;
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;
- int is_exten_parking;
analog_increase_ss_count();
@@ -2077,6 +2073,8 @@ static void *__analog_ss_thread(void *data)
timeout = 999999;
}
while (len < AST_MAX_EXTENSION-1) {
+ int is_exten_parking = 0;
+
/* Read digit unless it's supposed to be immediate, in which case the
only answer is 's' */
if (p->immediate) {
@@ -2100,7 +2098,9 @@ static void *__analog_ss_thread(void *data)
} else {
analog_play_tone(p, idx, ANALOG_TONE_DIALTONE);
}
- is_exten_parking = (parking_provider ? parking_provider->parking_is_exten_park(ast_channel_context(chan), exten) : 0);
+ if (ast_parking_provider_registered()) {
+ is_exten_parking = ast_parking_is_exten_park(ast_channel_context(chan), exten);
+ }
if (ast_exists_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num) && !is_exten_parking) {
if (!res || !ast_matchmore_extension(chan, ast_channel_context(chan), exten, 1, p->cid_num)) {
if (getforward) {
@@ -2253,7 +2253,7 @@ static void *__analog_ss_thread(void *data)
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), exten)) {
+ if (bridge_channel && !ast_parking_blind_transfer_park(bridge_channel, ast_channel_context(chan), exten)) {
ast_verb(3, "Parking call to '%s'\n", ast_channel_name(chan));
}
ao2_ref(bridge_channel, -1);