RTP Proxying with OpenSIPS / Kamailio / OpenSER

I have an OpenSIPS server that listens for multiple IP addresses. If I redirect calls back to the next point, I want all the signals and media to come from the IP address that was originally down to earth (I don't want the caller and the caller to recognize each other by IP addresses).

I believe that I need something like RTPProxy.

My question is: do I need one RTPProxy server for each IP address or can I route several IP addresses through one server? Is there a better solution?

I am going to try this myself, but I try my best to start the RTPProxy server correctly (my ignorance, not any problems with RTPProxy). I asked ahead of time to find out if anyone knew if I wasted my time setting it up or not.

[UPDATE]

For everyone who is interested, this is how I got the job, although I'm not sure that I want to work with this as a final solution. More testing required. For 2 IP addresses with topology hiding and RTP proxying. Along with the answer below, I hope this helps someone.

Download rtpproxy processes -

rtpproxy -l _your_public_ip_1_ -s udp:localhost:7722 rtpproxy -l _your_public_ip_2_ -s udp:localhost:7723 

Then modify the kamailio.cfg file -

 loadmodule "/usr/local/lib64/kamailio/modules/topoh.so" modparam("topoh", "mask_key", "Your_key_here") modparam("topoh", "mask_ip", "10.0.0.1") 

The next bit creates two groups for the RTP proxy - 1 and 2 -

 #!ifdef WITH_NAT # ----- rtpproxy params ----- modparam("rtpproxy", "rtpproxy_sock", "1 == udp:127.0.0.1:7722") modparam("rtpproxy", "rtpproxy_sock", "2 == udp:127.0.0.1:7723") 

then in the NAT section of the standard (sent) configuration, you choose which group to use in the proxy network based on the IP address to which the incoming call is called. rtp_proxy_manage is a very powerful version of force_ and unpce_ commands. It basically just works and does everything for you -

 route[NATMANAGE] { #!ifdef WITH_NAT .... if($Ri=="XXX1") set_rtp_proxy_set("1"); if($Ri=="XXX2") set_rtp_proxy_set("2"); rtpproxy_manage("",$Ri); 
+4
source share
1 answer

If you use RTPProxy, you need one RTPProxy server for each IP address. You can specify the IP to listen with the '-l' parameter:

 # /usr/sbin/rtpproxy -l 10.10.10.10 -s unix:/var/run/rtpproxy/rtpproxy1.sock -u rtpproxy rtpproxy -p /var/run/rtpproxy/rtpproxy1.pid & # /usr/sbin/rtpproxy -l 10.10.10.11 -s unix:/var/run/rtpproxy/rtpproxy2.sock -u rtpproxy rtpproxy -p /var/run/rtpproxy/rtpproxy2.pid & 

You will need to match this with independent instances of opensips / openser / kamailio:

 listen=udp:10.10.10.10:5060 ... loadmodule "rtpproxy.so" modparam("rtpproxy", "rtpproxy_sock", "unix:/var/run/rtpproxy/rtpproxy1.sock") ... unforce_rtp_proxy(); ... force_rtp_proxy(); 

and

 listen=udp:10.10.10.11:5060 ... loadmodule "rtpproxy.so" modparam("rtpproxy", "rtpproxy_sock", "unix:/var/run/rtpproxy/rtpproxy2.sock") ... unforce_rtp_proxy(); ... force_rtp_proxy(); 

If you have experience with C, you may be modifying the rtpproxy module to be aware of multiple rtpproxy instances.

In addition, if the thought of relaying RTP through user space bothers you, MediaProxy is an alternative.

Instead of a user space demonstrator transmitting RTP traffic, your openser / opensips / kamailio tells python MediaDispatcher via a JSON web message to contact an available MediaRelay to configure the linux kernel level conntrack traffic forwarding record.

The disadvantage of this approach is that the current python media dispatcher and the reading media relay /etc/mediaproxy/config.ini - you need to hack python to accept the configuration parameter so that you can have multiple configurations. ini, one for each instance, to configure the correct redirection.

An example / etc / mediaproxy / config.ini might look like this:

 [Relay] dispatchers = 10.10.10.10:25060 [Dispatcher] socket_path = /var/run/mediaproxy/dispatcher.sock listen = 10.10.10.10:25060 listen_management = 10.10.10.10:25061 [OpenSIPS] socket_path = '/var/run/opensips/socket' 

And in your opensips configuration file:

 modparam("mi_datagram", "socket_name", "/var/run/opensips/socket") ... loadmodule "mediaproxy.so" # ----- mediaproxy params ----- modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy/dispatcher.sock") #modparam("mediaproxy", "disable", 1) #modparam("mediaproxy", "natping_interval", 60) ... engage_media_proxy(); ... end_media_session(); 

It looks like you might be lucky with rtpproxy for your specific needs.

+7
source

Source: https://habr.com/ru/post/1437577/


All Articles