[SR-Users] Request-URI in fail route

Daniel-Constantin Mierla miconda at gmail.com
Thu Mar 15 11:59:32 CET 2012


Hello,

On 3/13/12 7:23 PM, Jan Klepal wrote:
> Hello,
>
> I am trying to set simple no-answer forward scenario: Alice calls Bob and
> after timeout 5s forward to Carol (and additionally Carol timeout forward to
> Dave).
>
> I am using Kamailio 3.2.2 default config. There is part of routing logic for
> no-answer forwarding:
>
> route[RELAY] {
>      if(is_method("INVITE")) {
>          t_set_fr(5000);
>          t_on_branch("BRANCH_ONE");
>          t_on_reply("REPLY_ONE");
>          t_on_failure("FAIL_ONE");
>      }
>      if(!t_relay()) {
>          sl_reply_error();
>      }
> }
>
> branch_route[BRANCH_ONE] {
>      $avp(divert) = $null;
>      if($rU == "bob") {
>          $avp(divert) = "carol";
>      }
>      # second problem
>      if($rU == "carol") {
>          $avp(divert) = "dave";
>      }
> }
>
> failure_route[FAIL_ONE] {
>      if($avp(divert) != $null) {
>          add_diversion("no-answer");
>          $rU = $avp(divert);
>          route(LOOKUP);
>          route(RELAY);
>      }
> }
>
> 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.


> 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.

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