[Serusers] Need help to implement into my ser.cfg compatibility with sems or voicemail

Antonio Membrives antonio.membrives at telintcable.es
Thu Nov 3 17:35:29 CET 2005


Hi to all, sorry for this mail, but, I need some help to implement some
voicemail compatibility, above I put my ser.cfg, this config work in Fedora
3 + MySQL + Ser 0.9.3 and work fine, the server have 2 NIC and can talk with
user into my lan and out my land. But I read some documents of SEMS and try
some configs and don't work. If anyone can waste some time to see this code
and help me a gratefully her with some beer if visit my city for tourist :D
Sems are 0.9.0 and the config are above.

Sorry for my horrible English and thanks for the help.

Antonio Membrives


####---------------------- ser.cfg ---------------------------------###
debug=3
fork=yes
log_stderror=no

listen=82.159.201.35           
listen=192.168.10.240
alias=telintcable.es
alias=82.159.201.35
port=5060
children=4

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

loadmodule "/usr/local/lib/ser/modules/mysql.so"
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/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"
loadmodule "/usr/local/lib/ser/modules/uri_db.so"
loadmodule "/usr/local/lib/ser/modules/domain.so"
loadmodule "/usr/local/lib/ser/modules/mediaproxy.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/msilo.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("domain", "db_mode", 1)
modparam("domain", "domain_table", "domain") 
modparam("domain", "domain_col", "domain")

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/local/etc/ser/sip-clients")
modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/ser/rtp-clients")

modparam("usrloc", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "use_domain", 1)

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

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

modparam("msilo", "registrar", "sip:registar at telintcable.es")
modparam("msilo", "db_url", "mysql://ser:heslo@localhost/ser")

modparam("tm", "fr_timer", 10)
modparam("tm", "fr_inv_timer", 15)
modparam("tm", "wt_timer", 10)

modparam("acc", "log_flag", 2) #1
modparam("acc", "log_level", 2) 
modparam("acc", "db_flag", 2) #1
modparam("acc", "db_missed_flag", 3) 
modparam("acc", "log_missed_flag", 3) 
modparam("acc", "db_url", "mysql://ser:heslo@localhost/ser")
#modparam("acc", "report_ack", 0)
modparam("acc", "log_fmt", "miocfsp")

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;
	};

	# -----------------------------------------------------------------
	# Record Route Section
	# -----------------------------------------------------------------
	if (method=="INVITE" && client_nat_test("3")) {
		# INSERT YOUR IP ADDRESS HERE
		record_route_preset("82.159.201.35: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;
	};
	setflag(1);
	# -----------------------------------------------------------------
	# 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")) {
		if (method == "MESSAGE") {
			if (!t_newtran()) {
				sl_reply_error();
			break;
		};
		if (m_store("0")) {
			t_reply("202", "Accepted for Later Delivery");
			break;
		};
		t_reply("503", "Service Unavailable");
		break;
		};
		if ((method=="INVITE" || method=="ACK") && t_newtran() ) {
          		t_reply("404", "Not Found");
			acc_db_request("Llamada perdida","missed_calls");
          		break;
			};
		sl_send_reply("404", "Usuario Not Found");
    		break;
	};
	setflag(3);
	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
	# ----------------------------------------------------------------

	sl_send_reply("100", "Trying");

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

	if (!www_authorize("telintcable.es","subscriber")) {
		www_challenge("telintcable.es","0");
		break;
	};

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

	consume_credentials();

	if (!save("location")) {
		sl_reply_error();
	};
	m_dump(); #msilo.so
}

