This manual will guide you on every detail about installing and using the Billing for FusionPBX native application. If you want to have a quick setup, you may read the quick guide and later return here.
Current version 1.5.0.
Assumptions: The reader is familiar with Linux and FusionPBX. This manual also assumes you already have LCR installed.
Before you start Billing for FusionPBX installation, you must satisfy the next requirements:
NOTE: If you are upgrading from any version to 1.5.0, crontabs have been moved to the resources/tools/ directory. You have to adjust your crontabs.
When you satisfy these requisites, please follow the next steps:
This method only applies if you are using the RPM's from the OKay's repository. The installation method is very similar to the LCR one. If you haven't installed the LCR, the RPM dependency engine will install it for you. However, please read the LCR Manual to understand some LCR specific tasks.
Go into / your Billing directory (usually /var/www/html/fusionpbx/app/billing or the right directory where you installed) and execute echo -n key > any_name.key command, where the key is your license number. Since version 1.0.1 license name can have any name with .key extension. You don't need to do this if you hold an IP license; IP licenses can be obtained only if you donate to convert the project into open-source.
You may want to apply the patch xml_cdr_inc.php.diff. From the FusionPBX root directory, type: patch -p0 < app/billing/resources/patches/xml_cdr_inc.php.diff. If you are not able to do this or you don't want to alter your installation you can always set up the following default settings:
The default settings approach is preferred.
To configure Billing for FusionPBX, you need to understand the following concepts:
Remember to fill the accountcode field with the correct value when creating items in FusionPBX. Accountcode by itself is just a variable, depending on your call flow you may configure it at:
If you don't know where to start, a good place is by configuring all the extensions with the proper accountcode value.
The Billing for FusionPBX software needs to have the cdr_billing variable set (any value). This is the way where you can decide what calls to bill or not. The best place to set this variable is in the "variable" dialplan (go to Dialplan -> Dialplan Manager menu option).
Insert at least this record in the database:
INSERT INTO v_rate_conversions (rate_conversion_uuid, from_iso4217, to_iso4217, rate, rate_epoch) VALUES ('55e5796b-3aba-4b0a-aab2-299994c755a4', 'USD', 'USD', 1, 0);
If your default currency is different than the USD, you will need to do the same equivalent SQL query. This query won't be necessary for future releases.
After that, sign up for a currency rate API key at https://www.currencyconverterapi.com/ and configure the following default setting:
Run the following command for the first time from the FusionPBX root directory: php app/billing/billing_crontab_currency_rate.php. If you are planning to have customers or carriers that use a mix of currencies, for the sake of speed, it is a good idea to set this crontab at least every 24 hours. This is totally optional, the software will query the API as needed.
Deals will allow you to give specials. Read our deals document to understand how it works.
(It will be soon here)
The following files can be edited and place into a crontab:
Follow this crontab example:
* * * * * cd /var/www/html/fusionpbx && php app/billing/billing_crontab_auto_topup.php
Configure the crontab frequency as your need it. It is important to call the scripts from within the FusionPBX directory.
Sometimes, you may need to change billing logic (only in specific cases). You can edit the file resources/functions/ratings.php
You may follow the installation procedure for any update.
Category | Sub Category | Type | Values | Default Value |
billing | earning_rate | numeric |
| 1.1 |
billing | payment_amount | array |
| |
billing | minimum_payment | numeric |
| 0 |
billing | minimum_payment_currency | text |
| USD |
billing | offline_enabled paypal_enabled stripe_enabled | boolean |
| true |
billing | offline_debug paypal_debug stripe_debug | boolean |
| false |
billing | offline_message_LANGUAGE paypal_message_LANGUAGE stripe_message_LANGUAGE | text |
| en |
billing | offline_postpaid_capable paypal_postpaid_capable stripe_postpaid_capable | boolean |
| false |
billing | offline_prepaid_capable paypal_prepaid_capable stripe_prepaid_capable | boolean |
| false |
billing | offline_percentage_comission | numeric |
| 0 |
billing | offline_fixed_comission_currency paypal_fixed_comission_currency stripe_fixed_comission_currency | text |
| Billing default currency, or USD |
billing | offline_fixed_comission paypal_fixed_comission stripe_fixed_comission | numeric |
| 0 |
billing | offline_default_charge paypal_default_charge stripe_default_charge | numeric |
| 0 |
billing | offline_minimum_payment paypal_minimum_payment stripe_minimum_payment | numeric |
| Global minimum payment or 0 |
billing | paypal_testmode stripe_testmode | boolean |
| false |
billing | paypal_seller_id | text |
| |
billing | paypal_domain | text |
| |
billing | stripe_publishable_key | text |
| |
billing | stripe_secret_key | text |
| |
billing | stripe_publishable_test_key | text |
| |
billing | stripe_secret_test_key | text |
| |
billing | paypal_callback_file stripe_callback_file | text |
| |
billing | paypal_callback_function stripe_callback_function | text |
| |
billing | debug | boolean |
| false |
billing | https | boolean |
| false |
billing | http_project_path | boolean |
| |
billing | invoice_first_caracters | numeric |
| 0 |
billing | invoice_image1 invoice_image2 invoice_image3 | text |
| |
billing | invoice_message | text |
| |
billing | invoice_subject | text |
| |
billing | invoice_cc | text |
| |
billing | invoice_bcc | text |
| |
billing | pyramid_message | text |
| |
billing | currency | text |
| USD |
billing | extension_price destination_price device_price ivr_menu_price | numeric |
| 0 |
billing | extensions_for_free destinations_for_free devices_for_free ivr_menu_for_free | numeric |
| 0 |
billing | deals_realtime | boolean |
| false |
billing | invoice_only_superadmins | var |
This variable will be fixed in future versions. | 0 |
billing | currency_database_cache_ttl | numeric |
| infinite |
billing | currency_converter_api | text |
| |
billing | whmcs_url | text |
| |
billing | whmcs_identifier | text |
| |
billing | whmcs_secret | text |
| |
billing | whmcs_http_user | text |
| |
billing | whmcs_http_password | text |
| |
billing | whmcs_billableitem_decimals | text |
| |
billing | whmcs_record_zeroes | boolean |
| false |
billing | whmcs_billableitem_invoiceaction | text |
| nextcron |
billing | ca_verification | boolean |
| true |
billing | short_duration_acceptable_percentage | numeric |
| 0 |
billing | short_duration_charge | numeric |
| 0 |
billing | short_duration_currency | text |
| the billing default currency or USD |
billing | short_duration_time | numeric |
| 0 |
billing | auto_topup_message | text |
| |
billing | low_balance_alert | numeric |
| 5 |
billing | low_balance_message | text |
|
LUA Variable | FreeSWITCH Variable | Values | Default Value |
lcr.billing |
| false | |
lcr.billing_dynamic_price | lcr_billing_dynamic_price |
| false |
lcr.billing_dynamic_earnings | lcr_billing_dynamic_earnings |
| false |
lcr.billing_default_list_fallback | billing_default_list_fallback |
| false |
billing_default_list_name |
| 'default' | |
lcr.billing_list_required | billing_list_required |
| false |
lcr.strict_earnings | lcr_strict_earnings |
| 'relaxed' |
accountcode |
| ||
cdr_billing |
| ||
lcr_user_first_rate |
| 0 | |
lcr_user_second_rate |
| 0 | |
lcr_user_first_increment |
| 0 | |
lcr_user_second_increment |
| 0 | |
lcr_user_currency |
| Billing default currency or USD |
Since 1.3.0, the Billing for FusionPBX has support for deals. A deal is an easy way to overwrite the rate of certain destinations based on some conditions. You will be able to offer deals such as:
An IT Company whose mission is generating value with low cost of ownership.
We will offer you Linux based solutions that satisfy your needs. We focus on VoIP & Linux, but we are up for any other challenge you may want to bring.