FreeSWITCH 1.2
上QQ阅读APP看书,第一时间看更新

Compiling FreeSWITCH for Windows

As mentioned in the Operating system prerequisites section, FreeSWITCH is built with MSVC or MSVCEE. The steps presented here are specifically for MSVCEE 2010; however, the steps for the various editions of MSVC are essentially the same.

Important considerations for Windows users

Unless you are a developer, you may find that using the FreeSWITCH binary installer is more than adequate for your needs. Simply download the x86 or x64 freeswitch.msi from http://files.freeswitch.org/windows/installer/ and run the installer. It is extremely simple to do. More information about the binaries can be found online at http://wiki.freeswitch.org/wiki/Installation_for_Windows#Precompiled_Binaries.

With the new features present in Microsoft's Visual Studio 2010, it is now highly advisable that users should use this development environment instead of Visual Studio 2008. Please do note that the recommendation also applies to the Express Editions. Some of the exciting new modules added in FreeSWITCH since 1.0.6 may not be present in the Visual Studio 2008 project files, as the contributors of the project mainly focused on developing applications with Visual Studio 2010.

At the time of writing, please do not attempt to import the Visual Studio 2010 solution file in a Visual Studio 2012 build environment, as FreeSWITCH currently does not build correctly with it.

Building the solution with MSVC/MSVCEE

There are several small steps to take prior to building with MSVCEE. They are as follows:

  1. Create a new folder and copy the bz2 file into it. In our example, we'll use the following:

    C:\FreeSWITCH\freeswitch-1.2.1.tar.bz2

  2. Right-click on freeswitch-1.2.1.tar.bz2 and extract the files with your decompression utility. You will now have a new file named freeswitch-1.2.1.tar.
  3. Right-click on freeswitch-1.2.1.tar and extract the files. This process will take a few moments. For 7-zip, you will then see a window similar to the following screenshot:
    Note

    WinRAR decompresses both the .gz and .tar files in a single step.

  4. After extraction, you will have a new sub-folder named after the latest version of FreeSWITCH. In our example, we now have a sub-folder named freeswitch-1.2.1. Double-click on the folder to see the complete FreeSWITCH source tree. It will be similar to the screen in the following screenshot:
  5. While there are many files, the only ones we care about right now are the two solution files. For MSVC, the file is named Freeswitch.2010.sln, and for MSVCEE, it is named Freeswitch.2010.express.sln. Double-click on the appropriate solution file for your edition of MSVC. The screenshots in this example will show MS Visual C++ Express Edition. However, the Professional and Ultimate editions will be very similar.
  6. After the solution file loads, click on the drop-down box (located on the toolbar) and change from Debug to Release, then go to Build | Build Solution or press F7. If you are using the Visual Studio 2010 IDE, then go to Build | Build Solution or enter the Ctrl + Shift + B key sequences. The solution will start building. Numerous messages will appear in the Output window. When the solution has finished building, you will see a message at the bottom of the Output window as shown in the following screenshot:
    Note

    The MSVC/MSVCEE solution files will automatically perform several steps that are usually done manually in a Linux/Unix installation. These include downloading all the sound and music files and building optional modules like Flite (text-to-speech) and PocketSphinx (speech recognition). However, these optional modules still need to be enabled in modules.conf.xml if you wish to have them automatically loaded when FreeSWITCH starts. More information about PocketSphinx can be found at http://cmusphinx.sourceforge.net/wiki/start. Go back to the Windows Explorer. You will see that the build process has created a new folder named Release. This is the FreeSWITCH installation directory. The last step before launching FreeSWITCH is to edit the modules.conf.xml file in order to enable mod_flite to be loaded by default when FreeSWITCH is started. We will be using the mod_flite text-to-speech (TTS) engine in several examples throughout this book.

  7. Double-click on the conf folder, then double-click on the autoload_configs folder. Open modules.conf.xml in an editor. In our example, we'll use MSVCEE to edit the file as seen in the following screenshot:
  8. Locate the following line near the end of the file:
    <!-- <load module="mod_flite"/> -->

    Remove the <!-- and --> tags so that it looks like the following:

    <load module="mod_flite"/>
  9. Save the file and exit the editor. You are now ready to launch FreeSWITCH for the first time.