Weird audio phenomenon - asterisk, linux or hardware?

I’ve been getting really bad outgoing sound quality using the iaxComm softphone via asterisk over a 512/128 ADSL connection. Yesterday i managed to improve it drastically (by the sound of echo testers of 3 different voip providers) by doing something which has left me completely bemused!

I can call the echo test and hear the same distorted, aftefact-filled, sound quality i’ve been hearing. But then if i toggle (off then on) the ADC capture switch on my soundcard (using gamix) it instantly improves to a standard that’s quite acceptable.

I’ve tried this several times, with 3 different echo tests (one in Australia and two in Europe - I’m in Australia) and two different softphones (iaxComm and SJphone) and it’s worked every time. But why it should work is completely mystifying me!

Assuming it’s not just an unlikely chain of weird co-incidences, i can only come up with the following possible explanations:

  1. there’s some weirdness with the soundcard / linux (2.6.11) combination (but this doesn’t seem likely as the sound quality from the same mic being captured on the same computer with qarecord is very good).

  2. stopping and starting the audio stream has some kind of resetting effect on either the softphone’s or asterisk’s encoding processes.

or 3) stopping and starting the audio stream has some kind of resetting effect on my adsl modem/router’s queues and packets aren’t getting dropped any more.

Number 3 doesn’t seem to be very likely though, because an even weirder thing is that, although i seem to be able to get consistent results with the other 3 (internet) echo testers, the echo test on my local asterisk server doesn’t work the same way and consistently has worse sound quality than the remote ones!

Am i going mad?

My asterisk server is a 1200MHz duron with 768MB ram and not really anything else running on it.

Is it likely to be something asterisk related, or should i be looking elsewhere?

Well, i’m still going mad! And i still can’t really explain the phenomenon. But i’m beginning to seriously suspect the ethernet switches in my local net.

I’m fairly convinced now that most - if not all - of the audio problems i’ve been experiencing are produced by the way the switches work. There’s one in the local network and one that’s part of the ADSL modem. I’m intending to try taking the modem/router out and using a speedtouch ADSL modem i’ve got. And also replacing the cheapish ethernet switch in the LAN with something a bit better quality.

The LAN one seems to be causing more problems than the modem one, but the modem one is definitely suspect too.