High Definition VoIP on Asterisk-FreePBX

Aastra 6739i SIP phoneA short guide on how to use High Definition VoIP on Asterisk and FreePBX.

What is it
HD VoIP in the Asterisk world involves selecting the g722 codec for VoIP calls.  g722 is known as a wideband codec as opposed to g711 which is narrowband.  The nice thing about it is that it does not require any more bandwidth than g711.  Both require 64kbit/s each way for a 2-way conversation.

The difference is that g722 employs compression combined with a higher sample rate to obtain a practical acoustic bandwidth of 50 Hz-7000 Hz as opposed to g711 which has a practical acoustic bandwidth of 200-3000 Hz.  The difference in voice quality is quite noticeable.  Instead of sounding like you are talking into a tin can it now sounds like the other person is in the same room.  You can hear more subtle nuances in the person’s voice and certain letters/syllables that are hard to distinguish on regular calls become much easier. 

If one endpoint is using g722 and the other is using g711, the endpoint using g722 will hear better sound quality from the other end but the g711 end will not notice much if any difference. Transcoding overhead between g722 and g711 is minimal.  Roughly equivalent to half the transcoding overhead between g711 and GSM.

How to enable it
You need to be using Asterisk 1.6 or a patched version of Asterisk 1.4.  You need at least one endpoint that supports g722 such as an Aastra 67xxi phone.  Enable g722 on the endpoint as the first choice, falling back to g711 or some other codec if Asterisk-FreePBX does not try to negotiate g722 first.

On asterisk you simply have to edit /etc/asterisk/sip.conf and place "allow=g722" before all the other "allow=" statements and reload asterisk.  This will make asterisk try negotiate g722 before the other codec’s.

Newer versions of FreePBX (introduced around v2.8) now have a feature for re-arranging the priority of codec’s.  If you try editing the sip.conf file FreePBX will simply re-write the file when you reload.  You can add the "allow=g722" statement to /etc/asterisk/sip_general_custom.conf and reload FreePBX but it will be added after the codecs listed in sip.conf and therefore at a lower priority.  The best way is to add it via a handy FreePBX module called "Asterisk SIP Settings".  That will add g722 capability to sip.conf and this module now allows you to re-arrange the priority of the codecs so you can place g722 as the first codec an endpoint will try negotiate if you so desire.
 

Sections: