[Spce-user] Extra_socket on private address

Andrew Pogrebennyk apogrebennyk at sipwise.com
Wed Jan 21 06:46:57 EST 2015


Hi,

On 01/20/2015 06:31 PM, Andres Gmail wrote:
> Hello, I would like to set up a extra_socket to connect to a gateway
> with E1 (sangoma) and receive and make calls as a "peering server".
> 
> SPCE has two interfaces, eth0 (private address) and eth1 (public
> address). All subscriber and other trunk are connected by the eth1
> interface (public).
> 
> Only for communication with the gateway I want to use private IP addresses.
> 
> Is it possible? or as I saw the list I will have problems with RTP?
> 
> Thanks in advance.

You may enable interface bridging in rtpengine if you want, there is no
problem. For background info see "direction" flag description in the
readme file at https://github.com/sipwise/rtpengine

First you need edit your /etc/ngcp-config/network.yml and add type
rtp_priv to the private interface. Apply the config and check that
/etc/default/ngcp-rtpengine-daemon contains both interfaces like in:
INTERFACES="ext/a.b.c.d priv/172.16.1.248"

Then you need to modify your proxy/proxy.cfg.customtt.tt2, because there
is no preference available yet to set the "direction" flag based on
peer. Basically, you should put
$var(rtpp_flags) = $var(rtpp_flags) + "direction=ext direction=priv " or
$var(rtpp_flags) = $var(rtpp_flags) + "direction=priv direction=ext " in
ROUTE_BRANCH_ACC_RTP, depending on whether this is a call from or to
that peer.

You may check a peer id, IP or insert a new preference to mark the peer
for which we need to set the flags - this is a really simple task if you
know a few things about how kamailio config works. We are planning to
introduce the preference in the next version, but for now and if you are
not comfortable with kamailio scripting you may use my code snippet:

> --- /etc/ngcp-config/templates/etc/kamailio/proxy/proxy.cfg.tt2	2015-01-13 22:03:41.603373033 +0100
> +++ /etc/ngcp-config/templates/etc/kamailio/proxy/proxy.cfg.customtt.tt2	2015-01-13 23:03:52.111658160 +0100
> @@ -7791,7 +7791,28 @@
>  				xlog("L_INFO", "Use mediaproxy for forward direction for IPv4/IPv4 - [% logreq -%]\n");
>  				$var(rtpp_flags) = $var(rtpp_flags) + "address-family=IP4 ";
>  			}
> -
> +			if($var(to_pstn) == 1 && pv_isset("$xavp(callee_peer_prefs[0]=>outbound_socket)"))
> +			{
> +				$var(ip) = $(xavp(callee_peer_prefs[0]=>outbound_socket){s.select,1,:});
> +				if($var(ip) == "172.16.1.248")
> +				{
> +					xlog("L_INFO", "Bridge media public/private for call to pstn - [% logreq -%]\n");
> +					$var(rtpp_flags) = $var(rtpp_flags) + "direction=ext direction=priv ";
> +				} else {
> +					xlog("L_INFO", "--- outbound_socket set for call to pstn but ip '$var(ip)' does not match subnet - [% logreq -%]\n");
> +				}
> +			}
> +			else if($avp(s:from_pstn) == 1 && pv_isset("$xavp(caller_peer_prefs[0]=>outbound_socket)"))
> +			{
> +				$var(ip) = $(xavp(caller_peer_prefs[0]=>outbound_socket){s.select,1,:});
> +				if($var(ip) == "172.16.1.248")
> +				{
> +					xlog("L_INFO", "Bridge media private/public for call from pstn - [% logreq -%]\n");
> +					$var(rtpp_flags) = $var(rtpp_flags) + "direction=priv direction=ext ";
> +				} else {
> +					xlog("L_INFO", "--- outbound_socket set for call from pstn but ip '$var(ip)' does not match subnet - [% logreq -%]\n");
> +				}
> +			}
>  			if(isflagset(FLAG_DOWNSTREAM))
>  			{
>  				if(isbflagset(FLB_ICE_CALLEE_REPLACE))

here i'm setting the RTP bridging for the peer if the extra_socket
selected for that peer is the private address.

Hope this helps.

Andrew



More information about the Spce-user mailing list