[OpenSIPS-Users] $DLG_lifetime but in ms

Răzvan Crainea razvan at opensips.org
Thu Jan 18 10:27:37 UTC 2024


HI, Trevor!

Unfortunately there is currently no way to round up the value, but what 
is unclear is why you need the extra billed_duration, and not simply 
using the duration field.

Best regards,

Răzvan Crainea
OpenSIPS Core Developer / SIPhub CTO
http://www.opensips-solutions.com / https://www.siphub.com

On 1/11/24 15:55, trevor at webon.co.za wrote:
> Hi All,
> 
> I have a simple issue I need to solve but cant seem to fine a elegant
> way of resolving.
> 
> I am using acc module + rate_cacher to do some simple billing.
> 
> I use $DLG_lifetime but this value seems to be a rounded to the nearest
> second what I need is to round up to the nearest second similar to how
> ACC module calculates duration
> 
> Here is an example CDR
> 
> 
> *************************** 1. row ***************************
>         duration: 35
>      ms_duration: 34168
> billed_duration: 34
> 
> As you can see duration is rounded up and billed_duration is rounded
> down.
> 
> Is there any way to get access to the ms of the dialogue from any
> module, I could resort to initializing my own timers but there is
> already a timer running in the acc module and would be more efficient
> to just use it.
> 
> 
> Here is how I am creating billed_duration
> 
> if (has_totag()) {
>      ....
>      ....
>      ....
>      if (is_method("BYE")) {
>          if ($DLG_lifetime == 0) {
>              $acc_extra(billed_duration) = 1;
>          }else{
>              $acc_extra(billed_duration) = $DLG_lifetime;
>          }
>      }
> 
>      route(RELAY);
>      exit;
> }
> 
> 
> Thanks
> Trevor Steyn
> 
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users



More information about the Users mailing list