Best way to handle different codecs with incoming calls

I am using asterisk to act more as a switch than a PBX, to provide wholesale and retail voip services.

Problem I am seeing is that even though there is no codec set on my origination provider’s trunk, if the remote end is forcing g729, the call will fail because my asterisk server attempts to send the call using ulaw. How can asterisk be programmed to use the codec that is set by the peer?

Thank you

the sip extension used by your remote peer (the one using g729) must have allow=g729,alaw so it allows g729 inbound. Then, if the call is conencted to another peer, this peer needs also to support g729 (in your sip.conf definition and by the final host). If not, you need g729 licenses to transcode from g729 to whatever is supported

There is no way to have my setup like a real provider and just have everything go through my system in “pass-thru” mode? I successfully got it working with outbound calls with canreinvite set to yes, but the incoming calls situation is disappointing me that I will not be able to rely on the peer’s codec setting when choosing the codec in which to deliver the call.

PS - the remote end does have disallow=all and allow=g729 but the call still comes in as ulaw. I want to avoid purchasing tons of codec licenses, but most of all I really want to do what I can to avoid transcoding.

Thank you

I think a lot of “real providers” use Asterisk!

You really need to provide sip set debug output, to see what is really happening. However, you need to remember that G.729 pass through is not possible if you do anything that requires Asterisk to:

  • generate tones itself;
  • generate voice announcement, unless you install the G.729 variants
  • play music on hold, unless you install the G.729 variants;
  • record the call;
  • playback a voice message.

All these require either a G.729 licence, or recordings that are already G.729 coded.