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
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
Fedora 40 Beta Released Soon
With the official release of Fedora 40 coming in April, it's almost time to download the beta and see what's new.
-
New Pentesting Distribution to Compete with Kali Linux
SnoopGod is now available for your testing needs
-
Juno Computers Launches Another Linux Laptop
If you're looking for a powerhouse laptop that runs Ubuntu, the Juno Computers Neptune 17 v6 should be on your radar.
-
ZorinOS 17.1 Released, Includes Improved Windows App Support
If you need or desire to run Windows applications on Linux, there's one distribution intent on making that easier for you and its new release further improves that feature.
-
Linux Market Share Surpasses 4% for the First Time
Look out Windows and macOS, Linux is on the rise and has even topped ChromeOS to become the fourth most widely used OS around the globe.
-
KDE’s Plasma 6 Officially Available
KDE’s Plasma 6.0 "Megarelease" has happened, and it's brimming with new features, polish, and performance.
-
Latest Version of Tails Unleashed
Tails 6.0 is based on Debian 12 and includes GNOME 43.
-
KDE Announces New Slimbook V with Plenty of Power and KDE’s Plasma 6
If you're a fan of KDE Plasma, you'll be thrilled to hear they've announced a new Slimbook with an AMD CPU and the latest version of KDE Plasma desktop.
-
Monthly Sponsorship Includes Early Access to elementary OS 8
If you want to get a glimpse of what's in the pipeline for elementary OS 8, just set up a monthly sponsorship to help fund its continued existence.
-
DebConf24 to be Held in South Korea
Busan will be the location of the latest DebConf running July 28 through August 4