The short answer: G729
The long one…
Audio codecs
The most commonly used codecs are:
- G711
- G729
G711
This is a PSTN quality codec, which is supported by 99% of all devices and providers (but often disabled to reduce traffic).
It has very good quality but the highest bandwidth usage (64 kbps + ~20 kbps overhead ≈ 84 kbps in one direction).
It comes in two flavors: G711u (ulaw) used in the USA and G711a (alaw) used mostly in Europe and other countries.
Do not use this codec if you have voice quality issues or limited traffic .
This codec is free, without any licensing fees.
G729
The quality is a little worse compared to G711 but it is often used because it reduces traffic (~8 kbps + ~20 kbps overhead ≈ 28 kbps in one direction).
It takes a lot of CPU power to transcode to/from another codec, so the total call count on the server is greatly reduced using this codec with transcoding.
This codec is not free and is charged per channel.
It is the best option for a medium-size company: it has acceptable quality for low traffic.
G723
The quality is a little worse again compared to G729, and it uses less traffic. It is not free. Avoid it if you can.
GSM
This is an acceptable codec for poor networks. The quality is worse compared to G729. Avoid using it if you can.
Wideband codecs
G722, iLBC, Speex, etc. are used by closed services, such as Skype. Most hardware does not support them so do not bother looking at them.
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 and syllables that are hard to distinguish on regular calls become much easier.
Video codecs
Read the manual for your device to check which codecs it supports.
H263 and H264 are the most popular.
Make sure the same codec is used on both devices that are communicating.
Fax codecs
If your system, provider or device does not support T38, you should use G711 for transmitting and receiving faxes.
G729 can be licenced in few channels (like for servers) and many (for manufacturers). For high volume manufacturers.
Also if you want to save your server’s CPU, you have different chances:
1) use some hardware what do encode instead of CPU (they are comes with own g729 licence too!)
2) use gateway instead of PRI cards
3) ask your provider to transcode
using option 2 and 3, you should set CanReinvite=yes and maybe directmedia so, the SIP endpoint (customer device) connects audio stream directly to provider or gateway (both has hardware g729 encode capability)
Thank you for additional information!