Hi there,
I use a t_on_failure("1") in route[1] for a unavailable server to
another sip server, but always get timeout (code=408) when the called
part hangup, no error (code=200) when calling part hangup. Please help!!
here is my ser.cfg and log:
==============================
#
# $Id: ser.cfg,v 1.25.2.1 2005/02/18 14:30:44 andrei Exp $
#
# simple quick-start config script
#
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd)
fork=yes
#log_stderror=yes # (cmd line: -E)
listen=127.0.0.1
/* Uncomment these lines to enter debugging mode
fork=no
log_stderror=yes
*/
check_via=no # (cmd. line: -v)
dns=no # (cmd. line: -r)
rev_dns=no # (cmd. line: -R)
#port=5060
#children=4
fifo="/tmp/ser_fifo"
# ------------------ 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/postgres.so"
loadmodule "/usr/local/lib/ser/modules/avpops.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"
#loadmodule "/usr/local/lib/ser/modules/xlog.so"
loadmodule "/usr/local/lib/ser/modules/acc.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"
# ----------------- setting module-specific parameters ---------------
modparam("acc", "log_missed_flag", 2)
modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1)
modparam("acc", "failed_transactions", 1)
modparam("acc", "log_fmt", "miocfsdrtup")
#modparam("acc", "db_flag", 3)
#modparam("acc", "db_missed_flag", 4)
#modparam("acc", "failed_transactions", 1)
#modparam("acc", "db_url",
"postgres://gatekeeper:mm1ch0t@localhost/ser")
#modparam("acc", "log_extra" ,"ua=hdr/User-Agent")
#modparam("acc", "db_extra" ,"uuid=avp/i:888;
src_ip=avp/i:999")
modparam("avpops", "avp_aliases", "c_uri=i:888; s_ip=i:999"
)
# -- usrloc params --
modparam("usrloc", "db_mode", 0)
# Uncomment this if you want to use SQL database
# for persistent storage and comment the previous line
#modparam("usrloc", "db_mode", 2)
# -- 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)
# — tm params --
# set time for which ser will be waiting for a final response;
# fr_inv_timer sets value for INVITE transactions, fr_timer
# for all others
modparam("tm", "fr_inv_timer", 15 )
modparam("tm", "fr_timer", 10 )
# ------------------------- request routing logic -------------------
# main routing logic
route{
# initial sanity checks -- messages with
# max_forwards==0, or excessively long requests
if (!mf_process_maxfwd_header("10")) {
sl_send_reply("483","Too Many Hops");
break;
};
if (msg:len >= 2048 ) {
sl_send_reply("513", "Message too big");
break;
};
if (method=="INVITE" || method=="BYE" || method=="CANCEL"){
## Accounting for all calls
setflag(1);
# setflag(2);
};
if (method=="INVITE") {
record_route();
}
# write the source IP as avp "s_ip" for accounting purposes
# avp_write( "$src_ip", "$s_ip");
if (loose_route() ) {
log("------- LOOSE ROUTE");
route(1);
break;
};
if (!uri==myself) {
# mark routing logic in request
append_hf("P-hint: outbound\r\n");
log("------- IF ROUTE");
#route(1);
break;
} else {
# write the current RURI as avp "c_uri" for accounting purposes
#avp_write( "$ruri", "$c_uri");
append_hf("P-hint: outbound alias\r\n");
log("------- ELSE ROUTE");
route(1);
break;
};
append_hf("P-hint: usrloc applied\r\n");
log("------- LAST ROUTE");
#route(1);
setflag(4);
break;
}
route[1]
{
if ((src_ip==192.168.0.199)) {
if ((uri=~"^sip:1617.*@127\.0\.0\.1") or
(uri=~"^sip:1508.*@127\.0\.0\.1")) {
log(1, "----------- Forwarding to OUR GW\n");
rewritehost("192.168.0.201");
log("----------- Host rewrited\n");
setflag(1);
# if we do not get a positive reply, continue at reply_route[1]
t_on_failure("1");
}else if ((uri=~"^sip:1.*@127\.0\.0\.1")) {
log("----------- Forwarding to GW\n");
rewritehost("192.168.0.100");
log("----------- Host rewrited\n");
setflag(1);
};
t_relay();
break;
}
}
failure_route[1] {
if (t_check_status("487")) {
break;
};
# forwarding failed -- try again at another destination
if (method=="INVITE" && t_check_status("403|408|500|503")) {
# revert_uri();
log("----------- Next gateway\n");
rewritehost("192.168.0.100");
log("----------- Host rewrited\n");
append_branch();
setflag(1);
t_relay();
}
}
=========================================
log:
Jul 31 15:17:38 localhost /usr/local/sbin/ser[3468]: ACC: transaction
answered: method=INVITE, i-uri=sip:16175552222@127.0.0.1:5060,
o-uri=sip:16175552222@192.168.0.201:5060,
call_id=C3ECE80-200011DB-9498E149-4F3DC2BB(a)199.232.41.199,
from=<sip:192.168.0.199>;tag=318DE490-1872, code=200,
totag=SDa3kv999-78f0001f-0-2058902615, fromtag=318DE490-1872,
to=<sip:16175552222@127.0.0.1>;tag=SDa3kv999-78f0001f-0-2058902615,
uid=n/a, userpart=16175552222
Jul 31 15:17:38 localhost /usr/local/sbin/ser[3463]: ACC: request
acknowledged: method=ACK,
i-uri=sip:127.0.0.1:5060;ftag=318DE490-1872;lr=on,
o-uri=sip:16175552222@192.168.0.100:5060;endpoint=127.2.0.43;transport=udp,
call_id=C3ECE80-200011DB-9498E149-4F3DC2BB(a)192.168.0.199,
from=<sip:192.168.0.199>;tag=318DE490-1872, code=200,
totag=SDa3kv999-78f0001f-0-2058902615, fromtag=318DE490-1872,
to=<sip:16175552222@127.0.0.1>;tag=SDa3kv999-78f0001f-0-2058902615,
uid=n/a, userpart=n/a
Jul 31 15:18:13 localhost /usr/local/sbin/ser[3471]: ACC: transaction
answered: method=BYE, i-uri=sip:127.0.0.1:5060;ftag=318DE490-1872;lr=on,
o-uri=sip:16175552222@192.168.0.100:5060;endpoint=127.2.0.43;transport=udp,
call_id=C3ECE80-200011DB-9498E149-4F3DC2BB(a)192.168.0.199,
from=<sip:192.168.0.199>;tag=318DE490-1872, code=408,
totag=SDa3kv999-78f0001f-0-2058902615, fromtag=318DE490-1872,
to=<sip:16175552222@127.0.0.1>;tag=SDa3kv999-78f0001f-0-2058902615,
uid=n/a, userpart=n/a