[SR-Users] [sr-dev] recursive calls to failure_route strange behavior

Miklos Tirpak miklos at iptel.org
Fri Nov 20 21:15:58 CET 2009


[please keep the list CC-d because others may also be interested in the 
solution or may know the answer better.]

On 11/20/2009 07:06 PM, Andres Moya wrote:
> Can i ask one more question here. It is complicated, i am using 
> uac_replace_from and uac_auth.
> I am using failure route to process authentication if necessary and 
> redirect on next carrier.
> 
> If i authenticated with one provider, then fot let say 415 ( i set only 
> speex in UAC to get it ;) ). Ok SER send request to second provider, i use
> uac_replace_from once again in my LOAD_AUTH route
> then uac_auth again.
> 
> Ok. now i see from ngrep that uac_replace_from did nothing in from field 
> and use user at domain for first provider, authentication failed :(

Which authentication fails? The first or the second one?
The first should work, at least the from header should be rewritten by 
the function.

The second authentication will not work this way (if it requires a 
different from header) because the proxy "remembers" for the header 
changes done before the first t_relay() function call and applies the 
same header modifications also for any other branch added from failure 
route. Hence, the outgoing SIP request to the second provider will 
contain the same from HF as the request to the first provider.

The easiest way is to apply the header modifications in branch route if 
you do not need to reuse them later from failure route. Modifications 
done in branch routes are valid only within that branch.

> 
> I moved uac_replace_from to my failure route to call once again before 
> uac_auth, but got config error as i can't use uac_replace_from in 
> failure_route.

I think you already use this function from failure route because it is 
in a route block that is included from failure route. The only 
difference is that the syntax checker does not recognize the issue. I am 
not familiar with uac_replace_from() but after having a quick look at 
the function I think it is safe to use it from here.

> Ok i will use textops to rewrite, but it is ugly? 

The main difference is that uac_replace_from() restores the original 
 From HF when the response if forwarded. If you use textops module then 
you need to restore the header manually.

> no. Maybe i should 
> call uac_replace_from in branch route?

I would suggest this way. Both for the first and for the second provider.

Miklos

> 
> Thanks




More information about the sr-users mailing list