Difference between revisions of "G723/G729 Codec installation"

From Kolmisoft Wiki
Jump to navigationJump to search
m
 
(33 intermediate revisions by 2 users not shown)
Line 1: Line 1:
<br>
<br>
----
<mkmeta>Instructions how to install g723 and g729 codecs</mkmeta>
'''NOTE: Remember that these codecs can be used for testing or educational purposes only. They are not free and license fees applies. See: http://www.voip-info.org/wiki-Asterisk+G.729+Licensing'''
 
'''G723 is not available for Asterisk in any legal form except you buy TDM... card from Digium.'''
<br>
----
<br><br>


==CPU Type==
==CPU Type==


First of all you need to know your CPU type. Do:
First of all, you need to know your CPU type. Do:


  cat /proc/cpuinfo
  cat /proc/cpuinfo


It will show CPU info and you will see a lot of info. Most crucial is:
It will show CPU info, and you will see a lot of info. The most crucial is:


  model name      : Intel(R) Core(TM)2 Duo CPU    E4500  @ 2.20GHz
  model name      : Intel(R) Core(TM)2 Duo CPU    E4500  @ 2.20GHz


NOTE: this will vary on different servers, but from this line you can see what kind of CPU is on this particular machine.
NOTE: this line will vary on different servers, but from it you can see what kind of CPU is on this particular machine.


Here as example we see that we have '''Intel(R) Core(TM)2 Duo CPU'''.
As an example, here we see that we have '''Intel(R) Core(TM)2 Duo CPU'''.


<br>
<br>
==x86_64?==
==x86_64?==


Then we need to know if our server is x86_64. For that we do:
Next, we need to know whether our server is x86_64. For that we do:


  uname -a
  uname -a
Line 34: Line 29:


<br>
<br>
==Codec installation==


Now go to: http://kvin.lv/pub/Linux/Asterisk/ and from the section: Asterisk 1.4 (if you use Asterisk 1.4) select the most appropriate codec.  
==Codec Installation==
 
===From scripts===
 
Install scripts for P4 and P4_64 are added in the newest MOR PRO installation tar. You can use them for fast installation.


For our example CPU we will choose:  
===Manual installation===
 
Now go to: http://kvin.lv/pub/Linux/Asterisk/ and from the Asterisk 1.4 section  (if you use Asterisk 1.4), select the most appropriate codec.
 
For our example CPU, we will choose:  


  codec_g723-ast14-gcc4-glibc-x86_64-pentium4.so
  codec_g723-ast14-gcc4-glibc-x86_64-pentium4.so
Line 63: Line 65:


<br>
<br>
==Testing==
==Testing==


Line 89: Line 92:
     g726    6  2    2    2        1    2    1    2    8    -    9    -    -
     g726    6  2    2    2        1    2    1    2    8    -    9    -    -
     g722    -  -    -    -        -    -    -    -    -    -    -    -    -
     g722    -  -    -    -        -    -    -    -    -    -    -    -    -
== G729 license installation ==
These instructions works with Asterisk 1.8.23
Download and execute the register utility to generate a valid license.
cd /root
wget http://downloads.digium.com/pub/register/x86-64/register
Change the permissions of the /root/register file to r-x------.
chmod 500 /root/register
Run the register utility and follow the interactive instructions. The registration utility will prompt you for your G.729 license key.
/root/register
Download and execute the benchg729 utility to determine the optimum build.
cd /root
wget http://downloads.digium.com/pub/telephony/codec_g729/benchg729/x86-64/benchg729-1.0.8-x86_64 -O benchg729
Change the permissions of the /root/benchg729 file to r-x------
chmod 500 /root/benchg729
Run the benchg729 utility and record the build that it recommends should be used for your platform.
/root/benchg729
Download and install the codec_g729 binary that is built for your platform from
http://downloads.digium.com/pub/telephony/codec_g729/asterisk-1.8.4/x86-64/
NOTE: Asterisk 1.8.23 requires binaries from exactly this download directory.
Extract downloaded file and copy codec_g729a.so to /var/lib/asterisk/modules.
Move original codec_g729.so to another directory for backup purposes.
Restart Asterisk and check if license is found:
asterisk -rvvv
*CLI> g729 show licenses                                                                         
0/0 encoders/decoders of 26 licensed channels are currently in use                               
Licenses Found:                                                                                   
Key: G729-EXAMPLE1 -- Host-ID: ex:am:pl:e0:ex:am:pl:e0:ex:am:pl:e0:ex:                           
am:pl:e0:ex:am:pl:e0 -- Channels: 2 (Expires: 2026-09-26) (OK)                                   
Key: G729-EXAMPLE2 -- Host-ID: ex:am:pl:e0:ex:am:pl:e0:ex:am:pl:e0:ex:                           
am:pl:e0:ex:am:pl:e0 -- Channels: 24 (Expires: 2026-09-26) (OK)


