[Serusers] ser + sems + isdn4linux config example

Jan Janak jan at iptel.org
Tue Jan 20 16:47:09 CET 2004


Attached is a config file for ser that acts just as SEMS frontend.
Voicemail and ISDN gateway are configured in sems.

The config file accepts signalling only from the main routing proxy (in
the example running on 192.168.0.2).

Username in the Request-URI of messages that are forwarded to voicemail
must begin with vm+ to distinguish the messages from the messages to the
ISDN gateway. Only numeric destinations are forwarded to the ISDN
gateway.

The main routing proxy will then forward to voicemail using this:
if (isflagset(4)) {
    # Voicemail is running on the same server as ISDN
    # gateway,
    # voicemail is distinguised by vm+
    # prefix
    rewritehostport("192.168.0.1:5060");
    prefix("vm+");
    t_relay();
};
										
   Jan.

On 19-01 07:12, Arnd Vehling wrote:
> Hi,
> 
> has anyone an example config for using ser with sems and the isdn4linux
> package to use ser as SIP<>ISDN GW for outgoing and maybe routing incoming
> calls?
> 
> best regards,
> 
>   Arnd
> 
> _______________________________________________
> Serusers mailing list
> serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers
-------------- next part --------------
#
# $Id: ser-isdngw.conf,v 1.2 2003/09/09 17:48:22 ullstar Exp $
#

debug=1		        # debug level (cmd line: -dddddddddd)
fork=yes

log_stderror=no # (cmd line: -E)
check_via=yes		# (cmd. line: -v)
dns=0			# (cmd. line: -r)
rev_dns=0		# (cmd. line: -R)
port=5060
listen=192.168.0.1
alias=mydomain.com
children=8
fifo="/tmp/ser2_fifo"

# Add the name of your system here
#listen=yourhostname
# for more names add alias entries, all that might be used as domain in SIP URI
#alias=yourhostname.yourdomain.com
#alias=your.ip.addr.ess


# ------------------ module loading ----------------------------------

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/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/vm.so"
	

# ----------------- setting module-specific parameters ---------------

# You may want to define things like databases here. Please refer to 
# the extensive SER documentation for this purpose. Module parameters 
# are always described in the modules README files.
#
# For pure isdn gateway functionality only a database is needed, we use
# a simple textfile for this purpose. Actually this is only neccessary until
# the vm module is reworked. Simply copy the etc/db directory from the isdngw
# directory somewhere and specify it in the following statement:

modparam("voicemail", "db_url","sql://ser:heslo@localhost/ser")


# -------------------------  request routing logic -------------------

# This section describes how SIP messages are handled. 

route{

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

        if (msg:len >= 2960) {  # messages > 2 * max. sized eth. datagrams
                sl_send_reply("513", "Message too large");
	        break;
        };

	if (src_ip != 192.168.0.2) {
		# Drop request that are not coming from the main proxy
		sl_send_reply("403", "Forbidden");
		break;
	};
					       
	# deal with my domain first
	if (uri == myself) {
		# ############################## #
		# isdngw specific configuration  #
		# ############################## #
		if (t_newtran()) {
			if (method == "INVITE" || method == "BYE" || method == "CANCEL"){

				# send a response right at the start to avoid retransmissions
				t_reply("100","Trying -- just wait a minute !");

				# isdngw only gets activated on invite requests
				if (method == "INVITE") {
				
					# Usernames begining with vm+ are destined to voicemail
					if (uri =~ "^[a-zA-Z]+:vm\+.*") {
						# remove the vm+ prefix
						strip(3);
						if (!vm("/tmp/am_fifo", "voicemail")) {
							log("Could not contact voicemail\n");
							t_reply("500", "Could not contact voicemail");
						};
					} else if (uri =~ "^[a-zA-Z]+:[0-9]+ at .*") {

					# isdngw feels to be responsible for numeric userparts
					# all numbers followed by @ and anything after it match
					# this expression
					# for example: sip:555123123 at yourdomain.com:5061 matches.
					# The vm command (from module vm) is used to contact the 
					# media server and though it the isdngw.
					# /tmp/am_fifo is the fifo filename ued for communications, make
					# shure the permissions are correct and that the same fifo
					# filename is defined in sems.conf.
						if (!vm("/tmp/am_fifo", "isdngw")) {
							log("could not contact isdngw\n");
							t_reply("500","could not contact isdngw");
						};
					# we dont feel responsible for sip addresses not starting with
					# a number, so send the right error code.
					} else {
						if (!vm("/tmp/am_fifo", "announcement")) {
							log("could not contact announcement\n");
							t_reply("500", "could not contact announcement");
						};
					};
					# stop routing here, the message is now processed by the media server
					break;
				};

				# The following handles the call termination, we must pass these requests
				# to the media server as follows. Again make shure the fifo name and permissions
				# are set correctly (like im sems.conf).
				if ((method == "BYE") || (method == "CANCEL")) {
						if (!vm("/tmp/am_fifo","bye")) {
							log("could not contact the media server\n");
							t_reply("500","could not contact the media server");
						};
						break;
				};
			# other methods than INVITE, BYE and CANCEL are not handled by this SIP Server
			# so we sent an error message
			} else {
				log("ERROR: method not supported\n");
				t_reply("500", "Sorry, method not supported");
			};	
		} else {
			# for any reason the transaction could not be created, send error code
			log("could not create new transaction\n");
			sl_send_reply("500","Could not create new transaction");
		};
	# not uri=myself, this SIP request is not directed to us, simply direct it to its
	# correct destination
	} else {
	    sl_send_reply("403", "No relaying");
	    break;
	};
# end of routing.
}



More information about the sr-users mailing list