Building a telephony server with FreeSwitch


Freeswitch is an alternative to Asterisk to build a telephony server. It is also open-source, was launched by a member of the Asterisk development teamp who wanted to rewrite the whole thing from scratch to cleanly separate the switching part from the PBX part (Asterisk mixes the two due to its monolithic architecture). Unlike Asterisk, Freeswitch was meant to be cross-platform from the the start, and is available for Windows in addition to *nix.

OpenZAP supports direct access to Sangoma cards through the wanpipe interface, and indirect access to Digium-compatible cards through the Zaptel interface; Because of this, as of April 2009, Windows users can only use Sangoma cards, or rely on an external VoIP gateway. Edit March 2010: OpenZap has been replaced with FreeTDM.

Here's a list of hardware that have been tested with Freeswitch. What can you do with Freeswitch? Here's a list. A web-based interface to the FS users mailing list is available here.

And here's the reason why Freeswitch authors chose XML over eg. INI files.

The big picture

Freeswitch is configured through different XML files loaded through the main freeswitch.xml. At runtime when FreeSwitch parses all the files, the resultant file is located as log/freeswitch.xml.fsxml.

Contexts are a set of extensions located in conf/dialplan/ (eg. Default, Public, etc.), and effectively define the dialplan. A call can go through different contexts over the length of the call, eg. an  unauthenticated call from a VoIP provider first go through the Public context before before forwarded to an IVR context, and end up being connected to an internal extension.

Profiles define User Agents ("end points of a phone call", says Wikipedia), and handles connections on a given IP and port number. This enables Freeswitch to support multiple companies on the same host while providing enhanced security. By default, Freeswitch comes with two profiles: Internal (private LAN), and External (Internet-accessible, public LAN.)

In a dialplan, profiles make use of contexts (eg. <param name="context" value="public"/>). What users can do depends on whether they authenticated (eg. local users making internal and outgoing calls) or not (eg. incoming calls from remote VoIP provider.) For security reason, it's a good idea to have the Internal and External profiles use their own dialplan.

Users (extensions) are configured through files in conf/directory/. Each extension maps to a context (<variable name="user_context" value="default"/>). If you need to perform more complex actions, use the dialplan to call external scripts.

Gateways, a.k.a. trunks, don't need to authenticate with Freeswitch, and are configured in conf/directory/default/

conf/autoload_configs contains a lot of XML files, but only those listed in modules.conf.xml will actually be loaded automatically by Freeswitch.

IVR sound files in English are located under sounds/en/us/callie/ivr/8000/

Voice mail is saved under storage


Pre-compiled binaries for Windows

Freeswitch requires the "Microsoft VisualC++ 2005 Redistributable Package", a.k.a. msvcr80d.dll (source)

By default, the Windows package does not install Freeswitch as a service. To do this, open a DOS box, and run "c:\freeswitch\freeswitch -install"

Running FS on a SheevaPlug

Downloading the latest source code with Git

First, make sure Git and its required dependencies are installed:

  1. yum install autogen autoconf zlib-devel openssl-devel perl cpio expat-devel gettext-devel curl-devel curl bzip2 git
  2. cd /usr/src
  3. git clone git://

Downloading the latest source code with SVN

Here, we'll download and compile the latest source code using SVN.

Note: As of March 2009, the config script will compile for ODBC instead of SQLite if it detects that unixODBC is installed... but doesn't check whether its counterpart unixODBC-devel is also installed. If not, in Suse Desktop: rpm -qa | grep -i odbc ; rpm -Uvh unixODBC-devel-2.2.11-21.4.i586.rpm (or rpm install unixODBC-devel.i386 or yum install unixODBC-devel)

  1. If installed, remove Asterisk (ps aux | grep -i asterisk)
  2. (prerequisites) yum install subversion autoconf automake libtool gcc-c++ ncurses-devel make
  3. svn co /usr/src/freeswitch

