aboutsummaryrefslogtreecommitdiffstats
path: root/funcs
diff options
context:
space:
mode:
authorbweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-03 22:02:50 +0000
committerbweschke <bweschke@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-03 22:02:50 +0000
commitcf7dd4c53ab358f9010b82af79e68c759c0f979e (patch)
treea88422b3a4e6afa3e43b6654372702569318cd1c /funcs
parentefada3b700940dc9b7482eb71205378942a4282d (diff)
Provide the ability to adjust txgain/rxgain on a channel level via the CHANNEL() function
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@24621 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'funcs')
-rw-r--r--funcs/func_channel.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/funcs/func_channel.c b/funcs/func_channel.c
index 16aebb4c2..3fe5db240 100644
--- a/funcs/func_channel.c
+++ b/funcs/func_channel.c
@@ -23,6 +23,7 @@
*/
#include <stdlib.h>
+#include <stdio.h>
#include <string.h>
#include <sys/types.h>
@@ -93,6 +94,7 @@ static int func_channel_write(struct ast_channel *chan, char *function,
char *data, const char *value)
{
int ret = 0;
+ signed char gainset;
if (!strcasecmp(data, "language"))
locked_string_field_set(chan, language, value);
@@ -100,7 +102,13 @@ static int func_channel_write(struct ast_channel *chan, char *function,
locked_string_field_set(chan, musicclass, value);
else if (!strcasecmp(data, "callgroup"))
chan->callgroup = ast_get_group(data);
- else if (!chan->tech->func_channel_write
+ else if (!strcasecmp(data, "txgain")) {
+ sscanf(value, "%hhd", &gainset);
+ ast_channel_setoption(chan, AST_OPTION_TXGAIN, &gainset, sizeof(gainset), 0);
+ } else if (!strcasecmp(data, "rxgain")) {
+ sscanf(value, "%hhd", &gainset);
+ ast_channel_setoption(chan, AST_OPTION_RXGAIN, &gainset, sizeof(gainset), 0);
+ } else if (!chan->tech->func_channel_write
|| chan->tech->func_channel_write(chan, function, data, value)) {
ast_log(LOG_WARNING, "Unknown or unavailable item requested: '%s'\n",
data);
@@ -123,8 +131,10 @@ static struct ast_custom_function channel_function = {
"R/O channeltype technology used for channel\n"
"R/W language language for sounds played\n"
"R/W musicclass class (from musiconhold.conf) for hold music\n"
+ "R/W rxgain set rxgain level on channel drivers that support it\n"
"R/O state state for channel\n"
"R/O tonezone zone for indications played\n"
+ "R/W txgain set txgain level on channel drivers that support it\n"
"R/O videonativeformat format used natively for video\n"
"\n"
"Additional items may be available from the channel driver providing\n"