Installing the Free G729 Codec for Asterisk
This tutorial will let you install the G729 Codec on an Asterisk installation in under 5 minutes.
Navigate to the codecs directory:
cd /usr/lib/asterisk/modules
Download the codec
- Codecs are provided as binary .so files, you can find the archive at http://asterisk.hosting.lv/#bin
- Take care of the following when picking up one of the files, they depend on your hardware/software:
- Processor Architecture: Check the kernel type installed on your system (using “uname -a” )
- Asterisk Version: As you can see there is codecs for Asterisk 1.2, 1.4 and also 1.6
- The most used ones are the following:
[root@Machine modules]# wget http://asterisk.hosting.lv/bin/codec_g729-ast14-gcc4-glibc-pentium.so
Notice that we are in the modules directory
Rename the codec file
mv codec_g729-ast14-gcc4-glibc-pentium4.so codec_g729.so
Restart Asterisk
/etc/init.d/asterisk restart
Check your work
Connect to Asterisk
asterisk -r
Then show all of the codec translations available using the command below, and check g729 at the left, you should see that it can be translated to many other codecs on the top of the table
Machine*CLI> show translations
Translation times between formats (in milliseconds) for one second of data
Source Format (Rows) Destination Format (Columns)
g723 gsm ulaw alaw g726aal2 adpcm slin lpc10 g729 speex ilbc g726 g722
g723 - - - - - - - - - - - - -
gsm - - 2 2 2 2 1 2 3 - - 2 -
ulaw - 3 - 1 2 2 1 2 3 - - 2 -
alaw - 3 1 - 2 2 1 2 3 - - 2 -
g726aal2 - 3 2 2 - 2 1 2 3 - - 2 -
adpcm - 3 2 2 2 - 1 2 3 - - 2 -
slin - 2 1 1 1 1 - 1 2 - - 1 -
lpc10 - 3 2 2 2 2 1 - 3 - - 2 -
g729 - 3 2 2 2 2 1 2 - - - 2 -
speex - - - - - - - - - - - - -
ilbc - - - - - - - - - - - - -
g726 - 3 2 2 2 2 1 2 3 - - - -
g722 - - - - - - - - - - - - -
Machine*CLI> quit
Troubleshooting
If you didn’t see the codec translation as mentioned above then probably you downloaded the wrong codec, please check again the points mentioned during downloading the codec, you can use the following commands to help you:
asterisk -V
uname -a
G.729 and G.723.1 codecs for Asterisk open source PBX
DISCLAIMER: You might have to pay royalty fees to the G.729/723.1 patent holders for using their algorithm.Sources
To compile the codecs it is recommended to install Intel IPP libraries for better performance. Asterisk 1.4 to 12 are supported.- asterisk-g72x-1.2.tar.bz2 - supports Asterisk 12, Composer XE 2013 SP1, Bcg729 1.0
- README
- hg clone http://bitbucket.org/arkadi/asterisk-g72x
- hg clone http://asterisk.hosting.lv/hg asterisk-g72x
Binaries
| Linux binaries Asterisk 1.8 Asterisk 11 Asterisk 12 |
Notes
- After download check MD5SUM.
- Use x86_64 build if running 64-bit mode. Binary without x86_64 in its name is 32-bit. Use pentium4/core2/opteron binaries even your processor is 64-bit capable but you are running 32-bit.
- Use Pentium 4 build for Pentium D. Use Pentium 3 for VIA C3 and Pentium 4 for VIA C7.
- XEON is a server brand CPU of Pentium3/Pentium4/Core families. Celeron is Pentium3/Pentium4/Core with smaller cache. Basically, there are 5 software cores: MMX, SSE, SSE2, SSE3, SSE4. Pick closest match from Intel CPU line and try it.
- GCC4, ICC - all binaries are compatible with Asterisk built by any other compiler, use what is faster or better for you.
- sse3 builds are for Prescott iteration of Pentium 4 chips with SSE3 support, check for PNI flag in /proc/cpuinfo.
- ICC cores are not always the fastest, check with '(core) show translation recalc 10' on Asterisk console, ensure the box is idle or else timings will be inaccurate.
Troubleshooting
- Noise or metalic sound with codec_g723
Configure /etc/asterisk/codecs.conf [g723] sendrate=63 or 53 as described at the top of this page. - Distorted sound
Disable VAD and CNG in phone and/or your VOIP provider. - show translation - codec is not loaded
Bump asterisk verbosity level with -vv and watch for messages right after 'loading module codec_g729...' - loader.c... /usr/lib/asterisk/modules/codec_g72...: cannot restore segment prot after reloc: Permission denied
Execute:
$ chcon -t textrel_shlib_t /usr/lib/asterisk/modules/codec_g72[39]*.so
This happens when SELinux is enabled and Asterisk process cannot load the codec because of ELF TEXTREL in shared library. This is how IPP works and that is fine. - loader.c... /usr/lib/asterisk/modules/codec_g72...: cannot enable executable stack as shared object requires: Permission denied
Execute:
$ execstack -c /usr/lib/asterisk/modules/codec_g72[39]*.so - Error loading module codec_g72...: cannot open shared object file: No such file or directory
Check
$ ldd codec_g729.so
$ strace -o trace.log -efile -f asterisk
send ldd output and trace.log file to Asterisk G.729 Google group. - Error loading module codec_g72...: wrong ELF class: ELFCLASS32
Use x86_64 binaries because you're running 64-bit OS. - $ ldd codec_g729.so: not a dynamic executable
You are running 32-bit, see Notes - note #2 - Asterisk crashing at startup
If Pentium4 codec is not working, try -no-sse builds, try Pentium3. Try ICC builds. Doesn't work - try Pentium and Debug builds. - Asterisk still crashing at startup
Compile asterisk with CFLAGS=-g
Run asterisk in gdb (with original and -debug version of the codec):
$ gdb /usr/sbin/asterisk
(gdb) r -cvvv
when it crashes do:
(gdb) set disassembly-flavor intel
(32-bit gdb 6.x) disassemble $eip $eip+20
(32-bit gdb 7.x) disassemble $eip, $eip+20
(64-bit gdb 6.x) disassemble $rip $rip+20
(64-bit gdb 7.x) disassemble $rip, $rip+20
(gdb) info registers
(gdb) info threads
(gdb) bt
(gdb) l
(gdb) q
Send an output to Asterisk G.729 Google group together with the result of 'cat /proc/cpuinfo'. - Why these Illegal instruction errors?
For in-depth technical information read http://gcc.gnu.org/PR32893 and http://bugs.gentoo.org/show_bug.cgi?id=151394.
Asterisk G.729 |
Visit this group |
Nenhum comentário:
Postar um comentário