[Asterisk-Users] Adjusting txgain/rxgain

Kris Boutilier Kris.Boutilier at scrd.bc.ca
Fri Nov 5 13:28:02 MST 2004


I went through something similar recently though involving having a channel
bank between myself and the world. The techniques used there should be
applicable to simpler hardware. 

To do this in a quantitative fashion you need a few different tools:
 - A recent patch to ztmonitor (or current CVS head) that adds an option to
display a numerical representation, as well as the bar graph. See:
http://bugs.digium.com/bug_view_page.php?bug_id=0002783

 - A phone number for a 'type 102 milliwatt test line' at _your_ serving
central office. Try calling the repair number for your telco - by assignment
they're usually found in xxx-958-nnnn or xxx-959-nnnn ranges in North
America. I don't recommend using a distant test line as there may be unknown
influencing factors. 

 - And optionally, another patch to chan_zap.c that allows the gains of a
channel to be twiddled on the fly without reloading. See:
http://bugs.digium.com/bug_view_page.php?bug_id=0002784

The steps I followed to set the rxgain were: 
 1. Edit /etc/asterisk/zapata.conf and ensure Tx and Rx gains are 0.0 across
the board. I also recommend disabling the echo canceller and training during
the tests.
 2. Access the Channel Bank console and ensure hardware gains are 0.0 (or as
close as possible) across the board - for simplicity I stick to adjusting
within Asterisk.
 3. Start 'ztmonitor' on the target trunk in 'quantitative' mode.
 4. Dial the CO Milliwatt test line from inside Asterisk via the target
trunk. Note the Rx level - it should be near 14844 
 5. If level is < optimal make the the rxgain for the channel more +ve. If >
than optimal, more -ve.
	note - restart will be required to apply gains if not using cli
patch.
 6. Once optimal rxgain has been determined, set it in zapata.conf and
restart asterisk.

Now, to set the txgain you need to have at least two lines on the asterisk
server so you can loop a call through the serving central office and back to
your own milliwatt source - to be able to listen to the effect you have on
your own outbound audio.
 7. Modify the dialplan to have incoming calls on the target trunk go to a
context that goes something like:
	exten => .....,1,Answer()
	exten => .....,2,Milliwatt()
 8. This time start 'ztmonitor' but refer to the second trunk, not the trunk
that terminates on Milliwatt().
 9. Dial the target trunk from inside Aaterisk via the second trunk. Note
the Rx level - it should be near 14844
10. If level is < optimal make the the txgain for the target trunk more +ve.
If > than optimal, more -ve.
11. Once optimal txgain has been determined, set it in zapata.conf and
restart asterisk.

Esentially, in the first step we're concerned with compensating for the
line/interface loss by twiddling the Zap rxgain, thus:
 
                     |  CB   |       |  Zap  |
                     |       |       | chan1 |
                     |-------|       |-------|
Reference          >-| TxTLP |>-Rx-->|Rxgain |
Signal   >-(loss)-/  |       |       |       | <-> Internal data stream 
                     | RxTLP |<-Tx--<|Txgain |
                     |       |       |       |


In the second step we're ensuring the interface has symmetric loss by
following the path:
 
                     |  CB   |       |  Zap  |
                     |       |       | chan1 |
                     |-------|       |-------|
	               | TxTLP |>-Rx-->|Rxgain |
    -----<-(loss)-\  |       |       |       | <-> Internal data stream 
   /               <-| RxTLP |<-Tx--<|Txgain |
   |                 |       |       |       |
Central
Office
   |                 |       |       | chan2 |
   |                 |-------|       |-------|
   \               >-| TxTLP |>-Rx-->|Rxgain |
    ->----(loss)--/  |       |       |       | <-> Internal data stream 
     compensated by  | RxTLP |<-Tx--<|Txgain |
      chan2 rxgain   |       |       |       |

We trust that once the call is inside or beyond the serving CO then it's all
inside a digital domain and there is no loss. If you should end up on a call
where the far end analog circuit has signficant loss then at least your
amplitude will be comparable to everone elses. 

Hope that helps.

Kris Boutilier
Information Systems Coordinator
Sunshine Coast Regional District

> -----Original Message-----
> From: Paul Dugas [mailto:Paul at DugasEnterprises.com]
> Sent: November 5, 2004 10:41 AM
> To: Asterisk Mailing List
> Subject: [Asterisk-Users] Adjusting txgain/rxgain
> 
{clip}
> 
> Is seems to me (and to the digium support guy I've contacted) 
> that I need to adjust the tx and rx gains.  The direction I've received 
> for doing so has been to "just fiddle with them till they sound better" 
> and I've done so without much success.  I've read the wiki page about
using 
> ztmonitor and adjusting till internal callers talking generates 50% 
> spikes on both Rx and Tx plots but doing so produces even more echo.
> 
> What am I missing?  Am I using ztmonitor correctly?  Is there a more
> step-by-step HOWTO for adjusting the gains?  I feel I may 
> need a bit of hand-holding here. ;)
> 
> Paul
> 
{clip}



More information about the asterisk-users mailing list