[OpenSIPS-Users] multiple use_media_proxy() calls

Dave Singer dave.singer at wideideas.com
Tue Jan 25 18:37:46 CET 2011


I have 2.4.4 running on centos 5.5. Here are my notes for getting it working
using mostly rpms.
Hope this helps you out and others too. If anyone wanted to put this in an
official doc for installing mediaproxy, that would be cool or point me to
where I could do that. :)

install stuff for opensips (plus some essential tools like vim and screen)
install that some is also used for mediaproxy. This is from a centos
minimal/barebones install point:

rpm -Uhv "http://yum.pgsqlrpms.org/reporpms/8.4/pgdg-centos-8.4-2.noarch.rpm
"
# had to use wget because rpm couldn't pull the url for some reason,
probably a redirection.
wget "
http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el5.rf.x86_64.rpm
"
rpm -Uhv rpmforge-release-*.rpm
rpm -Uhv "
http://download.fedora.redhat.com/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
"
yum install -y yum-fastestmirror yum-priorities vim-enhanced man rsyslog
wget screen
yum install -y vixie-cron monit rsyslog logrotate rsync tcpdump wireshark
ngrep patch postgresql-server mysql-devel postgresql-devel bison lynx flex
openssl-devel libxslt subversion make gcc wget vim-enhanced screen
which libxml2-devel
pcre-devel db4-devel net-snmp-devel expat-devel libmemcache-devel mysql-server
mysql
sed -r -i '/^\[/apriority = 20' /etc/yum.repos.d/epel*
sed -r -i '/^\[/apriority = 30' /etc/yum.repos.d/rpmforge.repo
sed -r -i '/^\[/apriority = 10' /etc/yum.repos.d/CentOS-*
sed -r -i '/^\[/apriority = 5' /etc/yum.repos.d/pgdg-84-centos.repo

Mediproxy install:
put this together primarily using the links below
http://voiprookie.blogspot.com/2009/04/blog-post.html
http://www.smartvox.co.uk/serfaq_install_mediaproxy2.htm<http://www.google.com/url?q=http%3A%2F%2Fwww.smartvox.co.uk%2Fserfaq_install_mediaproxy2.htm&sa=D&sntz=1&usg=AFrqEzf1fhZRLKRLKJ4P-SXFadnpG0NJog>
CentOS 5.5  install prerequisites:
NOTES:
  DO NOT install twisted or gnutls stuff with yum!! remove if rpm is
installed installed. ( rpm -qa | grep -E "twisted|gnutls" )
  Some newer versions of source packages below may not work because of
conflicts with CentOS versions of stuff like the kernel.

yum install libnetfilter_conntrack libnetfilter_conntrack-devel
python-dns python-ctypes pyOpenSSL python-application python-cjson
python-devel python-sqlobject python-zope-interface

wget "ftp://ftp.gnupg.ca/gnutls/gnutls-2.4.2.tar.bz2"
tar -xjf gnutls-2.4.2.tar.bz2
cd gnutls-2.4.2
##./configure --with-included-libtasn1 --libdir=/usr/local/lib64
./configure --with-included-libtasn1 --libdir=/usr/lib64
make
make install
cd /usr/local/lib64/
##for i in 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 ; do cp -v $i /usr/lib64/ ; done
cd /usr/local/src/
wget "
http://pypi.python.org/packages/source/p/python-gnutls/python-gnutls-1.1.9.tar.gz#md5=bdd81a9dd3c2f87393cd6c014bf6885b
"
tar -xzf python-gnutls-1.1.9.tar.gz
cd python-gnutls-1.1.9
./setup.py build
./setup.py install
cd ..
wget "http://tmrc.mit.edu/mirror/twisted/Twisted/8.1/Twisted-8.1.0.tar.bz2"
tar -xjf Twisted-8.1.0.tar.bz2
cd Twisted-8.1.0
./setup.py build
./setup.py install

