User Rating: 5 / 5

Star Active Star Active Star Active Star Active Star Active

After you decide to use FusionPBX as your main software for your VoIP business, the very next dilemma you will find is about the economics of telecommunications, in other words maximizing your profits. Happily for us, the VoIP and FreeSWITCH have something that is called LCR.

LCR by itself solve two issues:

  • termination calls have fault-tolerance, and
  • your termination cost is minimized (this is what this article is all about).


  • a way to charge users for PBX utilization.

Sadly, FusionPBX doesn't have an LCR or Billing applications out of the box. Lucky, my business has been developing an LCR and Billing for FusionPBX applications for some time. This article will describe all the wonderful things that the LCR and Billing applications come within its version 1.3.2.


Especially if you are based out of the USA. At some point, you will be ending to have carriers who charge in EUR, CAD, USD and any other currency. The mod_lcr from FreeSWITCH is not capable to compare rates with a mix of currencies. The new LCR replacement (aka app.lua lcr) can do a comparison.

As for the billing, you can charge your customers in a different currency than your main pricing list. You can have your pricing list in USD (recommended) and bill your customers in their local currency (CAD for example). What the software will do here is to convert the rate in real-time just before charging it.

Priority by Carrier

This is an LCR feature. It puts on top carrier selection regardless of the rate. Carrier priority is very handy if you want to first try your value carriers and then premium carriers.

fusionpbx lcr carrier

If you are not planning to use this feature, set the same value to all the carriers. Zero has the maximum priority.

Priority by Gateway

This is an LCR feature, similar to the carrier's priority, you can prioritize the gateways.

fusionpbx lcr carrier gateway

Priority on the gateways is useful for those carriers who have more than one presence point and you want to always try the closest to your server first.

Flat Rate and NANP Rates Mix

This is an LCR feature and it only applies if you are terminating calls to the USA. As you look for new carriers, you will find that some rates lists support NANP and others don't (flat-rate). This feature allows using a mix of carriers. If the termination conditions are met, the LCR will compare against the intra-state and intra-lata rates for the carriers that support it.

Rates based on the Originating Numbers

This is an LCR feature. Some carriers have different rates depending on who is calling. This is very common in Europe, some carriers give a lower rate if the caller has a caller id number from within Europe as well.

fusionpbx lcr carrier rate origination digits

The LCR for FusionPBX will use the origination digits and compare that value against the caller id number.

Anti Call Center Traffic: Dynamic Cancellation Ration Delay

This is an LCR feature. Since the COVID-19 pandemic, everybody is trying to make money from everything, telecommunications are not the exception. Many carriers have been being creative with their charges. One of the most common surcharges is the cancellation ratio. A cancelled call is the one that the originating party stops before the termination party answers it.

If an X percentage of your calls is greater than the cancellation threshold without this feature, you would be surcharged. Thanks to the cancellation ratio parameter, the LCR for FusionPBX will insert a delay on the terminating party. The idea of this feature is that if the caller is likely to cancel the call, it is better to cancel it in the PBX only than when the carrier has already been contacted.

Each time an outgoing call happens, the LCR will calculate a quick cancellation ratio within a period of days (totally configurable) for the current account code, the caller, the callee and the caller-callee tuple (it can be totally configured, please read the LCR Manual and Billing Manual). The delay is based on the average ringing time of the cancelled calls. When the LCR tries to connect to a given carrier, if the carrier threshold is lower than the current cancellation ratio and the delay hasn't been applied, the LCR sends a ringback sequence to the caller but it holds the connection. Once the delay is done, it will connect.

Diversion Support

This is an LCR feature. If you set the Diversion header, it will be passed along to the given carriers.

Variable Export from Leg-A to Leg-B

This is an LCR feature. The current mod_lcr from FreeSWITCH only allows you to pass to the gateways (leg-b) the variables that have been explicitly declared in the lcr.conf.xml file. Doing an export is not enough if the variable is not declared in the configuration file. This becomes a problem because, in some scenarios, you do not always know what variables to pass to the bridge statement that the mod_lcr creates.

