[asterisk-commits] qwell: branch qwell/ari_channel_mute r393830 - /team/qwell/ari_channel_mute/res/

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Jul 8 13:47:34 CDT 2013


Author: qwell
Date: Mon Jul  8 13:47:32 2013
New Revision: 393830

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=393830
Log:
Don't forget res_mutestream..

Modified:
    team/qwell/ari_channel_mute/res/res_mutestream.c

Modified: team/qwell/ari_channel_mute/res/res_mutestream.c
URL: http://svnview.digium.com/svn/asterisk/team/qwell/ari_channel_mute/res/res_mutestream.c?view=diff&rev=393830&r1=393829&r2=393830
==============================================================================
--- team/qwell/ari_channel_mute/res/res_mutestream.c (original)
+++ team/qwell/ari_channel_mute/res/res_mutestream.c Mon Jul  8 13:47:32 2013
@@ -125,38 +125,26 @@
 
 static int mute_channel(struct ast_channel *chan, const char *direction, int mute)
 {
-	int mute_in = 0;
-	int mute_out = 0;
-	int stream_type = AST_FRAME_VOICE;
+	unsigned int mute_direction = 0;
+	enum ast_frame_type frametype = AST_FRAME_VOICE;
 	int ret = 0;
 
 	if (!strcmp(direction, "in")) {
-		mute_in = 1;
+		mute_direction = AST_MUTE_DIRECTION_READ;
 	} else if (!strcmp(direction, "out")) {
-		mute_out = 1;
+		mute_direction = AST_MUTE_DIRECTION_WRITE;
 	} else if (!strcmp(direction, "all")) {
-		mute_in = 1;
-		mute_out = 1;
+		mute_direction = AST_MUTE_DIRECTION_READ | AST_MUTE_DIRECTION_WRITE;
 	} else {
 		return -1;
 	}
 
 	ast_channel_lock(chan);
 
-	if (mute_in) {
-		if (mute) {
-			ret = ast_channel_mute(chan, AST_MUTE_DIRECTION_READ, stream_type);
-		} else {
-			ret = ast_channel_unmute(chan, AST_MUTE_DIRECTION_READ, stream_type);
-		}
-	}
-
-	if (mute_out) {
-		if (mute) {
-			ret = ast_channel_mute(chan, AST_MUTE_DIRECTION_WRITE, stream_type);
-		} else {
-			ret = ast_channel_unmute(chan, AST_MUTE_DIRECTION_WRITE, stream_type);
-		}
+	if (mute) {
+		ret = ast_channel_mute(chan, mute_direction, frametype);
+	} else {
+		ret = ast_channel_unmute(chan, mute_direction, frametype);
 	}
 
 	ast_channel_unlock(chan);




More information about the asterisk-commits mailing list