Asterisk is a very well known open source IP PBX system. It’s scalability is amazing. Now days, Asterisk is used as PBX and also small to mid size Soft-Switches. An office can implement its own pbx system with a small cost with asterisk.
On the other hand, Raspberry Pi is a small yet full featured computer which can run asterisk and serve an office with 50 employees pretty easily at a premise considering no codec conversion is needed, as codec conversion can put nasty load on the server sometimes.
- Compiling g729 codec and enabling support in RasPBX. Deliverable will be codec_g729.so, compatible for RasPBX.
To prepare the build environment, I did –
# apt-get update && apt-get upgrade # apt-get install build-essential # apt-get install dh-autoreconf
Building BCG729 from Belledona Community
I have tried to pull the source from git and build but is doest support the build process for asterisk (in next phase). So I had to use v1.0.0 to server my purpose.
# cd /usr/local/src # wget http://download-mirror.savannah.gnu.org/releases/linphone/plugins/sources/bcg729-1.0.0.tar.gz # tar xzf bcg729-1.0.0.tar.gz # cd bcg729-1.0.0 # ./configure --libdir=/lib # make # make install
Building codec_g729.so for Asterisk
# cd /usr/local/src # wget http://asterisk.hosting.lv/src/asterisk-g72x-1.4.tar.bz2 # tar -jxvf asterisk-g72x-1.4.tar.bz2 # cd asterisk-g72x-1.4 # ./autogen.sh # ./configure CFLAGS='-march=armv6' --with-asterisk130 --with-bcg729 --with-asterisk-includes=/usr/include # make # make install
You can see the list of all available parameters by ./configure –help. As my asterisk version in RasPBX was 13.13.1, so I had to chose –with-asterisk130. I didn’t try the ITU code yet. I will share my experience if I try it in future.
The codec_g729.so file will be generated in the /usr/lib/asterisk/modules folder of RasPBX. Try –
# chmod +x /usr/lib/asterisk/modules/codec_g729.so # asterisk -vvvr # asterisk> core reload/core restart now # asterisk> core show translations recalc 10
– and you should see g729 in the list.
Performance was good for single call as we tested. Extensive test is needed before it should be used in production. I hope, optimization can be achieved by tuning up the build configuration and also ITU source for g729 might produce better result. If you have any idea and/or suggestion then I would love to hear that.
We may need to compile the library for a different version of Asterisk on Rasbian (Debian on Raspberry Pi). As an example, let’s try compiling g729 for latest Asterisk 14 (14.3.0) on Rasbian 8 using Raspberry Pi 3. In this case, we can execute –
# apt-get install openssl libxml2-dev libncurses5-dev uuid-dev sqlite3 libsqlite3-dev pkg-config libjansson-dev subversion libiksemel-dev libspeex-dev libssl-dev libmyodbc unixodbc-dev libsrtp0-dev # cd /usr/local/src # wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-14-current.tar.gz # tar zvxf asterisk-14-current.tar.gz
– and in “Building codec_g729.so for Asterisk” section, we need to change configure parameters as –
... # ./configure CFLAGS='-march=armv6' --with-asterisk140 --with-bcg729 --with-asterisk-includes=../asterisk-14.3.0/include ...
– to specify the build target as Asterisk 14 and also to include necessary directory containing headers to perform this build job.