Blair,
Thanks for an idea, but it seems like i have some syntax errors, ser fails
to start. I appreciate your help.
[root@ll-4355cceb root]# /etc/init.d/ser restart
Stopping ser:
[FAILED]
Starting ser: ERROR: bad config file (2 errors) [FAILED]
Following is my config after adding your codes.
#############################################
# $Id: features-callfwd.cfg 9 2005-08-19 15:30:55Z /CN=Greger V.
Teigre/emailAddress=greger(a)onsip.org $
debug=3
fork=yes
log_stderror=no
listen=sip.mydomain.com # INSERT YOUR IP ADDRESS HERE
port=5060
children=4
dns=no
rev_dns=no
fifo="/tmp/ser_fifo"
fifo_db_url="mysql://ser:heslo@localhost/ser"
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/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/uri.so"
loadmodule "/usr/local/lib/ser/modules/uri_db.so"
loadmodule "/usr/local/lib/ser/modules/mediaproxy.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
loadmodule "/usr/local/lib/ser/modules/avpops.so"
loadmodule "/usr/local/lib/ser/modules/domain.so"
loadmodule "/usr/local/lib/ser/modules/permissions.so"
modparam("auth_db|permissions|uri_db|usrloc",
"db_url", "mysql://ser:heslo@localhost/ser")
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)
modparam("registrar", "nat_flag", 6)
modparam("rr", "enable_full_lr", 1)
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://ser:heslo@localhost/ser")
modparam("avpops", "avp_table", "usr_preferences")
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;
};
# -----------------------------------------------------------------
# Record Route Section
# -----------------------------------------------------------------
if (method=="INVITE" && client_nat_test("3")) {
# INSERT YOUR IP ADDRESS HERE
record_route_preset("sip.mydomain.com: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()) {
if (has_totag() && (method=="INVITE" || method=="ACK")) {
if (client_nat_test("3")||search("^Route:.*;nat=yes")){
setflag(6);
use_media_proxy();
};
};
route(1);
break;
};
# -----------------------------------------------------------------
# Call Type Processing Section
# -----------------------------------------------------------------
if (!is_uri_host_local()) {
if (is_from_local() || allow_trusted()) {
route(4);
route(1);
} else {
sl_send_reply("403", "Forbidden");
};
break;
};
if (method=="CANCEL") {
route(1);
break;
} else if (method=="INVITE") {
route(3);
break;
} else if (method=="REGISTER") {
route(2);
break;
};
lookup("aliases");
if (uri!=myself) {
route(4);
route(1);
break;
};
if (!lookup("location")) {
sl_send_reply("404", "User Not Found");
break;
};
route(1);
}
route[1] {
# -----------------------------------------------------------------
# Default Message Handler
# -----------------------------------------------------------------
t_on_reply("1");
if (!t_relay()) {
if (method=="INVITE" || method=="ACK") {
end_media_session();
};
sl_reply_error();
};
}
route[2] {
# -----------------------------------------------------------------
# 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");
break;
};
if (!check_to()) {
sl_send_reply("401", "Unauthorized");
break;
};
consume_credentials();
if (!save("location")) {
sl_reply_error();
};
}
route[3] {
# -----------------------------------------------------------------
# INVITE Message Handler
# -----------------------------------------------------------------
if (!allow_trusted()) {
if (!proxy_authorize("","subscriber")) {
proxy_challenge("","0");
break;
} else if (!check_from()) {
sl_send_reply("403", "Use From=ID");
break;
};
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");
if (uri!=myself) {
route(4);
route(1);
break;
};
if (uri=~"^sip:011[0-9]*@") {
route(4);
route(5);
break;
};
if (avp_db_load("$ruri/username", "s:callfwd")) {
setflag(22);
avp_pushto("$ruri", "s:callfwd");
route(6);
break;
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
prefix("9");
route(4);
route(5);
break;
};
sl_send_reply("404", "User Not Found"); #Here we can send to VM if
user NOT
Online.
break;
};
if (avp_db_load("$ruri/username", "s:fwdbusy")) {
if (!avp_check("s:fwdbusy", "eq/$ruri/i")) {
setflag(26);
};
};
if (avp_db_load("$ruri/username", "s:fwdnoanswer")) {
if (!avp_check("s:fwdnoanswer", "eq/$ruri/i")) {
setflag(27);
};
};
t_on_failure("1");
route(4);
route(1);
}
route[4] {
# -----------------------------------------------------------------
# NAT Traversal Section
# -----------------------------------------------------------------
if (isflagset(6) || isflagset(7)) {
if (!isflagset(8)) {
setflag(8);
use_media_proxy();
};
};
}
route[5] {
# -----------------------------------------------------------------
# PSTN Handler
# -----------------------------------------------------------------
rewritehost("asterisk.mydomain.com"); # INSERT YOUR PSTN GATEWAY IP ADDRESS
avp_write("i:45", "inv_timeout");
# t_on_failure("1");
#------------------------------------Your Code Start
t_on_failure("3");
t_relay();
#------------------------------------Your Code End
route(4);
route(1);
}
route[6] {
# ------------------------------------------------------------------------
# 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 (uri!=myself) {
if (!isflagset(22)) {
append_branch();
};
route(4);
route(1);
break;
};
if (uri=~"^sip:011[0-9]*@") {
route(4);
route(1);
break;
};
if (!lookup("location")) {
if (uri=~"^sip:[0-9]{10}@") {
route(4);
route(1);
break;
};
sl_send_reply("404", "User Not Found");
};
route(4);
route(1);
}
onreply_route[1] {
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] {
#
# if (t_check_status("487")) {
# break;
# };
#
# if (isflagset(26) && t_check_status("486")) {
# if (avp_pushto("$ruri", "s:fwdbusy")) {
# avp_delete("s:fwdbusy");
# resetflag(26);
# route(6);
# break;
# };
# };
#
# if (isflagset(27) && t_check_status("408")) {
# if (avp_pushto("$ruri", "s:fwdnoanswer")) {
# avp_delete("s:fwdnoanswer");
# resetflag(27);
# route(6);
# break;
# };
# };
#
# end_media_session();
#}
#------------------------------------Your Code Start
failure_route[3] {
if (t_check_status("404")) {
prefix("u");
rewritehostport("asterisk.mydomain.com:5060");
append_branch();
t_relay_to_udp("asterisk.mydomain.com", "5060");
break;
} else if (t_check_status("408")) {
prefix("b");
rewritehostport("asterisk.mydomain.com:5060");
append_branch();
t_relay_to_udp("asterisk.mydomain.com", "5060");
break;
}
#------------------------------------Your Code End
#############################################
On 2/16/06, Steve Blair <blairs(a)isc.upenn.edu> wrote:
Something like this will do the trick:
...
t_on_failure("3");
t_relay();
...
failure_route[3] {
if (t_check_status("487")) {
prefix("u");
rewritehostport("<asterisk hostname>:<sip port>");
append_branch();
t_relay_to_udp("<asterisk hostname>", "<sip
port>");
break;
} else if (t_check_status("486")) {
prefix("b");
rewritehostport("<asterisk hostname>:<sip port>");
append_branch();
t_relay_to_udp("<asterisk hostname>", "<sip
port>");
break;
}
The prefix "u" and prefix "b" commands allow you to indicate to
Asterisk
whether to play the unavailable or busy greeting by prefixing the r-uri
username with the appropriate letter. You'll need to check the actual
status codes however because these are just examples.
-Steve
Ali Zaidi wrote:
Z,
I will take a look on those config. I was just looking for a quick
fix, i know lot of ppl using this pre-config from onsip and also want
similar that i'm trying to achieve.
I will try that in this weekend.
Ali...
On 2/16/06, *zhangshuai* <zhangshuai(a)goldentek.biz
<mailto:zhangshuai@goldentek.biz>> wrote:
Dear Ali Zaidi,
I'm testing the forwarding now, too. I think you could be more
aware after read SER-GettingStarted doc at
ONsip.org. And you may
want to try the onr.cfg, or redirect.cfg, which are much more
concise than features-callfwd.5.0.cfg, in the directory of
examples of SER src package, first.
Hi,
I'm having some problem forwarding to Asterisk VM. What i want is
when
ever
486, 404, 408 or 480 error triger then ser should
forward INVITE to
Asterisk.
Some one please tell me where and what i write in my
features-callfwd.5.0.cfg so it will forward to my asterisk box.
Thanks,
Ali... :lol:
_______________________________________________
Serusers mailing list
serusers(a)lists.iptel.org <mailto:serusers@lists.iptel.org>
http://lists.iptel.org/mailman/listinfo/serusers
_______________________________________________
Serusers mailing list
serusers(a)lists.iptel.org <mailto:serusers@lists.iptel.org>
http://lists.iptel.org/mailman/listinfo/serusers
------------------------------------------------------------------------
_______________________________________________
Serusers mailing list
serusers(a)lists.iptel.org
http://lists.iptel.org/mailman/listinfo/serusers