[SR-Users] Problem with worst case scenario of accessing 15 gateways over the DISPATCHER module - MAX_BRANCHES is reached

Klaus Feichtinger klaus.lists at inode.at
Thu Jul 7 14:39:36 CEST 2011


> Hi Klaus,
>
> i understand.
>
>> In case that the dispatcher-target is responding with a negative
>> response code (as it was until now), all targets are sequentially
>> addressed within a time of lower than 1 second until the error message
>> of the TM module is interrupting that process.
>
> 1s is of course fast enough.
>
>> However, if there is no alternative to changing the define value of
>> MAX_BRANCHES I will use your recommendation for limiting the number of
>> gateways that will be addressed over the failure_route. My Question
>> now is: how can I count the number of branches / rejections (from the
>> failure_route)?
>> I've tried using the pseudo_variable $branch(count) (according
>> description of the WIKI page), but the value is "0" all the time =>
>> not useful. I could create a private table and use the sqlops module.
>> Do you have any easier alternative recommendation how the number could
>> be limited?
>
> What about just incrementing an variable, like an avp and check this in
> an if  case?
>
> Best regards,
>
> Henning
Hi Henning,

I decided using your recommendation with AVP. Until now I kept some
distance to this mechanism (AVP in general). But because of having no
alternative (std. $var can not work, avoidance of self compilation for a
customer project a.s.o.) I have limited the number of hits - it is now
working fine. Without any dirty hack ;-)

Thanks and best regards,
Klaus

P.S. the abstract solution

route[YZ] {
     if (!ds_select_dst("1", "4")) { .. }
     $avp(i:9)=1;
     t_on_failure("xy");
     t_on_reply("yz");
     t_set_fr(3000, 750);
     t_relay();
     exit;
}

failure_route[xy] {
[...]
     if ($avp(i:9) < 10){
          $avp(i:9) = $avp(i:9) + 1;
          #!ifdef WITH_XLOGDEBUG
          xlog("L_INFO", " <FAILXY> the new value of branch counter is:
$avp(i:9) \n");
          #!endif
     } else {
          #!ifdef WITH_XLOGINFO
          xlog("L_INFO", " <FAILXY> distr. was interrupted due to too many
faulty GWYs \n");
          #!endif
          t_reply("480", "Temporarily Unavailable");
          exit;
     }
     if (!ds_next_dst()) { .. }
     [...]
}






More information about the sr-users mailing list