[Serusers] SEMS- unix socket problem

dim dim_hatzi at yahoo.gr
Sun Jan 6 17:28:12 CET 2008


hi everybody,
You can see attached my conf files for ser, ser-sems and sems.
I run two instances of ser :
1. the first on port 5060
2. the second which is the sip stack for sems, on 5070

My conf files show that when for example i call 101 or 102 , the call is 
directed to sems, but the debug of my 2nd ser shows this :

 2(8658) write_to_unixsock: Error in connect: Connection refused
 2(8658) ERROR:tm:t_write_unix: write_to_unixsock failed
 2(8658) write_to_unixsock: Error in connect: Connection refused
 2(8658) ERROR:tm:t_write_unix: write_to_unixsock failed

Probably these is some kind of problem with my unix socket configuration in my 
conf files...

can anyone help me ??
-------------- next part --------------
# config path for plugins
#

plugin_config_path=/usr/local/src/sems_tutorial_config/etc_local/

# optional parameter: fork={yes|no}
# 
# - specifies if sems should run in daemon mode (background)
#   (fork=no is the same as -E)
fork=no

# optional parameter: stderr={yes|no}
#
# - debug mode: do not fork and log to stderr
#   (stderr=yes is the same as -E)
stderr=yes

# optional parameter: loglevel={0|1|2|3}
#
# - sets log level (error=0, warning=1, info=2, debug=3)
#   (same as -D)
loglevel=3

# optional parameter: socket_name=<filename>
#
# - path and file name of our unix socket
socket_name=/tmp/sems_sock

reply_socket_name=/tmp/sems_rsp_sock

# optional parameter: ser_socket_name=<filename>
#
# - path and file name of Ser's unix socket
ser_socket_name=/tmp/ser_sock

# optional parameter: plugin_path=<path>
# 
# - sets the path to the plug-ins
# - may be absolute or relative to CWD
plugin_path=lib

# optional parameter: smtp_server=<hostname>
#
# - sets address of smtp server
smtp_server=localhost

# optional parameter: smtp_port=<port>
#
# - sets port of smtp server
smtp_port=25

# optional parameter: rtp_low_port=<port>
#
# - sets port of rtp lowest server
rtp_low_port=10502

# optional parameter: rtp_high_port=<port>
#
# - sets port of rtp highest server
rtp_high_port=60000
-------------- next part --------------
#
# $Id: ser.cfg,v 1.25.2.1 2005/02/18 14:30:44 andrei Exp $
#
# ser for sems configuration

# ----------- global configuration parameters ------------------------

debug=3         # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes	# (cmd line: -E)

check_via=no	# (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
port=5070
children=4

unix_sock="/tmp/ser_sock"
# ------------------ module loading ----------------------------------

loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/avp.so"
loadmodule "/usr/local/lib/ser/modules/avpops.so"
# ----------------- setting module-specific parameters ---------------

# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)
modparam( "avpops", "avp_aliases", "email=i:67" )
modparam("tm", "pass_provisional_replies", 1)
# appends for INVITE to voicemail
modparam("tm", "tw_append", "voicemail_headers:hdr[User-Agent];P-Email-Address=avp[$email]")

# appends for dtmf per INFO 
modparam( "tm", "tw_append",
   "info_append:hdr[Content-Length];hdr[Content-Type];msg[body]")

