G722 to G711u Transcoding Garbled

On FreePBX 2.9.0.7.

I can have two extensions set up as Polycom phones with:

disallow=all
allow=g722&ulaw

My SIP trunk has:

disallow=all
allow=ulaw

When the two extensions connect to each other, they get g722 and very clean voice quality.

But, when either of them make a call out the SIP provider, the transcoding happening in Asterisk makes the caller’s voice garbled to anyone externally.

If I switch the extensions back to:

disallow=all
allow=ulaw&G722

Then calls sound good out the SIP trunk to the PSTN, but the extensions do ULAW between them and the voice quality isnt “HD”.

Am I missing something in particular that would solve the garbled voice sound and still allow G722 between extensions?

What version of Asterisk are you using?

The version of Asterisk is 1.8.4.2

I run the FreePBX Distro and have used transcoding from G722 to G711 without garbling. I have, however, noticed an increased latency resulting from the transcoding.

Is it possible that the system you’re running is slow? Have you tried a more powerful processor?

I believe that I opened a FreePBX feature request that would allow codecs to be set in an outbound route, so that outbound calls to SIP providers can be forced to G711 and avoid transcoding.

Tony- if HD voice is going to catch on, you might want to see about pushing that suggestion forward.

You can’t set codecs on an Outbound Route.

You can only set codecs on these places:

  • Endpoints, i.e. the phone itself, and the order to be used.
  • Extensions page in FreePBX. disallow and allow section.
  • Trunk Settings, PEER Details
  • Globally in Asterisk SIP Settings module.

If you set the Endpoint to use G722 as a default codec, that is whats get sent to Asterisk to be used. If your calls go out on a trunk that does not have this codec Asterisk will transcode.

Mikael,

I’ve opened a feature request asking that the option be added to the outbound routes module. My thought is that FreePBX would process the number you’ve dialed and modify the allowed codecs accordingly before it puts the call through.

Alternatively, FreePBX could have a different set of Codec priorities for internal vs. external calls. That way, when I placed a call using a G722 handset, it would go out on G711 for external calls without transcoding.

Im going to do some further testing and see if my problem is CPU related.

The CPU in the FreePBX machine is the Intel Core 2 Duo Quad core at 2.6GHZ.

My asterisk is running on 700Mhz Celeron yet it does all transcoding fine G711/speex/speex16/amr/G729. I don’t have any G722 end-point so can’t comment directly on your issue yet if I recall correctly speex and G729 are fairly CPU heavy and those are working fine on my system. I’m assuming you don’t run asterisk on a machine that would do other stuff slowing you down.

Certainly the quad core CPU is not the limiting factor.

I wonder if Asterisk uses the timing interface the the x-coding.

Is this running in any type of a virtual environment?

@AdHominem, codec are static in Asterisk, they are only defined in configurations files that are read in by Asterisk. Once that is done, there is no way to change that except to edit the configuration files (by changing in FreePBX gui) and click on Apply Changes forcing Asterisk to reload the configuration.

The ticket is closed as invalid, as it is impossible to achieve what you want.

It turned out that I was wrong. Asterisk has two variables that can set the codec per call:
SIP_CODEC = Set the SIP codec for the inbound (=first) call leg.
SIP_CODEC_OUTBOUND = Set the SIP codec for the outbound call leg.

The codec set must be one that is configured for the call.

Thanks SkykingOH for setting me straight.