GSM codec quality issues

I have a new Asterisk installation and am having quality problems with the GSM codec. The scenarios that I have tried are as follows:

  1. providerA <–iax/ulaw–> asterisk <–sip/ulaw–> sip_phone (good)

  2. providerA <–iax/ulaw–> asterisk <–sip/gsm–> sip_phone (good)

  3. providerA <–iax/gsm–> asterisk <–sip/gsm–> sip_phone (good)

  4. providerA <–iax/gsm–> asterisk <–sip/ulaw–> sip_phone (bad)

  5. providerB <–sip/ulaw–> asterisk <–sip/ulaw–> sip_phone (good)

  6. providerB <–sip/ulaw–> asterisk <–sip/g729–> sip_phone (good)

  7. providerB <–sip/g729–> asterisk <–sip/g729–> sip_phone (good)

  8. providerB <–sip/g729–> asterisk <–sip/ulaw–> sip_phone (good)

  9. providerB <–sip/ulaw–> asterisk <–sip/gsm–> sip_phone (good)

  10. providerB <–sip/gsm–> asterisk <–sip/gsm–> sip_phone (good)

  11. providerB <–sip/gsm–> asterisk <–sip/ulaw–> sip_phone (bad)

Scenarios 4 and 11 where I’m doing GSM to external providers are where I have the problem. The sound quality is really, really, bad and barely intelligible. It sounds like a lot of static and distortion. What’s particularly confusing is that the problem exists only when GSM is the codec between external providers and the asterisk server. When GSM is the codec between the local phones and the asterisk server but not the providers, everything works fine.

The hardware is admittedly old (PIII), and may be the cause of the problem but I am doubtful of that. I doubt it’s processor contention as processor intensive combinations such as g729<->GSM work well. Memory and I/O resources are generally unused as well. Network utilization is low and the fact that ulaw to providers works well indicates that bandwidth is not an issue. The problem seems to be limited to the incoming stream from the provider side.

Show translation gives the following:
g723 gsm ulaw alaw g726aal2 adpcm slin lpc10 g729 speex ilbc g726 g722
g723 - - - - - - - - - - - - -
gsm - - 4 - - - 3 - 36 - - - -
ulaw - 8 - - - - 1 - 34 - - - -
alaw - - - - - - - - - - - - -
g726aal2 - - - - - - - - - - - - -
adpcm - - - - - - - - - - - - -
slin - 7 1 - - - - - 33 - - - -
lpc10 - - - - - - - - - - - - -
g729 - 15 9 - - - 8 - - - - - -
speex - - - - - - - - - - - - -
ilbc - - - - - - - - - - - - -
g726 - - - - - - - - - - - - -
g722 - - - - - - - - - - - - -

I’m using version Asterisk 1.4.16.2 built from the tarball on the web site. The OS is Debian/Linux (lenny/testing) running kernel 2.6.22 (stock). Provider facing connectivity is via cable Internet (10Mbps down, 640Kbps up).

At first I thought it might be a transcoding issue but I’ve eliminated that as a variable by using voicemail. I setup the codec to my providers to allow only GSM (logging confirms this) and configured the voicemail format for only GSM. So I’m only doing GSM to the providers, voicemail prompts are in GSM format, and voicemail storage format is GSM only for the sake of testing. In this scenario, if I call from outside using my cell phone, there should be no transcoding when I leave a voicemail message as it’s GSM all the way through and watching processor utilization supports this. When I call and access voicemail from a cell phone (I have 2 providers with same results from both), it all sounds very good. I leave a message (stored in GSM format only), hangup, then proceed to retrieve it. The message sounds as initially described being barely intelligible with lots of static and distortion. So all I have now are symptoms which show that GSM from my asterisk server is fine, but GSM from both external providers to the asterisk server is really bad and transcoding is not involved.

My apologies for the long winded message but I wanted to be as thorough as possible in hopes of finding an answer. Any ideas? Thanks in advance.

I have exactly the same situation (except for only having tested it with SIP).

Initially this showed up as all sounds being really bad quality but this went away when I loaded the other formats for sounds (mainly ulaw). So I assumed a transcode problem too.

Now I realize that this is more likely to be some problem with the GSM codec. It’s odd that this only affects one direction but I’ve heard of stranger things!

It’s unlikely to be CPU problems since my server is a 650MHz Athlon and that’s always been fine running gsm on * 1.4. The only difference is that I have had to reload the whole system so I have put the latest * version on.

I am a little concerned about my core show translation too since this shows ~80ms for GSM but about 45ms for g729. They were always a lot closer than that before, I think.

Just an FYI that I found a solution. Since I’m building from source, I noticed that during the config process that it was looking for GSM libraries and it found none. I did a search, installed libgsm1 and libgsm1-dev packages, re-ran the configure script (it now found GSM libraries), compiled, and it works well.

I was having garbled GSM prompts… the GSM library load prior compile fixed me right up. Thanks for the assist.

Hi all,

I seem to have the same problem, but I couldn’t yet fix it.
I have libgsm 1.0.12 installed, when compiling asterisk it says:
checking for gsm_create in -lgsm… yes
checking gsm.h usability… yes
checking gsm.h presence… yes
checking for gsm.h… yes

Could anyone help me please?
Thanks.