Book Image

FreeSWITCH 1.6 Cookbook

By : Giovanni Maruzzelli, Anthony Minessale II
Book Image

FreeSWITCH 1.6 Cookbook

By: Giovanni Maruzzelli, Anthony Minessale II

Overview of this book

Table of Contents (14 chapters)
FreeSWITCH 1.6 Cookbook
About the Authors
About the Reviewers


FreeSWITCH is increasingly becoming the "serious choice" for companies to base their products and offerings on. Its usage is widespread, scaling from Raspberry Pis to "Big Irons" in the data center.

There is a growing need for books and training, and with Packt Publishing, we decided to begin serving this burgeoning demand. This cookbook is a primer; then there will be a Mastering FreeSWITCH book, followed by a new edition of the classic FreeSWITCH book.

Obviously, nothing can beat a training camp or codeveloping in collaboration with an old hand, but these FreeSWITCH titles will form the basis on which a company or a consultant can begin embracing, deploying, and implementing FreeSWITCH.

This book is a complete update, rewrite, and integration of the old FreeSWITCH cookbook. This new edition covers FreeSWITCH 1.6.x, and a lot of new ground.

All the examples here have been updated and tested with the new FreeSWITCH series, while a new section has been added about connecting to Skype, and two entire chapters are on WebRTC and Lua programming.

Anthony Minessale II, Giovanni Maruzzelli

July 5 2015

What this book covers

Chapter 1, Routing Calls, shows that getting calls from one endpoint to another is the primary function of FreeSWITCH. This chapter discusses techniques of efficiently routing calls between phones and service providers.

Chapter 2, Connecting Telephones and Service Providers, assists in quickly getting your FreeSWITCH server connected to other VoIP devices. Telephones and service providers have specific requirements for connecting to FreeSWITCH.

Chapter 3, Processing Call Detail Records, discusses a number of ways to extract CDR data from your FreeSWITCH server. Call detail records, or CDRs, are very important for businesses.

Chapter 4, External Control, presents a number of real-world examples of controlling FreeSWITCH from an external process. FreeSWITCH can be controlled externally by the powerful and versatile event socket interface.

Chapter 5, PBX Functionality, is the largest chapter in this book. This chapter shows how to deploy features such as voicemail, conference calls, faxing, IVRs, and more, which most telephone systems have, in a FreeSWITCH server.

Chapter 6, WebRTC and Mod_Verto, features the new disruptive technology that allows real-time audio/video/data-secure communication from hundreds of millions of browsers. FreeSWITCH is ready to serve as a gateway and an application server.

Chapter 7, Dialplan Scripting with Lua, covers Lua, the scripting language of choice for programming complex logic in FreeSWITCH. Accessing databases, calling web servers, and interacting with user's choices now becomes easy.

What you need for this book

FreeSWITCH 1.6 Cookbook is an essential addition to any VoIP administrator's or WebRTC developer's library. PBX implementers will also gain from the thoroughly distilled recipes presented here.

Whether you are a FreeSWITCH expert or are just getting started, this book will take your skills to the next level.

Who this book is for

FreeSWITCH 1.6 Cookbook is written for anyone who wants to learn more about using FreeSWITCH in production. The information is presented in such a way that you can get up and running quickly. The cookbook approach eschews much of the foundational concepts, and instead focuses on discrete examples that illustrate specific features. If you need to implement a particular feature as quickly as possible, then this book is for you.


In this book, you will find several headings that appear frequently (Getting ready, How to do it, How it works, There's more, and See also).

To give clear instructions on how to complete a recipe, we use the following sections.

Getting ready

This section tells you what to expect in the recipe, and describes how to set up any software or any preliminary settings required for the recipe.

How to do it…

This section contains the steps required to follow the recipe.

How it works…

This section usually consists of a detailed explanation of what happened in the previous section.

There's more…

This section consists of additional information about the recipe in order to make you more knowledgeable about the recipe.

See also

This section provides helpful links to other useful information for the recipe.


In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "Many of the techniques employed in Local_Extension are discussed in this chapter."

A block of code is set as follows:

  <extension name="public_did">
    <condition field="destination_number"expression="^(8005551212)$">
      <action application="set" data="domain_name=$${domain}"/>
      <action application="transfer" data="1000 XML default"/>

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

  <extension name="public_did">
    <condition field="destination_number"expression="^(8005551212)$">
      <action application="set" data="domain_name=$${domain}"/>
      <action application="transfer" data="1000 XML default"/>

Any command-line input or output is written as follows:

perl -MCPAN -e 'install Regexp::Assemble'

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "You should see an application named directory in the list."


Warnings or important notes appear in a box like this.


Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files from your account at for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit and register to have the files e-mailed directly to you.

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from


Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to and enter the name of the book in the search field. The required information will appear under the Errata section.


Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.


If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.