Skip to content

traud/asterisk-broadvoice

Repository files navigation

BroadVoice for Asterisk

This is an implementation of the audio codecs

  • BroadVoice16 (BV16) and
  • BroadVoice32 (BV32).

RFC 4298 describes their behaviour in RTP. ‘16’ is not about the sample rate but bit rate. Therefore, BV16 is a narrowband (NB) codec. BV32 is the wideband codec (WB), a codec for HD Voice. A research paper comparing other audio codecs was published at InterSpeech 2010. BroadVoice is one of the few audio codecs allowing speech packets not only at 20 milliseconds, 10 milliseconds but also 5 milliseconds. Although this module supports this, Asterisk itself is not able to leverage this, see the Jira issue ASTERISK-25483 for details. Nowadays, several vendors of DECT headsets and DECT phones leverage BV32 as alternative to G.722. The latter requires two DECT slots, which halves the number of concurrent calls in one DECT cell.

To add a codec for SIP/SDP (m= and rtmap), you create a format module in Asterisk: bv32_pass-through.patch. However, both call legs must support BroadVoice (pass-through only). If one leg does not support BroadVoice, the call has no audio. Or, if you use the pre-recorded voice and music files of Asterisk, these files cannot be heard because they are not in BroadVoice but in slin. Therefore, this repository adds not just a format module for the audio-codec BroadVoice but also a transcoding module: bv32_transcoding.patch and codecs/codec_bv32.c.

Installing the patch

At least Asterisk 13.7 is required. These changes were last tested with Asterisk 13.38.3 (and Asterisk 20.3.0). If you use a newer version and the patch fails, please, report!

cd /usr/src/
wget downloads.asterisk.org/pub/telephony/asterisk/old-releases/asterisk-13.38.3.tar.gz
tar zxf ./asterisk*
cd ./asterisk*/
sudo apt install autoconf automake build-essential pkg-config libedit-dev libjansson-dev libsqlite3-dev uuid-dev libxslt1-dev xmlstarlet

Apply the patch:

wget github.com/traud/asterisk-broadvoice/archive/Library-1.2.tar.gz
tar zxf Library-1.*.tar.gz
rm Library-1.*.tar.gz
cp --verbose --recursive ./asterisk-broadvoice*/* ./
patch -p0 <./bv32_pass-through.patch
patch -p0 <./bv16_pass-through.patch

If you still use Asterisk 13, go for bv32_pass-through_13.patch instead.

Install libraries …

If you do not want transcoding but pass-through only, please, skip this step. To support transcoding, you’ll need to download the latest BV32 library and BV16 library. Then, you have to build and install, for example, in Debian/Ubuntu:

… for BroadVoice32:

cd ~/Downloads/
unzip -qq ./BroadVoice32OpenSource.v1.2.zip
cd ./BroadVoice32/FloatingPoint/
patch -p0 <~/Downloads/bv32_library.patch
sudo mkdir /usr/local/include/bvcommon
sudo cp -R ./bvcommon/*.h /usr/local/include/bvcommon/
sudo mkdir /usr/local/include/bv32
sudo cp -R ./bv32/*.h /usr/local/include/bv32/
cd ./Linux/
patch -p0 <~/Downloads/bv32_makefile.patch
make
sudo cp ./libbv32.so /usr/local/lib/
cd /usr/src/asterisk*
patch -p0 <./bv32_transcoding.patch

… BroadVoice16:

cd ~/Downloads/
unzip -qq ./BroadVoice16OpenSource.v1.2.zip
cd ./BroadVoice16/FloatingPoint/
patch -p0 <~/Downloads/bv16_library.patch
sudo mkdir /usr/local/include/bv16-floatingpoint
sudo mkdir /usr/local/include/bv16-floatingpoint/bvcommon
sudo cp -R ./bvcommon/*.h /usr/local/include/bv16-floatingpoint/bvcommon/
sudo mkdir /usr/local/include/bv16-floatingpoint/bv16
sudo cp -R ./bv16/*.h /usr/local/include/bv16-floatingpoint/bv16/
cd ./Linux/
patch -p0 <~/Downloads/bv16_makefile.patch
make
sudo cp ./libbv16.so /usr/local/lib/
cd /usr/src/asterisk*
patch -p0 <./bv16_transcoding.patch

The system headers for BroadVoice16 are installed at a different location to follow Linphone.

Re-load the system libraries:

sudo ldconfig

Run the bootstrap script to re-generate configure:

./bootstrap.sh

Configure your patched Asterisk:

./configure

Enable slin16 in menuselect for transcoding, for example via:

make menuselect.makeopts
./menuselect/menuselect --enable-category MENUSELECT_CORE_SOUNDS

Compile and install:

make
sudo make install

Testing

Several VoIP/SIP implementations use BV16, for example:

Several VoIP/SIP implementations use BV32, for example:

  • Adran IP 706/712
  • Baresip, removed with version 0.6.5
  • CounterPath X-lite 4.5.5 (for Windows XP)
  • CounterPath X-lite 4.7.1 (for Windows 7 and newer), removed with version 4.8.x (Mar. 2015)
  • RTX8663 introduced in 05.10 (Sep. 2020)

Some implementations use both:

  • Aastra 6700i and 6800i Series, removed with firmware 4.1.x (Jun. 2015; DEF39955)
  • SignalWire FreeSWITCH

Baresip, Linphone, and X-lite were tested.

Library

Till Apr. 2015, the BroadVoice library had its own webpage:

Till Jul. 2017, FreeSWITCH maintained its library variant in its source tree. That was based on version 1.0 but havily changed to build a proper shared library in Debian/Ubuntu. For example, all external symbols were renamed. The original version of that was available on Soft-Switch.org. Yet, another variant of version 1.0 can be found on FreeSWITCH, which added just a Linux build system. SUSE created a library in Oct. 2021…

Thanks go to

  • Steve Underwood for converting the BroadVoice library 1.0 into a shared library with an easy-to-use API.
  • Asterisk team: Thanks to their efforts and architecture, this module was written in one working day.

About

Asterisk 13 transcoding module: BroadVoice

Resources

License

Stars

Watchers

Forks

Languages