Index: channels/chan_dahdi.c =================================================================== --- channels/chan_dahdi.c (revision 400821) +++ channels/chan_dahdi.c (working copy) @@ -744,9 +744,9 @@ struct dahdi_pvt *oprpeer; /*!< "Operator Services" peer tech_pvt ptr */ /*! \brief Amount of gain to increase during caller id */ float cid_rxgain; - /*! \brief Rx gain set by chan_dahdi.conf */ + /*! \brief Software Rx gain set by chan_dahdi.conf */ float rxgain; - /*! \brief Tx gain set by chan_dahdi.conf */ + /*! \brief Software Tx gain set by chan_dahdi.conf */ float txgain; float txdrc; /*!< Dynamic Range Compression factor. a number between 1 and 6ish */ @@ -15975,12 +15975,18 @@ switch (cmd) { case CLI_INIT: - e->command = "dahdi set hwgain"; + e->command = "dahdi set hwgain {rx|tx}"; e->usage = "Usage: dahdi set hwgain \n" - " Sets the hardware gain on a a given channel, overriding the\n" - " value provided at module loadtime, whether the channel is in\n" - " use or not. Changes take effect immediately.\n" + " Sets the hardware gain on a given channel. Changes take effect\n" + " immediately whether the channel is in use or not.\n" + "\n" + " Please use swgain instead of hwgain.\n" + " * hwgain is not supported by most DAHDI hardware drivers.\n" + " * hwgain can be overridden using modprobe on the DAHDI driver.\n" + " * Asterisk cannot query for the current hwgain value.\n" + " * This is the only way to set hwgain by the channel driver.\n" + "\n" " which direction do you want to change (relative to our module)\n" " is the channel number relative to the device\n" " is the gain in dB (e.g. -3.5 for -3.5dB)\n"; @@ -15999,6 +16005,15 @@ else return CLI_SHOWUSAGE; + /* + * This is a half baked feature that never got implemented very + * well. You are potentially fighting for who sets the gain + * value since this gain value can also be set globally using + * modprobe on the DAHDI module. Asterisk cannot query for the + * current gain value. + */ + ast_cli(a->fd, "Please use swgain instead of hwgain.\n"); + channel = atoi(a->argv[4]); gain = atof(a->argv[5])*10.0; @@ -16044,12 +16059,13 @@ switch (cmd) { case CLI_INIT: - e->command = "dahdi set swgain"; + e->command = "dahdi set swgain {rx|tx}"; e->usage = "Usage: dahdi set swgain \n" - " Sets the software gain on a a given channel, overriding the\n" - " value provided at module loadtime, whether the channel is in\n" - " use or not. Changes take effect immediately.\n" + " Sets the software gain on a given channel and overrides the\n" + " value provided at module loadtime. Changes take effect\n" + " immediately whether the channel is in use or not.\n" + "\n" " which direction do you want to change (relative to our module)\n" " is the channel number relative to the device\n" " is the gain in dB (e.g. -3.5 for -3.5dB)\n"; @@ -16093,6 +16109,12 @@ ast_cli(a->fd, "software %s gain set to %.1f on channel %d\n", tx ? "tx" : "rx", gain, channel); + + if (tx) { + tmp->txgain = gain; + } else { + tmp->rxgain = gain; + } break; } ast_mutex_unlock(&iflock);