summaryrefslogtreecommitdiff
path: root/channels/chan_zap.c
diff options
context:
space:
mode:
authorBJ Weschke <bweschke@btwtech.com>2006-05-03 22:02:50 +0000
committerBJ Weschke <bweschke@btwtech.com>2006-05-03 22:02:50 +0000
commita7b1476058ab759ae23926a323ebadf6fe12f3f2 (patch)
treea88422b3a4e6afa3e43b6654372702569318cd1c /channels/chan_zap.c
parent282eb80ed42eace4cd628d4068d6697bf242d625 (diff)
Provide the ability to adjust txgain/rxgain on a channel level via the CHANNEL() function
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@24621 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels/chan_zap.c')
-rw-r--r--channels/chan_zap.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/channels/chan_zap.c b/channels/chan_zap.c
index f1a956638..86cf8bdb5 100644
--- a/channels/chan_zap.c
+++ b/channels/chan_zap.c
@@ -698,6 +698,7 @@ struct ast_frame *zt_exception(struct ast_channel *ast);
static int zt_indicate(struct ast_channel *chan, int condition);
static int zt_fixup(struct ast_channel *oldchan, struct ast_channel *newchan);
static int zt_setoption(struct ast_channel *chan, int option, void *data, int datalen);
+static int zt_func_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len);
static const struct ast_channel_tech zap_tech = {
.type = "Zap",
@@ -716,6 +717,7 @@ static const struct ast_channel_tech zap_tech = {
.indicate = zt_indicate,
.fixup = zt_fixup,
.setoption = zt_setoption,
+ .func_channel_read = zt_func_read,
};
#ifdef HAVE_LIBPRI
@@ -2904,6 +2906,25 @@ static int zt_setoption(struct ast_channel *chan, int option, void *data, int da
return 0;
}
+static int zt_func_read(struct ast_channel *chan, char *function, char *data, char *buf, size_t len)
+{
+ struct zt_pvt *p = chan->tech_pvt;
+
+ if (!strcasecmp(data, "rxgain")) {
+ ast_mutex_lock(&p->lock);
+ snprintf(buf, len, "%f", p->rxgain);
+ ast_mutex_unlock(&p->lock);
+ } else if (!strcasecmp(data, "txgain")) {
+ ast_mutex_lock(&p->lock);
+ snprintf(buf, len, "%f", p->txgain);
+ ast_mutex_unlock(&p->lock);
+ } else {
+ ast_copy_string(buf, "", len);
+ }
+ return 0;
+}
+
+
static void zt_unlink(struct zt_pvt *slave, struct zt_pvt *master, int needlock)
{
/* Unlink a specific slave or all slaves/masters from a given master */