Compiling and installing from source

  1. cd /usr/src/freeswitch
  2. If you need to eg. add OpenZap, edit modules.conf accordingly: ../../libs/openzap/mod_openzap
  3. ./
  4. ./configure
  5. make
  6. make install
  7. make cd-sounds-install && make cd-moh-install

    The sound file are available for some languages, and can be installed thusly: make cd-sounds-XX-install & make cd-moh-XX-install, where XX stands for the two-letter ISO name of the country (eg. ru, de, fr, etc.)
  8. make samples
  9. Edit PATH to include path to Freeswitch binaries (/usr/local/freeswitch/bin; for CentOS: Create /etc/profile.d/, add the line "export PATH=$PATH:/usr/local/freeswitch/bin", change access rights to this file: chmod 755 /etc/profile.d/, log off and log back on, echo $PATH)
  10. Run "freeswitch" to start the server manually
  11. Make sure the server is not running a firewall that would block incoming SIP connections (eg. /etc/init.d/iptables stop ; chkconfig iptables off; rpm -qa | grep -i iptable ; yum remove iptable)
  12. On a remote host, configure an SIP client: user=1000/password=1234/domain=server IP address, dial 9999 for music on hold or 5000 for an IVR
  13. "shutdown" to stop Freeswitch
  14. adduser freeswitch ; chown -R freeswitch:freeswitch /usr/local/freeswitch
  15. vipw (or vi /etc/password)

  16. To have Freeswitch start automatically at boot-time on a CentOS host:
    1. cp /usr/src/freeswitch/build/freeswitch.init.redhat /etc/init.d/freeswitch
    2. vim /etc/init.d/freeswitch

  17. chmod 755 /etc/init.d/freeswitch
  18. chkconfig freeswitch on
  19. chkconfig --list freeswitch
  20. Launch the server through the rc.d script: /etc/init.d/freeswitch start
  21. Wait about 30 seconds for Freeswitch to be  up and running, and connect to the server through the console: fs_cli
  22. Check SIP status: sofia status
  23. Check a specific SIP profile: sofia status profile internal
  24. To exit the console, type "/exit" or "..."; To stop the Freeswitch server and exit the console, type "fsctl shutdown elegant"

Using Freeswitch with a Digium FXO PCI card

If you use a PCI telephony card, you must first install Asterisk's Dahdi/Zaptel interface, followed by Freeswitch's OpenZap which relies on Dahdi.

Setting up Dahdi

  1. lspci -vv (Check that the hardware is detected)
  2. adduser asterisk; mkdir /etc/asterisk (to avoid errors during compile/install)
  3. cd /usr/src
  4. Download and unzip the latest Dahdi driver + tools from Asterisk
  5. make
  6. make install
  7. make config
  8. If you need to set options, eg. set the wctdm driver to work in France, vi /etc/modprobe.d/dahdi.conf:

    options wctdm opermode=FRANCE

  9. If you need to set eg. tones for France, vi /etc/dahdi/genconf_parameters: "lc_country fr"
  10. vi /etc/modprobe.d/dahdi.blacklist.conf:
    1. Comment out modules you do NOT want to blacklist
    2. Add "blacklist netjet"
  11. Reboot to get rid of the NetJet module that is loaded instead of the Wctdm module, and run "lsmod" to check that netjet/ISDN are gone
  12. Either run "dahdi_genconf modules", or edit /etc/dahdi/system.conf manually
  13. /etc/init.d/dahdi start, and check /var/log/messages
  14. For Freeswitch to be able to access the Dahdi devices, edit /etc/udev/rules.d/dahdi.rules, followed by "/etc/init.d/dahdi restart"

In case of trouble, take a look at OpenVox's Troubleshooting of Analog cards

Dahdi Configuration


Used to disable loading modules causing trouble for Dahdi, eg. netjet

This file sets module options.

Dahdi tools in /usr/sbin/

Setting up OpenZap

  1. cd /usr/src/freeswitch
  2. Edit modules.conf: Uncomment "../../libs/openzap/mod_openzap"
  3. Follow the instructions on how to compile Freeswitch
  4. vi /usr/local/freeswitch/conf/openzap.conf

    [span zt FXO]
    name => OpenZAP
    fxo-channel => 1

  5. vi /usr/local/freeswitch/conf/autoload_configs/openzap.conf.xml

        <span name="FXO">
  6. Run the Freeswitch console fs_cli, type "load mod_openzap", followed by "oz list"
  7. To have OpenZap be loaded automatically when Freeswitch starts, edit /usr/local/freeswitch/conf/autoload_configs/modules.conf.xml, and uncomment <load module ="mod_openzap"/>
  8. As OpenZap ignores the tones information from Dahdi and uses its own information, check that the tones information for your country are available in /usr/local/freeswitch/conf/tones.conf (examples)


If you experience echo, one thing to try is using the Open-source Line Echo Canceller (OSLEC).

Connecting FXO port to dialplan to extensions

Removing Dahdi

In case you wish to remove Dahdi so you can downgrade to Zaptel:

  1. /etc/init.d/dahdi stop
  2. rm -f /etc/init.d/dahdi
  3. rm -Rf /etc/dahdi/
  4. rm -f /etc/modprobe.d/dahdi.*
  5. rm -Rf /usr/share/dahdi/
  6. rm -f /usr/sbin/dahdi_*
  7. cd /usr/src/dahdi-linux/linux ; make uninstall
  8. reboot to check

Installing Zaptel

NOTE: Seems like Zaptel isn't compatible with more recent version of Linux. And since Zaptel has been replaced with Dadhi...

  1. yum install kernel-devel kernel-headers
  2. yum install gcc newt-devel libusb-devel
  3. cd /usr/src
  4. wget
  5. cd /usr/src/zaptel-
  6. ./install_prereq test
  7. ./configure
  8. make menuselect
  9. make
  10. make install
  11. make config

Connecting to the PSTN

A Freeswitch server can handle conversations over the analog phone network either by connecting out through ADSL to a VoIP provider on the Internet, or by connecting the server to a phone line on the premises through an SIP/PSTN gateway.

In this latter case, there are two options: Either an external device like the Linksys SPA-3102, or a PCI card from Digium, Sangoma, OpenVox, Atcom, etc. Sangoma also offers a two-FXO USB device.




External device

  • OS-independent, so Freeswitch can run on any computer
  • Cheaper than PCI cards
  • Provides an FXS port to connect an analog handset
  • More cables than a PCI card (power, Ethernet, PSTN)
  • Possible echo issue with SIP/PSTN connections

PCI card

  • More compact (onlye one cable: From card to PSTN wall plug)
  • More reliable than entry-level, external SIP/PSTN gateways
  • Requires a desktop computer
  • With one exception, only run under Linux
  • Possible incompatibility with some motherboards

Connecting Freeswitch to a PSTN line through the Linksys 3102

Here are few things to keep in mind: (uses the 3102 independantly, without Freeswitch)

Home VOIP system using FreeSwitch and a Linksys 3102 voice gateway (UK Guide)

SPA3102 FreeSwitch HowTo

  1. Reset the unit by plugging a handset in the Phone plug, and dialing **** followed by 73738#, and confirm with 1
  2. Since we won't use the 3102 as a router to connect two Ethernet networks, plug the 3102 to the LAN through its "Internet" connector, dial *** to enter the voice menu, followed by 110# to get its IP address, and 7932# followed by 1#, and 1 to enable the embedded web server
  3. Aim your browser at http://linksys-ip/admin/advanced (where linksys-ip is the 3102 IP address)


Wan Setup

Connection Type = Static IP

Static IP =

Netmask =

Gateway =

Primary DNS =

Secondary DNS =

Primary NTP Server =

Secondary NTP Server =

