I've been researching this topic on the forum and using Google and I can't seem to find a concrete answer. I currently have low balance email reminders enabled and working on my A2billing installation 1.3.0. The problem is it doesn't seem to be working correctly. I initially had the min. balance set at $5. I then changed it to $1 by editing a2billing.conf. This didn't seem to work as the old limit is still in effect ($5) furthermore I get reminder emails once per hours. This amounts to spam if the user doesn't top up their card immediately. I've already gotten 25 reminder emails from my system. I checked all 3 agi.conf and they all have the option to send email reminders set to "no" in addition their min_credit etc are all set to less than $5. Am I missing something, somewhere?

I think this might help someone trying to have a2billing send Email to customers with low balances. I worked on this until I got it to work because the original code did not work at all. I hope it helps someone.

Code wrote:

#!/usr/bin/php -q<?php/*************************************************************************** * a2billing_check_account.php * * 13 April 2007 * Purpose: To check account of each Users and send an email if the balance is less than the first argument. * Copyright 2007 User : Belaid Arezqui * ADD THIS SCRIPT IN A CRONTAB JOB * * The sample above will run the script every day of each month at 6AM crontab -e 0 6 1 * * php /var/lib/asterisk/agi-bin/libs_a2billing/crontjob/a2billing_check_account.php

field allowed values ----- -------------- minute 0-59 hour 0-23 day of month 1-31 month 1-12 (or names, see below) day of week 0-7 (0 or 7 is Sun, or use names)

****************************************************************************///exit();// CHECK ALL AND ENSURE IT WORKS / NOT URGENT

if (!($nb_card>0)){ if ($verbose_level>=1) echo "[No card to run the Recurring service]\n"; write_log(LOGFILE_CRONT_CHECKACCOUNT, basename(__FILE__).' line:'.__LINE__."[No card to run the check account service]"); exit();}

You can attach that .txt to a forum post. If you want to attach code to an enhancement/defect on Trac then it's best to use just .diff as the extension, as Trac will then display it with markup making the changes even more obvious.

Additionally I've a few comments about your changes themselves.
Was there a reason you removed part of the code that splits the task into pages of 5,000 customers? It's intended to give the SQL server and the mailserver an easier time by sleeping after each page.
I'm not sure your 4th parameter to mail() is correct. It specifies a header line, so must be a valid SMTP header. Perhaps you meant "From: [email protected]"?
I think you meant '$card_gen' rather than '$gen_card'.

I can contribute more once I figure out what I am doing. I am a C++ and Visual Object programer but PHP is a learning experience for me. I am learning and you will see more contribution once it is worth it.

Sorry duhty, we've been happily chatting away in your thread and I've only just noticed your question.
The way things currently stand the IVR will send an email after a call if the balance has dropped below min_credit_2call. The cron job will send an email each time it is triggered if the balance is below 5. If you want the cron job to send reminders less frequently you configure this with 'crontab -e', eg:

As post pay customers will have a negative balance, the where clause should have a check for account type.

Or modify the query to match post-pay customers approaching their credit limit.

Quote:

To prevent repeated warnings, a db flag needs to be set to show that a warning has been sent. Part of the code should see if credit has been applied and flag reset.

I was thinking exactly the same. Once that is in place I think adding a new configuration setting 'min_credit_sendreminder' would be useful in both check_account.php and especially the AGI, so we can warn them before they reach 'min_credit_2call'.

As post pay customers will have a negative balance, the where clause should have a check for account type.

Or modify the query to match post-pay customers approaching their credit limit.

Quote:

To prevent repeated warnings, a db flag needs to be set to show that a warning has been sent. Part of the code should see if credit has been applied and flag reset.

I was thinking exactly the same. Once that is in place I think adding a new configuration setting 'min_credit_sendreminder' would be useful in both check_account.php and especially the AGI, so we can warn them before they reach 'min_credit_2call'.

I agree about the min_credit_sendreminder but not the flag to show that it has been sent. it is not necessary as the reminder is sent once daily to not only warn but also give the customer his/her balance. I think that it is useful to know what your balance is so that you can act when it become critical.

it is not necessary as the reminder is sent once daily to not only warn but also give the customer his/her balance.

If we modify the AGI to send the reminder when the balance drops below min_credit_sendreminder, rather than min_credit_2call, then we'll need something to prevent a reminder being sent after each call.

it is not necessary as the reminder is sent once daily to not only warn but also give the customer his/her balance.

If we modify the AGI to send the reminder when the balance drops below min_credit_sendreminder, rather than min_credit_2call, then we'll need something to prevent a reminder being sent after each call.

For what I can see the reminder is not sent after each call it is being sent at 6AM each day. and it is not based on the min_credit_2call it is base on the on the min_credit which is hard coded in the file. so the min_credit_sendreminder is a welcome variable because it would allow to set the minimum without going to the file it self.

Sorry perhaps I forgot to mention that I was intending to modify the AGI to use min_credit_reminder too, hence the need for this extra field. Areski has understandly vetoed the idea for branches/1.3 though, so just what you described is going to happen.

Sorry perhaps I forgot to mention that I was intending to modify the AGI to use min_credit_reminder too, hence the need for this extra field. Areski has understandly vetoed the idea for branches/1.3 though, so just what you described is going to happen.

Does this mean 1.3 is frozen now, or that only a normal bug fix will be done on 1.3 ?

I realize this is outside the scope of this, but how goes 1.4? Anyone venture to use it in production yet? Or should one only browse the 1.4 to get familiar with it and stick to 1.3 ??

Reusing old version numbers for new code (+features) is not wise. I admit that some people are reluctant of upgrading when they see a new release number, but it's their fault. Anything that /behaves/ differently must have a different middle version.

Who is online

Users browsing this forum: No registered users and 3 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum