[OpenSIPS-Users] $DLG_lifetime but in ms
Marcin Groszek
marcin at voipplus.net
Tue Jan 23 11:44:07 UTC 2024
$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);
}
On 1/23/2024 1:12 AM, trevor at webon.co.za wrote:
> On Thu, 2024-01-18 at 12:27 +0200, Răzvan Crainea wrote:
>> 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 Răzvan
>
> I am using rate cacher and want to calculate billing in script and am
> unable to use duration field as this is only inserted into DB and not
> available as a variable unless I missed something in the document :)
>
> Regards
> Trevor Steyn
>
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
--
Best Regards:
Marcin Groszek
Business Phone Service
https://www.voipplus.net
More information about the Users
mailing list