Smartvox supplies Voice over IP products and solutions for Internet Telephony Service Providers and Businesses

Installing Mediaproxy 2 on CentOS 5 64bit

Important note: This page is not the latest. If you are using CentOS 6, we recommend that you go to our updated page describing installation of Mediaproxy version 2.5.2 on CentOS 6. Just follow the link here:
How to install Mediaproxy 2.5.2 on CentOS 6 64 bit

Mediaproxy 2 is a Python application from AG-Projects which is available as a free download as well as being available as a commercial product from AG-Projects. It is used in combination with the Mediaproxy module of OpenSIPS.

Unlike Mediaproxy 1, the new version has a lot of dependencies and it can be quite tricky to install. The INSTALL instructions that come with the package are very helpful, but unfortunately they are aimed primarily at installers who either have Debian or Ubuntu Linux distributions. If you are using CentOS (or Red Hat), especially the 64 bit versions, then getting Mediaproxy 2 to run could be the cause of much lost sleep (or lost hair or both)!

Having spent at least three days tearing my hair out getting it to work, it seemed like a friendly thing to do would be to let other CentOS OpenSIPS installers have the benefit of my experience. It also provides me with a reference document next time I want to build an OpenSIPS server on CentOS.

So here are the sequential instructions for installing the libraries needed for Mediaproxy 2. If you follow the instructions here, then continue with the instructions already supplied in the INSTALL file that comes with Mediaproxy 2, then you should get a result (much quicker than the first time I tried). ....and many thanks to Dan Pascu of ag-projects for all his help.

 

Update and install some packages using YUM

C and C++ compilers
yum install gcc
yum install gcc-c++

Development libraries and headers for some existing packages
yum install libgpg-error-devel.x86_64
yum install python-devel.x86_64

 

Install Linux libnetfilter_conntrack from RPM

libnfnetlink
Suggested version: libnfnetlink-0.0.25-1.el5.rf.x86_64.rpm
Locating a download: Use Advanced Search here http://rpm.pbone.net
Install: rpm -i libnfnetlink-0.0.25-1.el5.rf.x86_64.rpm

libnfnetlink-devel
Suggested version: libnfnetlink-devel-0.0.25-1.el5.rf.x86_64.rpm
Locating a download: Use Advanced Search here http://rpm.pbone.net
Install: rpm -i libnfnetlink-devel-0.0.25-1.el5.rf.x86_64.rpm

libnetfilter_conntrack
Suggested version: libnetfilter_conntrack-0.0.97-1.el5.rf.x86_64.rpm
Locating a download: Use Advanced Search here http://rpm.pbone.net
Install: rpm -i libnetfilter_conntrack-0.0.97-1.el5.rf.x86_64.rpm

libnetfilter_conntrack-devel
Suggested version: libnetfilter_conntrack-devel-0.0.97-1.el5.rf.x86_64.rpm
Locating a download: Use Advanced Search here http://rpm.pbone.net
Install: rpm -i libnetfilter_conntrack-devel-0.0.97-1.el5.rf.x86_64.rpm

 

Install libgcrypt (if needed) and gnutls from source tarball

Check your libgcrypt version first. Install v1.2.4 if required
Depending on which release of CentOS you are using, it is possible that your server already has a sufficiently up-to-date version of libgcrypt. Check the existing version using the following yum command:
yum info libgcrypt
If yum shows a version later than 1.2.4 then you will not need to install from source. Instead, just make sure that yum shows the library is "installed" rather than just being "available". If it is not installed, use this command to install it: yum install libgcrypt

If you are running on an older CentOS release with a correspondingly old version of libgcrypt, then you will have to install a newer version from source as follows:
Suggested version: libgcrypt-1.2.4.tar.gz
Locating a download site: http://www.gnupg.org/download/mirrors.en.html
Unzip: tar -xzf libgcrypt-1.2.4.tar.gz
Change to the sub-directory created when you unzipped the tarball
Build and install the library:
./configure --libdir=/usr/local/lib64
make
make install


Then install gnutls
Suggested version: gnutls-2.4.2.tar.bz2
Locating a download site: http://www.gnupg.org/download/mirrors.en.html
Unzip: tar -xf gnutls-2.4.2.tar.bz2
Change to the sub-directory created when you unzipped the tarball
Build and install the library:
./configure --with-included-libtasn1 --libdir=/usr/local/lib64
make
make install

 

