<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="Generator" CONTENT="MS Exchange Server version 6.5.7638.1">
<TITLE>FW: [Users] OpenSER config help to talk to PSTN..</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/plain format -->
<P><FONT SIZE=2>below is my config file i modified it a bit.. still pretty basic. trying to get basic connectivity to a PSTN gateway. I modified an example file.<BR>
<BR>
errors I get are:<BR>
<BR>
bash-3.00# openser -c<BR>
0(6841) parse error (98,21-28): parse error<BR>
0(6841) parse error (98,29-30): bad arguments<BR>
0(6841) parse error (121,33-36): parse error<BR>
0(6841) parse error (121,51-52): bad forwardargument<BR>
0(6841) parse error (139,55-56): unknown command, missing loadmodule?<BR>
<BR>
0(6841) parse error (145,55-56): unknown command, missing loadmodule?<BR>
<BR>
0(6841) parse error (151,55-56): unknown command, missing loadmodule?<BR>
<BR>
0(6841) parse error (163,10-11): parse error<BR>
0(6841) parse error (163,10-11):<BR>
ERROR: bad config file (9 errors)<BR>
<BR>
<BR>
#<BR>
# $Id: openser.cfg,v 1.6.2.1 2006/07/17 15:51:03 klaus_darilion Exp $<BR>
#<BR>
# simple quick-start config script<BR>
#<BR>
<BR>
# ----------- global configuration parameters ------------------------<BR>
<BR>
debug=3 # debug level (cmd line: -dddddddddd)<BR>
fork=yes<BR>
log_stderror=no # (cmd line: -E)<BR>
alias=ip<BR>
/* Uncomment these lines to enter debugging mode<BR>
fork=no<BR>
log_stderror=yes<BR>
*/<BR>
<BR>
check_via=no # (cmd. line: -v)<BR>
dns=no # (cmd. line: -r)<BR>
rev_dns=no # (cmd. line: -R)<BR>
port=5060<BR>
children=4<BR>
fifo="/tmp/openser_fifo"<BR>
<BR>
#<BR>
# uncomment the following lines for TLS support<BR>
#disable_tls = 0<BR>
#listen = tls:your_IP:5061<BR>
#tls_verify_server = 1<BR>
#tls_verify_client = 1<BR>
#tls_require_client_certificate = 0<BR>
#tls_method = TLSv1<BR>
#tls_certificate = "/usr/local/etc/openser/tls/user/user-cert.pem"<BR>
#tls_private_key = "/usr/local/etc/openser/tls/user/user-privkey.pem"<BR>
#tls_ca_list = "/usr/local/etc/openser/tls/user/user-calist.pem"<BR>
<BR>
# ------------------ module loading ----------------------------------<BR>
<BR>
# Uncomment this if you want to use SQL database<BR>
loadmodule "/usr/local/lib/openser/modules/mysql.so"<BR>
<BR>
loadmodule "/usr/local/lib/openser/modules/sl.so"<BR>
loadmodule "/usr/local/lib/openser/modules/tm.so"<BR>
loadmodule "/usr/local/lib/openser/modules/rr.so"<BR>
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"<BR>
loadmodule "/usr/local/lib/openser/modules/usrloc.so"<BR>
loadmodule "/usr/local/lib/openser/modules/registrar.so"<BR>
loadmodule "/usr/local/lib/openser/modules/textops.so"<BR>
<BR>
# Uncomment this if you want digest authentication<BR>
# mysql.so must be loaded !<BR>
#loadmodule "/usr/local/lib/openser/modules/auth.so"<BR>
#loadmodule "/usr/local/lib/openser/modules/auth_db.so"<BR>
<BR>
# ------------------ logs -------------------------------------------<BR>
<BR>
log_facility=LOG_LOCAL7<BR>
#Add the xlog module:<BR>
loadmodule "/usr/local/lib/openser/modules/xlog.so"<BR>
<BR>
# ----------------- setting module-specific parameters ---------------<BR>
<BR>
# -- usrloc params --<BR>
<BR>
modparam("usrloc", "db_mode", 0)<BR>
<BR>
# Uncomment this if you want to use SQL database<BR>
# for persistent storage and comment the previous line<BR>
#modparam("usrloc", "db_mode", 2)<BR>
<BR>
# -- auth params --<BR>
# Uncomment if you are using auth module<BR>
#<BR>
#modparam("auth_db", "calculate_ha1", yes)<BR>
#<BR>
# If you set "calculate_ha1" parameter to yes (which true in this config),<BR>
# uncomment also the following parameter)<BR>
#<BR>
#modparam("auth_db", "password_column", "password")<BR>
<BR>
# -- rr params --<BR>
# add value to ;lr param to make some broken UAs happy<BR>
modparam("rr", "enable_full_lr", 1)<BR>
<BR>
# ------------------------- request routing logic -------------------<BR>
# main routing logic<BR>
<BR>
route{<BR>
<BR>
/* ********* ROUTINE CHECKS ********************************** */<BR>
<BR>
# filter too old messages<BR>
if (!mf_process_maxfwd_header("10")) {<BR>
log("LOG: Too many hops\n");<BR>
sl_send_reply("483","Too Many Hops");<BR>
return;<BR>
};<BR>
if (len_gt( max_len )) {<BR>
sl_send_reply("513", "Wow -- Message too large");<BR>
return;<BR>
};<BR>
<BR>
/* ********* RR ********************************** */<BR>
<BR>
/* grant Route routing if route headers present */<BR>
if (loose_route()) { t_relay(); return; };<BR>
<BR>
/* record-route INVITEs -- all subsequent requests must visit us */<BR>
if (method=="INVITE") {<BR>
record_route();<BR>
};<BR>
<BR>
# now check if it really is a PSTN destination which should be handled<BR>
# by our gateway; if not, and the request is an invitation, drop it --<BR>
# we cannot terminate it in PSTN; relay non-INVITE requests -- it may<BR>
# be for example BYEs sent by gateway to call originator<BR>
if (!uri=~"sip:\+?[0-9]+@.*") {<BR>
if (method=="INVITE") {<BR>
sl_send_reply("403", "Call cannot be served here");<BR>
} else {<BR>
forward(uri:host, uri:port);<BR>
};<BR>
return;<BR>
};<BR>
<BR>
# account completed transactions via syslog<BR>
setflag(1);<BR>
<BR>
# authorize only for INVITEs -- RR/Contact may result in weird<BR>
# things showing up in d-uri that would return our logic; our<BR>
# major concern is INVITE which causes PSTN costs<BR>
<BR>
if (method=="INVITE") {<BR>
<BR>
# does the authenticated user have a permission for local<BR>
# calls (destinations beginning with a single zero)?<BR>
# (i.e., is he in the "local" group?)<BR>
if (uri=~"sip:0[1-9][0-9]+@.*") {<BR>
if (!is_user_in("credentials", "local")) {<BR>
sl_send_reply("403", "No permission for local calls");<BR>
return;<BR>
};<BR>
# the same for long-distance (destinations begin with two zeros")<BR>
} else if (uri=~"sip:00[1-9][0-9]+@.*") {<BR>
if (!is_user_in("credentials", "ld")) {<BR>
sl_send_reply("403", " no permission for LD ");<BR>
return;<BR>
};<BR>
# the same for international calls (three zeros)<BR>
} else if (uri=~"sip:000[1-9][0-9]+@.*") {<BR>
if (!is_user_in("credentials", "int")) {<BR>
sl_send_reply("403", "International permissions needed");<BR>
return;<BR>
};<BR>
# everything else ( e.g., interplanetary calls) is denied<BR>
} else {<BR>
sl_send_reply("403", "Forbidden");<BR>
return;<BR>
};<BR>
<BR>
}; # INVITE to authorized PSTN<BR>
<BR>
}; # authorized PSTN<BR>
<BR>
# if you have passed through all the checks, let your call go to GW!<BR>
<BR>
rewritehostport("ip:5060");<BR>
<BR>
# forward the request now<BR>
if (!t_relay()) {<BR>
sl_reply_error();<BR>
return;<BR>
};<BR>
<BR>
}<BR>
bash-3.00#<BR>
<BR>
</FONT>
</P>
</BODY>
</HTML>