LCDC: the Least Cost Dialplan Compiler


Shell script to compile rate files for PSTN termination providers into a dialplan fragment. It does NOT require AGI or external applications at runtime.


The compiler uses as input the same ratefiles and/or "p_" and "c_" files as the LCDial.sh AGI script, and configuration files similar (but not identical) to the one in LCDial.sh AGI script. It is run with the command line:

lcdc [-v] lcdialmacro

where "lcdialmacro" is the user-chosen name of the macro that will replace the Dial() command in the dialplan entries. For instance, if "lcdialmacro" is "lcd", running:

lcdc -v lcd

will read an lcd.conf configuration file (located in /etc/asterisk/lcdialsh, but this may be changed by editing the first lines of the script) and will produce an lcd.inc file (in the same directory) which can be used by placing in extensions.conf:

  1. include lcdialsh/lcd.inc

That file will also contain the definition of a [macro-lcd] macro context, and the Least Cost Dial function will then be available for invokation in the dialplan with lines such as:

exten => _X.,1,Macro(lcd,${EXTEN}[,extra parameters...])

For full documentation, see the comments in the script body.

Getting it

Here is an ipkg package for installation on embedded platforms such as OpenWRT; it may also be opened e.g. with "tar -zxf" or, under Windows, 7Zip and installed manually. It includes documentation, sample configuration file and a few sample rates files. The package also includes three "ratefile gatherers" which can be invoked by a cron job to retrieve the rates published by three inexpensive PSTN termination providers (VoipJet, Teliax and GloboTech Communications). It also contains a "finareafreecoverage" script printing the table of free destinations offered by some Finarea-related service providers, based on the current content of "p_" files and "c_" files (see sample on Finarea SA's page).


Feel free to holler at the author Enzo Michelangeli

See also

Asterisk | Asterisk cmd dial
Created by: enzo, Last modification: Mon 27 of Mar, 2006 (07:57 UTC)
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+