setup mediaproxy
wget "http://download.ag-projects.com/MediaProxy/mediaproxy-2.4.3.tar.gz"
tar -xzf mediaproxy-2.4.3.tar.gz
mv mediaproxy-2.4.3 /opt/mediaproxy
cd /opt/mediaproxy
./build_inplace
./media-relay --no-fork
lsmod
/etc/init.d/iptables status
/etc/init.d/iptables start
/etc/init.d/iptables status
modprobe ip_tables
lsmod
./media-relay --no-fork
./media-dispatcher --no-fork

sysctl -w net.ipv4.ip_forward=1
sed -i -r
's/^.*\<net.ipv4.ip_forward[[:space:]]*=[[:space:]][01]/net.ipv4.ip_forward
= 1/' /etc/sysctl.conf
mkdir -p /var/run/mediaproxy /etc/mediaproxy/tls
cp config.ini.sample /etc/mediaproxy/config.ini
cp tls/* /etc/mediaproxy/tls/

important stuff in /etc/mediaproxy/config.ini
[Relay]
dispatchers = <match listen value from dispatcher section>
relay_ip = <ip of relay host that media will proxy through>
port_range = 20000:60000
log_level = ERROR
; log_level options ( DEBUG, INFO, WARNING, ERROR and CRITICAL)
[Dispatcher]
socket_path = /var/run/mediaproxy-dispatcher.sock
management_use_tls = no
listen = <same ip as opensips>:5500
log_level = ERROR
; log_level options (DEBUG, INFO, WARNING, ERROR and CRITICAL)
[OpenSIPS]
socket_path = /tmp/opensips_fifo
max_connections = 10
Opensips.cfg Stuffopensips modules to load in opensips.cfg:
loadmodule "dialog.so" # requred for mediaproxy_engage and kill of (dead
calls)
loadmodule "mediaproxy.so" # if using mediaproxy_engage it is the only
mediaproxy function used in the script and only for initial INVITE.
loadmodule "mi_datagram.so" # required for mediaproxy to tell opensips to
end a call that rtp has timed out for (dead calls).
loadmodule "nathelper.so" # needed to fix sdp origin header to hide topoloty
that media doesn't fix but should. -eg- fix_nated_sdp("8","208.76.155.250");
# with ip of rtp relay, can be var. use in invite and replies with sdp -
detect sdp with if ( $cl > 0 )

params:
modparam("mi_datagram", "socket_name", "/tmp/opensips.sock")
modparam("mi_datagram", "children_count", 4)
modparam("dialog", "dlg_flag", 13)
# db_mode: 0 - NO_DB, 1 - REALTIME, 2 - DELAYED, 3 - ON SHUTDOWN
modparam("dialog", "db_mode", 3)
modparam("dialog", "db_url","postgres://opensips:passwd@localhost/opensips")
modparam("mediaproxy", "mediaproxy_socket",
"/var/run/mediaproxy-dispatcher.sock")
modparam("mediaproxy", "mediaproxy_timeout", 500)
modparam("mediaproxy", "signaling_ip_avp", "$avp(s:nat_ip)")
modparam("mediaproxy", "media_relay_avp", "$avp(s:media_relay)")


System performance tuning
cat /proc/interrupts | grep eth

echo 0200 > /proc/irq/<irq from above cmd>/smp_affinity
each char represents a cpu. each core is represented by a bit ( 1, 2, 4, 8 )

seems to be best to keep on different cores but same cpu (not cpu 0, first
cpu)

taskset -pc "8" `cat /var/run/mediaproxy-relay.pid`

actually should all be part of mediaproxy-relay init file so affinity is set
before media proxy is run and
mediaproxy-relay started:
taskset -c "<core number 0-16>" <command that actually runs the relay>
the core number can be a comma separated list or range: "0,5,7,9-11"
though it seems to work better set to a single core



On Tue, Jan 25, 2011 at 7:51 AM, Saúl Ibarra Corretgé
<saul at ag-projects.com>wrote:

>
>  Ok, I'll check.  Is the 2.4.4 version from the repository considered the
>> latest, or do I need to build something specific?
>>
>>
> Yes, that's the latest.
>
>
> --
> Saúl Ibarra Corretgé
> AG Projects
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110125/53cdfc65/attachment-0001.htm>


More information about the Users mailing list