[Serusers] problems with the pstn.cfg example

Daniel-Constantin Mierla daniel at iptel.org
Thu Sep 9 10:23:11 CEST 2004


The problem is shown by line:

1(31403) connect_db(): Can't connect to local MySQL server through
socket '/var/run/mysqld/mysqld.sock' (2)


There is a misconfiguration of mysql client -- see 
http://lists.iptel.org/pipermail/serusers/2003-March/000627.html

Daniel

On 9/9/2004 7:12 AM, Jamie Baddeley wrote:

>HI,
>
>I seem to have a problem getting this going. Attached is my ser.cfg.
>
>You'll see that (I think) that it's ok, but when it comes to database
>connection time, things fail. See following debug,
>
>1(31403) DEBUG: init_mod_child (1): tm
> 1(31403) DEBUG: callid: '2fa76cff-31403 at 127.0.0.1'
> 1(31403) DEBUG: init_mod_child (1): usrloc
> 2(31404) DEBUG: init_mod_child (2): tm
> 2(31404) DEBUG: callid: '2fa76cff-31404 at 127.0.0.1'
> 2(31404) DEBUG: init_mod_child (2): usrloc
> 1(31403) DEBUG: init_mod_child (1): auth_db
> 3(31405)  1(31403) DEBUG: init_mod_child (1): group
> 1(31403) connect_db(): Can't connect to local MySQL server through
>socket '/var/run/mysqld/mysqld.sock' (2)
> 1(31403) db_init(): Error while trying to connect database
> 1(31403) group:init_child(): Unable to connect database
> 1(31403) init_mod_child(): Error while initializing module group
> 1(31403) init_child failed
> 1(31403) INFO: signal 15 received
>
>So it seems that although I've done
>modparam("usrloc", "db_url",
>"mysql://ser:heslo@192.168.191.16:3306/ser")
>
>It still seems to think that the database is local?? (when it's not)
>
>Strangely the other attached file ser.cfg.pabx seems to work ok..
>
>Why is this? Am I doing something stupid? Or have I uncovered a bug?
>
>jamie
>
>
>
>  
>
>------------------------------------------------------------------------
>
>#
># $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp $
>#
># simple quick-start config script
>#
>
># ----------- global configuration parameters ------------------------
>
>debug=5         # debug level (cmd line: -dddddddddd)
>fork=yes
>log_stderror=yes # (cmd line: -E)
>
>/* Uncomment these lines to enter debugging mode
>#debug=7
>#fork=no
>#log_stderror=yes
>*/
>
>check_via=no    # (cmd. line: -v)
>dns=no           # (cmd. line: -r)
>rev_dns=yes      # (cmd. line: -R)
>#port=5060
>children=4
>fifo="/tmp/ser_fifo"
>
># ------------------ module loading ----------------------------------
>
># Uncomment this if you want to use SQL database
>loadmodule "/usr/lib/ser/modules/mysql.so"
>
>
>#new modules from pstn example
>
>
>
>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"
>
># Uncomment this if you want digest authentication
># mysql.so must be loaded !
>loadmodule "/usr/lib/ser/modules/auth.so"
>loadmodule "/usr/lib/ser/modules/auth_db.so"
>
>
>loadmodule "/usr/lib/ser/modules/acc.so"
>loadmodule "/usr/lib/ser/modules/group.so"
>loadmodule "/usr/lib/ser/modules/uri.so"
>
>
># ----------------- setting module-specific parameters ---------------
>
># -- usrloc params --
>
>#modparam("usrloc", "db_mode",   0)
>
># Uncomment this if you want to use SQL database
># for persistent storage and comment the previous line
>modparam("usrloc", "db_mode", 2)
>
># -- auth params --
># Uncomment if you are using auth module
>#
>#modparam("usrloc", "db_url", "sql://ser:<password>@localhost/ser")
>
>
>modparam("usrloc", "db_url", "mysql://ser:heslo@192.168.191.16:3306/ser")
>modparam("auth_db", "db_url", "mysql://ser:heslo@192.168.191.16:3306/ser")
>
>modparam("auth_db", "calculate_ha1", yes)
>
>
>#
># If you set "calculate_ha1" parameter to yes (which true in this config),
># uncomment also the following parameter)
>#
>modparam("auth_db", "password_column", "password")
>
># -- rr params --
># add value to ;lr param to make some broken UAs happy
>modparam("rr", "enable_full_lr", 1)
>
>
>
># -- acc params --
>modparam("acc", "log_level", 1)
># that is the flag for which we will account -- don't forget to
># set the same one :-)
>modparam("acc", "log_flag", 1 )
>
>
>
>
>
>
>
>
>
>
># -------------------------  Domains Covered ------------------------
>alias="fx.net.nz"
>alias="vixen.fx.net.nz"
>alias="special.fx.net.nz"
>alias="wlgvx1.fx.net.nz"
>
>
># -------------------------  request routing logic -------------------
>
># main routing logic
>
>route{
>
>	/* ********* ROUTINE CHECKS  ********************************** */
>
>	# filter too old messages
>	if (!mf_process_maxfwd_header("10")) {
>		log("LOG: Too many hops\n");
>		sl_send_reply("483","Too Many Hops");
>		break;
>	};
>	if (msg:len > max_len) {
>		sl_send_reply("513", "Wow -- Message too large");
>		break;
>	};
>
>	/* ********* RR ********************************** */
>
>	/* grant Route routing if route headers present */
>	if (loose_route()) { t_relay(); break; };
>	
>	/* record-route INVITEs -- all subsequent requests must visit us */
>	if (method=="INVITE") {
>		record_route();
>	};
>
>	# now check if it really is a PSTN destination which should be handled
>	# by our gateway; if not, and the request is an invitation, drop it --
>	# we cannot terminate it in PSTN; relay non-INVITE requests -- it may
>	# be for example BYEs sent by gateway to call originator
>	if (!uri=~"sip:\+?[0-9]+ at .*") {
>		if (method=="INVITE") {
>			sl_send_reply("403", "Call cannot be served here");
>		} else {
>			forward(uri:host, uri:port);
>		};
>		break;
>	}; 
>
>
>	# account completed transactions via syslog
>	setflag(1);
>
>	# free call destinations ... no authentication needed
>	if ( is_user_in("Request-URI", "free-pstn")  /* free destinations */
>			|  uri=~"sip:[79][0-9][0-9][0-9]@.*"  /* local PBX */
>			| uri=~"sip:98[0-9][0-9][0-9][0-9]") {
>		log("free call");
>	} else if (src_ip==192.168.0.10) {
>		# our gateway doesn't support digest authentication;
>		# verify that a request is coming from it by source
>		# address
>		log("gateway-originated request");
>	} else {
>		# in all other cases, we need to check the request against
>		# access control lists; first of all, verify request
>		# originator's identity
>
>		if (!proxy_authorize(	"gateway" /* realm */,
>				"subscriber" /* table name */))  {
>			proxy_challenge( "gateway" /* realm */, "0" /* no qop */ );
>			break;
>		};
>
>		# authorize only for INVITEs -- RR/Contact may result in weird
>		# things showing up in d-uri that would break our logic; our
>		# major concern is INVITE which causes PSTN costs 
>
>		if (method=="INVITE") {
>
>			# does the authenticated user have a permission for local
>			# calls (destinations beginning with a single zero)? 
>			# (i.e., is he in the "local" group?)
>			if (uri=~"sip:0[1-9][0-9]+ at .*") {
>				if (!is_user_in("credentials", "local")) {
>					sl_send_reply("403", "No permission for local calls"); 
>					break;
>				};
>			# the same for long-distance (destinations begin with two zeros")
>			} else if (uri=~"sip:00[1-9][0-9]+ at .*") {
>				if (!is_user_in("credentials", "ld")) {
>					sl_send_reply("403", " no permission for LD ");
>					break;
>				};
>			# the same for international calls (three zeros)
>			} else if (uri=~"sip:000[1-9][0-9]+ at .*") {
>				if (!is_user_in("credentials", "int")) {
>					sl_send_reply("403", "International permissions needed");
>					break;
>				};
>			# everything else (e.g., interplanetary calls) is denied
>			} else {
>				sl_send_reply("403", "Forbidden");
>				break;
>			};
>
>		}; # INVITE to authorized PSTN
>
>	}; # authorized PSTN
>
>	# if you have passed through all the checks, let your call go to GW!
>
>	rewritehostport("192.168.0.10:5060");
>
>	# forward the request now
>	if (!t_relay()) {
>		sl_reply_error(); 
>		break; 
>	};
>
>}
>  
>
>------------------------------------------------------------------------
>
>#
># $Id: ser.cfg,v 1.21.4.1 2003/11/10 15:35:15 andrei Exp $
>#
># simple quick-start config script
>#
>
># ----------- global configuration parameters ------------------------
>
>debug=7         # debug level (cmd line: -dddddddddd)
>fork=yes
>log_stderror=yes	# (cmd line: -E)
>
>/* Uncomment these lines to enter debugging mode 
>#debug=7
>#fork=no
>#log_stderror=yes
>*/
>
>check_via=no	# (cmd. line: -v)
>dns=no           # (cmd. line: -r)
>rev_dns=yes      # (cmd. line: -R)
>#port=5060
>children=4
>fifo="/tmp/ser_fifo"
>
># ------------------ module loading ----------------------------------
>
># Uncomment this if you want to use SQL database
>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"
>
># Uncomment this if you want digest authentication
># mysql.so must be loaded !
>loadmodule "/usr/lib/ser/modules/auth.so"
>loadmodule "/usr/lib/ser/modules/auth_db.so"
>
># ----------------- setting module-specific parameters ---------------
>
># -- usrloc params --
>
>#modparam("usrloc", "db_mode",   0)
>
># Uncomment this if you want to use SQL database 
># for persistent storage and comment the previous line
>modparam("usrloc", "db_mode", 2)
>
># -- auth params --
># Uncomment if you are using auth module
>#
>#modparam("usrloc", "db_url", "sql://ser:<password>@localhost/ser")
>
>
>modparam("usrloc", "db_url", "mysql://ser:heslo@wlgcd1:3306/ser")
>modparam("auth_db", "db_url", "mysql://ser:heslo@wlgcd1:3306/ser")
>
>modparam("auth_db", "calculate_ha1", yes)
>
>
>#
># If you set "calculate_ha1" parameter to yes (which true in this config), 
># uncomment also the following parameter)
>#
>modparam("auth_db", "password_column", "password")
>
># -- rr params --
># add value to ;lr param to make some broken UAs happy
>modparam("rr", "enable_full_lr", 1)
>
>
>
># -------------------------  Domains Covered ------------------------
>alias="fx.net.nz"
>alias="vixen.fx.net.nz"
>alias="special.fx.net.nz"
>
>
># -------------------------  request routing logic -------------------
>
># main routing logic
>
>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");
>		break;
>	};
>	if ( msg:len > max_len ) {
>		sl_send_reply("513", "Message too big");
>		break;
>	};
>
>	# 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
>	record_route();	
>	# loose-route processing
>	if (loose_route()) {
>		t_relay();
>		break;
>	};
>
>	# 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") {
>#			log(1, "REGISTER received\n");
>#		} else {
>#			log(1, "non-REGISTER received\n");
>#		};
>#		if (uri=~"sip:.*[@:]wlg.fx.net.nz") {
>#			log(1, "request for wlgvx1.fx.net.nz received\n");
>#		} else {
>#			log(1, "request for other domain received\n");
>
>	
># Uncomment this if you want to use digest authentication
>			if (!www_authorize("vixen.fx.net.nz", "subscriber")) {
>				www_challenge("vixen.fx.net.nz", "0");
>				break;
>			};
>
>			save("location");
>			break;
>		};
>
>lookup("aliases");   # (needed the ; at the end ot ir error'd)
>
>		# native SIP destinations are handled using our USRLOC DB
>		if (!lookup("location")) {
>			sl_send_reply("404", "Not Found");
>			break;
>		};
>	};
>	# forward to current uri now; use stateful forwarding; that
>	# works reliably even if we forward from TCP to UDP
>	if (!t_relay()) {
>		sl_reply_error();
>	};
>
>}
>
>  
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Serusers mailing list
>serusers at lists.iptel.org
>http://lists.iptel.org/mailman/listinfo/serusers
>  
>




More information about the sr-users mailing list