[OpenSIPS-Users] $DLG_lifetime but in ms

trevor at webon.co.za trevor at webon.co.za
Thu Jan 11 13:55:06 UTC 2024


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





More information about the Users mailing list