[OpenSIPS-Users] $DLG_lifetime but in ms

trevor at webon.co.za trevor at webon.co.za
Tue Jan 23 14:29:17 UTC 2024


On Tue, 2024-01-23 at 05:44 -0600, Marcin Groszek wrote:
> $avp(dlg_lifetime) is a read/ write variable and you can change its 
> value before acc is written.
> 
> To round up the duration using minimum billing block and increments
> you 
> need to save them first in to a dialog.
> 
> this is the logic I use (opensips 3.1)
> 
>                                          if ($(DLG_lifetime{s.int}) >
> $(dlg_val(minimum){s.int})) {
> math_eval("$DLG_lifetime / $dlg_val(increment)", $avp(lifetime));
> math_ceil("$avp(lifetime)", $avp(dlg_total_increment));
> math_eval("$avp(dlg_total_increment) * $dlg_val(increment)", 
> $avp(dlg_lifetime));
> math_ceil("$avp(dlg_lifetime)",$avp(dlg_lifetime));
>                                          }
>                                          else {
>                                                  $avp(dlg_lifetime) =
> $dlg_val(minimum);
>                                          }
> 
> 

Hi Marcin, 

This only works for billing increments bigger than "1" I am
implementing per second billing and $DLG_lifetime is a rounded to the
nearest second, if a call duration is at 1001ms $DLG_Lifetime will
return 1 I need to round up I need to bill anything past 1000ms to 2
seconds.

Regards
Trevor Steyn




More information about the Users mailing list