Codec issues

I would like to know how will I find out which codec I used or sent to other end of the line when I make a call. Is there any command in the asterisk CLI?And also can I change the codec I used to sent out? Or can I use diffrent codecs?Is g723 free?

Can somebody help me on this.



First, I assume you are talking about SIP calls (not iax).
try SIP SHOW CHANNELS at cli. It will tell you which channels are active and what codec they are using (under Form)

in sip.conf you can define what codec to use. This is done once in the [general] section, and again (optional) on each channel. Define codecs is done using the allow= and disallow= statements. Allowed codecs will be selected in order of preference. For example:


will allow only ulaw, alaw and gsm in that order of preference.


is the same except that if ulaw/alaw/gsm all are not usable by the remote party, it will attempt to negotiate for any other available codec, transcoding it if necessary.

I believe the command show codecs prints out the list of available codecs. The ones you need to know are:
ulaw/alaw (aka G.711 u/alaw) 64kbit/sec very very high voice quality. Can carry DTMF tones and fax. Popular, near universal support.
gsm: 13kbit/sec. Nice compression and voice quality. doesnt use a lot of CPU to encode.
iLBC (internet low bandwidth codec) 15kbit/sec, uses lots of CPU.
G.729 8kbit/sec good voice quality, uses lot of cpu but not as bad as iLBC. Requires license fee about $10 per channel to work in most countries. Popular, widely supported.

G723.1 is not currently supported by *. It can be used by * but only in pass thru mode, that is * will take the encoded voice frames and pass them from one end to the other without decoding them. This is rarely useful.

if you want to see the ‘cost’ of codec translation, use