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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Mar 15 14:37:54 CDT 2013


Author: dlee
Date: Fri Mar 15 14:37:50 2013
New Revision: 383259

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=383259
Log:
Moved event docs to be with the event generation

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

Modified: team/dlee/json_main/main/manager.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/json_main/main/manager.c?view=diff&rev=383259&r1=383258&r2=383259
==============================================================================
--- team/dlee/json_main/main/manager.c (original)
+++ team/dlee/json_main/main/manager.c Fri Mar 15 14:37:50 2013
@@ -964,73 +964,6 @@
                         manager.conf will be present upon starting a new session.</para>
 		</description>
 	</manager>
-	<managerEvent language="en_US" name="Newchannel">
-		<managerEventInstance class="EVENT_FLAG_CALL">
-			<synopsis>Raised when a new channel is created.</synopsis>
-			<syntax>
-				<parameter name="Channel">
-				</parameter>
-				<parameter name="ChannelState">
-					<para>A numeric code for the channel's current state, related to ChannelStateDesc</para>
-				</parameter>
-				<parameter name="ChannelStateDesc">
-					<enumlist>
-						<enum name="Down"/>
-						<enum name="Rsrvd"/>
-						<enum name="OffHook"/>
-						<enum name="Dialing"/>
-						<enum name="Ring"/>
-						<enum name="Ringing"/>
-						<enum name="Up"/>
-						<enum name="Busy"/>
-						<enum name="Dialing Offhook"/>
-						<enum name="Pre-ring"/>
-						<enum name="Unknown"/>
-					</enumlist>
-				</parameter>
-				<parameter name="CallerIDNum">
-				</parameter>
-				<parameter name="CallerIDName">
-				</parameter>
-				<parameter name="ConnectedLineNum">
-				</parameter>
-				<parameter name="ConnectedLineName">
-				</parameter>
-				<parameter name="AccountCode">
-				</parameter>
-				<parameter name="Context">
-				</parameter>
-				<parameter name="Exten">
-				</parameter>
-				<parameter name="Priority">
-				</parameter>
-				<parameter name="Uniqueid">
-				</parameter>
-				<parameter name="Cause">
-					<para>A numeric cause code for why the channel was hung up.</para>
-				</parameter>
-				<parameter name="Cause-txt">
-					<para>A description of why the channel was hung up.</para>
-				</parameter>
-			</syntax>
-		</managerEventInstance>
-	</managerEvent>
-	<managerEvent language="en_US" name="Newstate">
-		<managerEventInstance class="EVENT_FLAG_CALL">
-			<synopsis>Raised when a channel's state changes.</synopsis>
-			<syntax>
-				<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
-			</syntax>
-		</managerEventInstance>
-	</managerEvent>
-	<managerEvent language="en_US" name="Hangup">
-		<managerEventInstance class="EVENT_FLAG_CALL">
-			<synopsis>Raised when a channel is hung up.</synopsis>
-			<syntax>
-				<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
-			</syntax>
-		</managerEventInstance>
-	</managerEvent>
  ***/
 
 /*! \addtogroup Group_AMI AMI functions

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=383259&r1=383258&r2=383259
==============================================================================
--- team/dlee/json_main/main/manager_channels.c (original)
+++ team/dlee/json_main/main/manager_channels.c Fri Mar 15 14:37:50 2013
@@ -37,18 +37,87 @@
 static struct stasis_subscription *channel_state_sub;
 
 /*** DOCUMENTATION
+	<managerEvent language="en_US" name="Newchannel">
+		<managerEventInstance class="EVENT_FLAG_CALL">
+			<synopsis>Raised when a new channel is created.</synopsis>
+			<syntax>
+				<parameter name="Channel">
+				</parameter>
+				<parameter name="ChannelState">
+					<para>A numeric code for the channel's current state, related to ChannelStateDesc</para>
+				</parameter>
+				<parameter name="ChannelStateDesc">
+					<enumlist>
+						<enum name="Down"/>
+						<enum name="Rsrvd"/>
+						<enum name="OffHook"/>
+						<enum name="Dialing"/>
+						<enum name="Ring"/>
+						<enum name="Ringing"/>
+						<enum name="Up"/>
+						<enum name="Busy"/>
+						<enum name="Dialing Offhook"/>
+						<enum name="Pre-ring"/>
+						<enum name="Unknown"/>
+					</enumlist>
+				</parameter>
+				<parameter name="CallerIDNum">
+				</parameter>
+				<parameter name="CallerIDName">
+				</parameter>
+				<parameter name="ConnectedLineNum">
+				</parameter>
+				<parameter name="ConnectedLineName">
+				</parameter>
+				<parameter name="AccountCode">
+				</parameter>
+				<parameter name="Context">
+				</parameter>
+				<parameter name="Exten">
+				</parameter>
+				<parameter name="Priority">
+				</parameter>
+				<parameter name="Uniqueid">
+				</parameter>
+				<parameter name="Cause">
+					<para>A numeric cause code for why the channel was hung up.</para>
+				</parameter>
+				<parameter name="Cause-txt">
+					<para>A description of why the channel was hung up.</para>
+				</parameter>
+			</syntax>
+		</managerEventInstance>
+	</managerEvent>
+	<managerEvent language="en_US" name="Newstate">
+		<managerEventInstance class="EVENT_FLAG_CALL">
+			<synopsis>Raised when a channel's state changes.</synopsis>
+			<syntax>
+				<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
+			</syntax>
+		</managerEventInstance>
+	</managerEvent>
+	<managerEvent language="en_US" name="Hangup">
+		<managerEventInstance class="EVENT_FLAG_CALL">
+			<synopsis>Raised when a channel is hung up.</synopsis>
+			<syntax>
+				<xi:include xpointer="xpointer(/docs/managerEvent[@name='Newchannel']/managerEventInstance/syntax/parameter)" />
+			</syntax>
+		</managerEventInstance>
+	</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 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(const struct ast_channel_snapshot *snapshot)
+static struct ast_str *manager_build_channel_state_string(
+	const struct ast_channel_snapshot *snapshot)
 {
 	struct ast_str *out = ast_str_create(1024);
 	int res = 0;
@@ -95,6 +164,7 @@
 static void channel_newexten(struct ast_channel_snapshot *snapshot)
 {
 	/*** DOCUMENTATION
+	<managerEvent language="en_US" name="Newchannel">
 		<managerEventInstance>
 			<synopsis>Raised when a channel enters a new context, extension, priority.</synopsis>
 			<syntax>
@@ -106,6 +176,7 @@
 				</parameter>
 			</syntax>
 		</managerEventInstance>
+	</managerEvent>
 	***/
 	if (ast_strlen_zero(snapshot->appl)) {
 		/* Channel's not in a valid state for a Newexten event yet */
@@ -119,13 +190,17 @@
 		      "Application: %s\r\n"
 		      "AppData: %s\r\n"
 		      "Uniqueid: %s\r\n",
-		      snapshot->name, snapshot->context, snapshot->exten, snapshot->priority, snapshot->appl, snapshot->data, snapshot->uniqueid);
+		      snapshot->name, snapshot->context, snapshot->exten,
+		      snapshot->priority, snapshot->appl, snapshot->data,
+		      snapshot->uniqueid);
 }
 
 static void channel_snapshot_update(struct stasis_cache_update *update)
 {
-	struct ast_channel_snapshot *old_snapshot = stasis_message_data(update->old_snapshot);
-	struct ast_channel_snapshot *new_snapshot = stasis_message_data(update->new_snapshot);
+	struct ast_channel_snapshot *old_snapshot =
+		stasis_message_data(update->old_snapshot);
+	struct ast_channel_snapshot *new_snapshot =
+		stasis_message_data(update->new_snapshot);
 	int is_hungup, was_hungup;
 	char *manager_event = NULL;
 
@@ -153,9 +228,11 @@
 	if (manager_event) {
 		RAII_VAR(struct ast_str *, channel_event_string, NULL, ast_free);
 
-		channel_event_string = manager_build_channel_state_string(new_snapshot);
+		channel_event_string =
+			manager_build_channel_state_string(new_snapshot);
 		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",
+				      ast_str_buffer(channel_event_string));
 		}
 	}
 
@@ -232,10 +309,12 @@
  * \brief Callback processing messages on the channel topic.
  */
 static void channel_message_cb(void *data, struct stasis_subscription *sub,
-			       struct stasis_topic *topic, struct stasis_message *message)
+			       struct stasis_topic *topic,
+			       struct stasis_message *message)
 {
 	if (stasis_message_type(message) == stasis_cache_update()) {
-		struct stasis_cache_update *update = stasis_message_data(message);
+		struct stasis_cache_update *update =
+			stasis_message_data(message);
 		if (ast_channel_snapshot() == update->type) {
 			channel_snapshot_update(update);
 		}




More information about the asterisk-commits mailing list