I am using the sample configuration file called
"features-callfwd.5.0.cfg" with some modification. UA dials a 8
digits number and if it is not in the location table, prefix('9') will
be appended in the number and route to the PSTN gateway. According to
the configuration below, route 6 is responsible for call forward.
With appropriate records in usr_preferences, openser can perform
direct forward and forward on busy. However, in foward on no answer,
one of the party can't hear any voice from the other party. I think
the flow is something like this.
UA1 openser UA5 UA6
------INVITE---->
--------INVITE------------>
...
<-------time out/no answer-
------------------INVITE------------------>
...
<--------------RTP established---------------------------------->
result: UA6 can hear UA1, but UA1 can't get any sound from UA6
Anyone can help if there is any mistable in my configuration file to
fix the above problem. Thanks!
------------start configuration-------------
# $Id: features-callfwd.cfg 15 2005-09-15 17:37:10Z /CN=Greger V.
Teigre/emailAddress=greger(a)onsip.org $
debug=3
fork=yes
log_stderror=no
listen=203.193.16.226 # INSERT YOUR IP ADDRESS HERE
port=5060
children=4
dns=yes
rev_dns=no
fifo="/tmp/openser_fifo"
fifo_db_url="mysql://openser:openserrw@localhost/openser"
#fifo_mode=0666 #fifo permissions can be changed here
log_facility=LOG_LOCAL0
alias=01.ol.com
loadmodule "/usr/local/lib/openser/modules/mysql.so"
loadmodule "/usr/local/lib/openser/modules/sl.so"
loadmodule "/usr/local/lib/openser/modules/tm.so"
loadmodule "/usr/local/lib/openser/modules/rr.so"
loadmodule "/usr/local/lib/openser/modules/maxfwd.so"
loadmodule "/usr/local/lib/openser/modules/usrloc.so"
loadmodule "/usr/local/lib/openser/modules/registrar.so"
loadmodule "/usr/local/lib/openser/modules/auth.so"
loadmodule "/usr/local/lib/openser/modules/auth_db.so"
loadmodule "/usr/local/lib/openser/modules/uri.so"
loadmodule "/usr/local/lib/openser/modules/uri_db.so"
loadmodule "/usr/local/lib/openser/modules/mediaproxy.so"
loadmodule "/usr/local/lib/openser/modules/nathelper.so"
loadmodule "/usr/local/lib/openser/modules/textops.so"
loadmodule "/usr/local/lib/openser/modules/avpops.so"
loadmodule "/usr/local/lib/openser/modules/domain.so"
loadmodule "/usr/local/lib/openser/modules/permissions.so"
loadmodule "/usr/local/lib/openser/modules/acc.so"
loadmodule "/usr/local/lib/openser/modules/xlog.so"
loadmodule "/usr/local/lib/openser/modules/uac.so"
loadmodule "/usr/local/lib/openser/modules/group.so"
modparam("auth_db|permissions|uri_db|usrloc|acc|group",
"db_url", "mysql://openser:openserrw@localhost/openser")
modparam("auth_db", "calculate_ha1", 1)
modparam("auth_db", "password_column", "password")
modparam("nathelper", "rtpproxy_disable", 1)
modparam("nathelper", "natping_interval", 0)
modparam("mediaproxy","natping_interval", 30)
modparam("mediaproxy","mediaproxy_socket",
"/var/run/mediaproxy.sock")
modparam("mediaproxy","sip_asymmetrics","/usr/local/etc/ser/sip-clients")
modparam("mediaproxy","rtp_asymmetrics","/usr/local/etc/ser/rtp-clients")
modparam("usrloc", "db_mode", 2)
#minimize write back window - default is 60 seconds
modparam("usrloc", "timer_interval", 10)
#use deomain information for user
#modparam("usrloc", "use_domain", 1)
modparam("registrar", "nat_flag", 6)
#The maximum expires value of a Contact
modparam("registrar", "max_expires", 120)
#all contacts will be ordered in descending modification time order
modparam("registrar", "desc_time_order", 1)
#modparam("registrar", "use_domain", 1)
modparam("rr", "enable_full_lr", 1)
#Timer which hits if no final reply for an INVITE
modparam("tm", "fr_inv_timer", 27)
modparam("tm", "fr_inv_timer_avp", "inv_timeout")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("avpops", "avp_url",
"mysql://openser:openserrw@localhost/openser")
modparam("avpops", "avp_table", "usr_preferences")
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)
modparam("acc", "db_flag", 1)
modparam("uac", "from_restore_mode", "auto")
route {
xlog("L_INFO","---[$fU-MR]---\n");
# -----------------------------------------------------------------
# Sanity Check Section
# -----------------------------------------------------------------
if (!mf_process_maxfwd_header("10")) {
xlog("L_INFO","---[$fU-main(91)]: 483 Too Many
Hops---\n");
sl_send_reply("483", "Too Many Hops");
return;
};
if (msg:len > max_len) {
xlog("L_INFO","---[$fU-main(97)]: 483 Message
Overflow---\n");
sl_send_reply("513", "Message Overflow");
return;
};
#-----------------------------------------------------------------
# detect the anonymous incoming call and add anonymous to the uri
#-----------------------------------------------------------------
if (!has_totag() &&
(method=="INVITE"||method=="ACK"||method=="CANCEL"||method=="BYE"))
{
route(7);
}
#------------------------------------------------------------------
# Accoutnng Section
#------------------------------------------------------------------
setflag(1);
#t_relay();
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (method=="INVITE" && client_nat_test("3")) {
# INSERT YOUR IP ADDRESS HERE
record_route_preset("203.193.16.226:5060;nat=yes");
} else if (method!="REGISTER") {
record_route();
};
# -----------------------------------------------------------------
# Call Tear Down Section
# -----------------------------------------------------------------
if (method=="BYE" || method=="CANCEL") {
end_media_session();
};
# -----------------------------------------------------------------
# Loose Route Section
# -----------------------------------------------------------------
if (loose_route()) {
xlog("L_INFO","---[$fU-main(137)]:
loose_route()---\n");
if (has_totag() && (method=="INVITE" || method=="ACK")) {
if (client_nat_test("3")||search("^Route:.*;nat=yes")){
setflag(6);
use_media_proxy();
};
};
route(1);
return;
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
#domian module
if (!is_uri_host_local()) {
if (is_from_local() || allow_trusted()) {
route(4);
route(1);
} else {
xlog("L_INFO","---[$fU-main(159)]: 403
Forbidden---\n");
sl_send_reply("403", "Forbidden");
};
return;
};
if (method=="CANCEL") {
route(1);
return;
} else if (method=="INVITE") {
route(3);
return;
} else if (method=="REGISTER") {
route(2);
return;
} else if (method=="ACK") {
route(1);
return;
};
lookup("aliases");
#xlog("L_INFO","SIP line 191: [$fu] to [$tu]\n");
if (uri!=myself) {
route(4);
route(1);
return;
};
if (!lookup("location")) {
xlog("L_INFO","---[$fU-main(188)]: 404 User Not
Found---\n");
sl_send_reply("404", "User Not Found");
return;
};
route(1);
}
route[1] {
xlog("L_INFO","---[$fU-R1]---\n");
# -----------------------------------------------------------------
# Default Message Handler
# -----------------------------------------------------------------
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
#xlog("L_INFO","SIP Request line 220: [$rm] from [$fu] to
[$tu]\n");
}
route[2] {
xlog("L_INFO","---[$fU-R2]---\n");
# -----------------------------------------------------------------
# REGISTER Message Handler
# -----------------------------------------------------------------
sl_send_reply("100", "Trying");
if (!search("^Contact:[ ]*\*") && client_nat_test("7")) {
setflag(6);
fix_nated_register();
force_rport();
};
if (!www_authorize("","subscriber")) {
www_challenge("","0");
return;
};
if (!check_to()) {
xlog("L_INFO","---[$fU-route2(237)]: 401
Unauthorized---\n");
sl_send_reply("401", "Unauthorized");
return;
};
#------------check if the account is activated ----------
if (!is_user_in("From", "active")) {
xlog("L_INFO","---[$fU-route2(244)]: 402 Payment
Required---\n");
sl_send_reply("402", "Payment Required");
#append_hf("P-hint: PAYMANT REQUIRED\r\n");
return;
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
xlog("L_INFO","---[$fU-R3]---\n");
# -----------------------------------------------------------------
# INVITE Message Handler
# -----------------------------------------------------------------
#if (!allow_trusted()) {
#if (!proxy_authorize("","subscriber")) {
#proxy_challenge("","0");
#return;
#} else if (!check_from()) {
#sl_send_reply("403", "Use From=ID");
#return;
#};
#consume_credentials();
#};
if (client_nat_test("3")) {
setflag(7);
force_rport();
fix_nated_contact();
};
#if (uri=~"^sip:1[0-9]{10}@") {
#strip(1);
#};
lookup("aliases");
#xlog("L_INFO","SIP line 292: [$fu] to [$tu]\n");
if (uri!=myself) {
route(4);
route(1);
return;
};
#if (uri=~"^sip:011[0-9]*@") {
#route(4);
#route(5);
#return;
#};
if (avp_db_load("$ruri/username", "s:callfwd")) {
xlog("L_INFO","---[$fU-route3(305)]: destination uri:
[$ru]---\n");
setflag(22);
avp_pushto("$ruri", "s:callfwd");
xlog("L_INFO","---[$fU-route3(308)]: destination uri:
[$ru]---\n");
route(6);
return;
};
if (!lookup("location")) {
xlog("L_INFO","---[$fU]-(route3:315) destination uri:
[$du]---\n");
if (uri=~"^sip:[0-9]*@") {
xlog("L_INFO","---[$fU-route3(317)]:
sip:(0-9*@)---\n");
prefix("9");
route(4);
route(5);
return;
};
xlog("L_INFO","---[$fU-route3(324)]: 404 User Not
Found---\n");
sl_send_reply("404", "User Not Found");
return;
};
if (avp_db_load("$ruri/username", "s:fwdbusy")) {
if (!avp_check("s:fwdbusy", "eq/$ruri/i")) {
xlog("L_INFO","---[$fU-route3(331)]:
setflag(26)---\n");
setflag(26);
};
};
if (avp_db_load("$ruri/username", "s:fwdnoanswer")) {
if (!avp_check("s:fwdnoanswer", "eq/$ruri/i")) {
xlog("L_INFO","---[$fU-route3(338)]:
setflag(27)---\n");
setflag(27);
};
};
t_on_failure("1");
route(4);
route(1);
}
route[4] {
xlog("L_INFO","---[$fU-R4]---\n");
# -----------------------------------------------------------------
# NAT Traversal Section
# -----------------------------------------------------------------
if (isflagset(6) || isflagset(7)) {
xlog("L_INFO","---[$fU-route4(357)]: $ru---\n");
if (!isflagset(8)) {
xlog("L_INFO","---[$fU-route4(359)]: $ru---\n");
setflag(8);
use_media_proxy();
};
};
}
route[5] {
xlog("L_INFO","---[$fU-R5]---\n");
# -----------------------------------------------------------------
# PSTN Handler
# -----------------------------------------------------------------
rewritehost("203.193.16.242"); # INSERT YOUR PSTN GATEWAY IP ADDRESS
avp_write("i:45", "inv_timeout");
t_on_failure("1");
route(4);
route(1);
}
route[6] {
xlog("L_INFO","---[$fU-R6]---\n");
# ------------------------------------------------------------------------
# Call Forwarding Reply Route Handler
#
# This must be done as a route block because sl_send_reply() cannot be
# called from the failure_route block
# ------------------------------------------------------------------------
#if (uri=~"^sip:1[0-9]{10}@") {
#strip(1);
#};
lookup("aliases");
if (!isflagset(22)) {
append_branch();
};
if (uri!=myself) {
xlog("L_INFO","---[$fU-route6(405)]: (uri!=myyself)---\n");
route(4);
route(1);
return;
};
#if (uri=~"^sip:011[0-9]*@") { }
#if (uri=~"^sip:[0-9]*@") {
#xlog("L_INFO","---[$fU-route6(415)]: (app
prefix(9))---\n");
#prefix("9");
#route(4);
#route(5);
#return;
#};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]*@") {
xlog("L_INFO","---[$fU-route6(425)]: (sip:(0-9*@)---\n");
route(4);
route(1);
return;
};
xlog("L_INFO","---[$fU-route6(432)]: 404 User Not
Found---\n");
sl_send_reply("404", "User Not Found");
};
route(4);
route(1);
}
route[7] {
xlog("L_INFO","---[$fU-R7]---\n");
#if
(method=="INVITE"||method=="ACK"||method=="CANCEL"||method=="BYE")
{
#if (is_user_in("from","")) {
#xlog("L_INFO","SIP is_user_in=true\n");
#uac_replace_from("anonymous","sip:anonymous@s01.ol.com");
#}
#}
if (avp_db_load("$from/username","s:alias")) {
xlog("L_INFO","---[$fU-route7(450)]: have alias from
aliases- [$avp(s:alias)]---\n");
#uac_replace_from("$avp(s:alias)","sip:$avp(s:alias)@$si");
#uac_replace_from("$avp(s:alias) " ,"");
} else {
xlog("L_INFO","---[$fU-route7(454)]: no alias from
aliases---\n");
};
}
onreply_route[1] {
xlog("L_INFO","---[$fU-OR1]---\n");
if ((isflagset(6) || isflagset(7)) &&
(status=~"(180)|(183)|2[0-9][0-9]")) {
if (!search("^Content-Length:[ ]*0")) {
use_media_proxy();
};
};
if (client_nat_test("1")) {
fix_nated_contact();
};
}
failure_route[1] {
xlog("L_INFO","---[$fU-FR1]---\n");
if (t_check_status("487")) {
return;
};
if (isflagset(26) && t_check_status("486")) {
if (avp_pushto("$ruri", "s:fwdbusy")) {
xlog("L_INFO","---[$fU-failure_route1(505)]:
fwdbusy---\n");
avp_delete("s:fwdbusy");
resetflag(26);
route(6);
return;
};
};
if (isflagset(27) && t_check_status("408")) {
if (avp_pushto("$ruri", "s:fwdnoanswer")) {
xlog("L_INFO","---[$fU-failure_route1(515)]:
fwdnoanswer---\n");
avp_delete("s:fwdnoanswer");
resetflag(27);
route(6);
return;
};
};
end_media_session();
}
-----------end of configuration----------------