[OpenSER-Users] OpenSER with PostgreSQL

Cliff Flood cliff at jazinga.com
Fri Aug 31 20:07:51 CEST 2007


Hi,

I have an Ubuntu 6.06 install with PostgreSQL 8.1 and OpenSER 1.2.2 
which I am testing at the moment.

I have tested OpenSER with MySQL and it worked fine but when when I want 
to switch to PostgreSQL I'm having some difficulty.

I have used the postgressqldb.sh script to initialise the database and 
it has completed without error.

When I start OpenSER I get the following lines in my PostgreSQL logs:

LOG:  connection received: host=127.0.0.1 port=37610
LOG:  connection authorized: user=openser database=openser
LOG:  SSL SYSCALL error: EOF detected
LOG:  could not receive data from client: Connection reset by peer
LOG:  unexpected EOF on client connection

I have looked at OpenSER's logs with debugging turned on but I don't see 
anything that looks like an error but I would be happy to provide them.

`openserctl moni` returns:

ERROR: Error opening OpenSER's FIFO /tmp/openser_fifo
ERROR: Make sure you have the line 'modparam("mi_fifo", "fifo_name", 
"/tmp/openser_fifo")' in your config
ERROR: and also have loaded the mi_fifo module.


My openser.cfg looks like this:

debug=9            # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no    # (cmd line: -E)
children=4
listen=192.168.20.151

dns=no
rev_dns=no
port=5060
mpath="/usr/local/lib/openser/modules/"

loadmodule "mysql.so"
loadmodule "postgres.so"

loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "mi_fifo.so"

loadmodule "auth.so"
loadmodule "auth_db.so"

modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")

modparam("usrloc", "db_mode", 2)
modparam("usrloc", "db_url", 
"postgres://openser:openserrw@localhost/openser")

modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "db_url", 
"postgres://openser:openserrw@localhost/openser")
modparam("auth_db", "password_column", "password")

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

route{
	# initial sanity checks -- messages with
	# max_forwards==0, or excessively long requests
	if (!mf_process_maxfwd_header("10")) {
		sl_send_reply("483","Too Many Hops");
		exit;
	};

	if (msg:len >=  2048 ) {
		sl_send_reply("513", "Message too big");
		exit;
	};

	# we record-route all messages -- to make sure that
	# subsequent messages will go through our proxy; that's
	# particularly good if upstream and downstream entities
	# use different transport protocol
	if (!method=="REGISTER")
		record_route();

	# subsequent messages withing a dialog should take the
	# path determined by record-routing
	if (loose_route()) {
		# mark routing logic in request
		append_hf("P-hint: rr-enforced\r\n");
		route(1);
	};

	if (!uri==myself) {
		# mark routing logic in request
		append_hf("P-hint: outbound\r\n");
		# if you have some interdomain connections via TLS
		#if(uri=~"@tls_domain1.net") {
		#	t_relay("tls:domain1.net");
		#	exit;
		#} else if(uri=~"@tls_domain2.net") {
		#	t_relay("tls:domain2.net");
		#	exit;
		#}
		route(1);
	};

	# if the request is for other domain use UsrLoc
	# (in case, it does not work, use the following command
	# with proper names and addresses in it)
	if (uri==myself) {

		if (method=="REGISTER") {

			# Uncomment this if you want to use digest authentication
			# if (!www_authorize("host.doman.tld", "subscriber")) {
			#	www_challenge("host.domain.tld", "0");
			#	exit;
			# };

			save("location");
			exit;
		};

		lookup("aliases");
		if (!uri==myself) {
			append_hf("P-hint: outbound alias\r\n");
			route(1);
		};

		# native SIP destinations are handled using our USRLOC DB
		if (!lookup("location")) {
			sl_send_reply("404", "Not Found");
			exit;
		};
		append_hf("P-hint: usrloc applied\r\n");
	};

	route(1);
}


route[1] {
	# send it out now; use stateful forwarding as it works reliably
	# even for UDP2TCP
	if (!t_relay()) {
		sl_reply_error();
	};
	exit;
}


Any and all help appreciated.

-- 
Cliff Flood
Systems Administrator
Jazinga Inc.




More information about the Users mailing list