route[3] {

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

	if (!proxy_authorize("telintcable.es","subscriber")) {
		proxy_challenge("telintcable.es","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(uri=~"sip:100.*@telintcable.es" ||
uri=~"sip:100.*@82.159.201.35"){
		log(1, "LOG: Contactando con el modulo de conferencia\n");
		if(!t_write_req("/tmp/am_fifo","conference")){
			t_reply("500","Error contacting sems conference");
		};
		log(1, "LOG: Cerrando conexion con el modulo de
conferencia\n");
		break;	
	};
	if(method=="BYE" || method=="CANCEL"){
		log(1,"LOG: vm end - inicio\n");
		if(!t_write_req("/tmp/am_fifo","bye")){
			log(1,"LOG: No se ha podido contactar con vm\n");
			t_reply("500","Error contacting sems");
		};
		log(1,"LOG: vm end - final\n");
	};	

	if (!lookup("location")) {
		if ((method=="INVITE" || method=="ACK") && t_newtran() ) {
			t_reply("404", "Usuario no conectado");
			acc_db_request("Llamada perdida","missed_calls");
			break;
		};
		sl_send_reply("404", "Usuario no encontrado");
			break;
	};
	setflag(3);
	route(4);
	route(1);
}

route[4] {

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

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

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();
	};
}


### ------------------- sems.config ---------------------------------####

# $Id: sems.conf.sample,v 1.21 2005/01/05 16:48:04 sayer Exp $
#
# sems.conf.sample
#
# Sip Express Media Server (sems)
# 
# sample configuration file
# 
#
# whitespaces (spaces and tabs) are ignored
# comments start with a "#" and may be used inline
# 
# example: option=value1, value2  # i like this option
#

##################################
# global parameters              #
##################################

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

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

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

# optional parameter: fifo_name=<filename>
#
# - path and file name of our fifo file (same as -i)
fifo_name=/tmp/am_fifo

# optional parameter: ser_fifo_name=<filename>
#
# - path and file name of Ser's fifo file (same as -o)
ser_fifo_name=/tmp/ser_fifo

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

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

# optional parameter: send_method=<filename>
#
# - sets which method will be used to contact Ser:
#   FIFO or unix socket server.
# - values: fifo (default), unix_socket
#
# - PLEASE NOTE THAT: if you use 'fifo', make sure that
#   fifo_name and ser_fifo_name have been set. if you use 'unix_socket',
#   make sure that socket_name and ser_socket_name have been set.
# 
#send_method=unix_socket
send_method=fifo

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

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

# 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=1024

# optional parameter: rtp_high_port=<port>
#
# - sets port of rtp highest server
#rtp_high_port=65535

##################################
# module specific parameters     #
##################################

# sample voicemail configuration (inline)
config.voicemail=inline

# optional parameter: rec_file_extension=<ext>
# 
# - sets the file extension which will be used
#   to record messages.
# - example 1: wav
# - example 2: mp3
#
# WARNING: you must compile the mp3 plug-in
#          in order to use 'mp3' as default
#          extension. You will need the lame
#          encoder for that.
#          See plug-in/mp3/ReadmeMP3.txt for
#          more information.
#
rec_file_extension=wav

# optional parameter: announce_path=<path>
# 
# - sets the path where announce files are searched for
# - the file to be played is searched in the following order:
#   <announce_path>/<domainname>/<username>.wav
#   <announce_path>/<domainname>/<language>/<default_announce>
#   <announce_path>/<domainname>/<default_announce>
#   <announce_path>/<language>/<default_announce>
#   <announce_path>/<default_announce>
#   where <language> is taken from the body of P-Language header
#   of the request (if any).
announce_path=/usr/local/lib/sems/audio/

# parameter: default_announce=<filename>
# 
# - sets the name of the default announce WAV file
default_announce=default_en.wav

# parameter: max_record_time=<seconds>
#
# - maximum record time
max_record_time=30

# parameter: accept_delay=<x>
# 
# - delays accepting of the call for x seconds
# - default value is 0
accept_delay=0

# parameter: email_template_path=<filename>
#
# - email templates path
# 
# See the README file in <sems-src>/plug-in/voicemail
# for more information on the syntax used.
# - template to be used is selected in the following order:
#   <email_template_path><domain>_<language>.template
#   <email_template_path><domain>.template
#   <email_template_path>default_<language>.template
#   <email_template_path>default.template
#   where <language> is taken from the body of P-Language header
# of the request (if any).
#
email_template_path=/usr/local/etc/sems/

# end of configuration section for voicemail module
config.voicemail=end


# sample announcement configuration (inline)
config.announcement=inline

# optional parameter: announce_path=<path>
# 
# - sets the path where announce files are searched for
announce_path=/usr/local/lib/sems/audio/

# parameter: default_announce=<filename>
# 
# - sets the name of the default announce WAV file
default_announce=default_en.wav

# end of configuration section for announcement module
config.announcement=end


# sample isdngw module configuration (external file)
#config.isdngw=/etc/isdngw.conf

# sample ivr module configuration (inline)
config.ivr=inline
#
#
# The IVR checks for a script with the named of the callee
# (<local part in r-uri>.py for python, <local part in r-uri>.pl for perl)
# in the directory <ivr_script_path><domain>, then for 
# <ivr_script_path><domain><ivr_script_file>. If this is  not found,
# <ivr_script_path>/<local part in r-uri>.py if searched, 
# and if this is not found, <ivr_script_path>/<ivr_script_file> is used.
#
# So with a call to sayer at iptel.org and
#ivr_script_path=/etc/ivr and 
#ivr_script_file=ivr.py
# these files are checked:
#/etc/ivr/iptel.org/sayer.py
#/etc/ivr/iptel.org/ivr.py
#/etc/ivr/sayer.py
#/etc/ivr/ivr.py
#
  #parameter: ivr_script_path:
  # path to ivr scripts
  # 
  ivr_script_path=/etc/ivr/
  # default script file: this will be executed if <user>.py does not exist.
  #
  ivr_script_file=ivr.py

  # parameter : tts_caching
  # 	y or n
  #       text will be read from waves already synthesized and 
  #	cached in cache_path 
  tts_caching=y

  # parameter : tts_cache_path
  # 	path to cache waves
  # 	path must exist! 
  tts_cache_path=/tmp/wavs
# end of configuration section for ivr module
config.ivr=end

# sample conference configuration (inline)
config.conference=inline

# parameter: default_announce=<filename>
#
# - sets the full pathed name of the default announce WAV file.
#   Will be played to lonely users.
default_announce=/usr/local/lib/sems/audio/first_participant.wav
join_sound=/usr/local/lib/sems/audio/beep.wav
drop_sound=/usr/local/lib/sems/audio/beep.wav
# end of configuration section for conference module
config.conference=end

# example configuration for number reader
config.number_reader=inline

number_path=/usr/local/lib/sems/audio/

prolog_file=welcome_to_number_reader.wav

epilog_file=thanks_calling_number_reader.wav

# end of number_reader configuration
config.number_reader=end

# add more module configurations here (inline or external):
#
# config.mymodule=<filename>
#  or
# config.mymodule=inline
# ...
# config.mymodule=end




More information about the sr-users mailing list