[asterisk-commits] kmoore: branch kmoore/stasis-bridge_events r385087 - in /team/kmoore/stasis-b...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Apr 8 23:28:28 CDT 2013


Author: kmoore
Date: Mon Apr  8 23:28:24 2013
New Revision: 385087

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385087
Log:
Fix several bugs

Fix message route registration for bridge router in app_stasis event generation
Fix a crash where non-nullity of both snapshots in an update was assumed
Add bridge identifier for manager class filtering

Modified:
    team/kmoore/stasis-bridge_events/apps/app_stasis.c
    team/kmoore/stasis-bridge_events/main/manager.c

Modified: team/kmoore/stasis-bridge_events/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/apps/app_stasis.c?view=diff&rev=385087&r1=385086&r2=385087
==============================================================================
--- team/kmoore/stasis-bridge_events/apps/app_stasis.c (original)
+++ team/kmoore/stasis-bridge_events/apps/app_stasis.c Mon Apr  8 23:28:24 2013
@@ -1036,7 +1036,9 @@
 	int i;
 
 	/* update bridge_info for added channels if there is interest */ 
-	entering_chan = ao2_callback(new_snapshot->channels, 0, find_diff, old_snapshot->channels);
+	if (new_snapshot && old_snapshot) {
+		entering_chan = ao2_callback(new_snapshot->channels, 0, find_diff, old_snapshot->channels);
+	}
 	info = bridge_info_create_or_update(bridge_uniqueid, entering_chan);
 	if (!info) {
 		/* no interest in this bridge */
@@ -1060,8 +1062,10 @@
 
 bridge_handler_cleanup:
 	/* update bridge_info for removed channels if there is interest */ 
-	leaving_chan = ao2_callback(old_snapshot->channels, 0, find_diff, new_snapshot->channels);
-	ao2_find(info->channels, leaving_chan, OBJ_UNLINK | OBJ_NODATA);
+	if (new_snapshot && old_snapshot) {
+		leaving_chan = ao2_callback(old_snapshot->channels, 0, find_diff, new_snapshot->channels);
+		ao2_find(info->channels, leaving_chan, OBJ_UNLINK | OBJ_NODATA);
+	}
 }
 
 /*!
@@ -1249,7 +1253,9 @@
 
 	r |= stasis_message_router_add(app_channel_router, stasis_cache_update_type(), sub_snapshot_handler, NULL);
 	r |= stasis_message_router_add(app_channel_router, ast_channel_blob_type(), sub_blob_handler, NULL);
-
+	if (r) {
+		return AST_MODULE_LOAD_FAILURE;
+	}
 
 	app_bridges = ao2_container_alloc(APP_BRIDGES_BUCKETS, bridge_info_hash, bridge_info_cmp);
 	if (!app_bridges) {
@@ -1261,10 +1267,13 @@
 		return AST_MODULE_LOAD_FAILURE;
 	}
 
-	r |= stasis_message_router_add(app_channel_router, stasis_cache_update_type(), sub_bridge_handler, NULL);
+	r |= stasis_message_router_add(app_bridge_router, stasis_cache_update_type(), sub_bridge_handler, NULL);
 
 	r |= ast_register_application_xml(stasis, app_stasis_exec);
-	return r;
+	if (r) {
+		return AST_MODULE_LOAD_FAILURE;
+	}
+	return AST_MODULE_LOAD_SUCCESS;
 }
 
 static int unload_module(void)

Modified: team/kmoore/stasis-bridge_events/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/manager.c?view=diff&rev=385087&r1=385086&r2=385087
==============================================================================
--- team/kmoore/stasis-bridge_events/main/manager.c (original)
+++ team/kmoore/stasis-bridge_events/main/manager.c Mon Apr  8 23:28:24 2013
@@ -1335,6 +1335,7 @@
 	{ EVENT_FLAG_AOC, "aoc" },
 	{ EVENT_FLAG_TEST, "test" },
 	{ EVENT_FLAG_MESSAGE, "message" },
+	{ EVENT_FLAG_BRIDGE, "bridge" },
 	{ INT_MAX, "all" },
 	{ 0, "none" },
 };




More information about the asterisk-commits mailing list