gsm-codec-lib-r2 new release

Mychaela Falconia falcon at freecalypso.org
Fri May 12 15:54:01 UTC 2023


Hello GSM community,

I just put a new release of Themyscira GSM codec libraries and
utilities package:

ftp://ftp.freecalypso.org/pub/GSM/codecs/gsm-codec-lib-r2.tar.bz2
ftp://ftp.freecalypso.org/pub/GSM/codecs/gsm-codec-lib-latest.tar.bz2
(symlink)

The two libraries in this package (libgsmefr and libgsmfrp) are
intended for people who develop gateway software interconnecting
Osmocom-based GSM networks to PSTN or other networks, gateways which
include a speech transcoding function that terminates the GSM codec
leg.

If anyone is currently interconnecting an Osmocom GSM voice network to
the outside world using software which you did not write yourself
(Asterisk, FreeSwitch, Kamailio, whatever) and you care about the plain
old FR codec, and/or care about EFR, beyond just AMR, I encourage you
to investigate your current non-Osmocom gateway software to see exactly
how it implements FR and EFR.  Because there were NO pre-existing FOSS
libraries that correctly implement FR and EFR decoding prior to my
Themyscira gsm-codec-lib development, most pre-existing gateway
software probably implements these codecs in a flawed manner:

FR codec: Everyone to my knowledge implements this codec using classic
libgsm, a library that dates back to 1990s.  It's a good library, it's
a fully correct implementation of GSM 06.10 spec, and I use it too.
However, it implements _only_ a bare 06.10 encoder and a bare 06.10
decoder, without any DTX functions of GSM 06.31 and related specs.  In
the encoder direction having no DTX isn't really a problem (you won't
be able to do DTXd anyway unless you got lots of spectrum and are
running multi-ARFCN cells), but the lack of an Rx DTX handler per GSM
06.31 *is* a real problem: if you feed the uplink from a GSM call (RTP
stream from a BTS) to a bare GSM 06.10 decoder such as gsm_decode()
function in libgsm, you won't get correct handling of SID frames,
which every standard GSM MS will transmit, and you won't get correct
handling of BFI frame gaps, which will always occur.  The correct
solution is to insert a call to a GSM 06.31 Rx DTX handler (it is more
than an ECU) just before the call to gsm_decode(), and my libgsmfrp
offering is that GSM 06.31 Rx DTX handler.

EFR codec: Everyone other than me implements EFR (if they support it
at all) using an AMR library such as libopencore-amrnb.  I have seen
totally broken implementations that schlep 244-bit payloads directly
between supposed-to-be-EFR RTP and the AMR library, without reordering
those bits per gsm690_12_2_bitorder[] - those implementation have
exactly zero chance of ever actually working with a real GSM-EFR MS on
the other end - and I've also seen implementations that do perform this
bit reordering and are thus closer to correct.  But even the latter
implementations are still wrong when it comes to SID handling: EFR is
equivalent to the highest MR122 mode of AMR only for regular speech
frames, but not for SID.  There does exist a special encoding format for
representing GSM-EFR SID in AMR frame interfaces, but libopencore-amrnb
does not support GSM-EFR SID in any way at all.  If you take the uplink
from a GSM-EFR call and feed it to libopencore-amrnb decoder, any time
the GSM MS emits a SID frame, strange noise sounds will appear at the
output of that decoder, instead of the correct comfort noise.

Themyscira libgsmefr is a proper encoder and decoder library for EFR,
based on the EFR reference code from ETSI, in exactly the same way how
libopencore-amrnb is based on the AMR reference code from ETSI/3GPP.
It still has some performance problems which I will be working on later
(the goal of getting it to perform no worse than libopencore-amrnb has
not been achieved yet), but at least it is correct.

Hasta la Victoria, Siempre,
Mychaela aka The Mother


More information about the Community mailing list