[Users] Question concerning nathelper and rtpproxy

Bogdan-Andrei Iancu bogdan at voice-system.ro
Wed Jan 25 15:56:39 CET 2006


Hi Wolfgang,

indeed that was the problem - use r flag if you want rtpproxy to use the 
address from SDP instead of the IP from signalling.

never the less, it should also work without r - one the GW sends media 
to RTPproxy, the RTPproxy will learn the new destination and use this 
one for relaying. So, can you confirm that actually there is a rtp 
traffic from GW to rtpproxy?

regards,
bogdan

Wolfgang Hottgenroth wrote:

>I'm sorry, I've asked to quick. It's force_rtp_proxy("r") which I need
>to use. Now it seems to work for me.
>
>Thanks,
>Wolfgang
>
>
>
>Wolfgang Hottgenroth wrote:
>  
>
>>Hi,
>>
>>
>>I'm trying to get nathelper and rtpproxy to work, following the guide
>>found on onsip.org, but unfortunately, it does not work correctly for.
>>Don't know why.
>>
>>My setup is the following:
>>
>>
>>SIP-Phone (170.127.120.189) -> Proxy1 (62.191.185.30) -> Proxy2
>>(62.191.185.147) -> PSTN-GW (139.4.200.6)
>>
>>Proxy1 supports authentication and handles the NAT travseral stuff.
>>Since in the current testbed, SIP-Phone is not actual behind a NAT
>>device I bypassed the test in the openser configuration to recognize
>>this phone as "nated".
>>
>>What I see is, for a not nated phone, that the signaling goes the chain
>>as drawn above and the media stream goes from the phone to the ngw and
>>vice-versa, as I've expected. Everything is fine in this case.
>>
>>For a nated phone, the signaling again goes through the chain, but the
>>media stream from the phone goes to the rtpproxy on Proxy1, which tries
>>to send it to Proxy2, where no rtpproxy is running, and thereby an "ICMP
>>port unreachable" is returned (which actual does prevent the rtpproxy
>>from continously sending the media stream).
>>
>>Digging into the SIP and SDP is see the following:
>>
>>SIP-Phone sends an INVITE to Proxy1, in the SDP it has "Connection
>>Information: 170.127.120.189" (IP of the phone)
>>
>>Proxy1 replies with "100 Trying" and sends the INVITE to Proxy2, in the
>>SDP it has now "Connection Information: 62.191.185.30" (IP of Proxy1),
>>as I've expected.
>>
>>Proxy2 replied with "100 Trying" and sends the INVITE to the ngw, in the
>>SDP it still has "Connection Information: 62.191.185.30".
>>
>>Now the ngw sends "183 Session Progress" to Proxy2, which has in the SDP
>>"Connection Information: 139.4.200.6" (IP of the ngw).
>>
>>Proxy2 sends "183 Session Progress" to Proxy1, still with "Connection
>>Information: 139.4.200.6" in the SDP.
>>
>>Finally Proxy1 sends "183 Session Progress" to the phone, now with
>>"Connection Information: 62.191.185.30" (IP of Proxy1) in the SDP, as
>>I've expected, since the phone should send the media stream through the
>>rtpproxy running on Proxy1.
>>
>>The phone sends the media stream as expected to Proxy1.
>>
>>But, and this is the problem, the rtpproxy sends the media stream not to
>>the ngw, as I've expected looking into "SDP Connection Information"
>>received by this box, but to Proxy2, which never was mentioned in a
>>Connection Information.
>>
>>When starting rtpproxy with -f, I saw the it was asked by
>>openser/nathelper to proxy between the phone and Proxy2, so the rtpproxy
>>seems to work correctly. But why asks the nathelper on Proxy1 to proxy
>>the media between the phone and Proxy2 and not, as I've expected between
>>the phone and the ngw?
>>
>>My openser configuration is attached, if someone would be so nice to
>>have a look and send a hint for me.
>>
>>
>>Thanks,
>>Wolfgang
>>
>>
>>
>>
>>------------------------------------------------------------------------
>>
>>#
>># $Id: openser.cfg,v 1.5 2005/10/28 19:45:33 bogdan_iancu Exp $
>>#
>># ----------- global configuration parameters ------------------------
>>
>>debug=3            # debug level (cmd line: -dddddddddd)
>>fork=yes
>>log_stderror=yes    # (cmd line: -E)
>>
>>/* Uncomment these lines to enter debugging mode 
>>fork=no
>>log_stderror=yes
>>*/
>>
>>check_via=no	# (cmd. line: -v)
>>dns=no          # (cmd. line: -r)
>>rev_dns=no      # (cmd. line: -R)
>>port=5060
>>children=4
>>fifo="/tmp/openser_fifo"
>>
>>
>># ------------------ module loading ----------------------------------
>>
>>
>>loadmodule "/opt/openser/lib/openser/modules/sl.so"
>>loadmodule "/opt/openser/lib/openser/modules/tm.so"
>>loadmodule "/opt/openser/lib/openser/modules/rr.so"
>>loadmodule "/opt/openser/lib/openser/modules/maxfwd.so"
>>loadmodule "/opt/openser/lib/openser/modules/usrloc.so"
>>loadmodule "/opt/openser/lib/openser/modules/registrar.so"
>>loadmodule "/opt/openser/lib/openser/modules/textops.so"
>>
>>loadmodule "/opt/openser/lib/openser/modules/auth.so"
>>loadmodule "/opt/openser/lib/openser/modules/auth_radius.so"
>>
>>loadmodule "/opt/openser/lib/openser/modules/xlog.so"
>>
>>loadmodule "/opt/openser/lib/openser/modules/nathelper.so"
>>loadmodule "/opt/openser/lib/openser/modules/uri.so"
>>
>># ----------------- setting module-specific parameters ---------------
>>
>># -- usrloc params --
>>
>>modparam("usrloc", "db_mode",   0)
>>
>>#modparam("rr", "enable_full_lr", 1)
>>
>>modparam("xlog", "buf_size", 8192)
>>
>>modparam("auth_radius", "radius_config", "/opt/openser/etc/openser/radiusclient.conf")
>>modparam("auth", "rpid_prefix", "<sip:")
>>modparam("auth", "rpid_suffix", "@62.191.185.30>;screen=yes;privacy=off")
>>modparam("auth", "rpid_avp", "rpid")
>>
>>modparam("registrar", "nat_flag", 6)
>>
>>modparam("nathelper", "natping_interval", 30)
>>modparam("nathelper", "ping_nated_only", 1)
>>modparam("nathelper", "rtpproxy_sock", "unix:/opt/rtpproxy/sock/rtpproxy.sock")
>>
>># -------------------------  request routing logic -------------------
>>
>># main routing logic
>>
>>
>>route{
>>	xlog("L_NOTICE", "REQUEST: $rm, $ru, $si\n");
>>
>>	if (method != "REGISTER") {
>>		record_route();
>>	}
>>
>>	if (method == "BYE" || method == "CANCEL") {
>>		unforce_rtp_proxy();
>>	}
>>
>>	if (src_ip == "170.127.120.189") {
>>		xlog("L_NOTICE", "*** FOUND THAT PHONE\n");
>>		setflag(6);
>>		force_rport();
>>	}
>>
>>	if (loose_route()) {
>>		xlog("L_NOTICE", "*** loose routing enforced\n");
>>
>>		if (has_totag() && (method == "INVITE" || method == "ACK")) {
>>			if (nat_uac_test("3")) {
>>				xlog("L_NOTICE", "*** found NAT (1) !\n");
>>				setflag(6);
>>				force_rport();
>>				fix_nated_contact();
>>			}
>>			force_rtp_proxy("l");
>>		}
>>		route(1);
>>		return;
>>	}
>>		
>>	if (uri != myself) {
>>		xlog("L_NOTICE", "*** uri != myself\n");
>>		sl_send_reply("483", "will not handle this");
>>		return;
>>	}
>>
>>	if (method == "CANCEL") {
>>		xlog("L_NOTICE", "*** cancel\n");
>>		route(1);
>>		return;
>>	} else if (method == "INVITE") {
>>		xlog("L_NOTICE", "*** invite\n");
>>		route(3);
>>		return;
>>	} else if (method == "REGISTER") {
>>		xlog("L_NOTICE", "*** register\n");
>>		route(2);
>>		return;
>>	}
>>
>>	xlog("L_NOTICE", "*** at the end: $rm\n");
>>	route(1);
>>	return;
>>}
>>
>>route[1] {
>>	t_on_reply("1");
>>
>>	if (!t_relay()) {
>>		if (method == "INVITE" && isflagset(6)) {
>>			unforce_rtp_proxy();
>>		};
>>		sl_reply_error();
>>	}
>>}
>>
>>route[2] {
>>	if (!search("^Contact: [ ]*\*") && nat_uac_test("3")) {
>>		xlog("L_NOTICE", "*** found NAT (2) !\n");
>>		if (nat_uac_test("1")) {
>>			xlog("L_NOTICE", "  --> 1\n");
>>		}
>>		if (nat_uac_test("2")) {
>>			xlog("L_NOTICE", "  --> 2\n");
>>		}
>>		setflag(6);
>>		fix_nated_register();
>>		force_rport();
>>	}
>>
>>	if (! radius_www_authorize("uu.net")) {
>>		www_challenge("uu.net", "0");
>>		return;
>>	}
>>
>>	consume_credentials();
>>	
>>	if (!save("location")) {
>>		sl_reply_error();
>>	}
>>
>>	return;
>>}
>>	
>>route[3] {
>>	if (src_ip == "62.191.185.147") {
>>		xlog("L_NOTICE", "*** from upstream proxy\n");
>>		if (uri =~ "^sip:99") {
>>			xlog("L_NOTICE", "*** outbreak prefix from outside, reject\n");
>>			sl_send_reply("484", "no pstn outbreak for you");
>>			return;
>>		}
>>	} else {
>>		if (! radius_www_authorize("uu.net")) {
>>			www_challenge("uu.net", "0");
>>			return;
>>		};
>>
>>		consume_credentials();
>>
>>		if (nat_uac_test("3")) {
>>			xlog("L_NOTICE", "*** found NAT (3) !\n");
>>			setflag(6);
>>		}
>>
>>		append_rpid_hf();
>>
>>		if (uri=~"^sip:99") {
>>			xlog("L_NOTICE", "*** pstn outbreak call, uri: $ru\n");
>>			strip(2);
>>			xlog("L_NOTICE", "*** stripped uri: $ru\n");
>>			if (uri=~"^sip:[1-9]") {
>>				xlog("L_NOTICE", "*** local call\n");
>>				prefix("+49231");
>>			} else if (uri=~"^sip:0[1-9]") {
>>				xlog("L_NOTICE", "*** national call\n");
>>				strip(1);
>>				prefix("+49");
>>			} else if (uri=~"^sip:00[1-9]") {
>>				xlog("L_NOTICE", "*** international call\n");
>>				strip(2);
>>				prefix("+");
>>			} else {
>>				xlog("L_NOTICE", "*** something wrong\n");
>>				sl_send_reply("488", "wrong telephone number");
>>				return;
>>			}
>>
>>			rewritehostport("62.191.185.147:5060");
>>			route(4);
>>			route(1);
>>			return;
>>		}
>>	}
>>
>>	xlog("L_NOTICE", "*** looking up ...\n");
>>	if (!lookup("location")) {
>>		xlog("L_NOTICE", "  --> not found\n");
>>		sl_send_reply("404", "Not Found");
>>		return;
>>	}
>>	xlog("L_NOTICE", "  --> found\n");
>>
>>	route(4);
>>	route(1);
>>	return;
>>}
>>
>>route[4] {
>>	if (isflagset(6)) {
>>		xlog("L_NOTICE", "*** handle NAT (1)\n");
>>		force_rport();
>>		fix_nated_contact();
>>		force_rtp_proxy();
>>	}
>>	return;
>>}
>>
>>onreply_route[1] {
>>	xlog("L_NOTICE", "*** onreply_route\n");
>>	if (isflagset(6) && status =~ "(180)|(183)|2[0-9][0-9]") {
>>		if (! search("^Content-Length:[ ]*0")) {
>>			xlog("L_NOTICE", "*** handle NAT (2)\n");
>>			force_rtp_proxy();
>>		}
>>	}
>>
>>	if (nat_uac_test("1")) {
>>		fix_nated_contact();
>>		xlog("L_NOTICE", "*** handle NAT (3)\n");
>>	}
>>	
>>	return;
>>}
>>
>>
>>
>>------------------------------------------------------------------------
>>
>>_______________________________________________
>>Users mailing list
>>Users at openser.org
>>http://openser.org/cgi-bin/mailman/listinfo/users
>>    
>>
>
>
>_______________________________________________
>Users mailing list
>Users at openser.org
>http://openser.org/cgi-bin/mailman/listinfo/users
>
>  
>





More information about the Users mailing list