[asterisk-dev] Adding an audio format in Asterisk

Matt Fredrickson creslin at digium.com
Fri Mar 24 17:01:25 CDT 2017


On Fri, Mar 24, 2017 at 7:43 AM, Jean Aunis <jean.aunis at prescom.fr> wrote:
> Hello,
>
> I need to add support for a new audio format in Asterisk. It will be
> actually a very limited support : I just need to take the audio from one
> side and transmit it to the other side. No decoding / transcoding will be
> involved. One side will be a DAHDI endpoint, the other one a SIP endpoint.

What's the new audio format, if you don't mind me asking? (/me wonders
if it's CLEARMODE)

> Let's put aside for the moment the modifications which may have to be done
> on the channels drivers to handle the codec negotiation. If I focus on
> Asterisk's core and RTP handling, it seems I could achieve this simply by
> registering a new format in codec_builtin.c. Two questions then :
>
> - firstly, is this really the only thing to do, or am I missing something ?

I forget every time I've had to do this, and end up relearning it
every time.  Here are some other places that you'll need to modify:

main/rtp_engine.c: Some work here to work with SDP based protocols, like SIP.
include/asterisk/format_cache.h: To declare the new format in a header file.
main/format_cache.c: Also need to define the format here.
channels/chan_dahdi.c: It needs modified for support for any new
codecs that it needs to work with.

> - secondly, is there a more "pluggable" way to do this ? Maybe with a shared
> object which would be loaded on startup ?

Good question.  I don't think that there's a great way to add a
completely new codec (not previously described in Asterisk at all)
without patching Asterisk.  Perhaps Josh Colp or Kevin Harwell can
correct me if I'm wrong :-)

-- 
Matthew Fredrickson
Digium, Inc. | Engineering Manager
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA



More information about the asterisk-dev mailing list