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
This commit is contained in:
Kinsey Moore
2013-08-17 15:01:54 +00:00
parent d7f1f31270
commit 56aea1c030
11 changed files with 246 additions and 118 deletions

View File

@@ -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;