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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 12 16:36:39 CDT 2013


Author: kmoore
Date: Fri Apr 12 16:36:36 2013
New Revision: 385546

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385546
Log:
Fix bridge-related AMI events

This fixes bridge-related AMI events to be AMI 1.4 spec compatible by
including the usual contents of the channel snapshot in the manager
information and exposes the bridge snapshot manger string generation
function for future use.

(issue ASTERISK-21057)
........

Merged revisions 385543 from http://svn.asterisk.org/svn/asterisk/team/group/bridge_construction
........

Merged revisions 385545 from http://svn.asterisk.org/svn/asterisk/team/kmoore/stasis-bridging-channel_events

Modified:
    team/kmoore/stasis-bridge_events/   (props changed)
    team/kmoore/stasis-bridge_events/include/asterisk/manager.h
    team/kmoore/stasis-bridge_events/main/manager_bridging.c

Propchange: team/kmoore/stasis-bridge_events/
------------------------------------------------------------------------------
--- svnmerge-integrated (original)
+++ svnmerge-integrated Fri Apr 12 16:36:36 2013
@@ -1,1 +1,1 @@
-/team/kmoore/stasis-bridging-channel_events:1-385525
+/team/kmoore/stasis-bridging-channel_events:1-385545

Modified: team/kmoore/stasis-bridge_events/include/asterisk/manager.h
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/include/asterisk/manager.h?view=diff&rev=385546&r1=385545&r2=385546
==============================================================================
--- team/kmoore/stasis-bridge_events/include/asterisk/manager.h (original)
+++ team/kmoore/stasis-bridge_events/include/asterisk/manager.h Fri Apr 12 16:36:36 2013
@@ -347,6 +347,23 @@
 struct ast_str *ast_manager_build_channel_state_string(
 		const struct ast_channel_snapshot *snapshot);
 
+/*! \brief Struct representing a snapshot of bridge state */
+struct ast_bridge_snapshot;
+
+/*!
+ * \brief Generate the AMI message body from a bridge snapshot
+ * \since 12
+ *
+ * \param snapshot the bridge snapshot for which to generate an AMI message
+ *                 body
+ *
+ * \retval NULL on error
+ * \retval ast_str* on success (must be ast_freed by caller)
+ */
+struct ast_str *ast_manager_build_bridge_state_string(
+	const struct ast_bridge_snapshot *snapshot,
+	const char *suffix);
+
 /*! \brief Struct containing info for an AMI event to send out. */
 struct ast_manager_event_blob {
 	int event_flags;		/*!< Flags the event should be raised with. */

Modified: team/kmoore/stasis-bridge_events/main/manager_bridging.c
URL: http://svnview.digium.com/svn/asterisk/team/kmoore/stasis-bridge_events/main/manager_bridging.c?view=diff&rev=385546&r1=385545&r2=385546
==============================================================================
--- team/kmoore/stasis-bridge_events/main/manager_bridging.c (original)
+++ team/kmoore/stasis-bridge_events/main/manager_bridging.c Fri Apr 12 16:36:36 2013
@@ -108,17 +108,7 @@
 	</manager>
  ***/
 
-/*!
- * \brief Generate the AMI message body from a bridge snapshot
- * \internal
- *
- * \param snapshot the bridge snapshot for which to generate an AMI message
- *                 body
- *
- * \retval NULL on error
- * \retval ast_str* on success (must be ast_freed by caller)
- */
-static struct ast_str *manager_build_bridge_state_string(
+struct ast_str *ast_manager_build_bridge_state_string(
 	const struct ast_bridge_snapshot *snapshot,
 	const char *suffix)
 {
@@ -207,7 +197,7 @@
 		/* If we haven't already, build the channel event string */
 		if (!bridge_event_string) {
 			bridge_event_string =
-				manager_build_bridge_state_string(
+				ast_manager_build_bridge_state_string(
 					new_snapshot ? new_snapshot : old_snapshot, "");
 			if (!bridge_event_string) {
 				return;
@@ -231,8 +221,8 @@
 	ast_assert(merge_msg->to != NULL);
 	ast_assert(merge_msg->from != NULL);
 
-	to_text = manager_build_bridge_state_string(merge_msg->to, "");
-	from_text = manager_build_bridge_state_string(merge_msg->from, "From");
+	to_text = ast_manager_build_bridge_state_string(merge_msg->to, "");
+	from_text = ast_manager_build_bridge_state_string(merge_msg->from, "From");
 
 	/*** DOCUMENTATION
 		<managerEventInstance>
@@ -262,6 +252,7 @@
 	struct ast_bridge_blob *blob = stasis_message_data(message);
 	const char *type = ast_bridge_blob_json_type(blob);
 	RAII_VAR(struct ast_str *, bridge_text, NULL, ast_free);
+	RAII_VAR(struct ast_str *, channel_text, NULL, ast_free);
 	char *event;
 
 	if (!strcmp("leave", type)) {
@@ -272,13 +263,14 @@
 		return;
 	}
 
-	bridge_text = manager_build_bridge_state_string(blob->bridge, "");
+	bridge_text = ast_manager_build_bridge_state_string(blob->bridge, "");
+	channel_text = ast_manager_build_channel_state_string(blob->channel);
 
 	manager_event(EVENT_FLAG_CALL, event,
 		"%s"
-		"Uniqueid: %s\r\n",
+		"%s",
 		ast_str_buffer(bridge_text),
-		blob->channel->uniqueid);
+		ast_str_buffer(channel_text));
 }
 
 static int filter_bridge_type_cb(void *obj, void *arg, int flags)
@@ -294,7 +286,7 @@
 	struct ast_bridge_snapshot *snapshot = stasis_message_data(obj);
 	struct mansession *s = arg;
 	char *id_text = data;
-	RAII_VAR(struct ast_str *, bridge_info, manager_build_bridge_state_string(snapshot, ""), ast_free);
+	RAII_VAR(struct ast_str *, bridge_info, ast_manager_build_bridge_state_string(snapshot, ""), ast_free);
 
 	astman_append(s,
 		"Event: BridgeListItem\r\n"
@@ -390,7 +382,7 @@
 	}
 
 	snapshot = stasis_message_data(msg);
-	bridge_info = manager_build_bridge_state_string(snapshot, "");
+	bridge_info = ast_manager_build_bridge_state_string(snapshot, "");
 
 	ao2_callback_data(snapshot->channels, OBJ_NODATA, send_bridge_info_item_cb, s, ast_str_buffer(id_text));
 




More information about the asterisk-commits mailing list