[asterisk-commits] jrose: branch jrose/bridge_projects r388218 - /team/jrose/bridge_projects/res...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu May 9 15:51:25 CDT 2013


Author: jrose
Date: Thu May  9 15:51:23 2013
New Revision: 388218

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=388218
Log:
Fix a few things...

First, add SWAP_INHIBIT_TO since local channels were able to take the place of
a local channel that was parked which causes interval hooks to fall off and the
local channel to be able to occupy the parking space indefinitely. There might
be a better fix for that down the road.

Second, destroy an iterator that was accidentally left alive when doing one touch
parking and transfers to parking lots. This would leak channel references on both
the parker and parkee side when doing two party parking which prevented channel
destruction.

Third, fix a problem leading to a segfault when tearing down parker announcement
subscriptions. Also free the datastore which manages these subscriptions when the
datastore destroy function is invoked.

Modified:
    team/jrose/bridge_projects/res/parking/parking_bridge.c
    team/jrose/bridge_projects/res/parking/parking_bridge_features.c

Modified: team/jrose/bridge_projects/res/parking/parking_bridge.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/res/parking/parking_bridge.c?view=diff&rev=388218&r1=388217&r2=388218
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_bridge.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_bridge.c Thu May  9 15:51:23 2013
@@ -408,7 +408,7 @@
 	bridge = ast_bridge_alloc(sizeof(struct ast_bridge_parking), &ast_bridge_parking_v_table);
 	bridge = ast_bridge_base_init(bridge, AST_BRIDGE_CAPABILITY_HOLDING,
 		AST_BRIDGE_FLAG_MERGE_INHIBIT_TO | AST_BRIDGE_FLAG_MERGE_INHIBIT_FROM
-		| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM);
+		| AST_BRIDGE_FLAG_SWAP_INHIBIT_FROM | AST_BRIDGE_FLAG_SWAP_INHIBIT_TO);
 	bridge = ast_bridge_parking_init(bridge, bridge_lot);
 	bridge = ast_bridge_register(bridge);
 	return bridge;

Modified: team/jrose/bridge_projects/res/parking/parking_bridge_features.c
URL: http://svnview.digium.com/svn/asterisk/team/jrose/bridge_projects/res/parking/parking_bridge_features.c?view=diff&rev=388218&r1=388217&r2=388218
==============================================================================
--- team/jrose/bridge_projects/res/parking/parking_bridge_features.c (original)
+++ team/jrose/bridge_projects/res/parking/parking_bridge_features.c Thu May  9 15:51:23 2013
@@ -50,16 +50,32 @@
 
 static void parked_subscription_datastore_destroy(void *data)
 {
-	struct parked_subscription_datastore *subscription_data = data;
-
-	stasis_unsubscribe(subscription_data->parked_subscription);
-	subscription_data->parked_subscription = NULL;
+	struct parked_subscription_datastore *subscription_datastore = data;
+
+	stasis_unsubscribe(subscription_datastore->parked_subscription);
+	subscription_datastore->parked_subscription = NULL;
+
+	ast_free(subscription_datastore);
 }
 
 static const struct ast_datastore_info parked_subscription_info = {
 	.type = "park subscription",
 	.destroy = parked_subscription_datastore_destroy,
 };
+
+static void wipe_subscription_datastore(struct ast_channel *chan)
+{
+	struct ast_datastore *datastore;
+
+	ast_channel_lock(chan);
+
+	datastore = ast_channel_datastore_find(chan, &parked_subscription_info, NULL);
+	if (datastore) {
+		ast_channel_datastore_remove(chan, datastore);
+		ast_datastore_free(datastore);
+	}
+	ast_channel_unlock(chan);
+}
 
 static void parker_parked_call_message_response(struct ast_parked_call_payload *message, struct parked_subscription_data *data,
 	struct stasis_subscription *sub)
@@ -99,16 +115,13 @@
 	if (message->event_type == PARKED_CALL) {
 		/* queue the saynum on the bridge channel and hangup */
 		snprintf(saynum_buf, sizeof(saynum_buf), "%u %u", 1, message->parkingspace);
-
 		ast_bridge_channel_queue_playfile(bridge_channel, say_parking_space, saynum_buf, NULL);
-
-		/* toss the subscription */
-		stasis_unsubscribe(sub);
+		wipe_subscription_datastore(bridge_channel->chan);
 	}
 
 	if (message->event_type == PARKED_CALL_FAILED) {
 		ast_bridge_channel_queue_playfile(bridge_channel, NULL, "pbx-parkingfailed", NULL);
-		stasis_unsubscribe(sub);
+		wipe_subscription_datastore(bridge_channel->chan);
 	}
 }
 
@@ -118,20 +131,6 @@
 		struct ast_parked_call_payload *parked_call_message = stasis_message_data(message);
 		parker_parked_call_message_response(parked_call_message, data, sub);
 	}
-}
-
-static void wipe_subscription_datastore(struct ast_channel *chan)
-{
-	struct ast_datastore *datastore;
-
-	ast_channel_lock(chan);
-
-	datastore = ast_channel_datastore_find(chan, &parked_subscription_info, NULL);
-	if (datastore) {
-		ast_channel_datastore_remove(chan, datastore);
-		ast_datastore_free(datastore);
-	}
-	ast_channel_unlock(chan);
 }
 
 static int create_parked_subscription(struct ast_channel *chan, const char *parkee_uuid)
@@ -292,6 +291,7 @@
 			break;
 		}
 	}
+	ao2_iterator_destroy(&iter);
 
 	if (!other) {
 		ast_assert(0);




More information about the asterisk-commits mailing list