VoIP with FreeSWITCH
Configuration Highlights
The default FreeSWITCH configuration has many features. Table 1 shows Dialplan highlights, and Table 2 shows some of the more important files and subdirectories in the FreeSWITCH configuration.


The default install will create a directory named /usr/local/freeswitch/conf, which I'll refer to as $CONF. All config files are XML and can include other XML files.
The top of this XML tree is $CONF/freeswitch.xml, which includes various XML files that in turn include still more XML files. This arrangement allows you to make changes to the FreeSWITCH configuration without sifting through a particularly large file.
FreeSWITCH as a Daemon
To start FreeSWITCH as a daemon, use the -nc (no console) command-line argument:
freeswitch -nc
FreeSWITCH will report that it is backgrounding and will give the process ID (PID). To stop Free-SWITCH, simply execute freeswitch -stop at the Linux prompt. For now, leave FreeSWITCH running and use the fs_cli command to connect: You will be greeted with a brief welcome message and a CLI prompt and perhaps some debug messages on the screen. To turn down the debug level, type:
/log info
This will restrict log messages to the INFO level and lower and keep you from being inundated with debug information.
All commands to the fs_cli program begin with a slash, so type /help to see a list of available commands. Anything else typed at the fs_cli prompt will be sent to the FreeSWITCH server, with one exception: The ellipsis (…) will not shut down FreeSWITCH from fs_cli; rather, it exits the fs_cli program. Instead of shutting down FreeSWITCH from within fs_cli, exit the program and then issue the freeswitch -stop command at the Linux prompt.
Just let FreeSWITCH continue to run in the background while you set up a new user and modify the Dialplan.
Adding a New SIP User
FreeSWITCH comes with 20 users predefined, but if you want to add more, just two steps modify the configuration:
- Add a user entry in $CONF/directory/default/
- Modify the Dialplan to allow the new user to be called
To add a new user named "Katherine" with extension number 1500, change directory into $CONF/directory/default and make a copy of 1000.xml:
cp 1000.xml 1500.xml
In an editor, open 1500.xml, replace 1000 with 1500, and change the effective_caller_id_name to Katherine. Your new file should look similar to Listing 1.
Listing 1
New User 1500.xml
Now open $CONF/dialplan/default.xml and locate the Dialplan entry (or "extension") named Local_Extension. In the line
<condition field="destination_number" expression="^(10[01][0-9])$">
those familiar with regular expressions will recognize that ^(10[01][0-9])$ means "match exactly four digits – of which the first two are 10, the next one is 0 or 1, and the last one is any digit from 0 to 9 – and store the matched value in the variable $1." Put more simply, it matches anything from 1000-1019, inclusive.
To add the new user Katherine at extension 1500, use the pipe character, which is a logical OR:
<condition field="destination_number" expression="^(10[01][0-9]|1500)$">
Now launch the fs_cli program and then type reloadxml or press F6. The new extension is now ready for use.
The best way to test it is to set up a softphone (or a hard phone, if you have one) as 1500 with FreeSWITCH. In your X-Lite client, open the SIP account settings and change the display name to Katherine and the User name and Authorization user name fields to 1500 before saving the settings. Your client will momentarily say registering and then will say Ready in the display. Now you can make calls from your new extension. If you have a second phone, you can register it as 1000 and use it to call 1500.
« Previous 1 2 3 Next »
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Find SysAdmin Jobs
News
-
MNT Seeks Financial Backing for New Seven-Inch Linux Laptop
MNT Pocket Reform is a tiny laptop that is modular, upgradable, recyclable, reusable, and ships with Debian Linux.
-
Ubuntu Flatpak Remix Adds Flatpak Support Preinstalled
If you're looking for a version of Ubuntu that includes Flatpak support out of the box, there's one clear option.
-
Gnome 44 Release Candidate Now Available
The Gnome 44 release candidate has officially arrived and adds a few changes into the mix.
-
Flathub Vying to Become the Standard Linux App Store
If the Flathub team has any say in the matter, their product will become the default tool for installing Linux apps in 2023.
-
Debian 12 to Ship with KDE Plasma 5.27
The Debian development team has shifted to the latest version of KDE for their testing branch.
-
Planet Computers Launches ARM-based Linux Desktop PCs
The firm that originally released a line of mobile keyboards has taken a different direction and has developed a new line of out-of-the-box mini Linux desktop computers.
-
Ubuntu No Longer Shipping with Flatpak
In a move that probably won’t come as a shock to many, Ubuntu and all of its official spins will no longer ship with Flatpak installed.
-
openSUSE Leap 15.5 Beta Now Available
The final version of the Leap 15 series of openSUSE is available for beta testing and offers only new software versions.
-
Linux Kernel 6.2 Released with New Hardware Support
Find out what's new in the most recent release from Linus Torvalds and the Linux kernel team.
-
Kubuntu Focus Team Releases New Mini Desktop
The team behind Kubuntu Focus has released a new NX GEN 2 mini desktop PC powered by Linux.