[svn-commits] oej: branch oej/pinepeach r214990 - /team/oej/pinepeach/res/res_mutestream.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Mon Aug 31 11:54:46 CDT 2009


Author: oej
Date: Mon Aug 31 11:54:43 2009
New Revision: 214990

URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=214990
Log:
Cleaning up
- dialplan function is now MUTESTREAM
- both AMI and dialplan function now takes "all" as an argument for all streams


Modified:
    team/oej/pinepeach/res/res_mutestream.c

Modified: team/oej/pinepeach/res/res_mutestream.c
URL: http://svn.asterisk.org/svn-view/asterisk/team/oej/pinepeach/res/res_mutestream.c?view=diff&rev=214990&r1=214989&r2=214990
==============================================================================
--- team/oej/pinepeach/res/res_mutestream.c (original)
+++ team/oej/pinepeach/res/res_mutestream.c Mon Aug 31 11:54:43 2009
@@ -65,12 +65,10 @@
 static void destroy_callback(void *data)
 {
 	struct mute_information *mute = data;
-	ast_log(LOG_DEBUG, "***** About to destroy mute audiohook for this channel\n");
 
 	/* Destroy the audiohook, and destroy ourselves */
 	ast_audiohook_destroy(&mute->audiohook);
 	free(mute);
-	ast_log(LOG_DEBUG, "***** Destroying mute audiohook for this channel\n");
 
 	return;
 }
@@ -133,6 +131,7 @@
 	return 0;
 }
 
+/*! \brief Initialize mute hook on channel, but don't activate it */
 static struct ast_datastore *initialize_mutehook(struct ast_channel *chan)
 {
 	struct ast_datastore *datastore = NULL;
@@ -156,6 +155,7 @@
 	return datastore;
 }
 
+/*! \brief Add or activate mute audiohook on channel */
 static int mute_add_audiohook(struct ast_channel *chan, struct mute_information *mute, struct ast_datastore *datastore)
 {
 		/* Activate the settings */
@@ -170,6 +170,7 @@
 		return 0;
 }
 
+/*! \brief Mute dialplan function */
 static int func_mute_write(struct ast_channel *chan, char *cmd, char *data, const char *value)
 {
 	struct ast_datastore *datastore = NULL;
@@ -190,13 +191,13 @@
 		if (option_debug > 1) {
 			ast_log(LOG_DEBUG, "%s channel - outbound *** \n", ast_true(value) ? "Muting" : "Unmuting");
 		}
-	}
-
-	else if (!strcasecmp(data, "in")) {
+	} else if (!strcasecmp(data, "in")) {
 		mute->mute_read = ast_true(value);
 		if (option_debug > 1) {
 			ast_log(LOG_DEBUG, "%s channel - inbound *** \n", ast_true(value) ? "Muting" : "Unmuting");
 		}
+	} else if (!strcasecmp(data,"all")) {
+		mute->mute_write = mute->mute_read = ast_true(value);
 	}
 
 	if (is_new) {
@@ -208,12 +209,12 @@
 
 /* Function for debugging - might be useful */
 static struct ast_custom_function mute_function = {
-        .name = "MUTE",
+        .name = "MUTESTREAM",
         .write = func_mute_write,
-	.synopsis = "Muting the channel, totally and utterly",
-	.syntax = "MUTE(in|out) = true|false",
+	.synopsis = "Muting streams in the channel",
+	.syntax = "MUTESTREAM(in|out|all) = true|false",
 	.desc = "The mute function mutes either inbound (to the PBX) or outbound"
-		"audio.",
+		"audio. \"all\" indicates both directions",
 };
 
 static int manager_mutestream(struct mansession *s, const struct message *m)
@@ -264,8 +265,10 @@
 
 	if (!strcasecmp(direction, "in")) {
 		mute->mute_read = turnon;
-	} else {
+	} else if (!strcasecmp(direction, "out")) {
 		mute->mute_write = turnon;
+	} else if (!strcasecmp(direction, "all")) {
+		mute->mute_read = mute->mute_write = turnon;
 	}
 	
 	if (is_new) {
@@ -283,12 +286,10 @@
 static char mandescr_mutestream[] =
 "Description: Mute an incoming or outbound audio stream in a channel.\n"
 "Variables: \n"
-"  Channel: <name>        The channel you want to mute.\n"
-"  Direction: in | out    The stream you wan to mute.\n"
-"  State: on | off        Whether to turn mute on or off.\n"
-"  ActionID: <id>         Optional action ID for this AMI transaction.\n";
-
-
+"  Channel: <name>           The channel you want to mute.\n"
+"  Direction: in | out |all  The stream you wan to mute.\n"
+"  State: on | off           Whether to turn mute on or off.\n"
+"  ActionID: <id>            Optional action ID for this AMI transaction.\n";
 
 
 static int reload(void)




More information about the svn-commits mailing list