In my last two articles we looked at how to install FreeSWITCH on WIndows and the basic FreeSWITCH configuration. We have now seen how to create client extensions on the PBX as well as how to configure the internal SIP Profile to be able to serve client requests. Moreover, we have used a free software client to setup a test extension and verify that it could register on the PBX.
Today we will familiarize ourselves with the important CLI commands that are essential for basic troubleshooting and verification on the PBX. We will also examine the procedure for connecting our local VoIP system with a VoIP’s provider’s SIP network.
To give wings to our PBX system we need to set up basic dial plan cases. In order to do that you need to understand perl regular expressions, because the FreeSWITCH dial plan structure is full of them, therefore I will also try to provide a simple description of the most important regular expressions that you’ll need.
Basic FreeSWITCH Console Commands
Before getting into more configuration details, I believe it is wise to say first a few things about the FreeSWITCH Console, the tool that provides basic system administration and monitoring. There are two ways to access the FreeSWITCH console:
- By launching the Freeswitch.exe executable file you are immediately placed into the console. This method can only be used if manual initiation of FreeSWITCH is performed in case that FreeSWITCH launches automatically through a script.
- Access to console commands is done through fs_cli.exe, another executable file which can be found under the default FreeSWITCH path (C:/Freeswitch). This is the only way to access the console in case you automate FreeSWITCH initiation by running it as a service.
You can find an extensive article on FreeSWITCH console commands on the FreeSWITCH wiki.
Here are some basic commands that you will often use:
- Sofia status: Displays all your SIP profiles, VoIP gateways and their current state
- Sofia status profile <profile_name>: Displays details about a specific SIP profile. For example, “sofia status profile internal” displays your internal SIP profile’s configuration details and existing registered users. A sample output of this command is shown below:
- Status: Displays the system’s uptime details
- Reloadxml: Reloads dial plan xml files so that configuration updates take immediate effect
- Sofia profile <profile_name> restart: Restarts the specific profile. No need to reset the whole PBX system
How to Configure a VoIP Gateway
To be able to connect your PBX to a VoIP provider, a gateway (trunk) definition is needed. To configure your VoIP gateway you have to create a new xml file, similar to the example.xml file located under conf/sip_profiles/external folder.
You should give your file a sensible name and store it under this same folder. A sample gateway definition is presented below. Various VoIP providers have different configuration prerequisites; therefore you should consult your provider for guidelines.
An extensive list of SIP Provider examples can be found on the FreeSWITCH wiki.
The operation of the external gateway is controlled by the external SIP profile located under conf/sip_profiles. This file, called external.xml, is similar to the internal.xml file which I have already presented extensively in my previous article. If you haven’t done so, you should definitely spend some time on reading the first article in this series How to Configure FreeSWITCH on Windows Part 1.
Learning Regular Expressions in Preparation for Dial-Plan Configuration
To be able to perform digit manipulation and activate your dialing routes, you need first to understand how FreeSWITCH performs digit analysis. It is not a big deal so don’t be afraid. Once you learn the character notation of the regular expression (regexp) syntax you will be able to generate any type of dial plan recipe. You will be amazed at how sophisticated digit processing can be accomplished with this specific expression annotation.
I have grouped all important RegExp notations along with simple examples into the following table. You should print out this table. It will come in handy during your dial-plan manipulation (click on the table to see it full screen and to print it).
Up Next: FreeSWITCH Configuration Part 3
Now that you have learned about Regular Expressions we will move on to some basic Dial-plan recipes. Stay tuned, in my next article I will provide actual examples of dialing plans on FreeSWITCH. I will also show you how to install FreeSWITCH as a service so that it can be automatically initiated when the computer or server restarts.











Thanks for these discussions. Still looking for Part 3
James,
We’re glad you found this series helpful. Check out part 3 right here: http://www.trainsignal.com/blog/freeswitch-how-to