[OpenSIPS-Users] Quota - CDRTool Question

dotnetdub dotnetdub at gmail.com
Wed May 23 18:02:14 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,

Nearly There..

The rebuild worked!

The daily quota is still evading me.

I have put the line back in rating.php to 0.

I've set it in global.inc and tested it in rating.php by adding:

$log=sprintf("Parent Daily Quota quota %s\n",$parent->daily_quota);
                syslog(LOG_NOTICE, $log);

        if ($parent->daily_quota && is_numeric($parent->daily_quota)
&& $parent->daily_quota > 1 && $parent->daily_quota < 100) {
               $this->daily_quota = $parent->daily_quota;
        }

$log=sprintf("This Daily Quota quota %s\n",$this->daily_quota);
                syslog(LOG_NOTICE, $log);


To check it works and sure enough:

May 23 16:46:26 cdrtool[3802]: Parent Daily Quota quota 10
May 23 16:46:26 cdrtool[3802]: This Daily Quota quota 10

In cdrtool I have a customer with a monthly quota of 500 and today
usage of 53.0421 but when I run checkQuota.php:

No quota has been exceeded

So I am not php expert. Is this line a problem?

            } else if ($this->daily_quota &&
($this->db->f('cost_daily') >= $this->db->f('quota') *
$this->daily_quota/100)) {

Thanks for your help on this,
Brian







> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users



More information about the Users mailing list