Asterisk - The Open Source Telephony Project GIT-master-3dee037
The AST Frame Smoother

The ast_smoother interface was designed specifically to take frames of variant sizes and produce frames of a single expected size, precisely what you want to do.

The basic interface is: