Call Us Today! 877.742.2583

Page tree
Skip to end of metadata
Go to start of metadata


by Meftah Tayeb

Below you'll find a step by step guide for installing FreeSWITCH™ as a SBC. The LCR engine is provided by mod_lcr. The DID routing is done by mod_easyroute

This is all still development work and needs testing.


 Click here to expand Table of Contents



Install Debian stable netinstall

Upgrade debian distribution

Install SSH Server for remote administration

This will add MySQL enter a password etc.

Install FreeSWITCH dependencies


Restart server

Install utils for compilation




Download FreeSWITCH latest trunk and put them in /usr/src/freewitch

Edit modules.conf depending on your needs but you must enable mod_easyroute and mod_lcr modules.
 I recommend disabling mod_voicemail and mod_conferencing this is an SBC not a softswitch.

Enable mod_easyroute & mod_lcr in trunk/modules.conf by uncommenting the lines.

Upgrade to latest git

and that's it you get the latest git in /usr/src/freeswitch

Edit sip_profiles to use our outside IP

cd /usr/local/freeswitch/conf/sip_profiles

edit external.xml and replace $${local_ip_v4} and $${external_rtp_ip} your external IP. You will use external profiles for all endpoints. We will need to add security later. I also recommend you swap the internal port 5060 with the default port 5080. Most providers use 5060.

Optimizations before launching FreeSwitch


Start FreeSWITCH verify it works before we go too far.

-hp stands for high priority

You may see errors about ODBC not loaded

To connect to FreeSWITCH via fs_cli Command Line

with this tool you'll be able to get a console connection to FS the log level has not been changed so it could be very verbose to disable log, type /nolog in console

To Check if FS is running



Tell FreeSWITCH to actually use MOD_Easyroute & MOD_LCR module when running. Add the modules to modules.conf.xml in /usr/local/freeswitch/conf/autoload_configs.

Also disable any unused codecs, mod_voicemail and mod_conferencing

Now we need to enable odbc. This is for a mysql database.

Configuring ODBC

This is where you configure your various odbc drivers. On Debian systems the file was in /etc/odbcinst.ini

Note: you may have to change the path to the .so files depending on where they are installed. Default location for Debian: /usr/lib/odbc/

Basic odbc.ini:

This is where you configure your datasources. Your configs will reference [MySQL-free] since this is an ODBC connection. On Debian systems the file was in /etc/odbc.ini```


This file is in /usr/local/freeswitch/conf/autoload_configs The easyroute.conf.xml file will need to be configured with the settings for your database:

NOTE: The default technology profile and default gateway will be returned if the db lookup fails.

lcr.conf.xml & switch.conf.xml & db.conf.xml

These files are in /usr/local/freeswitch/conf/autoload_configs They will need to be configured with the settings for your database:

Create MySQL database

Okay now we need to create the tables - check the latest code first. There should be .sql files in the trunk but they normally are Postgresql or need tweaked.

Create some table data

Now we have tables. You will want to populate the npa_nxx_company_ocn table

download this via ftp to you server. Enter into MySQL

That should have populated the database table with the NPA data.

Sample data for lcr

Testing our database connections

From the freeswitch command line issue something similar to:

Which would respond with something like:


From the freeswitch command line issue something similar to:

If this comes back our databases are working.

Okay now we need to use this data to route traffic. I don’t know if this is the best way to do this but hey we are all learning. I route my traffic based on the sending IP. This is also a means of security. If the sending IP isn’t in the dialplan it won’t route in theory.

Each SIP Trunk endpoint will need an extension in the dialplan Providers will need an easyroute extension & Customers will need a LCR extension.

This is a provider that sends me traffic and I route based on IP then DID database lookup. I have also added ringback and audio error if out of trunks just like a wireline carrier..


Then we check that we are not over the limit for this trunk


This is a customer that sends me traffic and I route based on IP then LCR database lookup.

 Stop FreeSWITCH /usr/local/freeswitch/bin/freeswitch -stop

Lowering FS Log Level vi /usr/local/freeswitch/conf/autoload_configs/switch.conf.xml

Set Call Admission Control vi /usr/local/freeswitch/conf/autoload_configs/switch.conf.xml

With these settings, we have defined a maximum of 500 bridged calls (2*500 channels) and a maximum of 100 new sessions per second. You should set these parameters according to your hardware

Creation of a ramdisk for the FS database

Use Proxy Media to keep FS in the RTP media path (topology hiding) but without analyzing RTP or DTMF vi /usr/local/freeswitch/conf/sip_profiles/external.xml

Disable Presence Support in SIP_Profiles vi /usr/local/freeswitch/conf/sip_profiles/internal.xml



Okay at this point we have the general setup complete. You will need to add gateways and clean up the dialplan and add cdrs into the mix.. If you need help let me know I'm happy to help. This setup is the basic way most ITSP use SBCs. I need help with some things so If we want to start an SBC group I would be happy to help.

I’m really open to help on making a web interface for all this and making it more efficient. I pulled a lot of data from other posts please help move this along Thanks to all the Devel Teams' great work

Right now I use phpmyadmin to manage the SBC database.


Can I know you? I am Tayeb (aka DelphiWorld)