From a7b1476058ab759ae23926a323ebadf6fe12f3f2 Mon Sep 17 00:00:00 2001 From: BJ Weschke Date: Wed, 3 May 2006 22:02:50 +0000 Subject: 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 --- channels/chan_zap.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'channels/chan_zap.c') 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 */ -- cgit v1.2.3