[asterisk-commits] kmoore: trunk r385522 - in /trunk: include/asterisk/ main/

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


Author: kmoore
Date: Fri Apr 12 16:11:02 2013
New Revision: 385522

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=385522
Log:
Expose channel snapshot manager blob generation

These functions are already used in one branch (jrose's parking branch)
and will soon be used in other branches as well.

Modified:
    trunk/include/asterisk/manager.h
    trunk/main/manager_channels.c

Modified: trunk/include/asterisk/manager.h
URL: http://svnview.digium.com/svn/asterisk/trunk/include/asterisk/manager.h?view=diff&rev=385522&r1=385521&r2=385522
==============================================================================
--- trunk/include/asterisk/manager.h (original)
+++ trunk/include/asterisk/manager.h Fri Apr 12 16:11:02 2013
@@ -316,6 +316,37 @@
  */
 struct ast_datastore *astman_datastore_find(struct mansession *s, const struct ast_datastore_info *info, const char *uid);
 
+/*! \brief Struct representing a snapshot of channel state */
+struct ast_channel_snapshot;
+
+/*!
+ * \brief Generate the AMI message body from a channel snapshot
+ * \since 12
+ *
+ * \param snapshot the channel snapshot for which to generate an AMI message
+ *                 body
+ * \param suffix the suffix to append to the channel fields
+ *
+ * \retval NULL on error
+ * \retval ast_str* on success (must be ast_freed by caller)
+ */
+struct ast_str *ast_manager_build_channel_state_string_suffix(
+		const struct ast_channel_snapshot *snapshot,
+		const char *suffix);
+
+/*!
+ * \brief Generate the AMI message body from a channel snapshot
+ * \since 12
+ *
+ * \param snapshot the channel 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_channel_state_string(
+		const struct ast_channel_snapshot *snapshot);
+
 /*!
  * \brief Initialize support for AMI channel events.
  * \return 0 on success.

Modified: trunk/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/trunk/main/manager_channels.c?view=diff&rev=385522&r1=385521&r2=385522
==============================================================================
--- trunk/main/manager_channels.c (original)
+++ trunk/main/manager_channels.c Fri Apr 12 16:11:02 2013
@@ -232,18 +232,7 @@
 	</managerEvent>
  ***/
 
-/*!
- * \brief Generate the AMI message body from a channel snapshot
- * \internal
- *
- * \param snapshot the channel snapshot for which to generate an AMI message
- *                 body
- * \param suffix the suffix to append to the channel fields
- *
- * \retval NULL on error
- * \retval ast_str* on success (must be ast_freed by caller)
- */
-static struct ast_str *manager_build_channel_state_string_suffix(
+struct ast_str *ast_manager_build_channel_state_string_suffix(
 		const struct ast_channel_snapshot *snapshot,
 		const char *suffix)
 {
@@ -294,20 +283,10 @@
 	return out;
 }
 
-/*!
- * \brief Generate the AMI message body from a channel snapshot
- * \internal
- *
- * \param snapshot the channel 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_channel_state_string(
+struct ast_str *ast_manager_build_channel_state_string(
 	const struct ast_channel_snapshot *snapshot)
 {
-	return manager_build_channel_state_string_suffix(snapshot, "");
+	return ast_manager_build_channel_state_string_suffix(snapshot, "");
 }
 
 /*! \brief Struct containing info for an AMI channel event to send out. */
@@ -553,7 +532,7 @@
 		/* If we haven't already, build the channel event string */
 		if (!channel_event_string) {
 			channel_event_string =
-				manager_build_channel_state_string(new_snapshot);
+				ast_manager_build_channel_state_string(new_snapshot);
 			if (!channel_event_string) {
 				return;
 			}
@@ -572,7 +551,7 @@
 	const char *value = ast_json_string_get(ast_json_object_get(obj->blob, "value"));
 
 	if (obj->snapshot) {
-		channel_event_string = manager_build_channel_state_string(obj->snapshot);
+		channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
 	} else {
 		channel_event_string = ast_str_create(35);
 		ast_str_set(&channel_event_string, 0,
@@ -614,7 +593,7 @@
 
 	eventname = ast_json_string_get(ast_json_object_get(obj->blob, "eventname"));
 	body = ast_json_string_get(ast_json_object_get(obj->blob, "body"));
-	channel_event_string = manager_build_channel_state_string(obj->snapshot);
+	channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
 
 	if (!channel_event_string) {
 		return;
@@ -654,7 +633,7 @@
 		return;
 	}
 
-	channel_event_string = manager_build_channel_state_string(obj->snapshot);
+	channel_event_string = ast_manager_build_channel_state_string(obj->snapshot);
 
 	if (!channel_event_string) {
 		return;
@@ -721,13 +700,13 @@
 
 	/* Peer is required - otherwise, who are we dialing? */
 	ast_assert(peer != NULL);
-	peer_event_string = manager_build_channel_state_string_suffix(peer, "Dest");
+	peer_event_string = ast_manager_build_channel_state_string_suffix(peer, "Dest");
 	if (!peer_event_string) {
 		return;
 	}
 
 	if (caller) {
-		caller_event_string = manager_build_channel_state_string(caller);
+		caller_event_string = ast_manager_build_channel_state_string(caller);
 		if (!caller_event_string) {
 			return;
 		}




More information about the asterisk-commits mailing list