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

01 <include>
02   <user id="1500" mailbox="1500">
03     <params>
04       <param name="password" value="$${default_password}"/>
05       <param name="vm-password" value="1500"/>
06     </params>
07     <variables>
08       <variable name="toll_allow" value="domestic,international,local"/>
09       <variable name="accountcode" value="1500"/>
10       <variable name="user_context" value="default"/>
11       <variable name="effective_caller_id_name" value="Katherine"/>
12       <variable name="effective_caller_id_number" value="1500"/>
13       <variable name="outbound_caller_id_name" value="$${outbound_caller_name}"/>
14       <variable name="outbound_caller_id_number" value="$${outbound_caller_id}"/>
15       <variable name="callgroup" value="techsupport"/>
16     </variables>
17   </user>
18 </include

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.

Read full article as PDF:

Freeswitch.pdf (439.86 kB)

Related content

  • 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.

  • 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.


  • A Software Development Kit for FreeSwitch

    I thought I would suggest an SDK (Software Development Kit) that I found recently with FreeSwitch. It is called OZEKI VoIP SIP SDK, with FreeSwitch support. Here is their website: http://voip-sip-sdk.com/p_4...-sdk-with-freeswitch-voip.html
    I think it is a good opportunity for a developer to create a customized VoIP application, and I suggest it to professionals, who are interested in VoIP technology.

  • CEL is lossy codec


    Overall, a good article.

comments powered by Disqus

Direct Download

Read full article as PDF:

Freeswitch.pdf (439.86 kB)