|Last modified: 16-06-2020|
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.
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
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"
First, make sure Git and its required dependencies are installed:
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)
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.
In case of trouble, take a look at OpenVox's Troubleshooting of Analog cards
Used to disable loading modules causing trouble for Dahdi, eg. netjet
If you experience echo, one thing to try is using the Open-source Line Echo Canceller (OSLEC).
In case you wish to remove Dahdi so you can downgrade to Zaptel:
NOTE: Seems like Zaptel isn't compatible with more recent version of Linux. And since Zaptel has been replaced with Dadhi...
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.
Here are few things to keep in mind:
http://www.aoakley.com/articles/2008-01-08.php (uses the 3102 independantly, without Freeswitch)
Home VOIP system using FreeSwitch and a Linksys 3102 voice gateway (UK Guide)
Connection Type = Static IP
Static IP = 192.168.0.253
Netmask = 255.255.255.0
Gateway = 192.168.0.254
Primary DNS = 184.108.40.206
Secondary DNS = 220.127.116.11
Primary NTP Server = 0.fr.pool.ntp.org
Secondary NTP Server = 1.fr.pool.ntp.org
Enable WAN Web Server = yes
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 = 192.168.0.1
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 = stun.ekiga.net
EXT RTP Port Min
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 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 CID For VoIP CID = yes
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
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: 18.104.22.168
Echo Canceller: MG2
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?
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
Does OpenZap work with Dadhi 2.x?
Some important commands that you send through the bin/fs_cli command-line interface:
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"?
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
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
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.
Type "reloadxml" in the FS console to apply changes made to XML files.
cd conf/directory/default/ ; cp 1000.xml 1234.xml; vi 1234.xml
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:
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:
Here's how to create an inbound dialplan:
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.
Here are some ports that Freeswitch uses and will have to go through firewalls:
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.
Sources to check for this type of hardware: www.linuxdevices.com
<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/:
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).
SIP TCP/UDP 5060 - 5090
RTP UDP 16384 - 32768
? What about the connection between VoIP gateway and a remote SIP client?
"This module wraps the sofia SIP library from Nokia."
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)http://blogs.zdnet.com/Greenfield/?p=233