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
-
Linux Kernel Reducing Long-Term Support
LTS support for the Linux kernel is about to undergo some serious changes that will have a considerable impact on the future.
-
Fedora 39 Beta is Now Available for Testing
For fans and users of Fedora Linux, the first beta of release 39 is now available, which is a minor upgrade but does include GNOME 45.
-
Fedora Linux 40 to Drop X11 for KDE Plasma
When Fedora 40 arrives in 2024, there will be a few big changes coming, especially for the KDE Plasma option.
-
Real-Time Ubuntu Available in AWS Marketplace
Anyone looking for a Linux distribution for real-time processing could do a whole lot worse than Real-Time Ubuntu.
-
KSMBD Finally Reaches a Stable State
For those who've been looking forward to the first release of KSMBD, after two years it's no longer considered experimental.
-
Nitrux 3.0.0 Has Been Released
The latest version of Nitrux brings plenty of innovation and fresh apps to the table.
-
Linux From Scratch 12.0 Now Available
If you're looking to roll your own Linux distribution, the latest version of Linux From Scratch is now available with plenty of updates.
-
Linux Kernel 6.5 Has Been Released
The newest Linux kernel, version 6.5, now includes initial support for two very exciting features.
-
UbuntuDDE 23.04 Now Available
A new version of the UbuntuDDE remix has finally arrived with all the updates from the Deepin desktop and everything that comes with the Ubuntu 23.04 base.
-
Star Labs Reveals a New Surface-Like Linux Tablet
If you've ever wanted a tablet that rivals the MS Surface, you're in luck as Star Labs has created such a device.