[Serusers] Call forwarding(at no answer) doesn't work in failure route.

Yuhai Qin - Snow Line y.qin at snowlinegroup.org
Sun Apr 2 04:54:28 CEST 2006


I have been jailed by this script for almost one week. I refered all archives available(including Onsip's Getting Started) and simply couldn't make the Call Forwarding(at no answer) run properly.

In route[1], I used:

if (isflagset(28)){
  avp_pushto("$ruri", "s:fwdnoanswer");
  append_branch();
  lookup("location");
  xlog("L_INFO", "No answer, relaying after lookup. method <%rm> From <%fu> To <%tu> Contact <%ct> r-uri <%ru>\n");
};

t_relay();

In failure _route[1], I used:

if (isflagset(27) && t_check_status("408")) {
  setflag(28);
  revert_uri();
  route(1);
};

I think this is quite simple and straightforward,right? However, after I did revert_uri, avp_pushto, append_branch and lookup, t_relay never could relay the INVITE message to the new branch(I knew this because I checked with ngrep and found no any INVITE message for the new branch).

Anyone can help? It's urgent! Thank you so much!


Jerry.

P.S., here is my original ser.cfg. Just for your reference:
=============================================================================
debug=3         # debug level (cmd line: -dddddddddd)
fork=no
log_stderror=yes # (cmd line: -E)

listen=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="/tmp/ser_fifo"
fifo_db_url="mysql://ser:heslo@localhost/ser"
alias="sip.xx.com"
alias="xx.xx.xx.xx"
alias="xx.com"

# ------------------ module loading ----------------------------------
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"
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/group.so"
loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/avpops.so"
loadmodule "/usr/local/lib/ser/modules/xlog.so"

# ----------------- setting module-specific parameters ---------------
modparam("rr", "enable_full_lr", 1)

modparam("registrar", "nat_flag", 6)
modparam("nathelper", "natping_interval", 30) # Ping interval 30 s
modparam("nathelper", "ping_nated_only", 1)   # Ping only clients behind NAT

modparam("tm", "fr_timer", 20 )
modparam("tm", "fr_inv_timer", 30 )

modparam("usrloc", "db_mode",   2)
modparam("usrloc", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("uri_db", "db_url", "mysql://ser:heslo@localhost/ser")

modparam("acc", "log_level", 1)
modparam("acc", "log_flag", 1 )
modparam("acc", "db_url","mysql://ser:heslo@localhost/ser")
modparam("acc", "db_flag", 1 )

modparam("avpops", "avp_url", "mysql://ser:heslo@localhost/ser")
modparam("avpops", "avp_table", "usr_preferences")

# -------------------------  request routing logic -------------------
route
{
 if (!mf_process_maxfwd_header("10")) {
  sl_send_reply("483","Too Many Hops");
  break;
 };
 if (msg:len >=  max_len ) {
  sl_send_reply("513", "Message too big");
  break;
 };

 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
 };

 setflag(1); # used for acc.

 if (method=="INVITE")
     log(1, "INVITE message received\n");

 if (method=="ACK")
     log(1, "ACK message received\n");

 if (method=="BYE")
     log(1, "BYE message received\n");

 if (method=="CANCEL")
     log(1, "CANCEL message received\n");

 if (!method=="REGISTER") 
     record_route(); 

 if (loose_route()) {
  route(1);
  break;
 };
 
 if (uri!=myself) {
  route(1);
  break;
 };

 if (method=="REGISTER") {
  save("location");
  break;
 };

 if (method=="INVITE") {
  if (avp_db_load("$ruri/username", "s:fwdnoanswer")) {
   setflag(27);
   log(1, "dbg: FWDBUSY/FWDNOANSWER recorded!\n");
   lookup("location");
  };
 };

 t_on_failure("1");

 route(1);
}

route[1] 
{
 if (isflagset(6)) 
  force_rtp_proxy();

 if (isflagset(28)){
  avp_pushto("$ruri", "s:fwdnoanswer");
  append_branch();
  lookup("location");
  xlog("L_INFO", "No answer, relaying after lookup. method <%rm> From <%fu> To <%tu> Contact <%ct> r-uri <%ru>\n");
 };

 t_relay();
}

failure_route[1] {
 if (t_check_status("487")) {
  break;
 };
 if (isflagset(27) && t_check_status("408")) {
  revert_uri();
  setflag(28);
  route(1);
 };
}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20060401/c2e51451/attachment.htm>


More information about the sr-users mailing list