[OpenSIPS-Users] Call Forward
    Juri Nysschen 
    juri at greydotelecom.com
       
    Tue Mar  1 18:28:32 CET 2011
    
    
  
Hi All,
 
I am trying to call forward when the destination agent is not
registered/available on the proxy.
 
The relevant routes are below. 
 
On a 486 BUSY it works perfectly !
 
At the top of my route block I have:
      if (!mf_process_maxfwd_header("5")) {
            xlog("L_INFO","LOOP [$fd/$fu/$rd/$ru/$si/]\n");
            sl_send_reply("483","Unavailable");
            exit;
      }
 
so if the UA is not registered to the proxy and it cannot find it, 483 is
returned on the INVITE.
 
on 483 if I use the same code as on 486:
 
            revert_uri();
            prefix("171");
            rewritehostport("X.X.X.X:5060");
            t_relay();
 
It seems to endlessly loop, eventually giving header errors.
 
In both cases the INVITE is called using:
 
do_routing("1");
lookup("location");
route(1);
exit;
 
What am I missing? Surely it should act the same in both cases.
 
 
route[1] {
            xlog("L_INFO","Route1 [$fd/$fu/$rd/$ru/$si/]\n");
 
            if (is_method("INVITE")) {
                  t_on_branch("1");
                  t_on_failure("1");
                  xlog("L_INFO","Route1 INVITE [$fd/$fu/$rd/$ru/$si/]\n");
                  if(has_body("application/sdp")){
                        xlog("L_INFO","Route1 INVITE has SDP
[$fd/$fu/$rd/$ru/$si/]\n");
                        if (rtpproxy_offer()){
                              xlog("L_INFO","Route1 INVITE Proxy Offered
[$fd/$fu/$rd/$ru/$si/]\n");
                              t_on_reply("1");
                        }
                        else {
                              t_on_reply("3");
                        };    
                  } else {
                        xlog("L_INFO","Route1 INVITE No SDP
[$fd/$fu/$rd/$ru/$si/]\n");
                        t_on_reply("2");
                  }
            }
            
            if (is_method("ACK") && has_body("application/sdp")){
                  xlog("L_INFO","Route1 INVITE ACK with SDP Answer Proxy
[$fd/$fu/$rd/$ru/$si/]\n");
                  rtpproxy_answer();
            }     
            
            if (is_method("BYE")){
                  xlog("L_INFO","Route1 BYE [$fd/$fu/$rd/$ru/$si/]\n");
            }     
            
        if (!t_relay()) {
                sl_reply_error();
        };
        
}
 
 
branch_route[1] 
{
      xlog("L_INFO","Branch Route1  [$fd/$fu/$rd/$ru/$si/]\n");
      setflag(3); # start db accounting
}
 
failure_route[1] 
{
    xlog("L_INFO","Failure Route1  [$fd/$fu/$rd/$ru/$si/]\n");
    if (t_was_cancelled()) {
            xlog("L_INFO","Failed on Cancel [$fd/$fu/$rd/$ru/$si/]\n");
            exit;
    }
    
    if (t_check_status("6[0-9]")) {
            xlog("L_INFO","Global Failure on Congestion
[$fd/$fu/$rd/$ru/$si/]\n");
            exit;
    }
    
    if (t_check_status("486")){ # Divert on BUSY
            xlog("L_INFO","Call Forward on BUSY [$fd/$fu/$rd/$ru/$si/]\n");
            revert_uri();
            prefix("171");
            rewritehostport("X.X.X.X:5060");
            t_relay();
            exit; 
      };
   
    if (t_check_status("483")){ # Divert on UNAVAILABLE
            xlog("L_INFO","Call Forward on UNAVAILABLE not available
[$fd/$fu/$rd/$ru/$si/]\n");
            exit;
      };
 
}
 
 
Regards
 <http://www.greydotelecom.net/bcard/jnysschen.htm> Juri Nysschen
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20110301/5656089e/attachment-0001.htm>
    
    
More information about the Users
mailing list