Asterisk 1.8 – working AMR patch

As my Android phone supports only a handful of codecs other than GSM – no G.723 or G.729 -, I wanted to have my Asterisk support one of these, to have a better bitrate and/or sound quality.

Supported codecs:

a=rtpmap:96 GSM-EFR/8000
a=rtpmap:97 AMR/8000
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000

PCMU/PCMA (G.711u/a) is crap and takes up a lot of bandwidth, GSM is something we know for a long time, GSM-EFR I haven’t heard about it, AMR looked like a good candidate. Looking up asterisk and AMR resulted in an obsolete patch for a 1.8.0rc, but as it turned out, it could be brought up to date to compile on a “current” Asterisk.

I’ve chosen 1.8.11.1 as that’s available with the Debian buildscripts in Digium’s repository. Here is a patch which includes the AMR codebase from the 3GPP site and the required patches to the various Makefiles – chan_mobile and app_dahdibarge is intentionally taken out. Compiles and works fine on Ubuntu Hardy.

What you need to do:

  1. Download the patch:  http://uid0.hu/dl/asterisk-1.8.11.1-amr.patch
  2. Add the Digium repository into your sources.list:
    deb-src http://packages.asterisk.org/deb lucid main
  3. apt-get source asterisk
  4. Apply the patch with “patch -p1” into the untarred Asterisk source directory
  5. Run debian/rules binary
  6. Install the created .debs

Let me know if the build procedure doesn’t work for you. As this is a Lucid-based source package, it could happen that it’d cry out for updated libtool and/or autoconf packages – let me know if that’s the case.