The problem is on t_forward_nonack in t_fwd.c file,

I forced the code to process the second branch as if it were the first and
t_relay() works as I expected.


        /* on first-time forwarding, use current uri, later only what
           is in additional branches (which may be continuously refilled)
        */
        //if (t->first_branch==0) {
                try_new=1;
                current_uri = *GET_RURI(p_msg);
                branch_ret = add_uac( t, p_msg, &current_uri, &backup_dst, 
                                &p_msg->path_vec, proxy);
                if (branch_ret>=0)
                        added_branches |= 1<<branch_ret;
                else
                        lowest_ret=branch_ret;
        //} else try_new=0;


This is by no means a responsible hack/fix as I don't know how many things I
might be breaking with it but so far works for me.

Let me know If I might be causing a major problem with this.

Thank you

Chevio
 





Chevio wrote:
> 
> Hi All, 
> 
> I  am having a weird problem with t_relay when calling it from route[2] in
> the script below.
> 
> The problem that I am experiencing is that it does not relay the message
> to the modified destination uri host/port. Instead it relays the message
> to the modified uri/host/port from route[1]. 
> 
> I initially thought the problem was with my tncgw_route custom module that
> modifies the msg->new_uri
> but after some testing and debugging I realized that if I modify the
> destination uri host/port with rewritehostport functino on route[2]
> t_relay() is also failing (sending the message to the modified uri in
> route[1]).
> 
> Then I decided to try t_relay("udp:host:port") instead of t_relay() on
> route[2] and it worked fine. So the question is why does t_relay() is not
> picking the msg->new_uri when called from route[2]?.  
> 
> route[1] {
>       setflag(22);
>       # send it out now; use stateful forwarding as it works reliably
>       # even for UDP2TCP
>       
>       if (method=="INVITE"){
>               t_on_failure("1");
>               t_on_reply("1");
> 
>               $var(route_result)=tncgw_route("1");
>               tncgw_cdr();
>               
>               if($var(route_result)==-404){
>                       xlog("Invalid Route send 404 \n");
>                       sl_send_reply("404","Invalid Route");
>                       tncgw_releasecdr("404","SB Invalid Route");  
>                       exit;
>                       
>               }
> 
>               if($var(route_result)==-503){
>                       xlog("Congestion, send 503 \n");
>                       sl_send_reply("503","No route available for 
> destination");
>                       tncgw_releasecdr("503","SB No route available for 
> destination");  
>                       exit;
>                       
>               }
> 
>               if($var(route_result)<0){
>                       xlog("Call not routed\n");
>                       sl_send_reply("503","No route available for 
> destination");
>                       tncgw_releasecdr("$var(route_result)","SB Call not 
> routed");  
>                       exit;
>               }
> 
> 
>               t_relay();
>               exit;   
>       }
> }
> 
> route[2] {
>       setflag(22);
>       # send it out now; use stateful forwarding as it works reliably
>       # even for UDP2TCP
>       t_on_reply("2");
>       $var(route_result)=tncgw_route("2");
>              tncgw_cdr();
> 
>       if($var(route_result)==-404){
>               xlog("Invalid Route send 404 \n");
>               sl_send_reply("404","Invalid Route");
>               tncgw_releasecdr("404","SB Invalid Route");  
>               exit;
>       }
> 
>       if($var(route_result)==-503){
>               xlog("Congestion, send 503 \n");
>               sl_send_reply("503","No route available for destination");
>               tncgw_releasecdr("503","SB No route available for 
> destination");  
>               exit;
>       }
> 
>       if($var(route_result)<0){
>               xlog("Call not routed\n");
>               sl_send_reply("503","SB No route available for destination");
>               tncgw_releasecdr("$var(route_result)","SB Call not routed");  
>               exit;
>       }
> 
>       if (!t_relay()){
>       
>               sl_reply_error();
> 
>       };
> }
> 
> failure_route[1] {
>       setflag(22);
>       if(status=~"3[0-9][0-9]|4[0-9][0-9]|5[0-9][0-9]|6[0-9][0-9]")
>       {
>               /*
>               if first carrier failed the call then try the next in route
>               */
>               append_branch();
>               route(2);
>               exit;
>       }
> }
> 
> 
> onreply_route[1] {
>         setflag(22);
>       if (status=~"3[0-9][0-9]|4[0-9][0-9]|5[0-9][0-9]|6[0-9][0-9]") {
>               # Response from carrier
>               tncgw_releasecdr("$rs","From Carrier");
>       }
> 
> }
> 
> I appreciate any help.
> 
> Thank you.
> 
> Chevio
> 
> 

-- 
View this message in context: 
http://n2.nabble.com/Problem-with-t_relay-after-tp2450413p2457587.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.


_______________________________________________
Users mailing list
[email protected]
http://lists.opensips.org/cgi-bin/mailman/listinfo/users

Reply via email to