The LUA LCR replacement solves this inconvenience. A simple export statement of any variable is enough to make sure it will arrive at the leg-b.

Anti Call Center Traffic: Short Call Duration

This is a Billing feature. Again, since the COVID-19 pandemic, carriers surcharge because of short calls as well. By definition, a short call is any answered call that is equal to or shorter than six seconds (some abusive carriers consider a short call if its duration is lower than 15 seconds).

If an X percentage of a customer's calls is greater than a configured threshold, the software can add a surcharge on top of the call charge.

Profit Modes

This is an LCR and Billing feature. Depending on the kind of VoIP business, you can configure the profit mode as follows:

  • relaxed: the LCR will try all the carriers until one connects, regardless if there is a profit or not (the carrier rate is more expensive than the price you are selling to your customers).
  • strict: the LCR will only try the carriers that let you profit. If the carrier's rate < selling rate, then the LCR will consider that route.
  • percentage cap: this is a middle point between relaxed and strict. You can specify a profit percentage, and if the profit percentage is equal or greater to the specified cap, the LCR engine will consider that route.

Dynamic Selling Rates

This is a billing feature. You can always specify a fixed rate. Now, you can make a dynamic rate with a guaranteed profit. 

For example, if you configure to have a dynamic profit of 20% and someone calls to Canada, the selling rate will be 20% more.

Parent Billing Profiles

This is a billing feature. Billing profiles can have now a parent-child hierarchy.

fusionpbx billing parent profile

This is very useful for internal billing within organizations. If you want to keep billing for specific departments.

Pay the Balance in Full

This is a billing feature. For post-paid users, it will force them to pay the balance in full.

fusionpbx billing force full balance payment

Anti Fraud: Termination Rate Cap

This is a billing feature. It allows your customers to avoid those destinations that are more expensive than a specific rate.

fusionpbx billing maximum rate allowed

In the unfortunate case a customer account is hacked (weak password maybe), this feature will prevent them deplete their credit.

Pricing List Export by Customer

This is a billing feature. You can call a specific URL and export a specific customer pricing list in CSV or JSON format. Your customers may download periodically your pricing updates and automate the import.


This is a billing feature. You can now do deals; give a special rate for the very first N minutes in the monthly period to a specific prefix.

fusionpbx billing deals

This will allow you to offer packages, for example, give for free the first 100 minutes to Spain (prefix 34). The software can work in real-time or post mode. In real-time mode the software will look for a matching deal (based on the prefix, call duration and used minutes), if a hit is found, the PBX will overwrite the rate with the new value. In post mode, the call is charged at a standard rate and with a crontab, a correction to the balance is pushed into the billing profile of the customer.

Deals are totally compatible with the parent-child billing profiles. If a parent and a child have deals that could apply to a given call, the child deal has precedence. For example, if a parent has a deal that applies to Mexico (prefix 52) and a child has a deal that applies to Monterrey (prefix 5288). If the child calls to 5288XXXXXXXX, then the deal of the child applies; if the child calls to 5255XXXXXXXX then the parent deal applies.

Default Selling Rate

This is a billing feature. Rate lists are very long. As the Billing for FusionPBX software supports more than one selling pricing list, it makes no sense to clone the whole list if you are only going to modify few destination rates.

If the selling rate doesn't exist in the specific customer's rate list, then the software will look into the default rate list. You can use this feature to have two kinds of pricing lists: one by the minute and the other that allows unlimited (free) for specific destinations (like unlimited free calls to the USA and Canada). The default pricing list would be by the minute, and the unlimited pricing list would only contain the destination to overwrite the default's rates.

If you need more features to use the LCR and Billing, contact me. Some may be done for free others would be charged.

blog comments powered by Disqus


Read about IT, Migration, Business, Money, Marketing and other subjects.

Some subjects: FusionPBX, FreeSWITCH, Linux, Security, Canada, Cryptocurrency, Trading.