From fecc18b20ef556077d059d02c7a535adf1ee6efa Mon Sep 17 00:00:00 2001 From: Tzafrir Cohen Date: Fri, 15 Aug 2008 18:57:10 +0300 Subject: [PATCH] Remove a separate case for 0 gain on digital channels If the channel is not in audio mode Zaptel/DAHDI will refuse setting gains anyway. So instead of that, better put the channel in audio mode. --- channels/chan_dahdi.c | 25 ++++--------------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c index 2be2ce644..35c4e4e5c 100644 --- a/channels/chan_dahdi.c +++ b/channels/chan_dahdi.c @@ -1949,12 +1949,7 @@ static int dahdi_call(struct ast_channel *ast, char *rdest, int timeout) ast_log(LOG_WARNING, "Unable to flush input on channel %d: %s\n", p->channel, strerror(errno)); p->outgoing = 1; - if (IS_DIGITAL(ast->transfercapability)) { - set_actual_gain(p->subs[SUB_REAL].dfd, 0, 0, 0, p->law); - } else { - set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law); - } - + set_actual_gain(p->subs[SUB_REAL].dfd, 0, p->rxgain, p->txgain, p->law); mysig = p->sig; if (p->outsigmod > -1) @@ -8857,11 +8852,7 @@ static int pri_fixup_principle(struct dahdi_pri *pri, int principle, q931_call * res = dahdi_setlaw(new->subs[SUB_REAL].dfd, new->law); if (res < 0) ast_log(LOG_WARNING, "Unable to set law on channel %d\n", new->channel); - if (!new->digital) { - res = set_actual_gain(new->subs[SUB_REAL].dfd, 0, new->rxgain, new->txgain, new->law); - } else { - res = set_actual_gain(new->subs[SUB_REAL].dfd, 0, 0, 0, new->law); - } + res = set_actual_gain(new->subs[SUB_REAL].dfd, 0, new->rxgain, new->txgain, new->law); if (res < 0) ast_log(LOG_WARNING, "Unable to set gains on channel %d\n", new->channel); @@ -9723,11 +9714,7 @@ static void *pri_dchannel(void *vpri) res = dahdi_setlaw(pri->pvts[chanpos]->subs[SUB_REAL].dfd, law); if (res < 0) ast_log(LOG_WARNING, "Unable to set law on channel %d\n", pri->pvts[chanpos]->channel); - if (IS_DIGITAL(e->ring.ctype)) { - res = set_actual_gain(pri->pvts[chanpos]->subs[SUB_REAL].dfd, 0, 0, 0, pri->pvts[chanpos]->law); - } else { - res = set_actual_gain(pri->pvts[chanpos]->subs[SUB_REAL].dfd, 0, pri->pvts[chanpos]->rxgain, pri->pvts[chanpos]->txgain, law); - } + res = set_actual_gain(pri->pvts[chanpos]->subs[SUB_REAL].dfd, 0, pri->pvts[chanpos]->rxgain, pri->pvts[chanpos]->txgain, law); if (res < 0) ast_log(LOG_WARNING, "Unable to set gains on channel %d\n", pri->pvts[chanpos]->channel); if ((pri->nodetype != BRI_NETWORK_PTMP) && (pri->nodetype != BRI_NETWORK)) { @@ -10149,11 +10136,7 @@ static void *pri_dchannel(void *vpri) res = dahdi_setlaw(pri->pvts[chanpos]->subs[SUB_REAL].dfd, law); if (res < 0) ast_log(LOG_WARNING, "Unable to set law on channel %d\n", PVT_TO_CHANNEL(pri->pvts[chanpos])); - if (!pri->pvts[chanpos]->digital) { - res = set_actual_gain(pri->pvts[chanpos]->subs[SUB_REAL].dfd, 0, pri->pvts[chanpos]->rxgain, pri->pvts[chanpos]->txgain, law); - } else { - res = set_actual_gain(pri->pvts[chanpos]->subs[SUB_REAL].dfd, 0, 0, 0, pri->pvts[chanpos]->law); - } + res = set_actual_gain(pri->pvts[chanpos]->subs[SUB_REAL].dfd, 0, pri->pvts[chanpos]->rxgain, pri->pvts[chanpos]->txgain, law); if (res < 0) ast_log(LOG_WARNING, "Unable to set gains on channel %d\n", PVT_TO_CHANNEL(pri->pvts[chanpos])); /* Start PBX */ -- 2.11.4.GIT