Hi all,
I'm running ser 0.8.14 with nathelper+rtpproxy. I can initiate calls from
UA behind NAT to UA in public without problem. But, I can't initiate a
call from public to private even if the NATed client has been registered.
Please advise.
Here is the snippet of my ser.cfg
------------------------begin----------------------------------
#-----Nathelper parameters-----
modparam("registrar", "nat_flag", 6) # indicates that a registered client
is behind NAT
modparam("nathelper", "natping_interval", 60) #ping interval 30s
modparam("nathelper", "ping_nated_only", 1) #ping only clients behind NAT
.
.
if (nat_uac_test("3")) {
log(1, "src address different than via header->NAT
detected\n");
log(1, "force_rport and fix_nated_contact and setflag(5)\n");
if (method=="REGISTER" || ! search("^Record-Route:")) {
fix_nated_contact();# Rewrite contact with source
IP of signalling
if (method=="INVITE") {
fix_nated_sdp("1");# Add direction=active
to SDP
};
force_rport();# Add rport parameter to topmost Via
setflag(6);# Mark as NATed
};
append_hf("P-hint: fixed NAT contact for request\r\n");
};
.
.
route[1]
{
# !! Nathelper
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 client or server know to be behind a NAT, enable relay
if (isflagset(6)) {
force_rtp_proxy();
};
# NAT processing of replies; apply to all transactions (for example,
# re-INVITEs from public to private UA are hard to identify as
# NATed at the moment of request processing); look at replies
t_on_reply("1");
# send it out now; use stateful forwarding as it works reliably
# even for UDP2TCP
if (!t_relay()) {
sl_reply_error();
};
}
# NATed transaction ?
onreply_route[1] {
if (isflagset(6) && status =~ "(183)|2[0-9][0-9]") {
fix_nated_contact();
force_rtp_proxy();
} else if (nat_uac_test("1")) {
fix_nated_contact();
};
}
----------------------------end----------------------------------------
Regards.
After having good success with STUN (on a separate server) as a method
for traversing NAT from many devices, I am endeavouring to get rtpproxy
and nathelper configured as a fallback scenario for devices with no/poor
STUN support.
The issue I have is that calls from a UA using STUN to a UA registered
via nathelper don't transmit/receive any audio information, I assume
because the call does not traverse the proxy. Calls the other way are
OK, as I am setting a 'natted' flag and forcing rtp_proxy based on that
event (e.g. a UA handled via Nathelper CAN call a STUN serviced UA, but
not the other way around).
Is there any way to set proxying on/off based on the CALLED UA, not the
CALLING one? Can I test to see if a given UA registered via Nathelper,
and then enable proxying for all calls to that UA?
Am I even making sense?
--
==========================================
Rod Bacon - VOIP Systems Engineer
Empowered Communications
Ground Floor, 102 York St. South Melbourne
Victoria, Australia. 3205
Phone: +613 99401600 Fax: +613 99401650
FWD: 512237 IAXtel: 17007401708
==========================================
Dear ALL:
I start ser 0.9.0. And when I make a sip call or off-net call(to
PSTN), some error(as Subject) about MediaProxy will display in Log
file.
Does anybody have the same problem and have any solution to fix it?
My ser.cfg list below:
--------------------------------------------------------------------------------------------------------
debug=10 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)
listen=xxx.xxx.xxx.xxx
alias=ser.xxx.net.tw
alias=ser
alias=xxx.xxx.xxx.xxx
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 ----------------------------------
# ----------------- setting module-specific parameters ---------------
----------(skip)
# -- 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 --
modparam("usrloc", "db_mode", 1)
modparam("usrloc", "timer_interval", 60)
modparam("usrloc", "desc_time_order", 1)
# -- auth params --
modparam("auth_db", "calculate_ha1", yes)
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 params --
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")
# -- pdt 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 params
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") {
# allow all requests from user 700 - the Click2Dial controller
if (!isflagset(14)) {
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;
};
prefix2domain();
# ------------------------------------------------------------------------
# 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 on Tawan
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);
break;
};
# ------------------------------------------------------------------------
# Load ACL Section
# ------------------------------------------------------------------------
if (method=="INVITE" && !isflagset(14)) {
xlog("L_ERR", "Time:[%Tf] Method:<%rm> r-uri:<%ru>\n");
xlog("L_ERR", "IP:<%is> From:<%fu> To:<%tu> %ct\n");
if (is_user_in("Request-URI", "voicemail")) {
setflag(31);
};
if (is_from_local() || is_uri_host_local()) {
# Check user from grp table
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("$from/username", "s:callidblock")) {
if (avp_check("s:callidblock", "eq/y/i")) {
setflag(25);
};
};
};
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)) {
log(1, "SER: an International Call route(6)\n");
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)) {
log(1, "SER: a Domestic Call route(6)\n");
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") {
log(1, "SER: BLIND CALL FORWARDING\n");
# 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
log(1, "SER: Check Forwarding Number Rules\n");
route(1);
if (avp_check("$calltype", "eq/-/i")) {
log(1, "SER: 503 Service Unavailable 1\n");
sl_send_reply("503", "Service Unavailable");
break;
};
# test for domestic PSTN gateway
if (avp_check("$calltype", "eq/dom/i")) {
log(1, "SER: Start a domestic PSTN call route(3)\n");
route(3);
break;
};
# test for international PSTN gateway
if (avp_check("$calltype", "eq/int/i")) {
log(1, "SER: Start an international PSTN call route(6)\n");
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
log(1, "SER: Temporarily Unavailable\n");
sl_send_reply("480", "Temporarily Unavailable");
break;
};
if (uri=~"^sip:0[0-9]{9}@") {
# Send to PSTN Gateway
if (isflagset(28) || (is_user_in("From", "int")) ||
(is_user_in("From", "free-pstn"))) {
log(1, "SER: Start a PSTN call\n");
route(3);
} else {
log(1, "SER: 503 Service Unavailable 2\n");
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_db_load("$ruri/username", "s:fwdbusy")) {
route(1);
};
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("sip", "$calltype");
# Call rejected
if ((uri=~"^sip:0204[0-9]*@") ||
(uri=~"^sip:095[0-9]*@") ||
(uri=~"^sip:[0-9]{3}@")) {
break;
};
log(1, "SER: Look aliases\n");
lookup("aliases");
log(1, "SER: Look location\n");
if (!lookup("location")) {
if (uri=~"^sip:0[0-9]{9}@") {
# test for domestic PSTN number
if (isflagset(28)) {
log(1, "SER isflagset 28 (domestic)\n");
avp_write("dom", "$calltype");
};
} else if (uri=~"^sip:002[0-9]*@") {
# test for international PSTN number
if (isflagset(29)) {
log(1, "SER isflagset 29 (int)\n");
avp_write("int", "$calltype");
};
};
break;
};
log(1, "SER isflagset (sip)\n");
avp_write("sip", "$calltype");
}
route[2] {
log(1, "SER: SIP Call On-Net section route(2)\n");
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 (isflagset(25)) {
replace("^From:(.*)>" , "From: \"Anonymous\"
<sip:someone@anonymous.invalid>");
};
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] {
log(1, "SER: Demestic Call Off-Net section route(3)\n");
# All Domestic Calls Go To CISCO 5300
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;
};
# enable caller id blocking for PSTN calls
if (isflagset(25)) {
append_rpid_hf();
};
};
# SIP->PSTN calls get 45 seconds to timeout
log(1, "SER: Connecting to PSTN.....\n");
avp_write("i:45", "inv_timeout");
rewritehost("61.220.190.243");
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] {
log(1, "SER: Voice Mail section route(4)\n");
# 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] {
log(1, "SER: Voice Mail section route(5)\n");
# 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] {
log(1, "SER: International Call Off-Net section route(6)\n");
# All International Calls Go To CISCO 5300
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;
};
# enable caller id blocking for PSTN calls
if (isflagset(25)) {
append_rpid_hf();
};
};
# SIP->PSTN calls get 45 seconds to timeout
avp_write("i:45", "inv_timeout");
rewritehost("61.220.190.243");
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] {
log(1, "SER: Caller Blocked section route(7)\n");
# 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] {
log(1, "SER: Anonymous Call Rejection section route(8)\n");
# 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] {
log(1, "SER: Failure Route section failure_route(1)\n");
# 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")) {
log(1, "SER: fork to fwdbusy\n");
avp_delete("s:fwdbusy");
append_branch();
resetflag(26);
# test for domestic PSTN gateway
if (uri=~"^sip:0[0-9]{9}@") {
# if (avp_check("$fwd_busy_type", "eq/dom/i")) {
# test for domestic PSTN gateway
log(1, "SER: Busy Failure and Jump to route(3)\n");
route(3);
} else if (uri=~"^sip:002[1-9][0-9]*@") {
# } else if (avp_check("$fwd_busy_type", "eq/int/i")) {
# test for international PSTN gateway
log(1, "SER: Busy Failure and Jump to route(6)\n");
route(6);
} else {
# default to sip call
log(1, "SER: Busy Failure and Jump to route(2)\n");
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")) {
log(1, "SER: fork to fwdnoanswer\n");
avp_delete("s:fwdnoanswer");
append_branch();
resetflag(27);
if (uri=~"^sip:0[0-9]{9}@") {
# if (avp_check("$fwd_no_answer_type", "eq/dom/i")) {
# test for domestic PSTN gateway
log(1, "SER: No Answer Failure and Jump to route(3)\n");
route(3);
} else if (uri=~"^sip:002[1-9][0-9]*@") {
# } else if (avp_check("$fwd_no_answer_type", "eq/int/i")) {
# test for international PSTN gateway
log(1, "SER: No Answer Failure and Jump to route(6)\n");
route(6);
} else {
# default to sip call
log(1, "SER: No Answer Failure and Jump to route(2)\n");
route(2);
};
break;
};
} else if (isflagset(31) && avp_pushto("$ruri", "$voicemail")) {
avp_delete("$voicemail");
log(1, "SER: No Answer Failure and Jump to route(4)\n");
route(4);
break;
};
}
Dear ALL:
I insert records to my usr_preferences as below:
In usr_preferences table:
username domain attribute value
-------------------------------------------------------------------------------------------------------------------
1022 ser.xxx.net.tw donotdisturb n
1022 ser.xxx.net.tw voicemail n
1022 ser.xxx.net.tw anoncallrej n
1022 ser.xxx.net.tw callidblock n
1022 ser.xxx.net.tw callfwd
sip:0939749xxx@ser.xxx.net.tw
1022 ser.xxx.net.tw fwdnoanswer
sip:0939749xxx@ser.xxx.net.tw
1022 ser.xxx.net.tw fwdbusy
sip:0939749xxx@ser.xxx.net.tw
In grp table:
username domain grp
---------------------------------------------------
1022 ser.xxx.net.tw int
1011 ser.xxx.net.tw int
Now, I change my value to sip:0939749xxx@ser.xxx.net.tw. If its
attribute is "callfwd", the call will be forward to my mobile
phone(0939749xxx) using route(3) to PSTN. So the result is OK.
I delete the attribute "callfwd" in order to test "fwdnoanswer" function.
If UA 1011 make a call to UA 1022 and UA 1022 no answer, it should goto
failure_route[1] and make a call to route(3) depending on its "uri"
(phone number).
And I also find it runs to failure_route[1] and jump to route(3). But
the connection will disconnect for a few seconds. And displays "408
Request Timeout" on my X-Pro Client. I find it jumps to another
route(2) after disconnect.
I know I should not disturb you too much because of your works and
your new best example cfg file for us. But can you please help me to
discover what reason about it.
I think it should be the reason in my TM modules.
I am a Taiwanese and using a poor English.
Best Regard
Charles
Error Logs lists below:
------------------------------------------------------------------------------------------------------
SER: Failure Route section failure_route(1)
SER: fork to fwdnoanswer
SER: No Answer Failure and Jump to route(3)
SER: Demestic Call Off-Net section route(3)
SER: Connecting to PSTN.... <=========== Connect to PSTN here!!!!.
error: mediaproxy/sendMediaproxyCommand(): can't connect to MediaProxy
PDT:prefix2domain: no prefix found in [1022]
SER: SIP Call On-Net section route(2)
My ser.cfg list below:
--------------------------------------------------------------------------------------------------------
debug=10 # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no # (cmd line: -E)
listen=xxx.xxx.xxx.xxx
alias=ser.xxx.net.tw
alias=ser
alias=xxx.xxx.xxx.xxx
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 ----------------------------------
# ----------------- setting module-specific parameters ---------------
----------(skip)
# -- 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 --
modparam("usrloc", "db_mode", 1)
modparam("usrloc", "timer_interval", 60)
modparam("usrloc", "desc_time_order", 1)
# -- auth params --
modparam("auth_db", "calculate_ha1", yes)
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 params --
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")
# -- pdt 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 params
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") {
# allow all requests from user 700 - the Click2Dial controller
if (!isflagset(14)) {
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;
};
prefix2domain();
# ------------------------------------------------------------------------
# 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 on Tawan
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);
break;
};
# ------------------------------------------------------------------------
# Load ACL Section
# ------------------------------------------------------------------------
if (method=="INVITE" && !isflagset(14)) {
xlog("L_ERR", "Time:[%Tf] Method:<%rm> r-uri:<%ru>\n");
xlog("L_ERR", "IP:<%is> From:<%fu> To:<%tu> %ct\n");
if (is_user_in("Request-URI", "voicemail")) {
setflag(31);
};
if (is_from_local() || is_uri_host_local()) {
# Check user from grp table
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("$from/username", "s:callidblock")) {
if (avp_check("s:callidblock", "eq/y/i")) {
setflag(25);
};
};
};
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)) {
log(1, "SER: an International Call route(6)\n");
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)) {
log(1, "SER: a Domestic Call route(6)\n");
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") {
log(1, "SER: BLIND CALL FORWARDING\n");
# 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
log(1, "SER: Check Forwarding Number Rules\n");
route(1);
if (avp_check("$calltype", "eq/-/i")) {
log(1, "SER: 503 Service Unavailable 1\n");
sl_send_reply("503", "Service Unavailable");
break;
};
# test for domestic PSTN gateway
if (avp_check("$calltype", "eq/dom/i")) {
log(1, "SER: Start a domestic PSTN call route(3)\n");
route(3);
break;
};
# test for international PSTN gateway
if (avp_check("$calltype", "eq/int/i")) {
log(1, "SER: Start an international
PSTN call route(6)\n");
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
log(1, "SER: Temporarily Unavailable\n");
sl_send_reply("480", "Temporarily Unavailable");
break;
};
if (uri=~"^sip:0[0-9]{9}@") {
# Send to PSTN Gateway
if (isflagset(28) ||
(is_user_in("From", "int")) ||
(is_user_in("From", "free-pstn"))) {
log(1, "SER: Start a PSTN call\n");
route(3);
} else {
log(1, "SER: 503 Service
Unavailable 2\n");
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_db_load("$ruri/username", "s:fwdbusy")) {
route(1);
};
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("sip", "$calltype");
# Call rejected
if ((uri=~"^sip:0204[0-9]*@") ||
(uri=~"^sip:095[0-9]*@") ||
(uri=~"^sip:[0-9]{3}@")) {
break;
};
log(1, "SER: Look aliases\n");
lookup("aliases");
log(1, "SER: Look location\n");
if (!lookup("location")) {
if (uri=~"^sip:0[0-9]{9}@") {
# test for domestic PSTN number
if (isflagset(28)) {
log(1, "SER isflagset 28 (domestic)\n");
avp_write("dom", "$calltype");
};
} else if (uri=~"^sip:002[0-9]*@") {
# test for international PSTN number
if (isflagset(29)) {
log(1, "SER isflagset 29 (int)\n");
avp_write("int", "$calltype");
};
};
break;
};
log(1, "SER isflagset (sip)\n");
avp_write("sip", "$calltype");
}
route[2] {
log(1, "SER: SIP Call On-Net section route(2)\n");
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 (isflagset(25)) {
replace("^From:(.*)>" , "From: \"Anonymous\"
<sip:someone@anonymous.invalid>");
};
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] {
log(1, "SER: Demestic Call Off-Net section route(3)\n");
# All Domestic Calls Go To CISCO 5300
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;
};
# enable caller id blocking for PSTN calls
if (isflagset(25)) {
append_rpid_hf();
};
};
# SIP->PSTN calls get 45 seconds to timeout
log(1, "SER: Connecting to PSTN.....\n");
avp_write("i:45", "inv_timeout");
rewritehost("xxx.xxx.xxx.243");
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] {
------------------(skip)
}
route[5] {
--------------------(skip)
}
route[6] {
log(1, "SER: International Call Off-Net section route(6)\n");
# All International Calls Go To CISCO 5300
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;
};
# enable caller id blocking for PSTN calls
if (isflagset(25)) {
append_rpid_hf();
};
};
# SIP->PSTN calls get 45 seconds to timeout
avp_write("i:45", "inv_timeout");
rewritehost("xxx.xxx.xxx.243");
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] {
-----(skip)
}
route[8] {
log(1, "SER: Anonymous Call Rejection section route(8)\n");
# 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] {
log(1, "SER: Failure Route section failure_route(1)\n");
# 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")) {
log(1, "SER: fork to fwdbusy\n");
avp_delete("s:fwdbusy");
append_branch();
resetflag(26);
# test for domestic PSTN gateway
if (uri=~"^sip:0[0-9]{9}@") {
# if (avp_check("$fwd_busy_type", "eq/dom/i")) {
# test for domestic PSTN gateway
log(1, "SER: Busy Failure and Jump to
route(3)\n");
route(3);
} else if (uri=~"^sip:002[1-9][0-9]*@") {
# } else if (avp_check("$fwd_busy_type", "eq/int/i")) {
# test for international PSTN gateway
log(1, "SER: Busy Failure and Jump to
route(6)\n");
route(6);
} else {
# default to sip call
log(1, "SER: Busy Failure and Jump to
route(2)\n");
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")) {
log(1, "SER: fork to fwdnoanswer\n");
avp_delete("s:fwdnoanswer");
append_branch();
resetflag(27);
if (uri=~"^sip:0[0-9]{9}@") {
# if (avp_check("$fwd_no_answer_type", "eq/dom/i")) {
# test for domestic PSTN gateway
log(1, "SER: No Answer Failure and Jump
to route(3)\n");
route(3);
} else if (uri=~"^sip:002[1-9][0-9]*@") {
# } else if (avp_check("$fwd_no_answer_type",
"eq/int/i")) {
# test for international PSTN gateway
log(1, "SER: No Answer Failure and Jump
to route(6)\n");
route(6);
} else {
# default to sip call
log(1, "SER: No Answer Failure and Jump
to route(2)\n");
route(2);
};
break;
};
} else if (isflagset(31) && avp_pushto("$ruri", "$voicemail")) {
avp_delete("$voicemail");
log(1, "SER: No Answer Failure and Jump to route(4)\n");
route(4);
break;
};
}
Please don't send rubbish mail to me again , thanks
Mail: starhw.tw(a)yahoo.com.tw
_______________________________________________________________________
Yahoo!奇摩電子信箱
免費容量250MB,信件在多也不怕
http://tw.promo.yahoo.com/mail_new/index.html
Charles,
It's rather hard to say why you are having problems. Perhaps if you
use ngrep to produce a SIP debug output and email it to the serusers
list I'll be able to see what is happening.
Regards,
Paul
On Mon, 21 Feb 2005 02:16:47 +0800, Charles Wang <lazy.charles(a)gmail.com> wrote:
> Dear Paul:
>
> Thank you for your explanation, and I know what's it wrong on my plan.
>
> Now, I change my value to sip:0939749xxx@ser.xxx.net.tw. If its
> attribute is "callfwd", the call will be forward to my mobile
> phone(0939749xxx) using route(3) to PSTN. So the result is OK.
>
> But I rename the attribute "callfwd" to "fwdnoanswer" and use the same value.
> I want to test the no answer forward function.
>
> UA 1011 make a call to UA 1022 and UA 1022 no answer. It should goto
> failure_route[1] and make a call to route(3) depending on its "uri"
> (phone number).
>
> And I also find it runs to failure_route[1] and jump to route(3). But
> the connection will disconnect for a few seconds. And displays "408
> Request Timeout" on my X-Pro Client. I find it jumps to another
> route(2) after disconnect.
>
> I know I should not disturb you too much because of your works and
> your new best example cfg file for us. But can you please help me to
> discover what reason about it.
>
> I think it should be the reason in my TM modules.
>
> I am a Taiwanese and using a poor English.
>
> Best Regard
> Charles
>
> Error Logs lists below:
> ------------------------------------------------------------------------------------------------------
> SER: Failure Route section failure_route(1)
> SER: fork to fwdnoanswer
> SER: No Answer Failure and Jump to route(3)
> SER: Demestic Call Off-Net section route(3)
> SER: Connecting to PSTN.... <=========== Connect to PSTN here!!!!.
> error: mediaproxy/sendMediaproxyCommand(): can't connect to MediaProxy
> PDT:prefix2domain: no prefix found in [1022]
> SER: SIP Call On-Net section route(2)
>
> Subset of ser.cfg ( tm params, route[3] and failure_route[1] ) lists below:
> ------------------------------------------------------------------------------------------------------
> # -- 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")
>
> route[3] {
> log(1, "SER: Demestic Call Off-Net section route(3)\n");
>
> # All Domestic Calls Go To CISCO 5300
> 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;
> };
> # enable caller id blocking for PSTN calls
> if (isflagset(25)) {
> append_rpid_hf();
> };
> };
> # SIP->PSTN calls get 45 seconds to timeout
> log(1, "SER: Connecting to PSTN.....\n");
> avp_write("i:45", "inv_timeout");
> rewritehost("61.220.190.243");
> 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();
> };
> }
>
> failure_route[1] {
> log(1, "SER: Failure Route section failure_route(1)\n");
>
> # 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")) {
> log(1, "SER: fork to fwdbusy\n");
> avp_delete("s:fwdbusy");
> append_branch();
> resetflag(26);
>
> # test for domestic PSTN gateway
> if (uri=~"^sip:0[0-9]{9}@") {
> # if (avp_check("$fwd_busy_type", "eq/dom/i")) {
> # test for domestic PSTN gateway
> log(1, "SER: Busy Failure and Jump to route(3)\n");
> route(3);
> } else if (uri=~"^sip:002[1-9][0-9]*@") {
> # } else if (avp_check("$fwd_busy_type", "eq/int/i")) {
> # test for international PSTN gateway
> log(1, "SER: Busy Failure and Jump to route(6)\n");
> route(6);
> } else {
> # default to sip call
> log(1, "SER: Busy Failure and Jump to route(2)\n");
> 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")) {
> log(1, "SER: fork to fwdnoanswer\n");
> avp_delete("s:fwdnoanswer");
> append_branch();
> resetflag(27);
>
> if (uri=~"^sip:0[0-9]{9}@") {
> # if (avp_check("$fwd_no_answer_type", "eq/dom/i")) {
> # test for domestic PSTN gateway
> log(1, "SER: No Answer Failure and Jump to route(3)\n");
> route(3);
> } else if (uri=~"^sip:002[1-9][0-9]*@") {
> # } else if (avp_check("$fwd_no_answer_type", "eq/int/i")) {
> # test for international PSTN gateway
> log(1, "SER: No Answer Failure and Jump to route(6)\n");
> route(6);
> } else {
> # default to sip call
> log(1, "SER: No Answer Failure and Jump to route(2)\n");
> route(2);
> };
> break;
> };
> } else if (isflagset(31) && avp_pushto("$ruri", "$voicemail")) {
> avp_delete("$voicemail");
> log(1, "SER: No Answer Failure and Jump to route(4)\n");
> route(4);
> break;
> };
> }
>
> On Sun, 20 Feb 2005 00:29:50 -0500, Java Rockx <javarockx(a)gmail.com> wrote:
> > Charles,
> >
> > One problem I see is that the value for the forwarded number is not a
> > valid SIP URI.
> >
> > The values stored in the usr_preferences table must look like this:
> >
> > sip:4075551212@mycompany.com
> >
> > As for you question about the "-", "dom", and "int" avp lines, these
> > are not database related. Instead this is a bit of a hack. I use these
> > three values as AVPs which get referenced in other route blocks. The
> > reason I call this a hack is that it would be better to move this kind
> > of validation to a custom C module.
> >
> > Anyhow, the whole point of that route block is to validate the
> > destination number that the user is trying to have forwarded to. For
> > example, the user should not be allowed to forward to 911 or an
> > international number (unless they are entitled to international
> > dialing).
> >
> > One more note: That ser.cfg that you're referencing is very unwieldy.
> > I've since restructured the entire thing for simplicity reasons. This
> > ser.cfg follows the very simple concepts shown in the default ser.cfg
> > example.
> >
> > I feel it is much better to follow a per-method-type approach. For
> > example in the main route block I now have:
> >
> > if (method=="BYE") {
> > route(1); # BYE message handler
> > } else if (method=="ACK") {
> > route(2); # ACK message handler
> > } else ....
> >
> > I'm hoping to post my entire reworked ser.cfg to the mailing list this
> > week and seek comments and feedback on establishing "best coding
> > practices" for ser because as far as I know this hasn't been
> > addressed. My hopes are that the next ser.cfg I post, would at a
> > minimum, get the ball rolling on defining how best to code ser.cfg
> > logic.
> >
> > Regards,
> > Paul
>
I just got around to building a v0.9.0 system. When I use serctl to
stop the proxy a copious amout of log data appears in the syslog file.
I seem to rememer a parameter that can be added at build time to
greatly reduce the log output. Can someone either remind me of
this parameter or tell me what else can be done to reduce the output?
Thanks,Steve
Hi,
may be a trivial problem. I use ser 0.8.14 and cisco as5350. When ser sends
404 to an INVITE came from ISDN pri, cisco doesn't close ISDN path
immediately (after some timeout does)
Feb 20 21:37:35.716: //8/1677FFB88005/SIP/Call/sipSPICallInfo:
Disconnect Cause (CC) : 1
Disconnect Cause (SIP) : 404
How can I enable/forward cause code to PSTN side ?
thanks,
imedve
rtpproxy + nathelper + radius + mediaproxy + voicemail + asterisk +
ser0.8.14 and it is running fine.
ser-0.8.14-0.i386.rpm
ser-0.8.14-0.src.rpm
ser-debuginfo-0.8.14-0.i386.rpm
ser-jabber-0.8.14-0.i386.rpm
ser-mysql-0.8.14-0.i386.rpm
ser-radius-0.8.14-0.i386.rpm
/////////////////////////////////////////////
http://www.voice.dyndns.tv
sip:8100 at voice.dyndns.tv
Saitama Japan Sip EXpress router Support Team
mobile : 070-5548-9391
/////////////////////////////////////////////
Paul,
I whole heartedly agree with comments on structure of typical of ser.cfg
files and the difficulty of getting ones brain around the whole picture.
Your best "practices is" suggestion a great idea.
Is it possible to provide a version of your restructured file such that
customisation could be handled by a macro replacement process such as M4
perhaps even with "ifdefs"?
e.g.
ip addresse for sip, asterisk, ...
domain names for myself ...
asterisk extension numbers for voicemail...
proxy / not proxy...
etc
I do not want to appear negative to all the good people out there who are
working their balls off for the good cause but another idea which would help
people to use ser is for a combined document with a reference of all
functions together in one place?
i.e. not organised in separate by modules, as at present
and a reference description rather than an explanatory document as per the
Admin's Guide (and which does not cover all function I believe).
This would be so useful because as one came across a new function,
it would be possible to find the answer by ones self.
It might cut down the repetitive nature of some requests for help which I
believe stem from the real difficulty in knowing where to find the answer
ones self.
Cheers
Chris
-----Original Message-----
From: serusers-bounces(a)iptel.org [mailto:serusers-bounces@lists.iptel.org] On
Behalf Of Java Rockx
Sent: 20 February 2005 00:23
To: serusers(a)lists.iptel.org
Subject: Re: [Serusers] Warning: sl_send_reply: I won't send a reply for
ACK!!
Guys,
Since I just made very substantial changes to my ser.cfg I'd like to
test my full feature set before sharing it. I'm going to put a new
post on serusers_at_iptel.org in a day or two seeking comments on
establishing a "best practices" document for ser.cfg and in that post
I'll attach my ser.cfg which perhaps could be used as a basis for
beginning a dialog on this subject.
At a minimum I'd like to see a more complete and complex ser.cfg for
which other can base their work.
The problem with this is that it would require take some feedback from
the ser core team to ensure the "best practices" are correct and
properly reflect the designers intent. The reason I think this could
be a problem is that Andrei, Jiri, Jan, and company are more than busy
already.
The bottom line is that as great as ser is, coding practices are
mostly a mystry to developers seeking to install ser and when you get
in to complex functionality such as call forwarding confusion stumps
many users.
Regards,
Paul
On Sat, 19 Feb 2005 19:59:31 +0100 (CET), Medve Istvan <imedve(a)ew.hu> wrote:
> > Perhaps I'll post my entire ser.cfg this week for anyone that wants it.
>
> Please send it to me.
>
> Thanks,
> imedve
>
>
_______________________________________________
Serusers mailing list
serusers(a)lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers
--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 265.8.8 - Release Date: 14/02/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.1.0 - Release Date: 18/02/2005
--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.1.0 - Release Date: 18/02/2005