Skip to content

Adding iLBC to Asterisk

The Internet_Low_Bit_Rate_Codec is a freely-available stream processor that works really well with human voice compression. It typically delivers clear voice signals in ~16kb of bandwidth. For that reason, it has become very popular in Asterisk implementations. Unfortunately there have been license disputes in the open source community and the Asterisk maintainers have removed iLBC from the source tree. But you can still use it if you know a few tricks.

Build from Source

Depending on your distribution, you might need to build Asterisk from source. I'm using Red Hat Enterprise Linux 4, and Asterisk isn't one of the available packages. So here's how I did it. (I'm not going to detail how to install the kernel source, kernel headers, etc... See your distribution's instructions for that).

  cd /usr/src

  tar xzf asterisk-1.4.25.tar.gz
  cd asterisk-1.4.25

  # the following lines overcome a compile problem in 
  # RedHat Enterprise Linux 4 where the iLBC source isn't 
  # found by make, even after it is downloadeded.  
  # Your distro might not need this, so skip down as needed
  # get the ILBC source
  cd contrib/scripts/
  ./get_ilbc_source.sh
  cd ../..
  cd  codecs
  #the codecs/ilbc directory is empty, so make it a symlink to 
  #the contrib/scripts/codecs/ilbc directory
  rm -rf ilbc
  ln -s /usr/src/asterisk-1.4.25/contrib/scripts/codecs/ilbc ilbc
  cd ..

Then...

  ./configure
  make menuconfig

The menuconfig option gives a menu-based approach to configuring the source. ILBC is disabled by default, so we need to enable it. Here is what the main screen looks like:

               **************************************************
                   Asterisk Module and Build Option Selection
               **************************************************

                               Press 'h' for help.

                              1.  Applications
                              2.  Call Detail Recording
                              3.  Channel Drivers
                         ---> 4.  Codec Translators
                              5.  Format Interpreters
                              6.  Dialplan Functions
                              7.  PBX Modules
                              8.  Resource Modules
                              9.  Voicemail Build Options
                              10. Compiler Flags
                              11. Module Embedding
                              12. Core Sound Packages
                              13. Music On Hold File Packages
                              14. Extras Sound Packages

Go into option 4 and enable codec_ilbc, like this:

               **************************************************
                   Asterisk Module and Build Option Selection
               **************************************************

                               Press 'h' for help.

                              [*] 1.  codec_adpcm
                              [*] 2.  codec_alaw
                              [*] 3.  codec_a_mu
                              [*] 4.  codec_dahdi
                              [*] 5.  codec_g726
                              [*] 6.  codec_gsm
                              [*] 7.  codec_ilbc
                              [*] 8.  codec_lpc10
                              XXX 9.  codec_speex
                              [*] 10. codec_ulaw

                       Adaptive Differential PCM Coder/Decoder

Then backout and goto option 5 to enable format_ilbc

               **************************************************
                   Asterisk Module and Build Option Selection
               **************************************************

                               Press 'h' for help.

                              [*] 1.  format_g723
                              [*] 2.  format_g726
                              [*] 3.  format_g729
                              [*] 4.  format_gsm
                              [*] 5.  format_h263
                              [*] 6.  format_h264
                              [*] 7.  format_ilbc
                              [*] 8.  format_jpeg
                              [*] 9.  format_ogg_vorbis
                              [*] 10. format_pcm
                                  ... More ...


                        Raw iLBC data

After that, I recommend scanning through the other options to see if there are other things you need. In particular, options 12-14 contain some helpful soundfiles.

Exit out of the menuconfig and press 'S' to save your options. After that, its a fairly standard linux build process:

make
make install
make samples
make progdocs