[asterisk-dev] Adding an audio format in Asterisk

Jean Aunis jean.aunis at prescom.fr
Mon Mar 27 02:58:00 CDT 2017


Le 24/03/2017 à 23:01, Matt Fredrickson a écrit :
> 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)
As far as I know it will be a home-made codec which I know nothing 
about. But it's a good thing you mentioned CLEARMODE : I had not heard 
about it before, but it seems perfectly fit for what I'm trying to achieve.
So maybe I will implement this by adding support for 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.
Thank you for these points. I originally thought that adding a new line 
"CODEC_REGISTER_AND_CACHE" would magically do everything required, but 
now I see there is some more work to do. Still, it seems to remain quite 
easy.
>
>> - 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 :-)
>




More information about the asterisk-dev mailing list