[asterisk-commits] dlee: branch dlee/json_main r383320 - /team/dlee/json_main/main/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Mar 18 12:25:13 CDT 2013


Author: dlee
Date: Mon Mar 18 12:25:09 2013
New Revision: 383320

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383320
Log:
Addressed review feedback.

* Added missing docs for events.
* Got rid of add_exten variable in favor of an extra_fields string in building
  the event.

Modified:
    team/dlee/json_main/main/manager_channels.c

Modified: team/dlee/json_main/main/manager_channels.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/json_main/main/manager_channels.c?view=diff&rev=383320&r1=383319&r2=383320
==============================================================================
--- team/dlee/json_main/main/manager_channels.c (original)
+++ team/dlee/json_main/main/manager_channels.c Mon Mar 18 12:25:09 2013
@@ -176,6 +176,7 @@
 		<managerEventInstance>
 			<synopsis>Raised when a channel enters a new context, extension, priority.</synopsis>
 			<syntax>
+				<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
 				<parameter name="Application">
 					<para>The application about to be executed.</para>
 				</parameter>
@@ -197,7 +198,6 @@
 		return;
 	}
 
-	/* DEPRECATED: Extension field deprecated in 12 */
 	manager_event(EVENT_FLAG_DIALPLAN, "Newexten",
 		      "%s"
 		      "Application: %s\r\n"
@@ -210,11 +210,11 @@
 				    struct stasis_topic *topic,
 				    struct stasis_message *message)
 {
+	RAII_VAR(struct ast_str *, extra_fields, ast_str_create(40), ast_free);
 	struct stasis_cache_update *update = stasis_message_data(message);
 	struct ast_channel_snapshot *old_snapshot;
 	struct ast_channel_snapshot *new_snapshot;
 	int is_hungup, was_hungup;
-	int add_exten = 0;
 	char *manager_event = NULL;
 
 	if (ast_channel_snapshot() != update->type) {
@@ -234,7 +234,10 @@
 
 	if (!old_snapshot) {
 		manager_event = "Newchannel";
-		add_exten = 1;
+		/* DEPRECATED: Exten field deprecated in 12
+		 * remove in 14 */
+		ast_str_append(&extra_fields, 0, "Exten: %s\r\n",
+			       new_snapshot->exten);
 	}
 
 	if (old_snapshot && old_snapshot->state != new_snapshot->state) {
@@ -252,14 +255,10 @@
 		channel_event_string =
 			manager_build_channel_state_string(new_snapshot);
 
-		if (add_exten) {
-			ast_str_append(&channel_event_string, 0, "Exten: %s\r\n",
-				       new_snapshot->exten);
-		}
-
 		if (channel_event_string) {
-			manager_event(EVENT_FLAG_CALL, manager_event, "%s",
-				      ast_str_buffer(channel_event_string));
+			manager_event(EVENT_FLAG_CALL, manager_event, "%s%s",
+				      ast_str_buffer(channel_event_string),
+				      ast_str_buffer(extra_fields));
 		}
 	}
 
@@ -298,8 +297,17 @@
 	/*** DOCUMENTATION
 		<managerEventInstance>
 			<synopsis>Raised when a variable is set to a particular value.</synopsis>
-		</managerEventInstance>
-o	***/
+			<syntax>
+				<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
+				<parameter name="Variable">
+					<para>The variable being set.</para>
+				</parameter>
+				<parameter name="Value">
+					<para>The new value of the variable.</para>
+				</parameter>
+			</syntax>
+		</managerEventInstance>
+	***/
 	manager_event(EVENT_FLAG_DIALPLAN, "VarSet",
 		      "%s"
 		      "Variable: %s\r\n"
@@ -325,11 +333,12 @@
 	/*** DOCUMENTATION
 		<managerEventInstance>
 			<synopsis>A user defined event raised from the dialplan.</synopsis>
+			<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
 			<parameter name="UserEvent">
 				<para>The event name, as specified in the dialplan.</para>
 			</parameter>
 			<see-also>
-			<ref type="application">UserEvent</ref>
+				<ref type="application">UserEvent</ref>
 			</see-also>
 		</managerEventInstance>
 	***/




More information about the asterisk-commits mailing list