[Serusers] Call forward on no answer in 0.10

Maciej Żwirski mzwirek at poczta.fm
Mon Nov 27 10:49:47 CET 2006


Hi,

I've been trying to implement call forward on no answer with the new ser 
0.10. Now I've the following problem. The call times out as it should, 
enters the on_failure block, rewrites the address with the one from 
database and then goes to the standard route blocks. The problem is the 
last sip message being sent (although t_relay doesn't fail) is the 487 
request terminated... Can somebody help me with this? Below are the 
parts of my ser.cfg involved. Thanks.

Maciek

route["forward"] {
       t_on_reply("nat.mangle");

       xlog("L_INFO","Ruri: %ru\n");

       if(!lookup_user("Request-URI")) {
               xlog("L_INFO","PSTN\n");

               route("PSTN");
               return;
       }
       xlog("L_INFO","No PSTN\n");

       # User found, load profile
       load_attrs("$tu","t.uid");

       if(!lookup_contacts("location")) {
               sl_reply("483","Temporarily Unavailable");
               drop;
       }
       if(isflagset("nat.uas")) {
               $t.nat = true;
       }
       else $t.nat = false;

       route("send");
}

failure_route["call_forward"] {
       if (t_check_status("487")) {
               drop;
       }

       if ($t.call_forward_type) {
               append_branch();
               if (($call_forward_type == "noanswer") && 
t_check_status("408")) {
                       xlog("L_INFO","Failure\n");
                       avp_pushto("$ruri","s:call_forward_number_na");
                       route("forward");
                       return;
               }
               if (($call_forward_type == "onbusy") && 
t_check_status("486")) {
                       avp_pushto("$ruri","s:call_forward_number_bu");
                       route("send");
                       return;
               }
       }
#       end_media_session();
}

route["send"] {
       route("nat.mangle");
       t_on_reply("nat.mangle");

       if ($record_route) {
               record_route();
       }
       xlog("L_INFO","Relaying\n");
       if (!t_relay()) {
               sl_reply_error();
               drop;
       }
}

route["nat.detect"] {
       if (src_ip == 127.0.0.1) return;

       if (is_present_hf("^Record-Route:")) return;

       if (nat_uac_test("3")) {
               force_rport();
               setflag("nat.uac");
               $f.nat = true;
       }
       else $f.nat = false;
       return;
}

onreply_route["nat.mangle"] {
       if ($t.nat || $tr.nat) {
               fix_nated_contact();
       }
       if (!$f.nat && (!$t.nat || !$tr.nat)) return;
       if ($con_realm || $tr.con_realm) return;
       if (@cseq.method != "INVITE") return;

       if ((status =~ "(183)|2[0-9][0-9]") && !search("^Content-Length: 
0")) {
               if (!$rtpproxy && !$tr.rtpproxy) {
                       if ($t.nat || $tr.nat) {
                               fix_nated_sdp("8");
                               return;
                       }
                       else return;
               }
               force_rtp_proxy();
       }
       return;
}

route["nat.mangle"] {
       if ($f.nat) {
               if (method == "REGISTER") {
                       fix_nated_register();
               }
               else {
                       fix_nated_contact();
               }
       }
       if (($tr.rtpproxy || $fr.rtpproxy) && (method == "BYE") && 
(method == "CANCEL")) {
               unforce_rtp_proxy();
       }
       else if (method == "INVITE") {
               if (!$f.nat && (!$t.nat || !$tr.nat)) return;

               $record_route = true;

               if ($con_realm || $tr.con_realm) return;
               if ($f.connectivity_realm == $t.connectivity_realm) {
                       $con_realm = true;
                       return;
               }

               if (($f.sym_pass || $fr.comedia) && ($t.nat || $tr.nat) 
&& !$f.nat) {
                       $f.comedia = $f.sym_pass;
                       return;
               }
               if (($t.sym_pass || $tr.comedia) && $f.nat && (!$t.nat || 
!$tr.nat)) {
                       $t.comedia = $t.sym_pass;
                       fix_nated_sdp("8");
                       return;
               }
               if !($tr.rtpproxy || $rtpproxy) {
                       $rtpproxy = true;
               }
               force_rtp_proxy();
       }
       return 1;
}

route["PSTN"] {
       rewritehost("99.99.99.99");
       if (!t_relay()) {
               sl_reply_error();
               drop;
       }
}



----------------------------------------------------------------------
PS. >>> http://link.interia.pl/f19a6




More information about the sr-users mailing list