[SR-Users] wt_timer, delayed replies and sendto error

Daniel-Constantin Mierla miconda at gmail.com
Tue Sep 20 10:15:21 CEST 2011


Hello,

On 9/16/11 2:46 PM, Andreas Granig wrote:
> Hi,
>
> On 09/16/2011 09:10 AM, Daniel-Constantin Mierla wrote:
>>> It's actually an educated guess that this could be related to wt_timer,
>>> but I don't know what else it could be.
>>>
>> what happens is that when transaction is active and tm is handling the
>> replies, they are forwarded using the same socket where the request was
>> received (iirc).
>>
>> However, the transaction is gone so the reply is sent stateless and the
>> default rule of stateless forwarding for selecting the local socket is
>> to use the same socket where the message was received (in this case is
>> the reply is received on loopback interface). Try either to use mhomed
>> parameter or force the right send socket by hand (force_send_socket(...)
>> or $fs=...) when there is no active transaction for replies (use
>> t_check_trans()).
> Actually I do a force_send_socket in my onreply_routes, but the
> onreply_routes to be used are chosen during request handling. I don't
> have a default reply route though, which I guess must be used in this
> case, because information about which onreply_route to use is lost after
> wt_timer, right?

yes, a default onreply route has to be used.

>
> Roughly outlined, this is what I have now. I don't use mhomed, but
> rather set the sockets manually:
>
> route[REQUEST]
> {
>    if(request from outside) {
>      force_send_socket(localhost);
>      t_on_reply("REPLY_FROM_INSIDE");
>    }
>    else { # request from inside
>      force_send_socket(public interface);
>      t_on_reply("REPLY_FROM_OUTSIDE");
>    }
>    # relay to proper destination
> }
> onreply_route[REPLY_FROM_INSIDE]
> {
>    force_send_socket(public interface);
> }
> onreply_route[REPLY_FROM_OUTSIDE]
> {
>    force_send_socket(localhost);
> }
>
> And this is what I'd need to add if I got you right:
>
> # the default reply route used when transaction is already gone
> onreply_route
> {
>    if(reply from inside)
>      force_send_socket(localhost);
>    else
>      force_send_socket(public interface);
> }
>
> Does it look like a plan?
You should check first with t_check_trans() to see if transaction is 
gone. the default onreply route is called for all replies, no matter the 
transaction exists or not. Reading the logic, I find it opposite, if the 
reply comes from inside, you want to send it outside, via public 
interface, or?

Cheers,
Daniel

-- 
Daniel-Constantin Mierla -- http://www.asipto.com
Kamailio Advanced Training, Oct 10-13, Berlin: http://asipto.com/u/kat
http://linkedin.com/in/miconda -- http://twitter.com/miconda




More information about the sr-users mailing list