Setting up rxgain and txgain on an analog POTS line
To do this in a quantitative fashion you need a phone number for a 'milliwatt test line' at your serving central office (here is a list for Telecom Image:Milliwatt 100024.txt). I don't recommend using a distant test line as there may be unknown influencing factors.
The steps I followed to set the rxgain were:
- 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.
- Start 'ztmonitor' on the target trunk in 'quantitative' mode (ztmonitor -vv).
- Dial the CO Milliwatt test line from inside Asterisk via the target trunk. Note the Rx level - it should be near 14844.
- If level is < optimal make the the rxgain for the channel more +ve. If > than optimal, more -ve. Executing 'reload chan_zap.so' from the asterisk console will apply your changes.
- 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.
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()
- This time start 'ztmonitor' but refer to the second trunk, not the trunk that terminates on Milliwatt().
- Dial the target trunk from inside Asterisk via the second trunk. Note the Rx level - it should be near 14844.
- If level is < optimal make the the txgain for the target trunk more +ve. If > than optimal, more -ve.
- 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.
Reproduced from a post by Kris Boutilier on the Asterisk-Users group, and from here.