# 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 >=  2048 ) {
		sl_send_reply("513", "Message too big");
		break;
	};
	
	if (method != "ACK" && method != "INVITE" && method != "BYE" 
		&& method != "CANCEL" && method != "INFO" ){
			log("unsupported method\n");
			sl_send_reply("500","unsupported method");
			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();	
	
	# 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");
                if (!t_relay()) {
			sl_reply_error();
		}
                break;
        };

	# make transaction
	if (!t_newtran()){
		log("could not create transaction\n");
		sl_send_reply("500","could not create transaction");
		break;
	}

	# actively absorb ACKs
	if (method == "ACK") {
		t_relay();
		break;
	}
	
	# pass INFO to SEMS 
	if (method=="INFO") {
        	if(!t_write_unix("/tmp/sems_sock","sems/info_append")){
            		log("could not contact sems\n");
            		t_reply("500","could not contact media server");
        	}
		break;
	}

	# pass INFO to SEMS 
        if ((method=="BYE")||(method=="CANCEL")) {
                if(!t_write_unix("/tmp/sems_sock","sems")){
                        log("could not contact sems\n");
                        t_reply("500","could not contact media server");
                }
                break;
        }

	if (uri =~ "sip:101.*@") {
		if (!t_write_unix("/tmp/sems_sock","myapp")){
			log("could not contact media server\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}

	if (uri =~ "sip:102.*@") {
		if (!t_write_unix("/tmp/sems_sock","myconfigurableapp")){
			log("could not contact media server\n");
			t_reply("500","could not contact media server");	
 			break;
		}
		break;
	}

	if (uri =~ "sip:103.*@") {
		if (!t_write_unix("/tmp/sems_sock","myannounceapp")){
			log("could not contact media server\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}


	if (uri =~ "sip:104.*@") {
		if (!t_write_unix("/tmp/sems_sock","myjukebox")){
			log("could not contact media server\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}


	if (uri =~ "sip:105.*@") {
		if (!t_write_unix("/tmp/sems_sock","mycc")){
			log("could not contact media server\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}


	if (uri =~ "sip:106.*@") {
		if (!t_write_unix("/tmp/sems_sock","ivr_announce")){
			log("could not contact media server\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}






############ default sems apps
	if (uri =~ "sip:110.*@") {
		if (!t_write_unix("/tmp/sems_sock","echo")){
			log("could not contact echo\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}


	if (uri =~ "sip:111.*@") {
		if (!t_write_unix("/tmp/sems_sock","announcement")){
			log("could not contact announcement\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}

	if (uri =~ "sip:112.*@") {
		if (!t_write_unix("/tmp/sems_sock","conference")){
			log("could not contact conference\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}


	if (uri =~ "sip:113.*@") {
		if (!t_write_unix("/tmp/sems_sock","mailbox")){
			log("could not contact mailbox\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}

	if (uri =~ "sip:114.*@") {
		if (!t_write_unix("/tmp/sems_sock","early_announce")){
			log("could not contact early_announce\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}

	if (uri =~ "sip:115.*@") {
		# load email avp with some email address
		avp_write("root at localhost","$email");
		# use voicemail_headers append to pass it to sems
		if (!t_write_unix("/tmp/sems_sock","voicemail/voicemail_headers")){
			log("could not contact voicemail\n");
			t_reply("500","could not contact media server");	
			break;
		}
		break;
	}


	t_reply("404","Not found");
}
-------------- next part --------------
#
# $Id: ser.cfg,v 1.25.2.1 2005/02/18 14:30:44 andrei Exp $
#
# ser home proxy config script
# this forwards all calls to uri starting with 1 to localhost:5070

# ----------- global configuration parameters ------------------------

debug=2         # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=yes	# (cmd line: -E)

check_via=no	   # (cmd. line: -v)
dns=no             # (cmd. line: -r)
rev_dns=no         # (cmd. line: -R)
port=5060
children=4

loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
# ----------------- setting module-specific parameters ---------------
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)


# -------------------------  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 >=  2048 ) {
		sl_send_reply("513", "Message too big");
		break;
	};
	

        if (!(method=="REGISTER")) record_route();

	if ((method=="ACK") || (loose_route()) || (!uri==myself)) {
                t_relay();
                break;	
	};

        if (method=="REGISTER") {
                        save("location");
                        break;
        };
	
        if (method == "INVITE" ) {

		if (uri =~ "sip:1.*@")  {
			log("Forwarding to 5070");
	                rewritehostport("localhost:5070");
                	t_relay_to_udp("localhost","5070");
                	break;
		}

		if (lookup("location")) {
			if (!t_relay()) {
				sl_reply_error();
			};
			break;
		};		

	        sl_send_reply("404", "not found");

                break;
        }

        sl_send_reply("501", "method not understood here");
        break;

}


More information about the sr-users mailing list