<br>
<br>
==Problems==
==Troubleshooting==


<br>
<br>
===Asterisk crash===
===If Asterisk crashes===


When restarting Asterisk it crashes - that means wrong version of codecs are installed. Remove codecs from /usr/lib/asterisk/modules and repeat all procedure again with different - more appropriate versions of codecs. You can 'downgrade' codec version, starting from: ''codec_g723-ast14-gcc4-glibc-pentium4-sse3.so'' and going down till ''codec_g723-ast14-gcc4-glibc-pentium4.so'' until it works. (This is just an example - for your server codec versions can vary).
If Asterisk crashes when it is restarted, the wrong version of the codec is installed. Remove codecs from /usr/lib/asterisk/modules and repeat all procedures with different - more appropriate - versions of the codecs. You can 'downgrade' your codec version, starting from: ''codec_g723-ast14-gcc4-glibc-pentium4-sse3.so'' and keep going down as far as ''codec_g723-ast14-gcc4-glibc-pentium4.so'' until it works. (This is just an example - for your server, codec versions may vary).


<br>
<br>
Line 102: Line 156:
===Bad audio quality===
===Bad audio quality===


If you experiencing bad quality - try to downgrade your codec. As explained in previous version.
If you experience bad audio quality, try downgrading your codec, as explained in previous paragraph.
 
 
<br>
 
=== Does Asterisk support G729 Annex B? ===
 
No, Asterisk does not support Annex B, because Asterisk does not support silence suppression/voice activity detection (VAD).
 
