[asterisk-commits] oej: branch oej/mutestream-trunk r215112 - /team/oej/mutestream-trunk/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Tue Sep 1 09:58:08 CDT 2009


Author: oej
Date: Tue Sep  1 09:58:04 2009
New Revision: 215112

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=215112
Log:
Changes based on russellb's review of this stuff.

Modified:
    team/oej/mutestream-trunk/res/res_mutestream.c

Modified: team/oej/mutestream-trunk/res/res_mutestream.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/oej/mutestream-trunk/res/res_mutestream.c?view=diff&rev=215112&r1=215111&r2=215112
==============================================================================
--- team/oej/mutestream-trunk/res/res_mutestream.c (original)
+++ team/oej/mutestream-trunk/res/res_mutestream.c Tue Sep  1 09:58:04 2009
@@ -70,7 +70,7 @@
 		</syntax>
 		<description>
 			<para>The MUTESTREAM function can be used to mute inbound (to the PBX) or outbound audio in a call.
-			Example: 
+			Example:
 			</para>
 			<para>
 			MUTESTREAM(in)=on
@@ -161,7 +161,7 @@
 	return 0;
 }
 
-/*! \brief Initialize mute hook on channel, but don't activate it 
+/*! \brief Initialize mute hook on channel, but don't activate it
 	Assumes that the channel is locked
 */
 static struct ast_datastore *initialize_mutehook(struct ast_channel *chan)
@@ -186,7 +186,7 @@
 	return datastore;
 }
 
-/*! \brief Add or activate mute audiohook on channel 
+/*! \brief Add or activate mute audiohook on channel
 	Assumes channel is locked
 */
 static int mute_add_audiohook(struct ast_channel *chan, struct mute_information *mute, struct ast_datastore *datastore)
@@ -209,8 +209,8 @@
 	struct mute_information *mute = NULL;
 	int is_new = 0;
 
+	ast_channel_lock(chan);
 	if (!(datastore = ast_channel_datastore_find(chan, &mute_datastore, NULL))) {
-		ast_channel_lock(chan);
 		if (!(datastore = initialize_mutehook(chan))) {
 			ast_channel_unlock(chan);
 			return 0;
@@ -250,7 +250,7 @@
 	const char *id = astman_get_header(m,"ActionID");
 	const char *state = astman_get_header(m,"State");
 	const char *direction = astman_get_header(m,"Direction");
-	char idText[256] = "";
+	char id_text[256] = "";
 	struct ast_channel *c = NULL;
 	struct ast_datastore *datastore = NULL;
 	struct mute_information *mute = NULL;
@@ -271,7 +271,7 @@
 	}
 	/* Ok, we have everything */
 	if (!ast_strlen_zero(id)) {
-		snprintf(idText, sizeof(idText), "ActionID: %s\r\n", id);
+		snprintf(id_text, sizeof(id_text), "ActionID: %s\r\n", id);
 	}
 
 	c = ast_channel_get_by_name(channel);
@@ -284,6 +284,7 @@
 
 	if (!(datastore = ast_channel_datastore_find(c, &mute_datastore, NULL))) {
 		if (!(datastore = initialize_mutehook(c))) {
+			ast_channel_unlock(c);
 			ast_channel_unref(c);
 			return 0;
 		}
@@ -303,12 +304,12 @@
 	if (is_new) {
 		mute_add_audiohook(c, mute, datastore);
 	}
+	ast_channel_unlock(c);
 	ast_channel_unref(c);
-	ast_channel_unlock(c);
 
 	astman_append(s, "Response: Success\r\n"
 				   "%s"
-				   "\r\n\r\n", idText);
+				   "\r\n\r\n", id_text);
 	return 0;
 }
 
@@ -322,11 +323,6 @@
 "  ActionID: <id>            Optional action ID for this AMI transaction.\n";
 
 
-static int reload(void)
-{
-	return 0;
-}
-
 static int load_module(void)
 {
 	ast_custom_function_register(&mute_function);
@@ -345,8 +341,7 @@
 	return 0;
 }
 
-AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "MUTE resource",
+AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_DEFAULT, "MUTE resource",
 		.load = load_module,
 		.unload = unload_module,
-		.reload = reload,
 	       );




More information about the asterisk-commits mailing list