Codec alternative

I dont have funds for the G723 and G729 codecs. What is best alternative codec? Is it GSM?

Need advise. Thanks.

GSM is a good codec, good compression (almost as tight as g.729) but very little quality loss and also low CPU usage.
iLBC is similar but takes more CPU
both are around 15kbit/sec

for something midrange, g726-32 (ADPCM) is a good choice, its half the bandwidth of ulaw/alaw (g.711) but sounds almost identical. 32kbit/sec

of cource whatever codec you choose will be partially dictated by whatever the other side supports… if the other side is * then you can use almost anything

i plan to use * > digium > gateway (cisco or quintum). THis is ok for sending outbound calls (via gw g723 or g729) but I remember that SIP phones needs to talk directly to asterisk which doesnt have g723 and g729.

oh well. btw, if IAX is included in the choice? will it be GSM or IAX?

IAX is not a codec. IAX is a signalling/transport format, ie you would use IAX instead of SIP. Unless your phones or gateway support IAX, it will not help you.

Asterisk will happily passthru g.729 data if both sides support it (it will do this even if you do not purchase the codec from digium). However it is just taking data from one leg and passing it on to the other, so things like feature codes or recording probably won’t work.

So as I said you need to find codecs that both your gateway and phone support. I’d suggest going with g.726, GSM or ilbc if they are supported on both sides. If not, use 729 in passthru mode.

In IAX so if I use IAX-enabled/phones that support IAX i’ll still need a codec right? Just making sure.

What is that pass-thru mode? How do i implement it?

Here is the setup:
asterisk w/ digium > e1 > gateway

phone registers in asterisk so it will talk directly to asterisk and not gateway right? IM mixed up. sorry.

yes you are correct, iax is just a transport so you still need a codec. iax works with the same codecs SIP does.

passthru mode is included by default. just allow g.729 as a codec and you are set.

what do you mean by asterisk w/ digium? do you mean digium interface cards? if so which ones?

if you are using an E1 line, you dont need a codec, the E1 line uses ulaw (which also means passthru mode wont work)…

if i understand you right you have:

(many IP phones) --SIP-- Asterisk --E1 line-- gateway of some kind?

give me more info on your setup and what you are doing and i can be more helpful…

Yes you’re right on that.

Many IP phones > Asterisk with Digium E1 card > E1 tie line > gateway.

Lets assume that IP phones has G729 but my asterisk dont have. So its useless and i have to use GSM and/or other codecs. What im trying to say is that i thought at first i can register my IP phones w/ G729. i realize its not asterisk - dumb.

The gateway’s g729 (and other licensed codec) will be useful when the IP phones registered to asterisk will send it via another provider that supports g723/729, etc.

I really haven’t explored the performance/bandwidth consumption of GSM. Hope it really will not really hurt my bandwidth. :smile:

One more thing, Asterisk to Asterisk interconnection is via IAX right, what codec should i use?

okay i understand more now

thing is, an E1 uses ulaw. Thus whatever else you have, asterisk has to translate into ulaw for the gateway. That means you need the licenses from Digium, 32 of them one for each channel.

I am of course assuming that you are running the E1 as a voice span right into a channel bank type thing, not data. If you are running the E1 as an IP transport, then you can of course run VoIP across it and use any codec the gateway supports.

I guess i’m asking is what exactly is the gateway a gateway to?
if its a voip gateway and it connects to a remote VoIP system (feeding asterisk the E1), then you should skip the E1 entirely and just connect asterisk to the voip system by sip or whatever.
otoh if its a channel bank type thing that connects to many analog lines, or is an interface to your provider with another PRI of some kind coming out, then you need to feed it ulaw/alaw and you are stuck

The setup:

