Dear ALL:
I build a ser and use a 0.9.0 example of ser.cfg.
Now I have some error message in my log during I make a call.
Feb 19 05:53:51 ser /usr/local/sbin/ser[3551]: SER: Load ACL
Feb 19 05:53:51 ser /usr/local/sbin/ser[3551]: SER: a INT user
Feb 19 05:53:51 ser /usr/local/sbin/ser[3549]: error:
mediaproxy/sendMediaproxyCommand(): can't connect to MediaProxy
Feb 19 05:53:51 ser /usr/local/sbin/ser[3551]: SER: a FREE-PSTN user
Feb 19 05:53:51 ser /usr/local/sbin/ser[3551]: error:
mediaproxy/sendMediaproxyCommand(): can't connect to MediaProxy
Feb 19 05:53:57 ser /usr/local/sbin/ser[3549]: error:
mediaproxy/sendMediaproxyCommand(): can't connect to MediaProxy
Feb 19 05:54:00 ser /usr/local/sbin/ser[3551]: error:
mediaproxy/sendMediaproxyCommand(): can't connect to MediaProxy
Feb 19 05:54:11 ser /usr/local/sbin/ser[3550]: error:
mediaproxy/sendMediaproxyCommand(): can't connect to MediaProxy
Thank you for your kind.
Best Regard
Charles
My ser.cfg list below:
#
# $Id: ser.cfg,v 1.25 2004/11/30 16:28:24 andrei Exp $
#
# simple quick-start config script
#
# ----------- global configuration parameters ------------------------
debug=10 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)
/* Uncomment these lines to enter debugging mode
fork=no
log_stderror=yes
*/
listen=61.220.190.248
alias=ser.xxx.net
alias=ser
alias=xx.xx.xx.xx
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
port=5060
children=4
fifo_mode=0666
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:heslo@localhost/ser"
# ------------------ 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"
loadmodule "/usr/local/lib/ser/modules/textops.so"
# Uncomment this if you want digest authentication
# mysql.so must be loaded !
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/exec.so"
loadmodule "/usr/local/lib/ser/modules/avpops.so"
loadmodule "/usr/local/lib/ser/modules/domain.so"
loadmodule "/usr/local/lib/ser/modules/group.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"
loadmodule "/usr/local/lib/ser/modules/uri_db.so"
loadmodule "/usr/local/lib/ser/modules/permissions.so"
loadmodule "/usr/local/lib/ser/modules/speeddial.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/pdt.so"
loadmodule "/usr/local/lib/ser/modules/options.so"
loadmodule "/usr/local/lib/ser/modules/mediaproxy.so"
loadmodule "/usr/local/lib/ser/modules/xlog.so"
# ----------------- setting module-specific parameters ---------------
# -- mediaproxy params --
modparam("mediaproxy", "natping_interval", 30)
modparam("mediaproxy", "sip_asymmetrics",
"/usr/local/etc/ser/sip-asymmetric-clients")
modparam("mediaproxy", "rtp_asymmetrics",
"/usr/local/etc/ser/rtp-asymmetric-clients")
# -- usrloc params --
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
# ------------- usrloc parameters
# 0 = disable
# 1 = write-through
# 2 = write-back
modparam("usrloc", "db_mode", 1)
modparam("usrloc", "timer_interval", 60)
modparam("usrloc", "desc_time_order", 1)
# -- auth params --
# Uncomment if you are using auth module
#
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)
# -- db_url params --
modparam("acc|auth_db|domain|group|permissions|speeddial|uri_db|usrloc|pdt",
"db_url", "mysql://ser:heslo@localhost/ser")
# -- use_domain params --
modparam("auth_db|group|registrar|speeddial|uri_db|usrloc",
"use_domain", 0)
# -- permissions params --
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
# -- accounting params --
modparam("acc", "db_flag", 1)
modparam("acc", "db_missed_flag", 1)
modparam("acc", "log_fmt", "cdfimorstup")
modparam("acc", "log_level", 1)
modparam("acc", "failed_transactions", 1)
modparam("acc", "report_cancels", 1)
modparam("acc", "report_ack", 0)
# -- domain params --
modparam("domain", "db_mode", 1)
# ------------- exec parameters
modparam("exec", "setvars", 1)
modparam("exec", "time_to_kill", 10)
# ------------- registration parameters
modparam("registrar", "nat_flag", 2)
modparam("registrar", "min_expires", 60)
modparam("registrar", "max_expires", 86400)
modparam("registrar", "default_expires", 3600)
modparam("registrar", "append_branches", 1)
# -- avp params --
modparam("avpops", "avp_url",
"mysql://ser:heslo@localhost/ser")
modparam("avpops", "avp_table", "usr_preferences")
#modparam("avpops", "use_domain", "1")
modparam("avpops", "uuid_column", "uuid")
modparam("avpops", "username_column", "username")
modparam("avpops", "domain_column", "domain")
modparam("avpops", "attribute_column", "attribute")
modparam("avpops", "value_column", "value")
modparam("avpops", "type_column", "type")
modparam("avpops", "avp_aliases",
"voicemail=i:500;calltype=i:700;fwd_no_answer_type=i:701;fwd_busy_type=i:702")
# To use more than one tables example
#modparam("avpops", "db_scheme",
"scheme1:table=subscriber;uuid_column=uuid;value_column=first_name")
# -- tm params --
modparam("tm", "fr_timer", 15)
modparam("tm", "fr_inv_timer", 22)
modparam("tm", "wt_timer", 5)
modparam("tm", "fr_inv_timer_avp", "inv_timeout")
# -- pft params --
modparam("pdt", "db_table", "prefix_domain")
modparam("pdt", "prefix", "")
modparam("pdt", "hsize_2pow", 2)
modparam("pdt", "sync_time", 300)
modparam("pdt", "clean_time", 600)
# ------------- logging parameters
modparam("xlog", "buf_size", 8192)
# -- group params --
modparam("group", "table", "grp")
modparam("group", "user_column", "username")
modparam("group", "domain_column", "domain")
modparam("group", "group_column", "grp")
# ------------------------- request routing logic -------------------
# main routing logic
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;
};
# ------------------------------------------------------------------------
# NOTIFY Keep-Alive Section
# ------------------------------------------------------------------------
if ((method=="NOTIFY") && search("^Event: keep-alive")) {
sl_send_reply("200", "OK");
break;
};
# ------------------------------------------------------------------------
# OPTIONS Section
# ------------------------------------------------------------------------
if (method=="OPTIONS") {
options_reply();
break;
};
# ------------------------------------------------------------------------
# NAT Test Section #1
# ------------------------------------------------------------------------
if (method=="REGISTER" && client_nat_test("3")) {
fix_contact();
force_rport();
setflag(2);
};
# ------------------------------------------------------------------------
# Registration Section
# ------------------------------------------------------------------------
if (method=="REGISTER") {
if (!is_from_local()) {
sl_send_reply("403", "Unknown Domain");
break;
};
if (!www_authorize("", "subscriber")) {
www_challenge("", "0");
break;
};
if (!check_to()) {
sl_send_reply("401", "Unauthorized");
break;
};
# To - Use To username and (optionally) domain to check
if (is_user_in("To", "demo-disabled")) {
sl_send_reply("403", "Your evaluation period has expired");
break;
};
# To - Use To username and (optionally) domain to check
if (is_user_in("To", "disabled")) {
sl_send_reply("403", "Your account has been disabled");
break;
};
# snom sip phones use this header to start their
# keep-alive mechanism for NAT bindings
append_to_reply("P-NAT-Refresh: 15\r\n");
if (!save("location")) {
sl_reply_error();
};
break;
};
# ------------------------------------------------------------------------
# Accounting Section # 1
#
# NOTE: We test for flag 14 because we do not want to record Click2Dial
# entries
# ------------------------------------------------------------------------
if ((method=="INVITE" || method=="BYE") && !isflagset(14)) {
setflag(1);
};
# ------------------------------------------------------------------------
# NAT Tear-Down Section
# ------------------------------------------------------------------------
if ((method == "BYE" || method == "CANCEL")) {
end_media_session();
};
# ------------------------------------------------------------------------
# Record Route Section
#
# 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
# ------------------------------------------------------------------------
if (!method=="REGISTER") {
record_route();
};
# ------------------------------------------------------------------------
# Loose Route Section
#
# Grant route routing if route headers present
# ------------------------------------------------------------------------
if (loose_route()) {
route(2);
break;
};
# ------------------------------------------------------------------------
# NAT Test Section #1
# ------------------------------------------------------------------------
if (client_nat_test("3") && !search("^Record-Route:")) {
force_rport();
fix_contact();
};
# ------------------------------------------------------------------------
# PSTN Section
# ------------------------------------------------------------------------
if (method=="INVITE") { ## Deny PSTN to 0204 and 095
if ((uri=~"^sip:0204[0-9]*@") || (uri=~"^sip:095[0-9]*@")) {
sl_send_reply("503", "Service Unavailable");
break;
};
};
# ------------------------------------------------------------------------
# Alias Routing Section
# ------------------------------------------------------------------------
lookup("aliases");
if (!uri==myself) {
route(2); # local domain call
break;
};
# ------------------------------------------------------------------------
# Load ACL Section
# ------------------------------------------------------------------------
if (method=="INVITE" && !isflagset(14)) {
log(1, "SER: Load ACL\n");
if (is_from_local() || is_uri_host_local()) {
if (is_user_in("From", "int")) {
log(1, "SER: a INT user\n");
setflag(29);
};
if (is_user_in("From", "free-pstn")) {
log(1, "SER: a FREE-PSTN user\n");
setflag(28);
};
};
if (avp_db_load("$ruri/username", "s:anoncallrej")) {
if (avp_check("s:anoncallrej", "eq/y/i")) {
log(1, "SER: a ANON-CALL-REJ user\n");
setflag(24);
};
};
};
# ------------------------------------------------------------------------
# Anonymous Call Rejection Section # 24
# ------------------------------------------------------------------------
if (isflagset(24) && (method=="INVITE") &&
search("^(f|F)rom:.*(a|A)nonymous")) {
route(8);
break;
};
# ------------------------------------------------------------------------
# Speed Dialing Section
# ------------------------------------------------------------------------
if ((method=="INVITE") && (uri=~"^sip:[0-9]{2}@.*")) {
sd_lookup("speed_dial");
};
# ------------------------------------------------------------------------
# 002 International Call Section # 29
# ------------------------------------------------------------------------
if (method=="INVITE" && uri=~"^sip:002[0-9]*@") {
if (isflagset(29)) {
route(6);
} else {
sl_send_reply("503", "Service Unavailable");
};
break;
};
# ------------------------------------------------------------------------
# 0XXXXXXXXX Domestic Call Section # 29
# ------------------------------------------------------------------------
if (method=="INVITE" && uri=~"^sip:0[0-9]{9}@") {
if (isflagset(29)) {
route(6);
} else {
sl_send_reply("503", "Service Unavailable");
};
break;
};
# ------------------------------------------------------------------------
# URI Compare Section
#
# Here we compare the "from" and "to" to see if the caller is
dialing
# their own extension. If so then we route to voicemail(31) if needed
# ------------------------------------------------------------------------
if (method=="INVITE") {
avp_write("$from", "i:34");
if (avp_check("i:34", "eq/$ruri/i")) {
if (isflagset(31)) {
route(5);
break;
} else {
sl_send_reply("486", "Busy");
break;
};
};
};
# ------------------------------------------------------------------------
# Do Not Disturb Section
# ------------------------------------------------------------------------
if (avp_db_load("$ruri/username", "s:donotdisturb")) {
if (avp_check("s:donotdisturb", "eq/y/i")) {
route(5);
break;
};
};
# ------------------------------------------------------------------------
# Blind Call Forwarding Section
# ------------------------------------------------------------------------
if (method=="INVITE") {
# here we must store the current (aka original) R-URI because if
# we set call forwarding and the forwarded number is busy then we
# need to use this original R-URI to determine which voicemail
# box we should go to
if (isflagset(31)) {
avp_write("$ruri", "$voicemail");
};
if (avp_db_load("$ruri/username", "s:callfwd")) {
avp_pushto("$ruri", "s:callfwd");
# lookup the call fowarding number to see if it is a served
# sip number or a PSTN number
# check forwarding number rules
route(1);
if (avp_check("$calltype", "eq/-/i")) {
sl_send_reply("503", "Service Unavailable");
break;
};
# test for domestic PSTN gateway
if (avp_check("$calltype", "eq/dom/i")) {
route(3);
break;
};
# test for international PSTN gateway
if (avp_check("$calltype", "eq/int/i")) {
route(6);
break;
};
};
};
# ------------------------------------------------------------------------
# Call Routing Section
# ------------------------------------------------------------------------
if (!lookup("location")) {
# if flag 31 (ie voicemail) is set and we made it here this means
# the user's phone is not registered anywhere. We'll forward to
# voicemail after this block because we need to check the call
# forward settings first
if (isflagset(31)) {
# flag 19 means the user has voicemail but is not online
# so we need to remember to send to voicemail if call
# forwarding is not enabled
setflag(19);
};
if (method=="INVITE") {
if (does_uri_exist()) {
# subscriber record found, but they're offline
sl_send_reply("480", "Temporarily Unavailable");
break;
};
if (uri=~"^sip:0[0-9]{9}@") {
# Send to PSTN Gateway
if (isflagset(28)) {
route(3);
} else {
sl_send_reply("503", "Service Unavailable");
};
break;
};
sl_send_reply("404", "User Not Found");
break;
};
};
# ------------------------------------------------------------------------
# Call Forwarding Section
# ------------------------------------------------------------------------
if (method=="INVITE") {
# save R-URI in a temp AVP for later use
avp_write("$ruri", "i:99");
# only load the forward no answer option if voice mail is not enabled
if (!isflagset(31)) {
if (avp_db_load("$ruri/username", "s:fwdnoanswer")) {
route(1);
if (!avp_check("$calltype", "eq/-/i")) {
if (avp_check("$calltype", "eq/dom/i")) {
avp_write("dom", "$fwd_no_answer_type");
} else if (avp_check("$calltype", "eq/int/i")) {
avp_write("int", "$fwd_no_answer_type");
} else {
avp_write("sip", "$fwd_no_answer_type");
}
setflag(27);
};
};
};
if (avp_db_load("$ruri/username", "s:fwdbusy")) {
route(1);
if (!avp_check("$calltype", "eq/-/i")) {
if (avp_check("$calltype", "eq/dom/i")) {
avp_write("dom", "$fwd_busy_type");
} else if (avp_check("$calltype", "eq/int/i")) {
avp_write("int", "$fwd_busy_type");
} else {
avp_write("sip", "$fwd_busy_type");
}
setflag(26);
};
};
avp_pushto("$ruri", "i:99");
};
if (isflagset(19)) {
# send to voicemail
route(5);
} else {
route(2);
};
}
route[1] {
# Here we have route checks for all the call forwarding stuff.
# The return values are passed as AVP $calltype as follows:
#
# "-" = R-URI is not allowed
# "dom" = R-RURI is a domestic call
# "int" = R-RURI is an international call
# "sip" = R-RURI is a sip call
avp_write("-", "$calltype");
# Call rejected
if ((uri=~"^sip:0204[0-9]*@") ||
(uri=~"^sip:095[0-9]*@") ||
(uri=~"^sip:[0-9]{3}@")) {
break;
};
lookup("aliases");
if (!lookup("location")) {
if (uri=~"^sip:0[0-9]{9}@") {
# test for domestic PSTN number
if (isflagset(28)) {
avp_write("dom", "$calltype");
};
# } else if (uri=~"^sip:011[0-9]*@") {
} else if (uri=~"^sip:002[0-9]*@") {
# test for international PSTN number
if (isflagset(29)) {
avp_write("int", "$calltype");
};
};
break;
};
avp_write("sip", "$calltype");
}
route[2] {
if ((method=="INVITE") && !allow_trusted()) {
if (!proxy_authorize("", "subscriber")) {
proxy_challenge("", "0");
break;
} else if (!check_from()) {
log(1, "Spoofed SIP call attempt");
sl_send_reply("403", "Use From=ID");
break;
} else if (!(is_from_local() || is_uri_host_local())) {
sl_send_reply("403", "Please register to use our service");
break;
};
};
if (uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" &&
!search("^Route:")){
sl_send_reply("479", "We don't forward to private IP
addresses");
break;
};
if (method=="INVITE" || method=="ACK") {
use_media_proxy();
};
t_on_failure("1");
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
route[3] {
# All Domestic Calls Go To PSTN
if (method=="INVITE") {
if (!proxy_authorize("", "subscriber")) {
proxy_challenge("", "0");
break;
} else if (!check_from()) {
log(1, "Spoofed SIP call attempt");
sl_send_reply("403", "Use From=ID");
break;
} else if (!(is_from_local() || is_uri_host_local())) {
sl_send_reply("403", "Please register to use our service");
break;
};
};
# SIP->PSTN calls get 45 seconds to timeout
avp_write("i:45", "inv_timeout");
rewritehost("xx.xx.xx.xx");
if (uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" &&
!search("^Route:")){
sl_send_reply("479", "We don't forward to private IP
addresses");
break;
};
if (method=="INVITE" || method=="ACK") {
use_media_proxy();
};
if (isflagset(31)) {
t_on_failure("1");
};
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
route[4] {
# voicemail route #1
#
# this path this executed during these conditions:
#
# cond 1) the called number is in the location table
# but the callee did not answer the phone
# (ie, failover to voicemail)
#if (isflagset(25)) {
# replace("^From:(.*)>" , "From: \"Anonymous\"
<sip:someone@anonymous.invalid>");
#};
rewritehostport("99.99.99.100:5060");
append_branch();
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
route[5] {
# voicemail route #2
#
# this path this executed during these conditions:
#
# cond 1) the called number is not in the location table
# cond 2) the from_uri == to_uri (ie, caller==callee)
if (method=="INVITE" || method=="ACK") {
use_media_proxy();
};
rewritehostport("99.99.99.100:5060");
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
route[6] {
# All International Calls Go To PSTN
if (method=="INVITE") {
if (!proxy_authorize("", "subscriber")) {
proxy_challenge("", "0");
break;
} else if (!check_from()) {
log(1, "Spoofed SIP call attempt");
sl_send_reply("403", "Use From=ID");
break;
} else if (!(is_from_local() || is_uri_host_local())) {
sl_send_reply("403", "Please register to use our service");
break;
};
};
# SIP->PSTN calls get 45 seconds to timeout
avp_write("i:45", "inv_timeout");
rewritehost("xx.xx.xx.xx");
if (uri=~"[@:](192\.168\.|10\.|172\.(1[6-9]|2[0-9]|3[0-1])\.)" &&
!search("^Route:")){
sl_send_reply("479", "We don't forward to private IP
addresses");
break;
};
if (method=="INVITE" || method=="ACK") {
use_media_proxy();
};
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
route[7] {
# caller blocked announcment
#
# this path this executed if a caller has been blocked
if (method=="INVITE" || method=="ACK") {
use_media_proxy();
};
rewriteuri("sip:699@99.99.99.100:5060");
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
route[8] {
# anonymous call rejection announcment
#
# this path this executed for anonymous callers
if (method=="INVITE" || method=="ACK") {
use_media_proxy();
};
rewriteuri("sip:698@99.99.99.100:5060");
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
onreply_route[1] {
# Not all 2xx messages have a content body so here we
# make sure our Content-Length > 0 to avoid a parse error
if (status=~"(180)|(183)|2[0-9][0-9]") {
if (!search("^Content-Length:\ 0")) {
use_media_proxy();
};
};
if (client_nat_test("1")) {
fix_contact();
};
}
failure_route[1] {
# if caller hung up then don't sent to voicemail
if (t_check_status("487")) {
break;
};
if (isflagset(26) && t_check_status("486")) {
# forward busy is flag 26
if (avp_pushto("$ruri", "s:fwdbusy")) {
avp_delete("s:fwdbusy");
append_branch();
resetflag(26);
# test for domestic PSTN gateway
if (avp_check("$fwd_busy_type", "eq/dom/i")) {
# test for domestic PSTN gateway
route(3);
} else if (avp_check("$fwd_busy_type", "eq/int/i")) {
# test for international PSTN gateway
route(6);
} else {
# default to sip call
route(2);
};
break;
};
};
# here we can have either voicemail __OR__ forward no answer
if (isflagset(27) && t_check_status("408")) {
# forward no answer is flag 27
if (avp_pushto("$ruri", "s:fwdnoanswer")) {
avp_delete("s:fwdnoanswer");
append_branch();
resetflag(27);
if (avp_check("$fwd_no_answer_type", "eq/dom/i")) {
# test for domestic PSTN gateway
route(3);
} else if (avp_check("$fwd_no_answer_type", "eq/int/i")) {
# test for international PSTN gateway
route(6);
} else {
# default to sip call
route(2);
};
break;
};
} else if (isflagset(31) && avp_pushto("$ruri",
"$voicemail")) {
avp_delete("$voicemail");
route(4);
break;
};
}