Putting FreeSWITCH to work
Now that we have covered the basics, it is time to roll up our sleeves and really put FreeSWITCH to work. We will first learn a bit more about the main tool for controlling FreeSWITCH, the Command Line Interface (or CLI), after which we will configure one or two telephones and make some test calls.
Controlling FreeSWITCH with the CLI
In Chapter 2, Building and Installation, we briefly discussed a utility called fs_cli
. As we generally will run FreeSWITCH as a daemon (Linux/Unix) or a service (Windows), it is important to become familiar with using fs_cli
. For convenience, you can add fs_cli.exe
to your path in Windows. In Linux/Unix you can create a symbolic link, as follows:
#>ln –s /usr/local/freeswitch/bin/fs_cli /usr/local/bin/fs_cli
Some Linux users prefer to add /usr/local/freeswitch/bin
to the Linux path.
Now, if you simply type fs_cli
at the system command prompt, it will launch the fs_cli
program for you.
Tip
Generally speaking, Windows executable files will have .exe
at the end of the filename. On Windows systems, the fs_cli
program is named fs_cli.exe
. Windows users can type fs_cli.exe
or just fs_cli
, whereas Linux/Unix users should type fs_cli
to launch the FreeSWITCH command-line utility.
Launch the command-line utility:
#>fs_cli
You will be greeted with the following FS CLI welcome message as shown in the following screenshot:
Once connected, everything you type will be sent to the FreeSWITCH server, except for commands that begin with a /
(slash) character. These slash commands control the behavior of the fs_cli
program itself. Issue the /help
command to see the list of available fs_cli
slash commands as shown in the following screenshot:
Note that there are several different slash commands for exiting the system: /exit
, /quit
, and /bye
. Also, there is the ellipsis (…) shortcut for exiting out of the fs_cli
program. All four of these commands will exit the fs_cli
utility and return you to the system prompt. They are all equivalent, so use whichever suits you. Keep in mind that when running FreeSWITCH from the console, that is, not as a daemon or service, the ellipsis shortcut will perform a FreeSWITCH system shutdown!
The other slash command to keep in mind is /log
. By default, fs_cli
starts up with full debug logging enabled. (The welcome screen mentions this fact with +OK log level [7] displayed at start up.) The /log
command will let you control what level of debug logging will be displayed during your fs_cli
session. You can change the log level at any point during your session. When you exit and restart fs_cli
, the log level will reset to 7. (This behavior can be controlled with the -d
or –-debug
command-line parameters.) Unless you wish to see a lot of debug information, it is best to set the log level to 6, as follows:
freeswitch@internal>/log 6 +OK log level 6 [6]
Each number from 0 to 7 represents a different debug level as noted in the following table:
You may use the name (case-insensitive) as well as the number when specifying the log level:
freeswitch@internal>/log info +OK log level info [6]
All the other commands you type will be sent to the FreeSWITCH server. There are a few basic commands to become familiar with. They are as follows:
help
: Displays a list of available CLI commands; these commands are called FSAPI commands or just APIs for shortversion
: Displays the FreeSWITCH version you are runningstatus
: Displays some statistics about the currently running instance of FreeSWITCHshow channels
: Displays a list of individual channels that are activeshow calls
: Displays a list of bridged calls
A channel is a single call leg. An example of a one-legged call is a user checking his or her voicemail. On the other hand, a call is two individual call legs bridged (that is, connected) together. Be sure to understand the difference between show channels
and show calls
.
In the next section, we will learn a few more commands that will help us configure phones to work with FreeSWITCH.