Asterisk zapata gain adjustment

Setting the receive and transmit gain correctly is important to minimize echo and to enable clear conservations.

This is important for BOTH PRI and Analog lines into zaptel interfaces

If you have Asterisk v1.0.9 or earlier then you need to upgrade your zaptel driver to something newer. Old versions of Zaptel do not support so called quantitative mode.


The command is /usr/src/zaptel/ztmonitor 1 -vv

This is how it looks on screen

$ sudo ztmonitor 1 -vv

Visual Audio Levels.

Use zapata.conf file to adjust the gains if needed.

( # = Audio Level * = Max Audio Hit )
<----------------(RX)----------------> <----------------(TX)---------------->
                      1. * Rx: 3149 ( 3161) Tx: 0 ( 0)


When you tune your lines you need something to listen to. The best source is to call a Phone Telco test number. Their system is calibrated with the proper gain and plays a 1004Hz as a sound. Your other fallback is to use the Milliwatt() application to make your own.

Having a telco test phone # and using procedure is the best method.

This simple and concise guide should help MANY people solve their echo problems.
Simple echo avoidance

Analog Lines Gain Tuning


Note : Adjusting the signal to 50% works with PRI's, your might try that also.

Phone telco 1004hz test phone number and adjust RX gain for approximately 14500 on the quantitative indicator. This equates to greater than 100% on the graphical indication. NOT 50%!

  • An Asterisk-users mailing list post detailing a procedure to quantitatively set rxgain and txgain on a Zapata interface. Note: This used to point to 071301.html, but that didn't exist.
  • An Asterisk-users mailing list post that attempts to explain why correct gain settings can positively influence echo problems (ie. network loss planning). Note: This used to point to 096426.html, but that doesn't exist. There appears to be an off-by-6989 error in past links to lists.digium.com/pipermail/asterisk-users...

Acceptable value Both RX and TX should be in the middle.

PRI rx and tx gain tuning

Experience with configuring real asterisk production systems shows your best tuning is done as follows:
You should shoot for a ztmonitor reading of 50% on the graphical scale, NOT >100% as indicated above for analog lines.

  1. In zapata.conf, make sure rxgain and txgain are both set to 0.0.
  2. Run ztmonitor ztmonitor 1 -vv (where "1" is the appropriate zap channel you wish to monitor). Please be aware that in order to see the quantitative indicator, your terminal window must be greater in width than a normal 80X24 shell. Otherwise, you will see the graphical indicator, but not the quantitative numbers.
  3. Based upon the results of ztmonitor, adjust the tx and rx gain settings in zapata.conf. Most reading suggests going no lower than -11.0 and no higher than 11.0, though it will take values from -100 to 100. Make sure that rxgain=/txgain= lines are placed prior to channel= line in your zapata.conf otherwise the gain settings will not have any effect (at least for asterisk 1.4.11 and E1 card). Make sure you stop and restart asterisk each time you make a gain adjustment.
  4. In addition, you may want to uncomment and adjust the "echotraining=" from 800 to 128, which is the amount of time, in milliseconds, given to train echo out on a call.

I can't stress enough to make sure your RESTART. IE STOP NOW and restart Asterisk when you make rx/tx gain changes. As of 1.4.13 Asterisk chaning rx/tx gain on the fly and just RELOAD asterisk DOES NOT WORK.

I can't speak for versions between 1.4.13 and 1.4.17, however issuing only a reload command DOES work in 1.4.18.

I can confirm that as of at least 1.6.2.6, and using a PRI (both digium and openvox), gain adjustment can be done on the fly using dahdi set swgain tx/rx <chan> <value>. Setting the hardware gain does not work. Please note however that this gain is only for the current call. Additionally, you can change the gain values in the config file or the realtime config and simply dahdi restart to make them stick.


External Links


See Also


Setting the receive and transmit gain correctly is important to minimize echo and to enable clear conservations.

This is important for BOTH PRI and Analog lines into zaptel interfaces

If you have Asterisk v1.0.9 or earlier then you need to upgrade your zaptel driver to something newer. Old versions of Zaptel do not support so called quantitative mode.


The command is /usr/src/zaptel/ztmonitor 1 -vv

This is how it looks on screen

$ sudo ztmonitor 1 -vv

Visual Audio Levels.

Use zapata.conf file to adjust the gains if needed.

( # = Audio Level * = Max Audio Hit )
<----------------(RX)----------------> <----------------(TX)---------------->
                      1. * Rx: 3149 ( 3161) Tx: 0 ( 0)


When you tune your lines you need something to listen to. The best source is to call a Phone Telco test number. Their system is calibrated with the proper gain and plays a 1004Hz as a sound. Your other fallback is to use the Milliwatt() application to make your own.

Having a telco test phone # and using procedure is the best method.

This simple and concise guide should help MANY people solve their echo problems.
Simple echo avoidance

Analog Lines Gain Tuning


Note : Adjusting the signal to 50% works with PRI's, your might try that also.

Phone telco 1004hz test phone number and adjust RX gain for approximately 14500 on the quantitative indicator. This equates to greater than 100% on the graphical indication. NOT 50%!

  • An Asterisk-users mailing list post detailing a procedure to quantitatively set rxgain and txgain on a Zapata interface. Note: This used to point to 071301.html, but that didn't exist.
  • An Asterisk-users mailing list post that attempts to explain why correct gain settings can positively influence echo problems (ie. network loss planning). Note: This used to point to 096426.html, but that doesn't exist. There appears to be an off-by-6989 error in past links to lists.digium.com/pipermail/asterisk-users...

Acceptable value Both RX and TX should be in the middle.

PRI rx and tx gain tuning

Experience with configuring real asterisk production systems shows your best tuning is done as follows:
You should shoot for a ztmonitor reading of 50% on the graphical scale, NOT >100% as indicated above for analog lines.

  1. In zapata.conf, make sure rxgain and txgain are both set to 0.0.
  2. Run ztmonitor ztmonitor 1 -vv (where "1" is the appropriate zap channel you wish to monitor). Please be aware that in order to see the quantitative indicator, your terminal window must be greater in width than a normal 80X24 shell. Otherwise, you will see the graphical indicator, but not the quantitative numbers.
  3. Based upon the results of ztmonitor, adjust the tx and rx gain settings in zapata.conf. Most reading suggests going no lower than -11.0 and no higher than 11.0, though it will take values from -100 to 100. Make sure that rxgain=/txgain= lines are placed prior to channel= line in your zapata.conf otherwise the gain settings will not have any effect (at least for asterisk 1.4.11 and E1 card). Make sure you stop and restart asterisk each time you make a gain adjustment.
  4. In addition, you may want to uncomment and adjust the "echotraining=" from 800 to 128, which is the amount of time, in milliseconds, given to train echo out on a call.

I can't stress enough to make sure your RESTART. IE STOP NOW and restart Asterisk when you make rx/tx gain changes. As of 1.4.13 Asterisk chaning rx/tx gain on the fly and just RELOAD asterisk DOES NOT WORK.

I can't speak for versions between 1.4.13 and 1.4.17, however issuing only a reload command DOES work in 1.4.18.

I can confirm that as of at least 1.6.2.6, and using a PRI (both digium and openvox), gain adjustment can be done on the fly using dahdi set swgain tx/rx <chan> <value>. Setting the hardware gain does not work. Please note however that this gain is only for the current call. Additionally, you can change the gain values in the config file or the realtime config and simply dahdi restart to make them stick.


External Links


See Also


Created by: jht2, Last modification: Thu 09 of Dec, 2010 (13:57 UTC) by lordvadr
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+