I am using version 6.0 of the ASTPP application and have noticed that the system does not round the call duration times. This can create a discrepancy between the time measured by ASTPP and the time handled by trunk providers, who do round their times.
I would like to know if anyone in the community is aware of how to configure the system to round the call duration times. This would be very helpful for optimizing billing and avoiding small losses that, while they may seem insignificant, can accumulate over time.
Thank you in advance for any advice or solutions you can offer!
I wanted to share a solution I found for an issue I experienced. Initially.
Findings:
FreeSwitch generates call duration variables in seconds, milliseconds, and microseconds.
ASTPP uses the seconds variable for its calculations and CDR.
The ASTPP function that receives the variables from FreeSwitch is process_cdr, located in /opt/ASTPP/freeswitch/fs/lib/astpp.cdr.php, where it is handled as an array.
The array where ASTPP stores the call time in seconds is $dataVariable['billsec'], which is referenced by many other ASTPP functions and modules.
Solution:
To fix the issue, I recalculated the value of the $dataVariable['billsec'] array to reflect the time in seconds rounded to my needs. I added the following lines right after the initial assignment where the array coming from FreeSwitch is assigned:
// FS CDR variables
$dataVariable = $data['variables'];
// Convert milliseconds to seconds
$x_seconds = $dataVariable['billmsec'] / 1000;
// Round up to integer if fraction is >= 0.5
$dataVariable['billsec'] = round($x_seconds);
I’ve tested it and everything seems to be working as expected. I hope this solution is helpful to others facing a similar problem. If you have questions or need more details, feel free to ask.
It’s nice to know that the time I spent will be of use to others as well.
I think this is the goal of OpenSource, but it is being lost.
Before this one, the most recent update to this repository is 2 years old, although there are quite a few comments and corrections scattered around the Internet.
A “enable/disable” switch to do the rounding with a field which will also be enabled/disabled (based on the setting of the switch) where you add place integer value of the rounding of time one wants to happen.
I would guess the value would have to be stored in a database