LCR for FusionPBX with FreeSWITCH

This manual will guide you on every detail about how to install and use the LCR 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.

  1. LCR for FusionPBX installation
  2. LCR for FusionPBX configuration
  3. Maintenance Tasks
  4. Default Settings
  5. LUA & FreeSWITCH Variables

Assumptions: The reader is familiar with Linux and FusionPBX.

Read more: LCR for FusionPBX Manual


  • Codec support honoured through the codec field
  • Better PostgreSQL compatibility when dealing with dates
  • Better logging reasons on the log file
  • Importing engine rewritten, easier to include more carriers
  • FusionPBX 4.5.35, 5.0 compatibility


  • More PostgreSQL compatibilities
  • Easy way to show the Carrier UUID
  • Fix some typos
  • Fix theTo Connect Me import script
  • LCR price analysis is not co-dependant on the Billing
  • LUA script fixes, they are more resistant to NIL evaluations
  • nolocal:api_on_answer support
  • lcr_strict_earnings logic fix
  • billing_list_required logic fix
  • More informative debug messages in the FS_CLI console
  • Diversion SQL fix

  • More PostgreSQL compatibilities
  • Fix a bug that prevents the creation of new rates with PostgreSQL
  • Typos
  • Better handling of the LUA variables
  • Fallback pricing list is now any pricing list


  • PostgreSQL compatibilities
  • Tags support
  • Short Call support
  • Price analysis reworked
  • Better fallback pricing list support if Billing is installed


  • Typos


  • Ability to skip specific carriers on specific routes by setting a variable.
  • Fix a bug where lcr_user_*_rate variable was not always set.
  • Fix some typos in the LUA LCR script.
  • Support for dynamic pricing.


  • LUA LCR application is out of beta. It can now be used in production. The new LUA LCR replacement will let you use a mix of flat-rate and inter-(state/lata) carriers.
  • New price analysis to know who is your best carrier without actually doing a call.
  • Support more default values when importing, if your CSV is incomplete, it will build some default values based on others. If you miss the connection rate, or inter-state, inter-lata rate, those values will be obtained from the rate field.
  • More CSV import support to more carriers. Using the suggested CSV format is still recommended.
  • Origination support for some carriers that provide it.
  • Auto pricing support with more options to specify a percentage profit or new currency.


  • Useless rate fields are now hidden
  • Default pricing capabilities (MariaDB 10.2+, Postgresql 9.3+). The "default" selling pricing list now is a default, you can just modify specific prices in other lists and if that list doesn't have the specific selling rate, then it will use from the "default" list. Saves a lot of space and database performance when dealing with many pricing lists.


  • Carriers can be marked as fax-enabled carriers. If a call marked as fax (for_fax = 1 or for_fax = true) arrives, only carriers labeled as fax enabled will be considered for LCR calculations. Voice calls continue to work as always, this means a fax carrier can carry a voice call.
  • Because of the size of some rating lists, PHP could timeout or run out of memory, the import tool is also accessible through the command line.
  • Destinations usually are numeric, but there are some odd cases where letters are sent. LCR now supports letters as well.


  • Argentine Peso (ARS) supported
  • Voxbeam expiration rate field supported


  • Carrier priorities are like the gateway priorities. This is very useful if you want to give priority to a carrier (or a set of carriers) regardless of the rate.
  • Diversion header support (needs extra application). If you are using call diversion, take advantage of the headers to make it work correctly.
  • Better rate listing. It looks better now.
  • The importing rate tool is fixed. It is now pretty.
  • online import rates support. You can update their rates online without importing the CSV from them.
  • New selling pricing tool suggestion. If you are hesitant about what selling price you should start, it will create your first iteration based on your carrier costs.
  • The breakdown issue between carriers is fixed. If you have different carriers with different rates, you may be missing a cheaper rate if the given rate is from a smaller breakdown. This fix will allow you to evaluate the best fit for each carrier.
  • SQL queries speeded up.


  • Gateway now has priority within the carrier
  • New variables from mod_lcr


  • Bugfixes


  • Carriers can now have fixed priority


  • Bugfixes


  • Useless information is now hidden
  • Many speed optimizations

  • Bugfix that prevents installation in brand new deployments


  • Pseudo-enum support
  • Better support for FusionPBX 4.2

  • Bugfixes


  • IDR currency support
  • Minor fixes


  • Better support for FusionPBX 4.0


  • Support for FusionPBX 3.9


  • More fault tolerable
  • Better PostgreSQL support


  • Error fix for pricing verification
  • CSV importing rate lists now with multiple list support
  • Alphanumeric prefixes Support
  • Sudafrican Rand (ZAR) Support 
  • lcr.conf.xml.* files with new SQL queries to allow different pricing lists simultaneously

This article will help you to configure the LCR for FusionPBX native application in 10 minutes.  Please read the whole guide before configuring.  You must already have installed the application with a valid licence.


  1. To have a valid license of LCR or Billing for FusionPBX.
  2. To have a VoIP trunk to be hable to make calls to PSTN network, if you don;t have a vendor you can use To Call Me.
  3. To download pricing list in CSV format.  LCR for FusionPBX accepts native formats from Flowroute,, Voxbeam and To Call Me.  Any other format must be changed to next structure:
    Connect Increment,
    Talking Increment,
    Currency, [3 chars]
    Connect Rate,
    Direction, [inbound, outbound, internal]
    Start Date, [optional, if not specified then current date and time]
    End Date, [optional, if not specified then it will be 2099-12-31 06:50:00]
    Profile [use defaul if you dont know what to do, check lcr.conf.xml]
    Random [any value you want]

Carrier Configuration Procedure

  1. Log into FusionPBX with a superadmin user.
  2. Go to Accounts->Gateways menu and add a gateway if you don't have it yet. Details about configuration depends on your vendor.
  3. Go to App->LCR menu and add a Carrier. Fill the next values:
    Name: Label without spaces to identify your vendor
    Channels: Channel number your vendor gives to you.  Channel number is the number of simultaneous calls you can handle
    Enable: True or false to allow or not to use this vender on LCR decition
    Press the Save button.
  4. You will see your new carrier listed, edit it to add missing information.
  5. Link your carrier with a gateway (read step 2).  Fill next fields:
    Carrier: Select a gateway
    Suffix: If your carrier needs a prefix add it here; some carriers (mainly those who use IP authentication) needs a prefix
    Codec: Use a comma separated struna cadena sing to specify codecs your carrier needs to use, for example G729,GSM,PCMU. You may leave this value empty and FusionPBX will use default codecs
    Enable: Select true to allow this gateway to be selected on least cost route decition
  6. Link as many gateways you need to this Carrier.  Many vendors gives you more than one IP, this will allow you to have fault tolerance.
  7. Upload pricing CSV file (read step c) and press the button.  The process may delay, it depends on file size.  You will see SLQ code, when it finishes you can go backwards.  You are done, your vendor is ready to use.

Repeat these steps for each Carrier you need.

Allow LCR Procedure

  1. Go to Dialplan -> Outbound routes menu and edit your routes. Edit your routes and change your dialplans with next value: lcr/default/$1 (this value may vary depending on your configuration) this tells FusionPBX to use LCR to take carrier routing decition based on your destination.

About OKay

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.