Summary:ASTERISK-03234: [PATCH] ASTCC Maintainence Fee Bounty
Reporter:scubasteve (scubasteve)Labels:bounty patch
Date Opened:2005-01-09 10:22:32.000-0600Date Closed:2005-03-01 09:08:17.000-0600
Versions:Frequency of
Environment:Attachments:( 0) astcc-maint_BOUNTY.patch
Description:This patch should satisfy the requirements of the ASTCC Maintainence Bounty outlined at


This patch required a fair amount of database changes in order to implement the requested features.  Since the bounty required fees tied to brands, it was necessary to keep track of the card -> brand relationship.  Prior to this patch, the brand information was used only to populate pricing data when an account was created.

This patch brings a standalone program called chargemaintainence.pl which needs to run from cron daily.  This program does the billing and housekeeping.

The "brands" table got two new columns:  fee, days.  Both INTEGER.

The "cards" table also had two columns added:  brand, nextfee.  nextfee is INTEGER and brand is CHAR(40).  nextfee is a counter used to determine the fee assessment date.  It is decremented and reset (when needed) by the cron job.

I strongly recommend testing this with a non-production database, since I have only 'lightly' tested it.  If you *MUST* use a current database, it must be modified as follows:


ALTER TABLE cards add brand CHAR(40);
ALTER TABLE cards add nextfee INTEGER;

In order to test this, visit Configure and populate the following:

CDR Text for maintainence fee:      Account Fee
Modify CDR to show maintainence fee (YES/NO) YES
Verbose account maintainence (YES/NO) YES

... then set up some brands with fees.  Add users to those brands.  Run the cron job repeatedly (simulating the passage of 1 day for each invocation).  You should see some debug information stating certain cards have been charged.  Confirm fees are properly deducted and the user CDR data is updated to reflect the fee.


Disclaimer is on file.
Comments:By: scubasteve (scubasteve) 2005-01-10 14:28:09.000-0600


By: Mark Spencer (markster) 2005-01-11 13:09:24.000-0600

It's too bad there's no way to make this backwards compatible.

By: Mark Spencer (markster) 2005-01-11 13:16:19.000-0600

I should add that other than that it *looks* fine.  I'd like to get some testing info back (presumably from the person who is paying the bounty!)

By: scubasteve (scubasteve) 2005-01-11 22:46:37.000-0600


 I guess there's nothing stopping me from creating two new tables for these changes (and hopefully others in the future) and doing a join to get the necessary data.  Regardless of the method, it's still going to be "ugly" because there's no getting around the need for the database changes.

 I'd like to wait for the person who requested this to evaluate it before I make additional changes.



By: scubasteve (scubasteve) 2005-01-17 05:24:52.000-0600

Could someone please try this patch and provide some comments?

By: Mark Spencer (markster) 2005-01-17 07:59:35.000-0600

Have you been able to contact the person who placed the bounty?

By: scubasteve (scubasteve) 2005-01-17 17:31:41.000-0600

Mark, I have... He stated he was busy.  I'd just like to make sure this doesn't get closed out due to inactivity.

By: kafagy (kafagy) 2005-01-19 15:41:01.000-0600

a minor tweak to script chargemaintainence.pl to do the following:
1) start subtracting fees from cards with cards.firstuse > 0
2) stop subtracting fees when cards.facevalue <= cards.used.

chargemaintainence.pl.patch uploaded.

By: scubasteve (scubasteve) 2005-01-23 08:29:34.000-0600

Thanks, Kafagi.

A note to future Bounty Hunters:  This bounty was originally posted on voip-info on 1/8/05 by "kegrif".  I had the patch posted here within 24 hours of the bounty offering (1/9/05).

Two weeks have since gone by without a review or payment.  I've sent several polite emails requesting a review of the patch.  I did get a response about a week ago stating "I'm busy".

Kegrif, if you're too busy to fulfill your bounty obligations.. please don't post them.


By: kegrif (kegrif) 2005-01-23 10:14:27.000-0600

Bounty has been reviewed and bounty has been paid.

By: Mark Spencer (markster) 2005-01-23 13:04:13.000-0600

Okies well whenever you're ready for me to merge it let me know and i'll put it in!

By: Mark Spencer (markster) 2005-02-19 15:26:31.000-0600

Any more news here?  Are you ready?

By: Mark Spencer (markster) 2005-03-01 00:40:56.000-0600

Fixed in CVS head.