Mark Berry November 4, 2011
I’m using Asterisk 1.8.5 under FreePBX 126.96.36.199. My endpoints (Polycom IP430 phone, SPA3102 ATA) and my ITSP all support the G.729a codec. I wanted to test audio quality using this compressed codec.
G.729a requires that you purchase a license if you are converting (transcoding) the audio to another codec. Although the licenses are inexpensive, I preferred to avoid the overhead of transcoding by simply passing through the G.729a packets.
“Passing through” means that both legs of the call must use G.729a. At first I hoped to be able to use the standard ulaw (G.711u) codec for all calls except those going to my ITSP. However, I eventually found that if the first leg of a call prefers ulaw, and the second leg requires G.729a, Asterisk will not go back and reinvite the first leg using G.729a (see my comment in this thread). Bottom line: we need to set up the PBX to use G.729a on all calls, internal and external.
Setting It Up
Once that was clear, the setup was fairly simple:
- Download the current g729 sound files from Digium:
These are required for the voicemail system to work after converting to G.729.
- On the Asterisk machine, under
/var/lib/asterisk/sounds, rename the
- Create a new
endirectory and extract the new sounds there. Recursively change the group and Owner to asterisk and the permissions to 775 to match the original “en” directory.
- In the FreePBX admin panel, go to Tools > Config Edit. Add the following lines to sip_general_custom.conf:
That puts g729 as the first priority for the whole system.
- From the console, open the Asterisk CLI (asterisk –r). Make a call and type sip show channels. You should see the g729 codec on both legs of the call, whether you call internally or externally. Do try all combinations to make sure that G.729a is supported throughout. If not, the call will fail and you’ll see a corresponding message in the log (Tools > Asterisk Logfiles). (Or if you a the G.729a license, the call will succeed but will be transcoded.)
Update: Still Need to Transcode
November 5, 2011: Alas, not as easy as I thought. The above did set up G.729a pass-through on outbound calls. However, some problems remained:
- Inbound calls through the SPA3102 were still in G.711u format. Since Asterisk tried to use G.729a for the second leg, the call failed without a transcoder. Changing the SPA3102’s Preferred Codec to G729a solved that problem.
- Voicemail greetings are not available in .g729 format. Converting from .WAV to .g729, or even creating new greetings in .g729, seems to require a transcoder.
- Voicemail messages are not stored in .g729. This can be remedied by adding g729 to the list of formats in
voicemail.conf, but still seems to have trouble without a transcoder.
- Rod Montgomery, Directory of Services at Digium, writes in this thread that without a transcoder, Asterisk will not be able to process audio, e.g. DTMF codes for IVR and voicemail. I’m not sure about this one—it seemed to handle the DTMF when I called internally anyway.
Bottom line, it still makes sense to set up pass-through for actual phone calls, but there are so many places that audio conversion is needed that it makes sense to get the transcoder. As Mr. Montgomery says in the post linked above, you only need as many licenses as you have simultaneous channels doing transcoding. So if you are making all calls in pass-through mode, you only need a few licenses for receiving and accessing voicemail, and possibly for IVR.