* See also:
** [http://en.wikipedia.org/wiki/G.729#G.729_Annex_B  Wikipedia G729 Annex B]
** [[Dropping extra frame of G.729 since we already have a VAD frame at the end]]
** [[Comfort noise support incomplete in Asterisk (RFC 3389)]]
 
=== See also ===
* [http://downloads.digium.com/pub/telephony/codec_g729/README Official Digium G.729 installation guide]
<br><br>

Latest revision as of 14:25, 21 April 2021


CPU Type

First of all, you need to know your CPU type. Do:

cat /proc/cpuinfo

It will show CPU info, and you will see a lot of info. The most crucial is:

model name      : Intel(R) Core(TM)2 Duo CPU     E4500  @ 2.20GHz

NOTE: this line will vary on different servers, but from it you can see what kind of CPU is on this particular machine.

As an example, here we see that we have Intel(R) Core(TM)2 Duo CPU.


x86_64?

Next, we need to know whether our server is x86_64. For that we do:

uname -a

And we see that it is:

Linux xxxx #1 SMP Fri Nov 30 00:45:55 EST 2007 x86_64 x86_64 x86_64 GNU/Linux


Codec Installation

From scripts

Install scripts for P4 and P4_64 are added in the newest MOR PRO installation tar. You can use them for fast installation.

Manual installation

Now go to: http://kvin.lv/pub/Linux/Asterisk/ and from the Asterisk 1.4 section (if you use Asterisk 1.4), select the most appropriate codec.

For our example CPU, we will choose:

codec_g723-ast14-gcc4-glibc-x86_64-pentium4.so
codec_g729-ast14-gcc4-glibc-x86_64-pentium4.so

Now download these files to your server:

cd /usr/src/
wget http://asterisk.hosting.lv/bin/codec_g723-ast14-gcc4-glibc-x86_64-pentium4.so
wget http://asterisk.hosting.lv/bin/codec_g729-ast14-gcc4-glibc-x86_64-pentium4.so

Rename them to:

mv /usr/src/codec_g723-ast14-gcc4-glibc-x86_64-pentium4.so /usr/src/codec_g723.so
mv /usr/src/codec_g729-ast14-gcc4-glibc-x86_64-pentium4.so /usr/src/codec_g729.so

CHMOD both of them to 777:

chmod 777 codec_g72*.so

And copy to Asterisk modules:

cp codec_g72*.so /usr/lib/asterisk/modules


Testing

Restart Asterisk and execute in CLI:

show translation

It should show something like this:

CLI> show translation
        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    -   2    2    2        2     2    1     2    8     -    9    2    -
     gsm    6   -    2    2        2     2    1     2    8     -    9    2    -
    ulaw    6   2    -    1        2     2    1     2    8     -    9    2    -
    alaw    6   2    1    -        2     2    1     2    8     -    9    2    -
g726aal2    6   2    2    2        -     2    1     2    8     -    9    1    -
   adpcm    6   2    2    2        2     -    1     2    8     -    9    2    -
    slin    5   1    1    1        1     1    -     1    7     -    8    1    -
   lpc10    6   2    2    2        2     2    1     -    8     -    9    2    -
    g729    7   3    3    3        3     3    2     3    -     -   10    3    -
   speex    -   -    -    -        -     -    -     -    -     -    -    -    -
    ilbc    6   2    2    2        2     2    1     2    8     -    -    2    -
    g726    6   2    2    2        1     2    1     2    8     -    9    -    -
    g722    -   -    -    -        -     -    -     -    -     -    -    -    -

G729 license installation

These instructions works with Asterisk 1.8.23

Download and execute the register utility to generate a valid license.

cd /root
wget http://downloads.digium.com/pub/register/x86-64/register

Change the permissions of the /root/register file to r-x------.

chmod 500 /root/register

Run the register utility and follow the interactive instructions. The registration utility will prompt you for your G.729 license key.

/root/register

Download and execute the benchg729 utility to determine the optimum build.

cd /root
wget http://downloads.digium.com/pub/telephony/codec_g729/benchg729/x86-64/benchg729-1.0.8-x86_64 -O benchg729

Change the permissions of the /root/benchg729 file to r-x------

chmod 500 /root/benchg729

Run the benchg729 utility and record the build that it recommends should be used for your platform.

/root/benchg729

Download and install the codec_g729 binary that is built for your platform from

http://downloads.digium.com/pub/telephony/codec_g729/asterisk-1.8.4/x86-64/ NOTE: Asterisk 1.8.23 requires binaries from exactly this download directory.

Extract downloaded file and copy codec_g729a.so to /var/lib/asterisk/modules.

Move original codec_g729.so to another directory for backup purposes.

Restart Asterisk and check if license is found:

asterisk -rvvv
*CLI> g729 show licenses                                                                           
0/0 encoders/decoders of 26 licensed channels are currently in use                                 

Licenses Found:                                                                                    
Key: G729-EXAMPLE1 -- Host-ID: ex:am:pl:e0:ex:am:pl:e0:ex:am:pl:e0:ex:                             
am:pl:e0:ex:am:pl:e0 -- Channels: 2 (Expires: 2026-09-26) (OK)                                     
Key: G729-EXAMPLE2 -- Host-ID: ex:am:pl:e0:ex:am:pl:e0:ex:am:pl:e0:ex:                             
am:pl:e0:ex:am:pl:e0 -- Channels: 24 (Expires: 2026-09-26) (OK)


Troubleshooting


If Asterisk crashes

If Asterisk crashes when it is restarted, the wrong version of the codec is installed. Remove codecs from /usr/lib/asterisk/modules and repeat all procedures with different - more appropriate - versions of the codecs. You can 'downgrade' your codec version, starting from: codec_g723-ast14-gcc4-glibc-pentium4-sse3.so and keep going down as far as codec_g723-ast14-gcc4-glibc-pentium4.so until it works. (This is just an example - for your server, codec versions may vary).


Bad audio quality

If you experience bad audio quality, try downgrading your codec, as explained in previous paragraph.



Does Asterisk support G729 Annex B?

No, Asterisk does not support Annex B, because Asterisk does not support silence suppression/voice activity detection (VAD).

See also