Changing codec during call

Being relatively new to VOIP I did not know that the g729 codec is the absolute worst codec for music on hold possible. Seriously. It stinks something awful.

Is there a way to renegotiate the codec during the call reliably?

Transcoding is clearly not an option, and Digium’s codec segfaults all the time when transcoding. I have found it be a crapshoot in that regard.

Ideally what I would like to do is to have the all the music on hold MP3’s, and possibly a streaming service for business, that would use a better codec for music and then renegotiate back to g729 when the music on hold stops.

I don’t even know if that is possible with Asterisk. If not, then I am truly screwed. g729 sound quality is awesome, and going back to something else would be a tremendous sacrifice in call quality.


have you tried to “play” with SIP_CODEC var?


Have you tried converting the MP3 to g729 format.

As at the moment you are transcoding them via slin.

TBH mp3 moh is the best quality


Absolutely. Otherwise it would require a license for each call on hold which would be very expensive.

g729 produces extremely crappy MoH regardless of how you use it. There is a new “annex” or whatever that handles MoH quite a bit better, but that annex is not present on the phones I have in use. Perhaps in a future firmware update they might have it. In any case, the Digium codec present on the system is not that particular annex.

My problem is that I have put g729 everywhere because of increased call quality and bandwidth consumption. All of the phones are in remote locations and there was a huge difference when I switched from ulaw,g711,gsm etc. to g729. Night and day difference and I was sold on g729. The licensing cost would considerable if I did not lock the system down everywhere to prevent transcoding, which is the only time it uses a license.

On inbound calls is primarily when I need to use a MoH class with “higher quality” music. All other instances can be the built-in MoH which has the g729 files and sound quality is high, even if it does make you want to drink the Koolaid and board the mothership.

On these inbound calls I could temporarily switch away from g729 since all of the Asterisk boxes are colocated and bandwidth quality is very high and abundant at the datacenter.

I don’t know if it is possible to do this switching during a call and it would be a real tragedy to have to abandon the g729 codec, which is where I am being lead to right now. MoH is very important and the free offerings in Asterisk are simply unacceptable for use on inbound calls.

That would seem to be setting the codec before the call is placed, or answered. Not a codec change during a call.


Im confused

Why ? and there is no “FREE” G729 offerings. Also have you got a reliable timing source ? and lets be honest converting any music to a 8k is not going to give it justice

quote from a codec supplier

[quote] If you have any expectations of passing music-on-hold through a low bit rate vocoder with any characteristics that do justice to the word “fidelity”, you should take a step back and take a philosophical look at what you are trying to do. Have you ever heard the saying “to a child with a hammer, everything looks like a nail”?

Low bit rate vocoders look at their input signals and try to model them using a human vocal tract model. That model limits the tools available to the vocoder. So if the input signal is speech, the low bit rate vocoder does a reasonably good job at modeling and therefore compressing the speech without losing too much fidelity. But how many people do you know who can coax their vocal tract to mimic music. Sure, you may have a uniquely talented friend (who has too much time on his or her hands) who can sound like a particular instrument. But we’re not talking just about a single instrument, but multiple instruments plus singers all at the same time. What vocal tract model could do that? The low-bit-rate vocoder just doesn’t have the right tools in its toolbox to do the job. By increasing the bit rate to 12.4 kbps and by adding tools to its toolbox, G.729E performs better than its lower bit rate counterparts while maintaining its voice tools. But it is no substitute to audio and music codecs. [/quote]

Sometimes you have to accept the linitations.

It may be worth checking if a g729 transcoder is used if the call on hold is a g711 trunk call.



The free g729 MoH offerings I refer to are what come with Asterisk. They are free in the same way the Asterisk sounds are free.

I am using the Digium g729 codec, a g729 supported VOIP provider, and phones that all support g729.

I also understand the limitations of codecs and music in general. The terrible quality I refer to is specifically when they are transcoded (beforehand) into g729 files. Playing it back in anything else sounds decent, and I know it won’t ever come close to MP3.

Everything on the system is g729. I spent a good deal of time making sure this was true. The license is only good for 3 channels and I regularly have many many times that in concurrent calls in the system. If it was transcoding to g729 at any point I would have failed calls all over the place since the only codec allowed on the phones, and for the provider is g729.

I don’t even know if I have a timing source. I vaguely understand that it used for dialogic/t1 cards etc. I am all SIP/IAX everywhere in the system.

I just don’t know.