[OpenSIPS-Users] Multiple media relays on one server

Saúl Ibarra Corretgé saul at ag-projects.com
Wed Oct 19 18:22:31 CEST 2011

Hi Jim,

On Oct 19, 2011, at 4:08 PM, JimDoesVoip wrote:

> Hi All,
>  I have the impression (perhaps wrong) that we can run multiple media-relay
> processes on a single server and have them connect to the same media
> dispatcher(s).  I also have the perception that media-relay not
> multi-threaded.  Searched the mail list and didn't find indications that
> anyone was doing this.  Here are more details of what we are attempting:
> The scenario is that we have 4 bare metal servers running centOS 6.  Two of
> these servers are running openSIPS and media-dispatcher processes.  We are
> using mediaproxy 2.5.2.  To take advantage of the multiple cores [each
> server has 4 cores] we'd like to run about the same number of media relay
> processes on the servers that aren't running openSIPS.  Each of the
> media-relay processes would connect to both dispatchers to have things be as
> flexible / resilient as possible.  

You don't need to do that with MediaProxy. MediaProxy is single threaded (uses Twisted) and it will open 2 pairs of ports for each connection. When *a single* RTP packet was received from both sides, a conntrack rule is created in kernel space, so no packets are relayed in userspace anymore.

Thus, you'll not get better relaying performance for running multiple instances, the kernel will do the relaying for you.

You can run the relay in the same host as the dispatcher, btw.

> We are able to start multiple media-relays, run out of different
> directories, with different media port ranges on a single server using the
> --pid option.  When doing this, and connecting 2 of these media-relays to
> the same media-dispatcher we see errors in the logs that indicate that the
> media-relays are being disconnected and reconnected.  We are attempting to
> run the media-relays on the same IP address (well.. the media relays that
> are on the same server).  Do the media relays connecting to a particular
> dispatcher need their own IP address?  Do we need to run the media-relays on
> different IP addresses on the servers?  

The --pid option is not enough. You need different configuration, different port range and a different IP address. The dispatcher maps the relays by IP address, so you can't have two on the same. What you see in the logs is the dispatcher being confused by two connections from the same IP, which he thinks is a single relay.


Saúl Ibarra Corretgé
AG Projects

More information about the Users mailing list