[svn-commits] dlee: branch dlee/stasis-http r382896 - /team/dlee/stasis-http/apps/app_stasis.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Tue Mar 12 13:27:01 CDT 2013


Author: dlee
Date: Tue Mar 12 13:26:58 2013
New Revision: 382896

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=382896
Log:
Margins

Modified:
    team/dlee/stasis-http/apps/app_stasis.c

Modified: team/dlee/stasis-http/apps/app_stasis.c
URL: http://svnview.digium.com/svn/asterisk/team/dlee/stasis-http/apps/app_stasis.c?view=diff&rev=382896&r1=382895&r2=382896
==============================================================================
--- team/dlee/stasis-http/apps/app_stasis.c (original)
+++ team/dlee/stasis-http/apps/app_stasis.c Tue Mar 12 13:26:58 2013
@@ -49,7 +49,8 @@
 				<para>Name of the application to invoke.</para>
 			</parameter>
 			<parameter name="args">
-				<para>Optional arguments for the application invocation.</para>
+				<para>Optional arguments for the application
+				invocation.</para>
 			</parameter>
 		</syntax>
 		<description>
@@ -112,7 +113,8 @@
 };
 
 /*! Constructor for \ref stasis_app. */
-static struct stasis_app *app_create(const char *name, stasis_app_cb handler, void *data)
+static struct stasis_app *app_create(const char *name, stasis_app_cb handler,
+				     void *data)
 {
 	struct stasis_app *app;
 	size_t size;
@@ -402,7 +404,8 @@
 	return ast_json_ref(message);
 }
 
-static int send_start_msg(struct stasis_app *app, struct ast_channel *chan, int argc, char *argv[])
+static int send_start_msg(struct stasis_app *app, struct ast_channel *chan,
+			  int argc, char *argv[])
 {
 	RAII_VAR(struct ast_json *, msg_info, NULL, ast_json_unref);
 	RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref);
@@ -415,7 +418,8 @@
 
 	msg_info = ast_json_pack("{s: []}", "args");
 	if (!msg_info) {
-		ast_log(LOG_ERROR, "Couldn't create message for %s\n", app->name);
+		ast_log(LOG_ERROR,
+			"Couldn't create message for %s\n", app->name);
 		return -1;
 	}
 
@@ -423,8 +427,11 @@
 	json_args = ast_json_object_get(msg_info, "args");
 	ast_assert(json_args != NULL);
 	for (i = 0; i < argc; ++i) {
-		if (ast_json_array_append(json_args, ast_json_string_create(argv[i])) != 0) {
-			ast_log(LOG_ERROR, "Error appending arg to start message\n");
+		int r = ast_json_array_append(json_args,
+					      ast_json_string_create(argv[i]));
+		if (r != 0) {
+			ast_log(LOG_ERROR,
+				"Error appending arg to start message\n");
 			return -1;
 		}
 	}
@@ -462,17 +469,20 @@
 	return 0;
 }
 
-static void sub_handler(void *data, struct stasis_subscription *sub, struct stasis_topic *topic, struct stasis_message *message)
+static void sub_handler(void *data, struct stasis_subscription *sub,
+			struct stasis_topic *topic, struct stasis_message *msg)
 {
 	struct stasis_app *app = data;
-	if (ast_channel_snapshot() == stasis_message_type(message)) {
-		RAII_VAR(struct ast_json *, msg, NULL, ast_json_unref);
-		struct ast_channel_snapshot *snapshot = stasis_message_data(message);
-
-		msg = stasis_app_event_create("channel-state-change", snapshot, NULL);
-		app_send(app, msg);
-	}
-	if (stasis_subscription_final_message(sub, message)) {
+	if (ast_channel_snapshot() == stasis_message_type(msg)) {
+		RAII_VAR(struct ast_json *, json, NULL, ast_json_unref);
+		struct ast_channel_snapshot *snapshot =
+			stasis_message_data(msg);
+
+		json = stasis_app_event_create("channel-state-change", snapshot,
+					       NULL);
+		app_send(app, json);
+	}
+	if (stasis_subscription_final_message(sub, msg)) {
 		ao2_cleanup(data);
 	}
 }
@@ -490,11 +500,13 @@
 	}
 
 	controls = app_controls();
-	ao2_unlink_flags(controls, control, OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA);
+	ao2_unlink_flags(controls, control,
+			 OBJ_POINTER | OBJ_UNLINK | OBJ_NODATA);
 	ao2_cleanup(control);
 }
 
-static void dispatch_commands(struct stasis_app_control *control, struct ast_channel *chan)
+static void dispatch_commands(struct stasis_app_control *control,
+			      struct ast_channel *chan)
 {
 	struct ao2_iterator i;
 	void *obj;
@@ -519,7 +531,8 @@
 	RAII_VAR(struct ao2_container *, apps, apps_registry(), ao2_cleanup);
 	RAII_VAR(struct stasis_app *, app, NULL, ao2_cleanup);
 	RAII_VAR(struct stasis_app_control *, control, NULL, control_unlink);
-	RAII_VAR(struct stasis_subscription *, subscription, NULL, stasis_unsubscribe);
+	RAII_VAR(struct stasis_subscription *, subscription, NULL,
+		 stasis_unsubscribe);
 	int res = 0;
 	char *parse = NULL;
 	int hungup = 0;
@@ -627,7 +640,8 @@
 
 	res = send_end_msg(app, chan);
 	if (res != 0) {
-		ast_log(LOG_ERROR, "Error sending end message to %s\n", args.app_name);
+		ast_log(LOG_ERROR,
+			"Error sending end message to %s\n", args.app_name);
 		return res;
 	}
 




More information about the svn-commits mailing list