Enable WAN Web Server = yes

Lan Setup

Networking service = Bridge (so we can connect to the 3102 through either its Internet or Ethernet port; The LAN IP address is ignored)



Enable Web Admin Access = yes

Syslog/debug server =


SIP TCP Port Min/Max = 5060

RTP Port Min/Max (Must be port-mapped on NAT router, or can 3102 punch holes itself?)

"RTP Packet Size" should be changed from 0.030 to 0.020 to avoid problems ("When you make outbound call using analog phone attached to the FXS port and the person you call hears choppy voice")

NAT Support Parameters : what is VIA?

STUN Enable = yes

STUN Test Enable = ?

STUN Server =


EXT RTP Port Min

Regional (France)

Dial Tone = 440@-10; 10(*/0/1)

Second Dial Tone = 420@-19,520@-19;10(*/0/1+2)

Busy Tone = 440@-10; 10(0.5/0.5/1)

Ring Back Tone = 440@-10; 10(1.5/3.5/1)

Time Zone = GTM +1

DST Rule = start=3/-1/7/2;end=10/-1/7/3;save=1

FXS Port Impedance = 600

Caller ID Method = ETSI FSK

Caller ID FSK Standard = bell 202

Line 1

Line Enable = yes

NAT Mapping Enable = no

SIP Port = 5062

Proxy = FS server

User ID + Password = SIP account on FS server

Register = ?

Make/Ans Call Without Reg = ?

Dial Plan = ?


Line Enable = yes

NAT Mapping Enable = no

SIP Port = 5061

Proxy = FS server

User ID + Password

Preferred Codec = G711U

Dial Plan 1 = (S0<:9999>) //Incoming calls from POTS sent to extension 9999 on FS server

VoIP-To-PSTN Gateway Enable = ?

Line 1 VoIP Caller DP = 1

PSTN-To-VoIP Gateway Enable = ?

PSTN Ring Thru Line 1 = no


PSTN Caller Default DP = 1

VoIP Answer Delay = 0

PSTN Answer Delay = 0

PSTN Ring Thru Delay = 1

PSTN Ring Timeout = 5

Detect CPC = yes

Detect Polarity Reversal = yes

Detect Disconnect Tone = yes

Disconnect Tone = 480@-30,620@-30;4(.25/.25/1+2)

FXO Port Impedance = 370+620||310nF

User 1

