[OpenSIPS-Users] Quota - CDRTool Question

dotnetdub dotnetdub at gmail.com
Thu May 24 11:24:43 CEST 2012


On 23 May 2012 16:17, Tijmen de Mes <tijmen at ag-projects.com> wrote:
> On 05/23/2012 01:47 PM, dotnetdub wrote:
>>
>> Just one question. I want to enable a daily limit of 10% of the monthly
>> limit.
>>
>> I've added "daily_quota"        =>  "10",  to my global.inc
>>
>> I've noticed that in rating.php that this is here:
>>
>>    var $daily_quota   = 0;       // by default do not check daily quota
>>
>> Do I comment this out, set it to 10 or 1 to enable or delete it?
>
> Don't edit rating.php. the value in global.inc should be enough. (line 5685
> of rating.php overrides it)
>
>> And one other question.
>>
>> I add a quota to the opensips table. When does it get copied to the
>> cdrtool.quota_usage table?
>>
>> I have added quota now for all subscribers but they don't go the cdrtool
>> table.
>
> Try the quotaReset script and then quotaCheck. It should now rebuild from
> radius/opensips db
>
>
> --
> Tijmen de Mes
> AG Projects


Hi Tijmen,

Been looking at this for Stephen.

So I think I fixed some bugs!

in rating.php on line 6006 it was never checking if the daily quota
was being exceeded.

I've changed it to:

$query=sprintf("select * from quota_usage where datasource = '%s' and
quota > 0 and (cost > quota or cost_today >=
quota/$this->daily_quota)",$this->CDRS->cdr_source);

Then on line 6027 currently is:
 else if ($this->daily_quota && ($this->db->f('cost_daily') >=
$this->db->f('quota') * $this->daily_quota/100)) {

the variable cost_daily is incorrect - it should be cost_today

Regards
Brian.



More information about the Users mailing list