[Serusers] Re: RTPproxy and SER

Alexandre Aractingi aaractingi at libertysurf.fr
Wed Sep 28 17:07:45 CEST 2005


Le mercredi 28 septembre 2005 à 15:56 +0200, Andreas Granig a écrit :
> You have to set a reply-route and use the mediaproxy/rtpproxy there
> too 
> for 180/183/200 having an SDP body.
> 
> Check the GettingStarted document on http://onsip.org for example 
> configurations using mediaproxy or rtpproxy.

Thanks for your answer. Actually my ser.cfg is derived from a simple
onsip.org example. The weird thing is that I have an on-reply_route and
a t_on_reply("1") statement, and still I don't see the call coming in
the onreply-route logs (even when the 200 OK is sent). Maybe that
explains the problem.

I attached my config, is there any obvious problem there?
Thanks a lot for your kind help,

-- 
Alexandre Aractingi <aaractingi at libertysurf.fr>
-------------- next part --------------
# $Id: nat-mediaproxy.cfg 9 2005-08-19 15:30:55Z /CN=Greger V. Teigre/emailAddress=greger at onsip.org $
debug=3
fork=no
log_stderror=yes

listen=x.x.x.x           # INSERT YOUR IP ADDRESS HERE
port=5060
children=4

dns=no
rev_dns=no
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:heslo@localhost/ser"

loadmodule "/usr/lib/ser/modules/mysql.so"
loadmodule "/usr/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/rr.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/usrloc.so"
loadmodule "/usr/lib/ser/modules/registrar.so"
loadmodule "/usr/lib/ser/modules/auth.so"
loadmodule "/usr/lib/ser/modules/auth_db.so"
loadmodule "/usr/lib/ser/modules/uri.so"
loadmodule "/usr/lib/ser/modules/uri_db.so"
loadmodule "/usr/lib/ser/modules/domain.so"
loadmodule "/usr/lib/ser/modules/mediaproxy.so"
loadmodule "/usr/lib/ser/modules/nathelper.so"
loadmodule "/usr/lib/ser/modules/textops.so"
loadmodule "/usr/lib/ser/modules/xlog.so"

modparam("auth_db|domain|uri_db|usrloc", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")

modparam("nathelper", "rtpproxy_disable", 1)
modparam("nathelper", "natping_interval", 0)

modparam("mediaproxy","natping_interval", 30)
modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy.sock")
modparam("mediaproxy","sip_asymmetrics","/usr/etc/ser/sip-clients")
modparam("mediaproxy","rtp_asymmetrics","/usr/etc/ser/rtp-clients")

modparam("usrloc", "db_mode", 2)

modparam("registrar", "nat_flag", 6)

modparam("rr", "enable_full_lr", 1)

route {

	# -----------------------------------------------------------------
	# Sanity Check Section
	# -----------------------------------------------------------------
	if (!mf_process_maxfwd_header("10")) {
		sl_send_reply("483", "Too Many Hops");
		break;
	};

	if (msg:len > max_len) {
		sl_send_reply("513", "Message Overflow");
		break;
	};

        #debug info
        xlog("L_INFO","[%rm] from [%fu] to [%tu] r_uri [%ru]\n");
        xlog("L_INFO","[%rm] contact [%ct]\n");


	# -----------------------------------------------------------------
	# Record Route Section
	# -----------------------------------------------------------------
	if (method=="INVITE" && client_nat_test("3")) {
		# INSERT YOUR IP ADDRESS HERE
		record_route_preset("192.0.2.13:5060;nat=yes"); 
	} else if (method!="REGISTER") {        
		record_route(); 
	};

	# -----------------------------------------------------------------
	# Call Tear Down Section
	# -----------------------------------------------------------------
	if (method=="BYE" || method=="CANCEL") {
		end_media_session();
	};

	# -----------------------------------------------------------------
	# Loose Route Section
	# -----------------------------------------------------------------
	if (loose_route()) {

		if (has_totag() && (method=="INVITE" || method=="ACK")) {

			if (client_nat_test("3") || search("^Route:.*;nat=yes")) {
				setflag(6);
				use_media_proxy();
			};
		};

		route(1);
		break;
	};

	# -----------------------------------------------------------------
	# Call Type Processing Section
	# -----------------------------------------------------------------
	if (uri!=myself) {
		route(4);
		route(1);
		break;
	};

	if (method=="CANCEL") {
		route(1);
		break;
	} else if (method=="INVITE") {
		route(3);
		break;
	} else if (method=="REGISTER") {
		route(2);
		break;
	};

	lookup("aliases");
	if (uri!=myself) {
		route(4);
		route(1);
		break;
	};

	if (!lookup("location")) {
		sl_send_reply("404", "User Not Found");
		break;
	};

	route(1);
}

route[1] {
        xlog("L_INFO","Debug route(1)... forcée par le media proxy\n");
		use_media_proxy();
	# -----------------------------------------------------------------
	# Default Message Handler
	# -----------------------------------------------------------------

	t_on_reply("1");

	if (!t_relay()) {

		if (method=="INVITE" || method=="ACK") {
			end_media_session();
		};

		sl_reply_error();
	};
}

route[2] {

        xlog("L_INFO","Debug route(2)...\n");
	# -----------------------------------------------------------------
	# REGISTER Message Handler
	# ----------------------------------------------------------------

	sl_send_reply("100", "Trying");

	if (!search("^Contact:[ ]*\*") && client_nat_test("7")) {
		setflag(6);
		fix_nated_register();
		force_rport();
	};

	#if (!www_authorize("","subscriber")) {
	#	www_challenge("","0");
	#	break;
	#};

	#if (!check_to()) {
	#	sl_send_reply("401", "Unauthorized");
	#	break;
	#};

	#consume_credentials();

	if (!save("location")) {
		sl_reply_error();
	};
}

route[3] {
        xlog("L_INFO","Debug route(3)...\n");

	# -----------------------------------------------------------------
	# INVITE Message Handler
	# -----------------------------------------------------------------

	#if (!proxy_authorize("","subscriber")) {
	#	proxy_challenge("","0");
	#	break;
	#} else if (!check_from()) {
	#	sl_send_reply("403", "Use From=ID");
	#	break;
	#};

	#consume_credentials();

	if (client_nat_test("3")) {
		setflag(7);
		force_rport();
		fix_nated_contact();
	};

	lookup("aliases");
	if (uri!=myself) {
		route(4);
		route(1);
		break;
	};

	if (!lookup("location")) {

                          if (uri=~"^sip:0") {
			# Forward to our main SIP server
                           strip(1);
                           prefix("33");
				use_media_proxy();
                           forward( 62.39.119.30, 5060 );
                           break;
                           } else {

		sl_send_reply("404", "User Not Found");
		break;
		};
	};

	route(4);
	route(1);
}

route[4] {

	# -----------------------------------------------------------------
	# NAT Traversal Section
	# -----------------------------------------------------------------

	if (isflagset(6) || isflagset(7)) {
		use_media_proxy();
	};
}

onreply_route[1] {

### Note : this function doesn't get invoked, even though the 200 OK is transmitted... weird...
	if(status=="200")
	  {
	      log("this is a 200 OK reply\n");
	  };


	if ((isflagset(6) || isflagset(7)) && (status=~"(180)|(183)|2[0-9][0-9]")) {



		if (!search("^Content-Length:[ ]*0")) {
		# Si le content-lenght est 0 alors c'est un 200OK à un register, donc pas besoin de media_proxy
		# Autrement c'est un décroché, donc il faut forcer le media proxy
        		xlog("L_INFO","Debug 200OK renvoyé, forcé par le media proxy\n");
			use_media_proxy();
		};
	};

	if (client_nat_test("1")) {
		fix_nated_contact();
	};
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3118 bytes
Desc: not available
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20050928/7ac5a9e9/attachment.bin>


More information about the sr-users mailing list