Installing an X100P card from

  1. cd /usr/src
  2. wget
  3. tar xzvf ./zaptel-
  4. cd zaptel-
  5. ./configure
  6. make
  7. make install
  8. make config
  9. vim /etc/sysconfig/zaptel, and comment out modules you don't need (keep $MODULES wcfxo)
  10. cd /etc ; mv zaptel.conf zaptel.conf.orig
  11. vim /etc/zaptel.conf (for France):
  12. modprobe wctdm OR modprobe wcfxo?
  13. modprobe zaptel
  14. lsmod, and check that wcfxo, zaptel, and crc_ccitt are loaded
  15. ztcfg -vv (if it says "ZT_CHANCONFIG failed on channel 1: No such device or address (6)", it's a false alarm)



  1. /etc/zaptel.conf: fxsks=1 is last statement in file
  2. In BIOS, set PCI slot to use IRQ7
  3. Booted grub with acpi=no
  4. Booted grub with noapic (Linux gets stuck)
  5. Flashed BIOS with F2 version
  6. Removed Zaptel, rebooted, downloaded and compiled Dahdi (no config/configure -> make all; make install; make config; dahdi_genconf modules)
  7. Rebooted: FXO PCI Master abort...
  8. Shutdown: Replaced with a SCSI card which worked fine, retried the X100P... which now shows up in demsg :-/
  9. But... while lspci does return "Communication controller: Motorola SM56 PCI Modem", it's not listed in "cat /proc/interrupts"
  10. Also, when using the following for /etc/dahdi/system.conf...


    ... and running "/etc/init.d/dahdi restart": "Running dahdi_cfg:  DAHDI_CHANCONFIG failed on channel 1: No such device or address (6)"

    dahdi_cfg -vv : "DAHDI_CHANCONFIG failed on channel 1: No such device or address (6)"



The problem is with high-speed USB ports. I kept getting Unknown DAA errors. Soon as I disabled the USB ports everything worked as it should. It was the same case with EVERY motherboard I tried.


It was frustrating because everything worked fine in my old computer, but when I upgraded it was not.


Zaptel Version:

Echo Canceller: MG2





Channel map:


Channel 01: FXS Kewlstart (Default) (Slaves: 01)


1 channels to configure.


ZT_CHANCONFIG failed on channel 1: No such device or address (6)



If you have any zaptel hardware it is now recommended to edit /etc/sysconfig/zaptel and set there an optimal value for the variable MODULES .

I think that the zaptel hardware you have on your system is:

pci:0000:03:00.0     wcfxo-       1057:5608 Wildcard X100P





Need to first install Zaptel/Dahdi?

  1. lspci -v to check that the card is recognized
  2. cat /proc/interrupts to check that the card was assigned an IRQ. If not listed here,

If still NOK, "remove any unneeded peripheral from the PCi bus, toggle the plug-n-play option in your bios. If you have a "Reset Hardware Configuration" or something like that turn it on. Also try a different PCI slot.

Systems running chipsets from SIS, nvidia and some VIA (so pretty much all AMD) dont handle those cards very well at all.

acpi noaicp nosmp etc..etc

echotraining =x


Does OpenZap work with Dadhi 2.x?

Playing with Freeswitch

Important commands

Some important commands that you send through the bin/fs_cli command-line interface:

GUI for FreeSwitch

Configuring a Siemens 580IP

Leave the handset on its cradle long enough to fully charge the battery, then connect the base station to the router so it gets an IP configuration through DHCP. To check what IP address was assigned and configure the handset from a web browser, open the Menu and navigate to "IP Address".

By default, System PIN = 0000

Settings > Telephony > Connections > Configure "IP1" to connect the 580IP to Freeswitch

Domain = IP address of Freeswitch server

Registrar = IP address of Freeswitch server

In case the 580IP is used to register with another SIP server besides Freeswitch, here's how to configure things so that the handset if you prefer to have it handle the dialplan instead of Freeswitch:


If I want to use a different line manually, specify its number (eg. 5551234#2 to use line #2) as listed in "Telephony > Connections".

In case you want all outgoing calls to be handled by the Freeswitch server, ie. not make use of the 580IP dialplan feature, add the VoIP gateways to the Freeswitch server, and just create a single connection in the Siemens in "Telephony > Number Assignment".


What is the use of the "Telephony > Dialling Plans > Dialling Plans" section?

When should I use "Telephony > Number Assignment > Call Manager"?

What to try

Common extensions for testing:

Enable mod_python, and have Python scripts be called by the dialplan

Configure SIP accounts, including voicemail and sending e-mail.


Connect a PSTN/VoIP gateway

Investigating issues

fs_cli> console loglevel [0-7] (where 1=EMERG and 7=DEBUG)

fs_cli> sofia loglevel <all|default|tport|iptsec|nea|nta|nth_client|nth_server|nua|soa|sresolv|stun> [0-9]

fs_cli> sofia loglevel all 0

fs_cli > sofia profile <profilename> siptrace on|off

fs_cli > sofia tracelevel info #details in log/freeswitch.log file

Configuration files

Here's a diagram to get the big picture.

By default, configuration files live in /usr/local/freeswitch/conf/. The XML files are either stand-alone or include references to other XML files.

Note that an X-PRE-PROCESS line cannot be commented out, and must be removed entirely if not needed.

Information is available in the Getting Started Guide, and the Freeswitch default configuration layout.

Configuration data is stored in XML files under /usr/local/freeswitch/conf/ . This layout is in no way required, you can minimize the configuration to just one file if needed. The main config file is called freeswitch.xml, you don't need to change it in any way, it just loads all other config files.


FS doesn't need more than the hard-coded conf/freeswitch.xml, but it's a much better idea to have it load different XML files from sub-directories to handle SIP accounts, dialplans, etc. At runtime when FreeSwitch parses all the files, the resultant file is located as log/freeswitch.xml.fsxml. freeswitch.xml contains multiple sections, each used by a different component in FreeSwitch: "configuration", "diaplan", "directory", and "phrases" (to locate sound files).


Used to define global variables


This is the directory where you'll customize your dialplan; Equivalent to Asterisk's extensions.conf

Diaplans are located in conf/dialplan/ . Everything in the public context is available to everyone, while everything in "default" context are only available to users that have registered with FreeSWITCH. Logically, this should be "internal", but I guess "default" is a legacy.

You can define in the user profiles (in the directory) which context they belong to, and you can define the public context in the sofia configuration. Contexts are a logical grouping of extensions. You may have multiple extensions contained within a single context.

dialplan: This is the place where you setup your dialplan. There are some examples of how to configure your dialplan included. (recipes); put your custom diaplan entries into the extensions subdirectory under conf/dialplan. You may create one or more XML files in this subdirectory, all of which will be included in the dialplan thanks to an "include" directive in the default.xml file. By keeping your customized extensions separate from default.xml you will be able to update default.xml without having to re-enter your custom extensions.


A list of modules that are automatically loaded when Freeswitch starts; modules.conf.xml tells Freeswitch which modules to load. There are certain modules required for operation so you should not edit this file unless you know that you wish to add or remove a specific module.

The sofia.conf.xml file includes other xml files (conf/sip_profiles/*.xml) to define multiple "profiles" (ie. contexts; See below).

Note that by default, all XML configuration files under autoload_configs/ are parsed, even if a module is commented out in modules.conf.xml, but Freeswitch will only actually use settings for modules that are explicitely listed in modules.conf.xml


A list of SIP extensions, one XML file per extensions. User authentication is available under conf/directory/ . For instance, a connection to a remote VoIP gateway can be done through either the external profile or through information in directory/.

directory: The directory contains all users that may register and use freeswitch as their pbx.; holds authentication credentials for other sip endpoints that will register to freeswitch (most commonly users). The directory configuration default is configured to process the glob $PREFIX/conf/directory/default/*.xml by the configuration included in freeswitch.xml $PREFIX/conf/directory/*.xml.


Tells FS how to talk sip. Each profile has its own port. Unlike other softswitches (like Asterisk), FreeSWITCH allows you to handle media (calls, video, etc.) differently based on where the equipment is attached to your network. This assists with security as well as providing added functionality. SIP Profiles allow you to define paths to devices or carriers that may live inside or outside your network. These paths can be of many different types, but must consist of a unique combination of port and IP pairs.

You could have SIP profiles for your internal network, or multiple profiles for each subnet of your internal network, or even completely different protocols like IPv6 as profile definitions. This helps FreeSWITCH identify how to route different types of calls when necessary, and also gives you the flexibility to tailor your dialplans based on what path a call originates to/from. The default profiles are located in: $PREFIX/conf/sip_profiles/PROFILE_NAME.xml -- where PROFILE_NAME is the name of the profile.

A list of contexts, eg. Internal, External, etc. This adds security and lets Freeswitch handle media that take different forms (voice, video, etc.). A profil consists in an IP address + Port number, and contains information that will be inherited by devices using this profile

A profile is a SIP UA (an endpoint), which communicates with other SIP endpoints. An obvious reason for multiple profiles is to tell Sofia how to handle calls meant for remote SIP users behind the NAT router, and calls meant for local SIP users located on the same LAN as the originating caller. 

Each profile contains a complete description of a SIP UA. When FreeSWITCH starts, it reads sofia.conf.xml and starts up a separate UA for each profile in the configuration file.

In FS, SIP equipments can have different profiles, and are located under SIP_Profiles/. By default, there is an internal profile (register by connecting to FS on UDP5060) and an external profile (Connect to FS on UDP5080; nat.xml is deprecated.)

The default profiles are located in: $PREFIX/conf/sip_profiles/PROFILE_NAME.xml -- where PROFILE_NAME is the name of the profile.In order to secure your FreeSwitch it is wise to link your outbound (external) profile to a dialplan context other than 'default', which in the default configuration is the where authenticated users are placed.

The default port for external connections is 5080. This also means if you are trying to connect a phone remotely to your FreeSWITCH box, you must set it to connect on port 5080, or change your ports around. 

Working with the XML files

Type "reloadxml" in the FS console to apply changes made to XML files.

Creating a new SIP account, and adding it to the Internal SIP profile/context

cd conf/directory/default/ ; cp 1000.xml 1234.xml; vi 1234.xml

Adding a new VoIP gateway



There are two ways to define VoIP gateways, depending if they're common to all SIP users, or user-specific. More information in Clarification: Gateways. A list of examples to connect to SIP providers is available here.

Create a new XML file in conf/sip_profiles/external

For outbound calls, add a new file in conf/dialplan/default/. Important: Freeswitch uses the files in their alphanumerical order, so 00_ is called before 01_

For inbound calls, add a new files in conf/dialplan/public/

A fuller example:

  1. cd conf/sip_profiles/external; cp example.xml mygw.xml; vi mygw.xml:
  2. <include>
      <gateway name="outbound.mygw">
        <param name="username" value="****yourusername"/>
        <param name="password" value="****yourpassword"/>
        <param name="proxy" value="****outboundurl"/>
        <param name="register" value="false"/>
      <gateway name="inbound.mygw">
        <param name="username" value="****yourusername"/>
        <param name="password" value="****yourpassword"/>
        <param name="extension" value="1000"/>
        <param name="proxy" value="****inboundurl"/>
        <param name="register-proxy" value="****inboundurl"/>

Creating a new dialplan (including an IVR), and linking it to the new SIP account

Note: Since filenames determine the order in which Freeswitch loads XML files depends on their filename, make sure existing files in the same folder aren't loaded before yours.

Here's how to create an outbound dialplan:

  1. cd conf/dialplan/default; vi 00_outbound_mygw.xml
  2. <include>
       <extension name="dialmygw">
         <condition field="destination_number" expression="^(\d{7,11})$">
           <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
           <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
           <action application="bridge" data="sofia/gateway/outbound.mygw/$1"/>

Here's how to create an inbound dialplan:

  1. cd conf/dialplan/public; vi 00_inbound_mygw.xml
  2. <include>
      <extension name="public_did">
        <condition field="destination_number" expression="^(.*)$">
          <action application="set" data="domain_name=$${domain}"/>
          <action application="transfer" data="1000 XML default"/>
  3. In order to secure your FreeSwitch it is wise to link your outbound profile to a dialplan context other than 'default', which in the default configuration is the where authenticated users are placed.

    Note: The nat.xml file (and profile) have been deprecated. Use the external profile and port 5080.

Scripts can access Freeswitch through its Even Socket Library.


For security reason, it is recommended to link the outbound profile ("External") to its own dialplan, different from the one used for internal calls ("Internal", previously known as "Default").

By default, note that the Internal profile listens for incoming connections on UDP5060 while the External profile listens on UDP5080.

Freeswitch and NAT firewalls

Here are some ports that Freeswitch uses and will have to go through firewalls:

General NAT example scenarios

Securing Freeswitch

This is especially important if the Freeswitch box is open to the Internet to let remote SIP users connect to FS, or access a web server running on the same box.

  1. Remove any unneeded applications
  2. Disable unneeded services
  3. Use a NAT firewall, especially one that can capture illegitimate login requests and block those IP addresses from getting into your system
  4. Configure SSH and Apache to listen to non-standard ports
  5. Create a user account specifically to be used with SSH, and configure SSH to only allow connections from this user (eg. useradd mysshuser; passwd mysshuser; vi /etc/ssh/sshd_config : AllowUsers mysshusers AND PermitRootLogin no AND Port 196; restart SSHd)
  6. SIP: Choose secure passwords for accounts, and double-check the SIP profiles that allow dialing out through the POTS



Compact PCs without PCI slot

Sources to check for this type of hardware:

Compact PCs with PCI slot

Intel Atom-based motherboards

Non-Intel motherboards

Asterisk Appliances

Full alternative hardware

Seagate Dockstar

Raspberry Pi

SwitchPi project.

Planex MZK-W04NU


Linksys WRT54

FritzBox 7270

Linksys NSLU2


In vars.xml, what is default_password used for?

<X-PRE-PROCESS cmd="set" data="default_password=1234"/>

It's the SIP default password if none given in user files under conf/directory/default/:

# cat 1000.xml
  <user id="1000" mailbox="1000">
      <param name="password" value="$${default_password}"/>
      <param name="vm-password" value="1000"/>

What are the options to connect a FS server to a POTS line?

To act as a VoIP gateway, you can use external solutions like Sangoma's USB device, or Ethernet-based solutions like Linksys' SPA-3102 or GrandStream's HT503.

If  you'd rather use a PCI card: As of April 2009, FS' OpenZAP interface can talk to hardware either directly (only Sangoma cards are supported), or indirectly through the Zaptel interface (which isn't available for Windows).

How to configure routers to allow remote IP clients to connect to Freeswitch and/or POTS VoIP gateway?

SIP TCP/UDP  5060 - 5090  

RTP UDP      16384 - 32768

? What about the connection between VoIP gateway and a remote SIP client?

How to install FS as a service in Windows?

What is mod_spidermonkey?

The Mozilla SpiderMonkey Javascript (ECMA Script) engine

What is mod_sofia?

"This module wraps the sofia SIP library from Nokia."

How to check my voicemail?

Dial 4000, followed by the extension # and password (with the test accounts, password=extension)

Articles to read in the Freeswitch wiki

  1. DONE Docs/MainPage
  2. DONE Download
  3. DONE Install guide
  4. DONE Configuring FreeSWITCH
  5. DONE
  6. Admin documentation (Includes examples, debugging, JavaScript examples, etc.)
  7. User documentation
  8. conf/freeswitch.xml
  9. conf/Vars.xml
  10. conf/autoload_configs/modules.conf.xml
  11. conf/autoload_configs/sofia.conf.xml
  12. conf/directory/ (user configuration)
  13. conf/sip_profiles/ (internal, external)
  14. conf/dialplan/ (Dialplan_XML, recipes)
  15. From Asterisk to Freeswitch
  16. Freeswitch FAQ
  18. Home VOIP system using FreeSwitch and a Linksys 3102 voice gateway (UK Guide) by Rob Smart
  19. How To Set Up a Linksys SPA3102 VOIP Router/ATA for BT UK

Other stuff to read

SIP and NAT firewalls

Options: STUN + port maping, UPnP or nat-pmp (to automate port mapping), IAX

ATCOM IAX Hard phones (530P?)

DIAX softphone (looks ugly)

I've used both AT530 and AT530P ip phones, they have good voice quality and somehow resistent to harsh environment like offices ;) , except the keypad which after a year or more just sometimes types two digits with one push on a button. The AG188N ATA is also a good choise and we have some installation which work without any problem yet.

Pika Warp: their support and development enviroment sucks

What to Do With a $99 Wall Wart Linux Server

GSM gateways: EdgePBX, PORTech MV-370, OpenVox G400P (+ at least one GSM module + SIM card)