[asterisk-users] Why doesn't Asterisk try to prevent transcoding

Ryan Wagoner rswagoner at gmail.com
Sun Dec 15 08:00:28 CST 2013

On Sun, Dec 15, 2013 at 7:20 AM, jg <webaccounts at jgoettgens.de> wrote:

> I see, you do want something like picking g722 provided there is no
> transcoding. Because Asterisk is a B2BUA it can transcode, so it would
> choose g722 where the other party is doing g711.
> For known parties, maybe one could change the SIP configuration on the fly
> using the Asterisk realtime engine, or modify the settings of the phone
> with an http request. Generally, an Asterisk configuration option like
> "prioritize_matching_codecs" would be needed, but I don't think this is
> very useful. In this case there should also be all sound files available in
> g722. Even if you have them, some channels might still be silent as
> sometimes users choose to get MOH, for example, from the phone itself.
> Phones usually store sound files in a single format assuming that somebody
> else is able to transcode if necessary.
> Please correct me, if my description is incorrect.
> jg
You are correct. Your idea of the prioritize_matching_codecs option is what
I am looking for. Yes Asterisk can transcode, but why transcode when you
don't need to. If the phone is advertising both formats it should support
them. If the phone only supports local MOH in one format then the phone
should only advertise that format.

If Answer and Playback are called first then the format would have already
been sent back in the 200 OK and Asterisk would transcode when Dial is
called. If Dial is called first, change the format for the 200 OK and use
it for the rest of the call. I haven't looked into what happens with

The idea comes from the following setup. I have 450 users on a FreePBX /
Asterisk server with a Sangoma transcoding card. However I am limited in
the number of sessions. I also have a number of smaller 10-50 user
deployments without transcoding cards.

Remote users have phones with g729
Local users have phones with g722,ulaw,g729
SIP Trunks with ulaw,g729
PRIs with ulaw

Remote to local should use g729
Local to local should use g722
Remote to SIP trunk should use g729
Local to SIP trunk should use ulaw
Local to PRI should use ulaw
Remote to PRI would transcode g729 to ulaw

If I set these codecs on the devices depending on which side initiates that
call transcoding occurs more often than I would like. I could reverse the
codec order, however a lower bandwidth codec is chosen in cases where I
would prefer a higher bandwidth codec.

I looked at this a year ago on Asterisk 1.8 and ended up using ulaw for
everything but remote phones. The remote phones end up transcoding g729 to
ulaw for most calls.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20131215/323e411e/attachment.html>

More information about the asterisk-users mailing list