Manually copy some run-time libraries to /usr/lib64

Copy the following dynamic libraries from /usr/local/lib64 to /usr/lib64
libgcrypt.so.11.2.3 (only if you installed v1.2.4 from source)
libgnutls.so.26
libgnutls.so.26.4.6
libgnutls-extra.so.26
libgnutls-extra.so.26.4.6
libgnutls-openssl.so.26
libgnutls-openssl.so.26.4.6

You may also need to edit the sym-link /usr/lib64/libgcrypt.so.11
On older releases of CentOS 5 where it was necessary to install libgcrypt 1.2.4 from source, you will probably find remnants of the older version of libgcrypt that was already present on the machine before you installed version 1.2.4. In this case, it may be necessary to modify or replace a sym-link present in /usr/lib64:
libgcrypt.so.11 --> libgcrypt.so.11.2.2
On my server, I used midnight commander to edit the sym-link so it pointed to the new runtime library installed from the tarball. It now looks like this:
libgcrypt.so.11 --> libgcrypt.so.11.2.3

 

Install some Python packages

Install ctypes
This library is required for Python version 2.4, which is the default version installed by yum at the time of writing. However, if you have Python version 2.5 (or later) then you probably will not need this library as it is included.

Suggested version: ctypes-1.0.2.tar.gz
Locating a download site: http://pypi.python.org/pypi/ctypes/1.0.2
Unzip: tar -xzf ctypes-1.0.2.tar.gz
Change to the sub-directory created when you unzipped the tarball
Build and install the library:
./setup.py build
./setup.py install

Install python-application
Suggested version: python-application-1.1.5.tar.gz
Locating a download site: http://pypi.python.org/pypi/python-application/1.1.5
Unzip: tar -xzf python-application-1.1.5.tar.gz
Change to the sub-directory created when you unzipped the tarball
Build and install the library:
./setup.py build
./setup.py install

Install python-cjson
Suggested version: python-cjson-1.0.5.tar.gz
Locating a download site: http://pypi.python.org/pypi/python-cjson/1.0.5
Unzip: tar -xzf python-cjson-1.0.5.tar.gz
Change to the sub-directory created when you unzipped the tarball
Build and install the library:
./setup.py build
./setup.py install

Install python-gnutls
Suggested version: python-gnutls-1.1.9.tar.gz
Locating a download site: http://pypi.python.org/pypi/python-gnutls/1.1.9
Unzip: tar -xzf python-gnutls-1.1.9.tar.gz
Change to the sub-directory created when you unzipped the tarball
Build and install the library:
./setup.py build
./setup.py install

 

Install Python-ZopeInterface from RPM

Python-Zopeinterface
Suggested version: python-ZopeInterface-3.3.0-1.el5.pp.x86_64.rpm
Locating a download: Use Advanced Search here http://rpm.pbone.net
Install: rpm -i python-ZopeInterface-3.3.0-1.el5.pp.x86_64.rpm

 

Install the Twisted Python package

Install the core Twisted package from Twisted Matrix Labs
Suggested version: Twisted-8.1.0.tar.bz2
Locating a download site: http://twistedmatrix.com/trac
Unzip: tar -xf Twisted-8.1.0.tar.bz2
Change to the sub-directory created when you unzipped the tarball
Build and install the library:
./setup.py build
./setup.py install

 

Install Mediaproxy 2

Mediaproxy 2
Suggested version: mediaproxy-2.3.8.tar.gz
Locating a download site: http://download.ag-projects.com/MediaProxy
Suggested location to copy and then unzip the tarball: /usr/local
Unzip: tar -xzf mediaproxy-2.3.8.tar.gz
Change to the sub-directory created when you unzipped the tarball
Build and install the library (system wide):
./setup.py build
./setup.py install

Build and install the library (standalone in the local directory):
./build_inplace

 

And finally...

Set ip forwarding with immediate effect
echo "1" > /proc/sys/net/ipv4/ip_forward

Set ip forwarding permanently
Edit the file /etc/sysctl.conf
Change the line "net.ipv4.ip_forward = 0"
to "net.ipv4.ip_forward = 1"

config.ini
Create a config.ini file from the sample template provided (config.ini.sample) and copy it to the appropriate directory. Using the system wide version, put it in /etc/mediaproxy. For standalone build you can also put it in the local directory where media-relay and media-dispatcher are located. If a file exists in both locations, the local one takes precedence.