Huge thanks to Joshua Colp for mirroring services

Asterisk-Users: Setting the gain structure

Share on Twitter Digg this story Click to view a printable version Sat, 6 Nov 2004 18:12:43 -0500

Kris Boutilier has posted details to the Asterisk-Users list on how to use the milliwatt services of your telco and multiple lines to set the gain structure correctly in Asterisk:

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: 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: 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 6000

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
                     | RxTLP |<-Tx--<|Txgain |     data
                     |       |       |       |     stream


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


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


You haven't voted yet! Vote:
Current Rating: 0/10 (0 votes)

Comments (Click to post)

Comments
Name:
Subject:
Website:
Message: 

Similar Articles (Based on Title)

#asterisk: Automatic gain control - December 20, 2004
Sam Bashton has sent us details of a program he has created to adjust the volume of your PC while the telephone is in use. This could be used to play music while you are not on the phone and turn it down when you are.

Setting Up @Home 0.8 Guide - April 1, 2005
Kerry Garrison has posted details of a new Set up guide for Asterisk @ Home

Asterisk-Users: UK Male Voice - September 19, 2004
Mark Phillips of http://www.g7ltt.com/ has completed some male brittish voice recordings for Asterisk [download fixed]

Asterisk-Users: How to restart a GS 101/102 phone remotely - September 28, 2004
Tony Mountifield posted an answer to the asterisk-users list on how to remotely restart a GrandStream phone.

Asterisk-Users: UK Sounds - September 28, 2004
Mark Phillips posted to the asterisk-users list with the URL for his GSM and WAV recordings.

Asterisk-Users: MFC/R2 Support... - September 28, 2004
Steve Underwood has posted his MFC/R2 protocol software URL to the asterisk-users mailing list.

Asterisk-Users: New patch to allow speex quality settings: - September 29, 2004
BKW Has asked people to check out bug #2536 on the bugtracker. This allows speex to have its quality and complexity settings changed.

Asterisk-Users: Damin Posts his Asterisk Presentation - October 5, 2004
Damin (Greg Boehnlein) posted details about his Asterisk presentation at the Ohio Linuxfest.

Asterisk-Users: Asterisk Forums ask for help - October 7, 2004
The unofficial Asterisk online forums over at xvoip are asking for help.

Asterisk-Users: Asterisk-Java Released (different from JAsterisk) - October 8, 2004
Another Asterisk/Java Integration project has been started. Click through for details

Asterisk-Users: US$1000 Bounty for RPT issues - October 8, 2004
Bart Coppens has posted a $1000 bounty to get Asterisk to do silence suppresion.

Asterisk-Users: New Fedora Core 1 RPMS for Asterisk 1.0 - October 10, 2004
Andrew McRory has uploaded Fedora Core 1 RPMS to his FTP site.

Asterisk-Users: Request for IAX debug session transcript with IAXy - October 11, 2004
Held needed getting IAXy debug's for phone manufacturer's implementation of IAX


Original Content (C) 2004-2010 Matt Riddell
Back 5  Feed Add
to
Google Subscribe with Bloglines
Go to today

Icons by: FastIcon.com


Back to life
July 21, 2010 Average Vote: 10
Hey all - I am back online after some pretty big projects which have taken all my time. Will be updating the Asterisk news over the next few days.

Nerd Vittles: Building a Bluetooth Proximity Detection System with Asterisk
December 12, 2005 Average Vote: 10
The Nerd Vittles site has an article on proximity detection using Asterisk and a TomTom GPS

Automated Testing Update
July 30, 2010 Average Vote: 10
Russell Bryant has posted details of a new mailing list for automated testing of Asterisk and some information on the progress that has been made. There is no way to say how important I think this work is. It really makes a huge difference to Asterisk and the ability to use it in an enterprise environment. Really great work.

VoIP-Info: FFasterisk Video file converter
August 25, 2006 Average Vote: 10
The wiki has a link to a new piece of software for converting video to the format required for Asterisk.

Code Review: SRTP support for Asterisk
March 12, 2009 Average Vote: 10
Terry Wilson has moved his SRTP branch onto the Digium review board.

HumBug - Pre BETA Launch Registration
July 27, 2010 Average Vote: 10
Nir Simionovich has posted details of the beta of the new call analytics service.

Interview with BKW_
December 7, 2004 Average Vote: 10
We've finally completed our interview with BKW. Hope you like! :-)

SlashDot: GSM and Asterisk Integration
August 21, 2005 Average Vote: 10
There is a post up on SlashDot which talks about using cellphones with Asterisk.

Interview with Mark Spencer
November 26, 2004 Average Vote: 9.9
We have managed to get an interview with Mark Spencer AKA Markster. Mark Spencer is the creator of Asterisk and by far the most active developer.

Asterisk and Kamailio realtime integration tutorial
May 24, 2010 Average Vote: 9.9
Daniel-Constantin Mierla has posted a link to a tutorial on integrating Asterisk and Kamailio using realtime.

Asterisk IPv6 update
February 1, 2010 Average Vote: 9.8
Olle has posted an update on IPV6 in Asterisk and a link to a blog post of his.

Proposal for T.38 transparent gateway design in Asterisk
April 29, 2010 Average Vote: 9.8
Kevin Fleming has posted a proposed design for a transparent T.38 gateway for Asterisk:

Asterisk Monitoring with iPhone and iPod touch
February 12, 2010 Average Vote: 9.7
For the past couple of weeks I have been working on an app that allows you to monitor and restart Asterisk servers.

Monitoring Asterisk with Munin
January 7, 2010 Average Vote: 9.7
I had a few requests for these munin plugins after some discussion on one of the Asterisk lists and thought people might like them.

New Zealand Asterisk Voices
March 2, 2006 Average Vote: 9.7
Chris Hodgetts has posted details of recordings of Asterisk Sounds with a New Zealand accent.


Automated Testing Update
July 30, 2010
Russell Bryant has posted details of a new mailing list for automated testing of Asterisk and some information on the progress that has been made. There is no way to say how important I think this work is. It really makes a huge difference to Asterisk and the ability to use it in an enterprise environment. Really great work.

Asterisk 1.8.0-beta2 Now Available
July 28, 2010
The Asterisk Development Team has announced the release of Asterisk 1.8.0-beta2.

HumBug - Pre BETA Launch Registration
July 27, 2010
Nir Simionovich has posted details of the beta of the new call analytics service.

Branch Merging Changes
July 26, 2010
Russell Bryant has posted details of some changes to the way developers need to commit code to Asterisk because of the newly released 1.8 branch.

Asterisk 1.8.0-beta1 is Now Available
July 26, 2010
The Asterisk Development Team has announced the release of Asterisk 1.8.0-beta1. This release marks the beginning of the testing process for the eventual release of Asterisk 1.8.0.

Asterisk 1.6.2.10 Now Available
July 26, 2010
The Asterisk Development Team has announced the release of Asterisk 1.6.2.10.

Asterisk 1.4.34 Now Available
July 26, 2010
The Asterisk Development Team has announced the release of Asterisk 1.4.34.

AppleRaisin - AstDB over realtime
July 23, 2010
Olle has posted a note about his awesome AppleRaisin branch which provides the ability to store AstDB in realtime. This would make for a much simpler failover and clustering situation.

QueueMetrics 1.6.1 released
July 22, 2010
Lenz has posted a note to inform us that QueueMetrics version 1.6.1 has been released. This release offers a large number of bug fixes, misc improvements and new developements including hotdesking.

Asterisk 1.8 Branch Creation
July 22, 2010
Russell Bryant has posted a note to inform us of the creation of the 1.8 branch of Asterisk.