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.

Buy this article as PDF

Express-Checkout as PDF
Price $2.95
(incl. VAT)

Buy Linux Magazine

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content

  • Post-PRISM Privacy

    Linux users didn't need the recent NSA eavesdropping scandal to convince them that securing communication was a good idea. Free software developers have been creating secure tools for years that offer similar functionalities to all of those popular but very leaky services with ridiculous names.

  • FreeSWITCH 1.0.2 with New Codecs and Fax for VoIP

    Free VoIP platform software FreeSWITCH is now in version 1.0.2. Enhancements include a fax module and new codecs for higher sampling rates.

comments powered by Disqus
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.

Learn More