Is there a way to measure SIP channel volume (to CLI etc)?

I need a way to measure the digital audio level in an Asterisk connection.
Basically just a digital level meter of some sort.

I see there is a way to do this for zaptel cards, but have not found a way to check the transmission level of other types of audio connections. This is not really a problem for pure digital networks, but once some analog interfaces are mixed in the analog speech levels need to get set correctly. I want to be able to measure the 2-wire analog level (on Tip-Ring) and, at the same time, measure the digital level in the Asterisk switch.

External FXO/FXS Gateway boxes are a good example of why this is needed, they need to have their gains set correctly. The easist place to check this would be at the Asterisk switch by monitoring the level of a specific connection. The end goal is to make all sources of audio have about the same level with no echo, so testing at the Asterisk switch would makes sense.

On a related note I see that there appears to be a fair amount of confusion about what the “correct” speech level is, and about how to make Asterisk generate a “correct” digital milliwatt level (note that PlayTones does NOT generate a correct 0 dB signal). The Milliwatt() functions DOES generate the correct level, but 1000Hz is not the desired test frequency because it is an exact sub-multiple of 8 kHz. A better choice is 1004 Hz at 0 dB. I found this was easy to solve by simply created a 10 second wav file of the desired 1004 Hz 0 dB milliwatt tone. I then use PlayBack(file) in a loop to setup an extension as a milliwatt test number. This works well.

I believe the correct nominal VoIP speech transmit level (Active Speech Level, = short term rms level when speaking) is around -15 or -16 dB, where a full scale ulaw digital sine wave is +3.17 dB. Since there is no loss expected in a short Voip connection this is also the expected speech receive level. I think, but am not sure yet, that larger network providers sometimes insert some loss in a digital connection if echo starts to be noticable. This would have been done to avoid the cost of echo cancelers where ever possible. Such padding would have only been a few dB, once the echo got too bad they would give up on the padding and require an echo canceler. I am still looking into this, because it could effect the expected speech receive levels.