aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_zap.c
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 /channels/chan_zap.c
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 '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 */