jump to navigation

Asterisk g.729 and g.723 Codec Transcoding/Pass-Thru February 10, 2009

Posted by hasnain110 in Asterisk.

Given below are the step by step instruction for making Asterisk work as a codec Transcoder

Step 1:

Download suitable codec binaries for your asterisk platform

Step 2:

Restart asterisk to make asterisk load newly installed codec modules

e.g. amportal restart

Step 3:

log into asterisk console asterisk -rvvvv and type this command core show codec and check if you can see newly install codecs

elastix*CLI> core show codecs
Disclaimer: this command is for informational purposes only.
It does not indicate anything about your configuration.
INT    BINARY        HEX   TYPE       NAME   DESC
1 (1 <<  0)      (0x1)  audio       g723   (G.723.1)
2 (1 <<  1)      (0x2)  audio        gsm   (GSM)
4 (1 <<  2)      (0x4)  audio       ulaw   (G.711 u-law)
8 (1 <<  3)      (0x8)  audio       alaw   (G.711 A-law)
16 (1 <<  4)     (0x10)  audio   g726aal2   (G.726 AAL2)
32 (1 <<  5)     (0x20)  audio      adpcm   (ADPCM)
64 (1 <<  6)     (0x40)  audio       slin   (16 bit Signed Linear PCM)
128 (1 <<  7)     (0x80)  audio      lpc10   (LPC10)
256 (1 <<  8)    (0x100)  audio       g729   (G.729A)
512 (1 <<  9)    (0x200)  audio      speex   (SpeeX)
1024 (1 << 10)    (0x400)  audio       ilbc   (iLBC)
2048 (1 << 11)    (0x800)  audio       g726   (G.726 RFC3551)
4096 (1 << 12)   (0x1000)  audio       g722   (G722)
65536 (1 << 16)  (0x10000)  image       jpeg   (JPEG image)
131072 (1 << 17)  (0x20000)  image        png   (PNG image)
262144 (1 << 18)  (0x40000)  video       h261   (H.261 Video)
524288 (1 << 19)  (0x80000)  video       h263   (H.263 Video)
1048576 (1 << 20) (0x100000)  video      h263p   (H.263+ Video)
2097152 (1 << 21) (0x200000)  video       h264   (H.264 Video)

Step 4:

Choose your fav. editor in linux , mine is Vi

vi /etc/asterisk/extensions.conf and add these lines under the [General]

#include sip_general_additional.conf
bindport =5060         ; Port to bind to (SIP is 5060)
bindaddr =    ; Address to bind to (all addresses on machine)

And for your GW settings do the same


Now set your Eyebeam to send calls using g.729 codec to asterisk it should work

To check if calls are going into g.729/723 codec run this command on the main console

sip show channels

I hope this should work



1. Quick facts about VoIP SIP SDK | Intro to SIP - August 28, 2009

[…] Asterisk g.729 and g.723 Codec Transcoding/Pass-Thru « Hasnain Ali … […]

2. Tariq Aziz - September 1, 2009

Salam hasnain Sb!
Really pleased to see this blog. I googled a lot about “Codecs(mainly G723) behaviour/compatability with Asterisk” but still confused. can you guide me a link where I can read the details of codecs and then which codecs are supported in asterisk w.r.t diff versions and how can i proceed further.??
Like what happens when a sip/sdp invite contains G723 as the first or only preference in media attribute.
2.Does asterisk behave differently for diff codecs if no licensing is involved and it works only in Pass through mode by default??.
3.Finally we are using Asterisk as SBC( in both; proxy and non-proxy mode) and face issue only when we receive invites with G723 as first preference and how much it depends on end system(Soft switch and Media GWs).
Your help/guidance will really solve a lot of problems!

hasnain110 - September 30, 2009


Sorry for the rate reply as im pretty occupied with some stuff here. Here are the quick answers that I can give you for now

1.You can know the list of codecs supported core show codecs ..about information voip-info.org is the best guide for this

2. For all the liscense codecs which works in pass-thru mode the behaviour is different. However for the built-in free codecs its different. The only difference in simple words is for pass-thru codecs you can not register the device directly to Asterisk and make call.

3. please send me a Wireshark packet trace of sip. This will help me exactly narrow down the issue

3. Shuvro - September 29, 2009

Hi Ali

It is a nice guide line to install codec. But could u let me know which binary is appropriate for me to use in Asterisk- and Fedora 10,64 bit and Intel Xeon processor??

and Secondly I must to pay for G723 and G729 even I installed those binary codec??

hasnain110 - September 30, 2009


Sorry for a late reply as im pretty occupied with some stuff here. No you dont need to pay for any liscense its a pass-thru codec which means you can make a call if you receive a call from g729/g723 call. but you can not register a phone directly and make a call with g729 codec

4. Suraj Ohri - February 26, 2010

Hello Sir,
My Question is i dont want to convert my codec Peer to peer calling in asterisk.

I mean to say if my client send call with G723 then call must be passed with G723 and if my client send call with G729 then call must be passed with G729..so what is the settings for this please help me..

hasnain110 - March 2, 2010

Hello Suraj

First explain me the scenario you are using then I might can help you. If you are using in codec in pass-thru then yes it is possible to send and receive call in same codec but the scenario must be pass-thru

Suraj Ohri - March 20, 2010

Hello Hasnain
Thanks for your reply
i am using asterisk free pbx with a2billing.

Suraj Ohri - March 20, 2010

Hello Hasnain
Thanks for your reply
i am using asterisk free pbx with a2billing.
if i will remove a2billing my calls are passing near about 500-600 calls.i think issue is a2billing so what i have to disable in a2billing or what is the solution.

plz reply me

Thank You

hasnain110 - March 27, 2010

Hello Suraj

I personally think A2Billing shouldnt be the case , check the following

1. Are you doing Transcoding on the astetierks?
2. Are you relaying media from Asterisk

Try using Asterisk only for Signalling not the RTP , you will see a huge difference

5. max - September 30, 2010

thank you for useful post

6. shah - February 3, 2011

You said in one of your post that “Try using Asterisk only for Signaling not the RTP , you will see a huge difference”

can you explain it a bit more. How can i do that?

hasnain110 - February 3, 2011

Explanation: the logic is simple, its easy for asterisk to process the signalling as compare to handling the media as well if the media is also processed by the Asterisk.

Howto: find the below fiend in sip.conf and make it no

directrtpsetup = no

then reload the asterisk configuration.

To see the difference I would recommend you to see the CPU and mem usage stats of Asterisk before and after making this change you will find a huge progress. (as long as you are running at least 30 calls on the switch else you will not notice the difference)

shah - February 4, 2011

Thanks for your prompt reply and very well explanation. You got a great approach to VOIP. Actually I am having one way voice problem scenario is something like this

Customer—(SIP Trunk)—>My A2billing–(IAX2 Trunk)–>Freepbx—->PSTN

My voice is heard clear on the other end but what I hear is just scrambling sound.
Call load is not the problem because even I test it with the single call at a time facing the same problem.

No Transcoding as I am using g729 all the way. Now I am not sure that either problem lies in the A2billing or SIP – IAX2 bridging or PSTN.

If customer using VAD(voice activation detection)or Silence Suppression can it be the issue … as asterisk does not support the these features.

Thanks in advance for you kind help.

7. Hafeez ul Hassan - January 21, 2012

If provider is using g729a codec. Could I have to use same or g729. What is difference between both of them?


8. Muhammad Sergani - March 31, 2014

Hello Hasanain,

It’s good to bump into this blog after years 🙂

Mohammad Sergani

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: