[Users] problem with mediaproxy, can't login - openser 1.0.0, mediaproxy 1.4.2

Samuel Kopp samuel.kopp at gmail.com
Tue Mar 28 02:52:02 CEST 2006


I can´t autentic my sip phone
sjphone

this is my openser.cfg
--------------
# $Id: nat-mediaproxy.cfg 9 2005-08-19 15:30:55Z /CN=Greger V.
Teigre/emailAddress=greger at onsip.org $
debug=3
fork=yes
log_stderror=no

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

alias=200.160.248.54

dns=no
rev_dns=no

fifo="/tmp/openser_fifo"
fifo_db_url="mysql://openser:openserrw@localhost/openser"

loadmodule "/usr/lib/openser/modules/mysql.so"
loadmodule "/usr/lib/openser/modules/sl.so"
loadmodule "/usr/lib/openser/modules/tm.so"
loadmodule "/usr/lib/openser/modules/rr.so"
loadmodule "/usr/lib/openser/modules/maxfwd.so"
loadmodule "/usr/lib/openser/modules/usrloc.so"
loadmodule "/usr/lib/openser/modules/registrar.so"
loadmodule "/usr/lib/openser/modules/auth.so"
loadmodule "/usr/lib/openser/modules/auth_db.so"
loadmodule "/usr/lib/openser/modules/uri.so"
loadmodule "/usr/lib/openser/modules/uri_db.so"
loadmodule "/usr/lib/openser/modules/mediaproxy.so"
loadmodule "/usr/lib/openser/modules/nathelper.so"
loadmodule "/usr/lib/openser/modules/textops.so"
loadmodule "/usr/lib/openser/modules/domain.so"
loadmodule "/usr/lib/openser/modules/acc.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("auth_db", "use_domain", 1)

#modparam("auth_db", "db_url", "mysql://openserro:openserro@localhost/openser")
#modparam("auth_db", "user_column", "username")
#modparam("auth_db", "domain_column", "domain")
#modparam("auth_db", "password_column", "password")

modparam("domain", "db_mode", 1)

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

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

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

modparam("registrar", "default_expires", 60)
modparam("registrar", "min_expires", 30)
modparam("registrar", "nat_flag", 6)
modparam("registrar", "use_domain", 1)

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

modparam("acc", "db_url", "mysql://openserro:openserro@localhost/openser")
#modparam("acc", "failed_transactions", 1)
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)
modparam("acc", "db_flag", 1)

###

route {

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

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


	# -----------------------------------------------------------------
	# Record Route Section and Acc section
	# -----------------------------------------------------------------
	if (method=="INVITE" && client_nat_test("3")) {
		# INSERT YOUR IP ADDRESS HERE
		record_route_preset("200.160.248.54:5060;nat=yes");
	} else if (method!="REGISTER") {
	if!(uri=~"^sip:833[0-9]*@") {
		record_route();
		setflag(1);
	    }
	};

	# -----------------------------------------------------------------
	# 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);
		return;
	};

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

	if (uri==myself) {
	
	    if (method=="CANCEL") {
		    route(3);
		    return;
	    } else if (method=="INVITE") {
		    route(3);
		    return;
	    } else if (method=="REGISTER") {
		    route(2);
		    return;
	    };

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

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

route[1] {

	# -----------------------------------------------------------------
	# Default Message Handler
	# -----------------------------------------------------------------

	t_on_reply("1");

	if (!t_relay()) {

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

		sl_reply_error();
	};
}

route[2] {

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

	sl_send_reply("100", "Trying");

	if (!www_authorize("voip.voxya.com.br","subscriber")) {
		www_challenge("voip.voxya.com.br","1");
		return;
	};

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

	consume_credentials();

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

route[3] {

	# -----------------------------------------------------------------
	# CANCEL and INVITE Message Handler
	# -----------------------------------------------------------------

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


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

	#if (uri=~"^sip:0[0-9]*@*) {
	#	rewritehost("10.10.10.10"); #This is where PSTN Gateway installed
	#	route(1);
	#	return;
	#};
	
	if (!lookup("location")) {
		sl_send_reply("404", "User Not Found");
		return;
	};
	
	if (method=="CANCEL") {
		route(1);
		return;
	};
	
	if (!proxy_authorize("voip.voxya.com.br","subscriber")) {
		proxy_challenge("voip.voxya.com.br","1");
		return;
	} else if (!check_from()) {
		sl_send_reply("403", "Use From=ID");
		return;
	};

	consume_credentials();

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


onreply_route[1] {

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

		if (!search("^Content-Length:\ +0")) {
			use_media_proxy();
		};
	};

	if (client_nat_test("1")) {
		fix_nated_contact();
	};
}




More information about the sr-users mailing list