[asterisk-commits] kmoore: branch kmoore/parking_unload r396875 - in /team/kmoore/parking_unload...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Aug 16 15:09:12 CDT 2013


Author: kmoore
Date: Fri Aug 16 15:09:10 2013
New Revision: 396875

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=396875
Log:
Push parking module ref/unref into parking stubs

Modified:
    team/kmoore/parking_unload/include/asterisk/parking.h
    team/kmoore/parking_unload/main/parking.c
    team/kmoore/parking_unload/res/parking/parking_bridge_features.c

Modified: team/kmoore/parking_unload/include/asterisk/parking.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/parking_unload/include/asterisk/parking.h?view=diff&rev=396875&r1=396874&r2=396875
==============================================================================
--- team/kmoore/parking_unload/include/asterisk/parking.h (original)
+++ team/kmoore/parking_unload/include/asterisk/parking.h Fri Aug 16 15:09:10 2013
@@ -114,6 +114,8 @@
 
 #define PARKING_MODULE_VERSION 1
 
+struct ast_module_info;
+
 /*!
  * \brief A function table providing parking functionality to the \ref AstBridging
  * Bridging API and other consumers
@@ -188,6 +190,9 @@
 	 * \retval non-zero on error
 	 */
 	int (* parking_park_bridge_channel)(struct ast_bridge_channel *parkee, const char *parkee_uuid, const char *parker_uuid, const char *app_data);
+
+	/*! \brief The module info for the module registering this parking provider */
+	const struct ast_module_info *module_info;
 };
 
 /*!

Modified: team/kmoore/parking_unload/main/parking.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/parking_unload/main/parking.c?view=diff&rev=396875&r1=396874&r2=396875
==============================================================================
--- team/kmoore/parking_unload/main/parking.c (original)
+++ team/kmoore/parking_unload/main/parking.c Fri Aug 16 15:09:10 2013
@@ -34,6 +34,7 @@
 #include "asterisk/parking.h"
 #include "asterisk/channel.h"
 #include "asterisk/_private.h"
+#include "asterisk/module.h"
 
 /*! \brief Message type for parked calls */
 STASIS_MESSAGE_TYPE_DEFN(ast_parked_call_type);
@@ -133,6 +134,11 @@
 		return -1;
 	}
 
+	if (table->module_info) {
+		SCOPED_MODULE_USE(table->module_info->self);
+		return table->parking_park_bridge_channel(parkee, parkee_uuid, parker_uuid, app_data);
+	}
+
 	return table->parking_park_bridge_channel(parkee, parkee_uuid, parker_uuid, app_data);
 }
 
@@ -145,6 +151,11 @@
 		return -1;
 	}
 
+	if (table->module_info) {
+		SCOPED_MODULE_USE(table->module_info->self);
+		return table->parking_blind_transfer_park(parker, context, exten);
+	}
+
 	return table->parking_blind_transfer_park(parker, context, exten);
 }
 
@@ -157,6 +168,11 @@
 		return -1;
 	}
 
+	if (table->module_info) {
+		SCOPED_MODULE_USE(table->module_info->self);
+		return table->parking_park_call(parker, exten, length);
+	}
+
 	return table->parking_park_call(parker, exten, length);
 }
 
@@ -167,6 +183,11 @@
 
 	if (!table || !table->parking_is_exten_park) {
 		return -1;
+	}
+
+	if (table->module_info) {
+		SCOPED_MODULE_USE(table->module_info->self);
+		return table->parking_is_exten_park(context, exten);
 	}
 
 	return table->parking_is_exten_park(context, exten);

Modified: team/kmoore/parking_unload/res/parking/parking_bridge_features.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/parking_unload/res/parking/parking_bridge_features.c?view=diff&rev=396875&r1=396874&r2=396875
==============================================================================
--- team/kmoore/parking_unload/res/parking/parking_bridge_features.c (original)
+++ team/kmoore/parking_unload/res/parking/parking_bridge_features.c Fri Aug 16 15:09:10 2013
@@ -241,7 +241,6 @@
 	struct ast_exten *exten_obj;
 	struct pbx_find_info info = { .stacklen = 0 }; /* the rest is reset in pbx_find_extension */
 	const char *app_at_exten;
-	SCOPED_MODULE_USE(parking_get_module_info()->self);
 
 	ast_debug(4, "Checking if %s@%s is a parking exten\n", exten, context);
 	exten_obj = pbx_find_extension(NULL, NULL, &info, context, exten, 1, NULL, NULL, E_MATCH);
@@ -279,7 +278,6 @@
 {
 	RAII_VAR(struct ast_bridge_channel *, other, NULL, ao2_cleanup);
 	int peer_count;
-	SCOPED_MODULE_USE(parking_get_module_info()->self);
 
 	if (ast_strlen_zero(context) || ast_strlen_zero(exten)) {
 		return -1;
@@ -356,7 +354,6 @@
 	RAII_VAR(struct ast_bridge *, parking_bridge, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_bridge *, original_bridge, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_channel *, parker, NULL, ao2_cleanup);
-	SCOPED_MODULE_USE(parking_get_module_info()->self);
 
 	if (strcmp(ast_channel_uniqueid(bridge_channel->chan), uuid_parkee)) {
 		/* We aren't the parkee, so ignore this action. */
@@ -421,7 +418,6 @@
 {
 	RAII_VAR(struct parking_lot *, lot, NULL, ao2_cleanup);
 	const char *lot_name = NULL;
-	SCOPED_MODULE_USE(parking_get_module_info()->self);
 
 	ast_channel_lock(parker->chan);
 	lot_name = find_channel_parking_lot_name(parker->chan);
@@ -633,10 +629,15 @@
 
 int load_parking_bridge_features(void)
 {
+	parking_provider.module_info = parking_get_module_info();
+
 	if (ast_parking_register_bridge_features(&parking_provider)) {
 		return -1;
 	}
 
-	ast_bridge_features_register(AST_BRIDGE_BUILTIN_PARKCALL, feature_park_call, NULL);
+	if (ast_bridge_features_register(AST_BRIDGE_BUILTIN_PARKCALL, feature_park_call, NULL)) {
+		return -1;
+	}
+
 	return 0;
 }




More information about the asterisk-commits mailing list