[asterisk-dev] Proposed RTP engine API change

Mark Michelson mmichelson at digium.com
Fri Dec 14 16:51:11 CST 2012


Hi everyone,

There is a bit of a discrepancy in the RTP engine API in Asterisk 1.8. 
If you have a look in include/asterisk/rtp_engine.h, there is the 
following function:

format_t ast_rtp_instance_available_formats(struct ast_rtp_instance 
*instance, format_t to_endpoint, format_t to_asterisk);

This function can return the result of the following RTP engine callback:

int (*available_formats)(struct ast_rtp_instance *instance, format_t 
to_endpoint, format_t to_asterisk);

As you can see, the types returned by the 
ast_rtp_instance_available_formats() and the available_formats() 
callback is different. The available_formats() function should be 
returning a format_t instead of an int. For reference, a format_t is a 
typedef'd int64_t. The result is that it is impossible to be able to 
return certain format types in the formats_available() RTP engine 
callback if an int is only 32 bits.

In stock Asterisk this turns out not to be an issue because the two RTP 
engines included do not define an available_formats() callback. However, 
for the version of Asterisk that runs on Digium's gateway products, this 
is a problem since it uses an RTP engine that provides an 
available_formats() callback.

I plan to amend the problem in the mainline 1.8 branch. It is an API 
change, but it's clearly fixing a bug. What I would like to know is if 
there are objections to putting this change into 1.8. Are there any 
people out there that have implemented an RTP engine for which this 
would cause an issue?

Note that Asterisk 10, 11, and trunk are not affected by this bug since 
the media core was completely overhauled in Asterisk 10.

Thanks for your feedback,
Mark Michelson



More information about the asterisk-dev mailing list