[svn-commits] kmoore: branch kmoore/cel_cleanup r392316 - in /team/kmoore/cel_cleanup: incl...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu Jun 20 11:12:40 CDT 2013


Author: kmoore
Date: Thu Jun 20 11:12:38 2013
New Revision: 392316

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=392316
Log:
Bring things in line with the task

Modified:
    team/kmoore/cel_cleanup/include/asterisk/cel.h
    team/kmoore/cel_cleanup/main/cel.c

Modified: team/kmoore/cel_cleanup/include/asterisk/cel.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_cleanup/include/asterisk/cel.h?view=diff&rev=392316&r1=392315&r2=392316
==============================================================================
--- team/kmoore/cel_cleanup/include/asterisk/cel.h (original)
+++ team/kmoore/cel_cleanup/include/asterisk/cel.h Thu Jun 20 11:12:38 2013
@@ -255,6 +255,14 @@
 	enum ast_cel_event_type event_type,
 	struct ast_json *blob);
 
+/*!
+ * \brief Get the CEL topic
+ *
+ * \retval The CEL topic
+ * \retval NULL if not allocated
+ */
+struct stasis_topic *ast_cel_topic(void);
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

Modified: team/kmoore/cel_cleanup/main/cel.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/cel_cleanup/main/cel.c?view=diff&rev=392316&r1=392315&r2=392316
==============================================================================
--- team/kmoore/cel_cleanup/main/cel.c (original)
+++ team/kmoore/cel_cleanup/main/cel.c Thu Jun 20 11:12:38 2013
@@ -125,8 +125,11 @@
 /*! Message router for state that CEL needs to know about */
 static struct stasis_message_router *cel_state_router;
 
+/*! Topic for CEL-specific messages */
+static struct stasis_topic *cel_topic;
+
 /*! Aggregation topic for all topics CEL needs to know about */
-static struct stasis_topic *cel_state_topic;
+static struct stasis_topic *cel_aggregation_topic;
 
 /*! Subscription for forwarding the channel caching topic */
 static struct stasis_subscription *cel_channel_forwarder;
@@ -136,6 +139,9 @@
 
 /*! Subscription for forwarding the parking topic */
 static struct stasis_subscription *cel_parking_forwarder;
+
+/*! Subscription for forwarding the CEL-specific topic */
+static struct stasis_subscription *cel_cel_forwarder;
 
 /*! Container for primary channel/bridge ID listing for 2 party bridges */
 static struct ao2_container *bridge_primaries;
@@ -1447,11 +1453,14 @@
 {
 	stasis_message_router_unsubscribe_and_join(cel_state_router);
 	cel_state_router = NULL;
-	ao2_cleanup(cel_state_topic);
-	cel_state_topic = NULL;
+	ao2_cleanup(cel_aggregation_topic);
+	cel_aggregation_topic = NULL;
+	ao2_cleanup(cel_topic);
+	cel_topic = NULL;
 	cel_channel_forwarder = stasis_unsubscribe_and_join(cel_channel_forwarder);
 	cel_bridge_forwarder = stasis_unsubscribe_and_join(cel_bridge_forwarder);
 	cel_parking_forwarder = stasis_unsubscribe_and_join(cel_parking_forwarder);
+	cel_cel_forwarder = stasis_unsubscribe_and_join(cel_cel_forwarder);
 	ao2_cleanup(linkedids);
 	linkedids = NULL;
 	ast_cli_unregister(&cli_status);
@@ -1484,33 +1493,45 @@
 		return -1;
 	}
 
-	cel_state_topic = stasis_topic_create("cel_state_topic");
-	if (!cel_state_topic) {
+	cel_aggregation_topic = stasis_topic_create("cel_aggregation_topic");
+	if (!cel_aggregation_topic) {
+		return -1;
+	}
+
+	cel_topic = stasis_topic_create("cel_topic");
+	if (!cel_topic) {
 		return -1;
 	}
 
 	cel_channel_forwarder = stasis_forward_all(
 		stasis_caching_get_topic(ast_channel_topic_all_cached()),
-		cel_state_topic);
+		cel_aggregation_topic);
 	if (!cel_channel_forwarder) {
 		return -1;
 	}
 
 	cel_bridge_forwarder = stasis_forward_all(
 		stasis_caching_get_topic(ast_bridge_topic_all_cached()),
-		cel_state_topic);
+		cel_aggregation_topic);
 	if (!cel_bridge_forwarder) {
 		return -1;
 	}
 
 	cel_parking_forwarder = stasis_forward_all(
 		ast_parking_topic(),
-		cel_state_topic);
+		cel_aggregation_topic);
 	if (!cel_parking_forwarder) {
 		return -1;
 	}
 
-	cel_state_router = stasis_message_router_create(cel_state_topic);
+	cel_cel_forwarder = stasis_forward_all(
+		ast_cel_topic(),
+		cel_aggregation_topic);
+	if (!cel_cel_forwarder) {
+		return -1;
+	}
+
+	cel_state_router = stasis_message_router_create(cel_aggregation_topic);
 	if (!cel_state_router) {
 		return -1;
 	}
@@ -1580,8 +1601,18 @@
 {
 	RAII_VAR(struct ast_channel_blob *, obj, NULL, ao2_cleanup);
 	RAII_VAR(struct ast_json *, cel_blob, NULL, ast_json_unref);
+	RAII_VAR(struct stasis_message *, message, NULL, ao2_cleanup);
 	cel_blob = ast_json_pack("{s: i, s: O}",
 		"event_type", event_type,
 		"event_details", blob);
-	ast_channel_publish_blob(chan, cel_generic_type(), cel_blob);
-}
+
+	message = ast_channel_blob_create(chan, cel_generic_type(), cel_blob);
+	if (message) {
+		stasis_publish(ast_cel_topic(), message);
+	}
+}
+
+struct stasis_topic *ast_cel_topic(void)
+{
+	return cel_topic;
+}




More information about the svn-commits mailing list