[SR-Users] Request-URI in fail route

Daniel-Constantin Mierla miconda at gmail.com
Mon Mar 19 11:26:20 CET 2012


Hello,

for convenience, I extended dispatcher module to be able to give the uri 
value as parameter to add_diversion() function, see commit:

http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=ef6b531dfaf08476932d44b23c82b94e0f06a86a

Maybe you want to try it -- reporting if it works would be very appreciated.

Cheers,
Daniel

On 3/15/12 11:24 PM, Daniel-Constantin Mierla wrote:
> Hello,
>
> On 3/15/12 7:05 PM, Jan Klepal wrote:
>> Hello Daniel,
>>
>> On Thursday 15 of March 2012 11:59:32 you wrote:
>>>> First problem I encountered is that I can't check $rU in 
>>>> failure_route (it
>>>> is always set to original Request-URI - bob). Is this normal 
>>>> behavior or
>>>> am I missing something? Because of that I have to set divert 
>>>> destination
>>>> in branch route.
>>> in failure route you have access to the value of r-uri before 
>>> getting to
>>> any branch_route or failure_route. You can use an avp to store the 
>>> value
>>> you would like to check later in tm specific routes.
>>>
>> Thanks for confirming usage of avp.
>>
>>>> Second problem is when Carol's no-answer forward to Dave happens. Then
>>>> add_diversion adds invalid diversion header because it uses 
>>>> Request-URI
>>>> which is still set to bob.
>>> You can set the r-uri to the value you want before calling
>>> add_diversion, after that set it to what you want to be the 
>>> destination.
>>>
>> I am not able to make this working... not sure if I follow you 
>> correctly. So I
>> tried following minimal config:
>>
>> route {
>>      if(is_method("REGISTER")) {
>>          save("location");
>>          exit;
>>      }
>>      lookup("location");
>>      t_set_fr(5000);
>>      t_on_failure("FAIL_ONE");
>>      t_relay();
>> }
>>
>> failure_route[FAIL_ONE] {
>>      add_diversion("no-answer");
>>      rewiteuser("carol");
>>      lookup("location");
>>      t_on_failure("FAIL_TWO");
>>      t_relay();
>> }
>>
>> failure_route[FAIL_TWO] {
>>      rewriteuser("carol");
>>      add_diversion("no-answer");
>>      rewiteuser("dave");
>>      lookup("location");
>>      t_relay();
>> }
>>
>> First failure route works correctly, it adds diversion header.
>>
>> However in second failure route diversion header is not appended to 
>> SIP packet
>> at all (no matter if I try to overwrite r-uri). In case I overwrite 
>> r-uri in
>> first failure route before calling add_diversion it still uses 
>> original r-uri.
>> Same result changing r-uri with $ru or even with $rU instead of 
>> rewiteuser
>> function.
>>
>> There is also problem in case of cross redirect (B->C and C->B)... 
>> secondary
>> invites end with 500 Internal server error from UA (probably because 
>> it gets
>> invite with same callid and tags as original invite).
>>
>> I think I need to use B2BUA to make multiple forwards working.
> I checked the sources of diversion header -- add_diversion is actually 
> using the incoming URI, not the updated one.
>
> You better use insert_hf(...) from textops module to add the diversion 
> header:
>
> http://kamailio.org/docs/modules/stable/modules_k/textops.html#id2498304
>
> For the loop, yes, that is client side. You can keep the list of 
> destinations in avps and then check in config if a new destination was 
> already tried and then reply 404 not found or something else from 
> Kamailio.
>
> Cheers,
> Daniel
>
>

-- 
Daniel-Constantin Mierla
Kamailio Advanced Training, April 23-26, 2012, Berlin, Germany
http://www.asipto.com/index.php/kamailio-advanced-training/




More information about the sr-users mailing list