Billing

This is a project by dlucio to manage billing for VoIP.

=What is Billing for FusionPBX?= Billing for FusionPBX is a native FusionPBX application (please see App menu on any FusionPBX installation) that allows to bill for incoming, internal or outgoin calls and some other capabilities.

=The Software Billing for FusionPBX is a commercial third party development, therefore it is not included in FusionPBX out of the box. You must download it, install it and get a valid license.

Download the software
You can go to author's Billing for FusionPBX website at www.okay.com.mx and download LCR and Billing for FusionPBX. You need to download both, since Billing needs LCR to work.

Install
You will find in www.okay.com.mx LCR and Billing quick starts. However, to install, you must follow next steps:

=My use:= I have no billing mechanism of any kind. This will have to be the whole thing.


 * 1) Bill various monthly and per-minute charges.
 * 2) Bill residential users a flat monthly fee, optionally a monthly per-DID fee, and per-minute, as set in the dialplan handled by mod_nibblebill.
 * 3) Bill business in a multi-tenant manner. Flat fee for PBX hosting/support and flat fee for trunks (if through me) or per-minute, again as per mod_nibblill.
 * 4) This should integrate with paypal, which allows variable recurring. It's free until 2011 then only $20/year.
 * 5) Trigger paypal payments on a low balance threshold.
 * 6) It should provide a payment/balance trail and list the CDRs and the prices of whatever they were billed. Also, let me restrict outgoing calls for no balance.
 * 7) I would like integration with DIDWW API, so users can choose to add a new DID and it gets added to their monthly charges and gets automatically routed to their extension (personal) or where they want (business)
 * 8) Perhaps - users, or atleast the admin, should be able to cancel monthly charges - but to be completed at the end of the month.
 * 9) Since the monthly charges are stored in a DB, then we should be able to dynamically check from the dial plan if someone has a certain service enabled or not. e.g. if this account has an unlimited plan, use their gateway (gw_${user}) else, use the carrier and charge with mod_nibblebill

Methodology

 * Daily "sweeps" of CDRs and bills into the user's running charges list.

Big questions
Is the user ID in fusionpbx a one:one relationship with a billing account, e.g. a mod_nibblebill account?

Generally, yes - one user can have multiple extensions, but only one billing account.

However, perhaps we want to assign more than one user to the same bill. Each one should be able to see his own service and modify it accordingly. Maybe.

Tables
Payment trail - record the payments.
 * Do I want to save the balance at the time of the payment? Maybe, it's good to know..