[OpenSIPS-Users] Can not CANCEL the call

Bogdan-Andrei Iancu bogdan at voice-system.ro
Tue Aug 31 19:53:50 CEST 2010


Hi,

if t_check_trans() fails, it is because the CANCEL does not match any in 
progress INVITE...Please post the network trace showing the INVITE and 
the CANCEL sent to opensips.

Regards,
Bogdan

HUYNH Hoang Huy wrote:
> Hello friends,
> I have problem with CANCEL request because of t_check_trans() is 
> always failed.
> Here is my config file
>  
>
>     # --- main routing logic
>     ########################################################################
>     # Request route generic
>     ########################################################################
>     route[0]
>     {
>
>      #Flood detection
>      if (!pike_check_req()) {
>       #xlog("L_INFO", ">>>>>> Flood detection \n - M=$rm RURI=$ru
>     F=$fu T=$tu IP=$si ID=$ci (R00-02)\n");
>       drop();
>       #sl_send_reply("403", "Forbidden");
>       exit;
>      }
>      
>      xlog("L_INFO", "OPENSIPS: New request; M=$rm ; F=$fu ; T=$tu ;
>     IP=$si ; ID=$ci\n");
>      if (!mf_process_maxfwd_header("10"))
>      {
>       sl_send_reply("483","Too Many Hops");
>       exit;
>      };
>      
>      if (msg:len >=  2048 )
>      {
>       
>       sl_send_reply("513", "Message too big");
>       exit;
>      };
>      
>
>      
>      if(is_method("SUBSCRIBE") || is_method("NOTIFY") ||
>     is_method("OPTIONS"))
>         {
>             drop();
>         };
>      
>      #NAT detection
>      route(7);
>      
>      if (!is_method("REGISTER"))
>      {
>       record_route();
>      };
>      
>      if(is_method("CANCEL") || is_method("BYE"))
>      {
>       
>       unforce_rtp_proxy();
>       #end_media_session();
>      
>      }
>       
>      if(loose_route())
>      {
>       if(!has_totag())
>       {
>        
>        sl_send_reply("403", "Initial Loose-Routing Rejected");
>        exit;
>       }
>         
>      }
>      
>      if (is_method("REGISTER"))
>      {
>        
>       route(2);
>      }
>      
>      if(is_method("INVITE"))
>      {
>       
>       route(3);
>      }
>      
>      if(is_method("CANCEL") || is_method("ACK"))
>      {
>       route(6);
>      }
>      
>      append_hf("P-hint: usrloc applied\r\n");
>      route(1);
>     }
>     ########################################################################
>     # Request route generic
>     ########################################################################
>      
>     route[1]
>     {
>      
>      if (subst_uri('/(sip:.*);nat=yes/\1/'))
>      {
>       setbflag(6);
>      }; 
>      if(isbflagset(6))
>      {
>       
>       t_on_reply("1");
>       t_on_failure("2");
>      
>      }
>      
>      if (!t_relay("0x05"))
>      {
>       if ((is_method("INVITE") || is_method("BYE")) && isbflagset(6))
>       {
>            unforce_rtp_proxy();
>            #end_media_session();
>            
>       };
>      
>       sl_reply_error();
>      }
>      exit;
>     }
>      
>
>     ############################################`############################
>     # Request route 'REGISTER'
>     ########################################################################
>     route[2]
>     {
>      sl_send_reply("100", "Trying");
>      
>      if(!aaa_www_authorize("sip.worldfone.com.vn"))
>      {
>       xlog("L_INFO", "aaa_www_authorize failed, challenging M=$rm
>     RURI=$ru F=$fu T=$tu IP=$si ID=$ci .. \n");
>       
>       www_challenge("sip.worldfone.com.vn", "0");
>       exit;
>      }
>      
>      if(!db_check_to())
>      {
>       sl_send_reply("401","Unauthorized");
>          exit;
>        }
>      
>      consume_credentials();
>      
>      if(!save("location"))
>      {
>       sl_reply_error();
>       exit;
>      }
>      
>      exit;
>      
>     }
>      
>     ########################################################################
>     # Request route 'INVITE'
>     ########################################################################
>     route[3]
>     {
>      
>      sl_send_reply("100", "Trying");
>      
>      /* Don't authen if INVITE from these IPs */
>      if(
>     ($si=="210.211.108.102")||($si=="222.255.236.131")||($si=="222.255.236.132")
>     )
>         {
>       route(5);
>       route(1);
>       exit;
>         }
>         else
>         {
>       if(!aaa_proxy_authorize("sip.worldfone.com.vn"))
>       {
>        xlog("L_INFO", "aaa_proxy_authorize ; M=$rm ; F=$fu ; T=$tu ;
>     IP=$si ; ID=$ci\n");
>        proxy_challenge("sip.worldfone.com.vn","0");
>        exit;
>       
>       }
>       
>       if (!db_check_from())
>       {
>        sl_send_reply("403","Forbidden");
>        exit;
>       }
>       consume_credentials();
>       
>       route(4);
>       
>       route(1);
>       exit;
>         };
>     }
>      
>
>     ########################################################################
>     # Request route 'invite-to-external/PC2Phone'
>     ########################################################################
>     route[4]
>     {
>      
>      if(isbflagset(6))
>      {
>        #force_rtp_proxy();
>        fix_nated_sdp("3");
>      #xlog("L_INFO", "*-*-* fix_nated_sdp *-*-*\n");
>      }
>      setbflag(11);
>      
>      rewritehostport("210.211.108.102:5060");
>      
>      append_hf("Service: PC2PHONE\r\n");
>      
>
>     }
>      
>     ########################################################################
>     # Request route 'invite-to-internal'/PC2PC
>     ########################################################################
>     route[5]
>     {
>      if(!lookup("location"))
>      {
>       sl_send_reply("404","User is offline");
>       exit;
>      }
>      else
>      {
>       xlog("L_INFO", "OPENSIPS: PC2PC found user\n");
>       
>       #if(isbflagset(6))
>       #{
>       # force_rtp_proxy();
>       #}
>       append_hf("Service: PC2PC\r\n");
>      }
>     }
>      
>     ########################################################################
>     # Request route 'base-route-local'
>     ########################################################################
>     route[6]
>     {
>      
>      t_on_reply("2");
>      t_on_failure("2");
>      if(t_check_trans())
>      {
>       
>       if(!t_relay())
>       {
>        xlog("L_INFO", "Reply error for CANCEL request - M=$rm RURI=$ru
>     F=$fu T=$tu IP=$si ID=$ci\n");
>        sl_reply_error();
>       }
>      }
>      else
>      {
>       
>       xlog("L_INFO", "Dropping mis-routed request - M=$rm RURI=$ru
>     F=$fu T=$tu IP=$si ID=$ci\n");
>      
>      }
>      exit;
>      
>     }
>      
>
>     ########################################################################
>     # Fix NATed contact
>     ########################################################################
>     route[7]
>     {
>       force_rport();
>      if (nat_uac_test("19"))
>      {
>       if (method=="REGISTER")
>       {
>        fix_nated_register();
>       }
>       else
>       {
>        fix_nated_contact();
>       };
>       setbflag(6);
>      };
>      
>      
>     }
>      
>     ########################################################################
>     # Check for failure cases from AVP
>     ########################################################################
>     route[8]
>     {
>      
>       avp_print();
>       switch($avp(s:h323-credit-time))
>      
>        {
>      
>           case "-100":
>         sl_send_reply("401","UnAuthorised");
>             break;
>      
>           case "-101":
>             sl_send_reply("401","User not found");
>         break;
>         
>           case "-102":
>         sl_send_reply("409","Conflict");
>         break;
>      
>           case "-103":
>         sl_send_reply("402","Payment Required");
>         break;
>      
>       case "-104":
>         sl_send_reply("407","User not active");
>         break;
>      
>       case "-105":
>         sl_send_reply("604","Does not match dial plan");
>         break;
>         
>       case "-107":
>         sl_send_reply("604","Dial plan is diable");
>         break;
>       case "-108":
>         sl_send_reply("484","Address Incomplete");
>         break;
>         
>       default:
>         sl_send_reply("403","UnAuthorised");
>       
>      }
>     }
>      
>     ########################################################################
>     # Failure route
>     ########################################################################
>     failure_route[2]
>     {
>      
>             if(isbflagset(6))
>             {
>                    unforce_rtp_proxy();
>            
>             }
>     }
>      
>     ########################################################################
>     # Reply route generic
>     ########################################################################
>     onreply_route[1]
>     {
>      
>
>      if ((isbflagset(6) || isbflagset(3)) &&
>     status=~"183||(2[0-9][0-9])")
>      {
>       if(!search("^Content-Length:[ ]*0"))
>       {
>      
>        if(isbflagset(11))
>               {
>         fix_nated_sdp("3");
>         #force_rtp_proxy();
>      
>               }
>        else
>        {
>      
>         force_rtp_proxy();
>      
>        }
>           
>       }
>      }
>      search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
>      if (isbflagset(6))
>      {
>      
>       fix_nated_contact();
>      }
>      
>      if (status=~"180||183||(2[0-9][0-9])")
>      {
>       # Add AVP into headers
>       #route(10);
>      }
>      exit;
>     }
>      
>      
>      
>     ########################################################################
>     # Reply route 'base-standard-reply'
>     ########################################################################
>     onreply_route[2]
>     {
>      xlog("L_INFO", "Reply - S=$rs D=$rr F=$fu T=$tu IP=$si ID=$ci
>     (RR1-01)\n");
>      exit;
>      
>     }
>
> I take long time for this but can not find out where is problem.
> Please everyone help me solve where is problem and how to fix it.
>  
> Best regards,
> Thank you,
>
> Huy Huynh (Mr.)
> ------------------------------------------------------------------------
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>   


-- 
Bogdan-Andrei Iancu
OpenSIPS Bootcamp
20 - 24 September 2010, Frankfurt, Germany
www.voice-system.ro




More information about the Users mailing list