[svn-commits] oej: branch oej/pinepeach r215381 - /team/oej/pinepeach/res/res_mutestream.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Wed Sep 2 00:39:49 CDT 2009
Author: oej
Date: Wed Sep 2 00:39:45 2009
New Revision: 215381
URL: http://svn.asterisk.org/svn-view/asterisk?view=rev&rev=215381
Log:
Updates (based on trunk version)
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=215381&r1=215380&r2=215381
==============================================================================
--- team/oej/pinepeach/res/res_mutestream.c (original)
+++ team/oej/pinepeach/res/res_mutestream.c Wed Sep 2 00:39:45 2009
@@ -27,14 +27,6 @@
#include "asterisk.h"
ASTERISK_FILE_VERSION(__FILE__, "$Revision: 89545 $")
-
-#include <time.h>
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <math.h>
-#include <errno.h>
#include "asterisk/options.h"
#include "asterisk/logger.h"
@@ -48,8 +40,6 @@
#include "asterisk/audiohook.h"
#include "asterisk/manager.h"
-
-
/* Our own datastore */
struct mute_information {
struct ast_audiohook audiohook;
@@ -110,6 +100,7 @@
if (!(datastore = ast_channel_datastore_find(chan, &mute_datastore, NULL))) {
if (option_debug > 1)
ast_log(LOG_DEBUG, " *** Can't find any datastore to use. Bad. \n");
+ ast_channel_unlock(chan);
return 0;
}
@@ -132,7 +123,9 @@
return 0;
}
-/*! \brief Initialize mute hook on channel, but don't activate it */
+/*! \brief Initialize mute hook on channel, but don't activate it
+ \pre assumes that channel is locked
+*/
static struct ast_datastore *initialize_mutehook(struct ast_channel *chan)
{
struct ast_datastore *datastore = NULL;
@@ -179,8 +172,10 @@
struct mute_information *mute = NULL;
int is_new = 0;
+ ast_channel_lock(chan);
if (!(datastore = ast_channel_datastore_find(chan, &mute_datastore, NULL))) {
if (!(datastore = initialize_mutehook(chan))) {
+ ast_channel_unlock(chan);
return 0;
}
is_new = 1;
@@ -205,16 +200,17 @@
if (is_new) {
mute_add_audiohook(chan, mute, datastore);
}
+ ast_channel_unlock(chan);
return 0;
}
/* Function for debugging - might be useful */
static struct ast_custom_function mute_function = {
- .name = "MUTESTREAM",
+ .name = "MUTEAUDIO",
.write = func_mute_write,
.synopsis = "Muting streams in the channel",
- .syntax = "MUTESTREAM(in|out|all) = true|false",
+ .syntax = "MUTEAUDIO(in|out|all) = true|false",
.desc = "The mute function mutes either inbound (to the PBX) or outbound"
"audio. \"all\" indicates both directions",
};
@@ -285,7 +281,7 @@
}
-static char mandescr_mutestream[] =
+static const 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"
@@ -294,16 +290,11 @@
" 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);
- ast_manager_register2("MuteStream", EVENT_FLAG_SYSTEM, manager_mutestream,
+ ast_manager_register2("MuteAudio", EVENT_FLAG_SYSTEM, manager_mutestream,
"Mute an audio stream", mandescr_mutestream);
return 0;
}
@@ -312,7 +303,7 @@
{
ast_custom_function_unregister(&mute_function);
/* Unregister AMI actions */
- ast_manager_unregister("MuteStream");
+ ast_manager_unregister("MuteAudio");
return 0;
}
@@ -320,5 +311,4 @@
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS, "MUTE resource",
.load = load_module,
.unload = unload_module,
- .reload = reload,
);
More information about the svn-commits
mailing list