++++++++++ Config file below
+++++++++++++++++++
# ----------- global configuration parameters ------
# Debugging
#
# Max level = 9, or ser -ddddddddd
# Don't use forking while debugging
debug=9
fork=no
log_stderror=yes # (cmd line: -E)
# -- Debug mode --
/*
fork=no
debug=6
log_stderror=yes
*/
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
fifo="/tmp/ser_fifo"
alias=newbridges.nl
alias=192.168.1.247
# ------------------ module loading ----------------------------------
# Uncomment this if you want to use SQL database
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"
# added 30-06-05
loadmodule "/usr/local/lib/ser/modules/exec.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
# Digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
# ----------------- setting module-specific parameters ---------------
# -- usrloc params --
# Use this for non-persistent data storage
#modparam("usrloc", "db_mode", 0)
# use this for persistent storage (and comment the previous line)
modparam("usrloc", "db_mode", 2)
# -- auth params --
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)
modparam("rr", "enable_double_rr", 1)
modparam("rr", "add_username", 1)
# ------------------------- request routing logic -------------------
# main routing logic
#
# This defines the handling of incorrect and Register messages,
# and sends message to other routes :
#
# 1) (main route)
# 2) PBX
# 3) PSTN / Gateway traffic
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;
};
# 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
# ACKS follow this path
if (loose_route()) {
# mark routing logic in request
append_hf("P-hint: rr-enforced\r\n");
route(1);
break;
};
if (!uri==myself) {
# mark routing logic in request
append_hf("P-hint: outbound\r\n");
route(1);
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") {
# Uncomment this if you want to use digest authentication
if (!www_authorize("newbridges.nl", "subscriber")) {
www_challenge("newbridges.nl", "0");
break;
};
save("location");
break;
};
lookup("aliases");
if (!uri==myself) {
append_hf("P-hint: outbound alias\r\n");
route(1);
break;
};
# This part handles numbers (5xx,6xx,7xx) and (5xxx,6xxx,7xxx)
# which are internal numbers for the PABX
#
if (uri=~"^
si"^sip:[5-7][0-9]{2,3}@.*")
{
log(1, "LOG: PBX call, contacting gateway...\n");
route(2);
break;
};
#
# Gateway traffic directly to PSTN
#
# The assumption is that other all
# numeric usernames between 5 and 20 digits are really pstn
numbers
# and so they are routed to the gateway
if (uri=~
"sip:[0-9]{5,20}@.*") {
if (method=="INVITE"){
log(1, "LOG: PSTN call, contacting gateway...\n");
};
route(3);
break;
};
# native SIP destinations are handled using our USRLOC DB
if (!lookup("location")) {
sl_send_reply("404", "User Not Found / Offline");
break;
};
};
append_hf("P-hint: usrloc applied\r\n");
route(1);
}
# main route
route[1]
{
# send it out now; use stateful forwarding as it works reliably
# even for UDP2TCP
if (!t_relay()) {
sl_reply_error();
};
}
# PBX/gateway traffic
# the '01' prefix specifies which port the gateway should use
route[2]
{
rewritehostport("192.168.1.244:5060");
forward(uri:host, uri:port);
break;
} /* end of route 2 - PBX traffic*/
# PSTN/gateway traffic
# the '01' prefix specifies which port the gateway should use
route[3]
{
rewritehostport("192.168.1.244:5060");
forward(uri:host, uri:port);
break;
} /* end of route 3 - PSTN traffic*/
Hilco de Lathouder
New Bridges
Voice Processing Engineers
Calandstraat 44
3316 EA Dordrecht
The Netherlands (timezone: GMT+1)
+31 (78) 6548787
(lathouder@newbridges.nl) |
|