<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Sun, Dec 15, 2013 at 7:20 AM, jg <span dir="ltr"><<a href="mailto:webaccounts@jgoettgens.de" target="_blank">webaccounts@jgoettgens.de</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">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.<br>

<br>
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.<br>

<br>
Please correct me, if my description is incorrect.<span class=""><font color="#888888"><br>
<br>
jg</font></span><div class=""><div class="h5"><br></div></div></blockquote><div><br></div><div>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.<br>
<br></div><div>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 transfers.<br>
<br></div><div>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.<br>
<br></div><div>Remote users have phones with g729<br></div><div>Local users have phones with g722,ulaw,g729<br></div><div>SIP Trunks with ulaw,g729<br></div><div>PRIs with ulaw<br><br></div><div>Remote to local should use g729<br>
</div><div>Local to local should use g722<br>Remote to SIP trunk should use g729<br></div><div>Local to SIP trunk should use ulaw<br></div><div>Local to PRI should use ulaw<br></div><div>Remote to PRI would transcode g729 to ulaw<br>
<br></div><div>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.<br>
<br></div><div>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.<br></div><div><br></div><div>Ryan<br></div>
</div></div></div>