Sip phones (gsm) > asterisk w/ digium > e1 (ulaw/alaw/isdn/r2,etc.) > gateway > internet (voip g273/g729>

What do you mean that i need license from digium? Digium to gateway will be isdn or r2 whichever applicable. of course i’d prefer isdn.

"I I guess i’m asking is what exactly is the gateway a gateway to?
if its a voip gateway and it connects to a remote VoIP system (feeding asterisk the E1), then you should skip the E1 entirely and just connect asterisk to the voip system by sip or whatever. "

Yes to a remote terminating switch or so. I need the gateway to make it g723/g729.

ehhh, why use the gateway at all? that seems like an exercise in futility… you convert the call from SIP to E1 on * and then back to some voip protocol again to talk to the remote system

why not just do:

(many IP phones running g.729) - (asterisk in passthru mode) --your internet link-- (whatever the gateway connects to)?
Thus you dump the gateway and the E1 card, no need to convert the audio or buy codecs, the call is encoded once on the ip phone and the media is shot straight thru asterisk to whatever the gateway would connect to. Both sides (phone and whatever is on the other end) support g.729 so you are all set.

alternatively if you really really want to use the gateway for g.729 encoding, i am assuming the gateway, asterisk, and the IP phones are all on the same LAN (and the gateway links it to another site somewhere else, thus the need for low bandwidth). If this is the case then you don’t need to worry about bandwidth because asterisk is on the lan. Thus:
(phones using ulaw/alaw) -LAN- (Asterisk using ulaw/alaw) -E1- (gateway) —g.729— other voip system

However an E1 card and cisco gateway are going to be a lot more expensive- E1 is 32 channels, so even assuming you did license every channel you have $320 in g.729 licenses. I am sure that an E1 card and a cisco gateway cost more than $320…

what does the gateway connect to? what protocol is it using?

Hey thanks for enlightening me - this one:

“(many IP phones running g.729) - (asterisk in passthru mode) --your internet link-- (whatever the gateway connects to)?
Thus you dump the gateway and the E1 card, no need to convert the audio or buy codecs, the call is encoded once on the ip phone and the media is shot straight thru asterisk to whatever the gateway would connect to. Both sides (phone and whatever is on the other end) support g.729 so you are all set.”

WHy i didnt thought of this. Oh i see, i dont know the passthru mode… how do i enable it again?

just set allow=g729. If you don’t buy the 729 codec, asterisk will use it in passthru mode.

You might want to buy a few channels of the codec to use for voicemail and stuff, as I understand it they won’t be ‘occupied’ if the call can be passed thru. Just don’t use options like t or r when dial()'ing and you’re set.

Alright :smiley:

Now i get it. If my phones doesnt have g723/9 i’ll forward them to the e1 > gateway, if they have then pass-thru mode will do.

Oh btw, how is there a command something that will detect the codecs of the phones registered to * ? THat could be a problem is there are lots of phones involved.

you cant really detect the codecs by registration, but you can see it as the call comes in.

Every single IP phone that I have ever seen supports G.729. All of them.

Even if they didn’t, you could run ulaw to asterisk, pay for some g.729 codecs, and translate. This will still cost a hell of a lot less than E1 gateways.

Btw, which of the codecs use low CPU?

CLI> show translation will give you an idea. the longer it takes to translate, the more CPU it must use.

Higher number means more CPU needed?

    g723   gsm  ulaw  alaw  g726 adpcm  slin lpc10  g729 speex  ilbc

g723 - 5 2 2 3 2 1 12 14 - 24
gsm 16 - 2 2 3 2 1 12 14 - 24
ulaw 16 5 - 1 3 2 1 12 14 - 24
alaw 16 5 1 - 3 2 1 12 14 - 24
g726 17 6 3 3 - 3 2 13 15 - 25
adpcm 16 5 2 2 3 - 1 12 14 - 24
slin 15 4 1 1 2 1 - 11 13 - 23
lpc10 19 8 5 5 6 5 4 - 17 - 27
g729 18 7 4 4 5 4 3 14 - - 26
speex - - - - - - - - - - -
ilbc 19 8 5 5 6 5 4 15 17 - -