[asterisk-dev] Transcoding: Codec 2, iLBC 20, SILK, GSM-EFR, AMR(-WB)

Alexander Traud pabstraud at compuserve.com
Tue Nov 24 09:08:35 CST 2015

Thanks to the codec/format changes which were introduced with Asterisk 13,
adding new trancoding modules is possible within one working day. Thanks to
format-attribute modules, the debugging of the SDP/fmtp-negotiation resides
in one source file. Therefore, I was able to port five formats to
Asterisk 13: <http://github.com/traud>.

Question #1: Level of Integration?

Now, I plan to submit those modules into Asterisk. However, which level of
integration is desired for which format: pass-through only (like G.729),
pass-through plus library detection (like Opus), everything (like Speex)?

pass-through including fmtp negotiation (level 1)
 |  pass-through plus library detection in ./configure (level 2)
 |   |  transcoding module in codecs/codec_* (level 3)
 |   |   |
[x] [x] [x] Codec 2 <http://www.rowetel.com/codec2.html>
[x] [x] [x] iLBC 20; the other mode iLBC 30 is available already
[ ] [ ] [ ] SILK; deprecated since September 2012 in favor of Opus
[x] [x] [ ] GSM-EFR; GSM-FR is available already
[x] [x] [ ] AMR and AMR-WB

Your opinion? Please, set/change your checkmarks as desired! Of course, I am
able to find a contra position for each codec. Of course, I would like to
see complete support for all codecs (level 3). Anyway, some arguments why I
implemented those codecs:
* SILK/24 is the only default HD codec in the famous CSipSimple for Android.
  All other HD codecs must be enabled in CSipSimple manually.
* GSM-EFR is default in Stock-Android, optional in Voice-over-LTE (VoLTE)
  Beside AMR and GSM-FR the only codec with compression (the rest is G.711).
* AMR(-WB) are mandatory when linked to VoLTE (3GPP TS 26.103 chapter 7)
* Codec 2 does not have a MIME media-type specification, yet.
  However, Codec 2 is supported in FreeSWITCH and CSipSimple.
* iLBC 20 was an apprentice piece thanks to the patch in ASTERISK-18094.

Question #2: Format-attribute Keys as Header Files?

In Asterisk 13, some formats do have a header file in include/asterisk/,
like CELT and Opus (*_attr_keys). However internally, nobody consumes those
headers anymore. Some format-attribute modules offer "format_attribute_set"
but nobody uses that either. Is it OK, to create new header files? For which
use-case should I implement "format_attribute_set"?

Question #3: Module Loading Priority

H.26x modules load very late (AST_MODPRI_DEFAULT). The Opus Codec module
loads very early (AST_MODPRI_CHANNEL_DEPEND). Which one is correct? Or are
both and there is a reason why video modules load later than audio modules?

Question #4: Orphan Format-attribute module CELT

Currently, Asterisk 13 does not offer even pass-through of SILK or CELT.
Still their header files and their format-attribute modules are present. Is
there a reason for this?
For example, the SILK module contains several bugs, like creating several
fmtp lines instead of one, is able to parse only a single parameter, and
does not return a default when used with an internal transcoding module.

Final Sentence

Although it would be nice to see at least some of this work in Asterisk, I
am mainly interested in a code-review. Is it possible to submit everything
for code-review even if there is no chance to pass?

More information about the asterisk-dev mailing list