FreeSWITCH 1.2
eBook: $26.99
Formats: PDF, PacktLib, ePub and Mobi formats
save 15%!
Print + free eBook + free PacktLib access to the book: $71.98    Print cover: $44.99
save 37%!
Free Shipping!
UK, US, Europe and selected countries in Asia.
Also available on:
Table of Contents
Sample Chapters

Learn how to install and configure a complete telephony system of your own, even if this is your first time using FreeSWITCH In-depth discussions of important concepts like the dialplan, user directory, NAT handling, and the powerful FreeSWITCH event socket Best practices and expert tips from the FreeSWITCH experts, including the creator of FreeSWITCH, Anthony Minessale

Book Details

Language : English
Paperback : 428 pages [ 235mm x 191mm ]
Release Date : May 2013
ISBN : 1782161007
ISBN 13 : 9781782161004
Author(s) : Anthony Minessale, Michael S Collins, Darren Schreiber, Raymond Chandler
Topics and Technologies : All Books, Networking and Servers, Networking & Telephony, Open Source

Table of Contents

Chapter 1: Architecture of FreeSWITCH
Chapter 2: Building and Installation
Chapter 3: Test Driving the Example Configuration
Chapter 4: SIP and the User Directory
Chapter 5: Understanding the XML Dialplan
Chapter 6: Using XML IVRs and Phrase Macros
Chapter 7: Dialplan Scripting with Lua
Chapter 8: Advanced Dialplan Concepts
Chapter 9: Moving Beyond the Static XML Configuration
Chapter 10: Controlling FreeSWITCH Externally
Chapter 11: Web-based Call Control with mod_httapi
Chapter 12: Handling NAT
Chapter 13: VoIP Security
Chapter 14: Advanced Features and Further Reading
Appendix A: The FreeSWITCH Online Community
Appendix B: Migrating from Asterisk to FreeSWITCH
Appendix C: The History of FreeSWITCH
  • Chapter 1: Architecture of FreeSWITCH
    • A revolution has begun and secrets have been revealed
    • The FreeSWITCH design – modular, scalable, and stable
    • Important modules – Endpoint and Dialplan
    • Complex applications made simple
      • Voicemail
      • Multi-party conferencing
      • The FreeSWITCH API (FSAPI)
      • The XML registry
      • Language modules
      • The demonstration configuration
    • Summary
    • Chapter 2: Building and Installation
      • Setting up the FreeSWITCH environment
        • Operating system
      • Operating system prerequisites
        • Linux/Unix
        • Mac OS X
        • Windows
      • Text editors and XML
      • Downloading the source
      • Building from the latest code
      • Compiling FreeSWITCH for Linux/Unix/Mac OS X
        • Compiling FreeSWITCH
          • Step 1 – edit modules.conf
          • Step 2 – run the configure script
          • Step 3 – run the make and make install utilities
          • Step 4 – edit modules.conf.xml
          • Step 5 – install sound and music files
      • Compiling FreeSWITCH for Windows
        • Important considerations for Windows users
        • Building the solution with MSVC/MSVCEE
      • Starting FreeSWITCH
      • Running FreeSWITCH in the background
      • Summary
      • Chapter 3: Test Driving the Example Configuration
        • Important concepts to understand
        • Putting FreeSWITCH to work
          • Controlling FreeSWITCH with the CLI
        • Configuring a SIP phone to work with FreeSWITCH
          • SIP settings
          • X-Lite soft phone
          • Hard phones
            • Aastra phones
            • Polycom phones
            • Snom phones
        • Testing the example Dialplan
          • Test calls for a single phone
            • The Tetris extension
            • Echo test
            • Music on hold
            • Demonstration IVR
            • The information application
          • Test calls for two or more phones
            • Calling another telephone
            • Parking a call
            • Calling a conference
          • Example Dialplan quick reference
        • Summary
        • Chapter 4: SIP and the User Directory
          • Understanding the FreeSWITCH user directory
          • Working with the FreeSWITCH user directory
          • User features
          • Adding a user
          • Testing voicemail
          • Groups of users
          • Connecting to the world with gateways
            • Setting up a new gateway
            • Making calls
            • Receiving calls
            • Making calls without a gateway
          • SIP profiles and user agents
          • Summary
          • Chapter 5: Understanding the XML Dialplan
            • FreeSWITCH XML Dialplan elements
            • Contexts
              • Default
              • Public
              • Features
            • Extensions
              • Conditions
            • Call legs and channel variables
            • Accessing channel variables
            • Regular expressions
            • Actions and anti-actions
            • How Dialplan processing works
            • Creating a new extension
            • Important Dialplan applications
              • bridge
              • playback
              • say
              • play_and_get_digits
              • ivr
              • sleep
              • answer
              • pre_answer
              • hangup
              • set
              • transfer
            • Dialstring formats
            • Summary
            • Chapter 6: Using XML IVRs and Phrase Macros
              • IVR engine overview
              • IVR XML configuration file
              • IVR engine overview
                • IVR menu definitions
                  • greet-long
                  • greet-short
                  • invalid-sound
                  • exit-sound
                  • timeout
                  • inter-digit-timeout
                  • max-failures
                  • max-timeouts
                  • digit-len
                  • tts-voice
                  • tts-engine
                  • confirm-key
                  • confirm-macro
                • IVR menu destinations
                  • menu-exec-app
                  • menu-play-sound
                  • menu-back
                  • menu-top
                • Routing calls to your IVR
                • Nesting IVRs
              • Using phrases with IVRs
                • Calling Phrase Macros
                • Phrase Macro examples – voicemail
              • Advanced routing
              • Summary
              • Chapter 7: Dialplan Scripting with Lua
                • Getting started with Lua
                  • Running Lua scripts from the Dialplan
                • Basic Lua syntax
                • Building voice applications
                  • A simple IVR – interacting with the caller
                  • Conditions and looping
                  • Even more conditions and looping
                • Advanced IVR concepts
                  • Connecting to a database with LuaSQL
                  • Making a web call with curl
                  • Lua patterns versus regular expressions
                • Scripting tips
                • Summary
                • Chapter 8: Advanced Dialplan Concepts
                  • Dialplan overview
                  • General Diaplan concepts
                    • Contexts
                    • Conditions
                    • Actions
                  • Putting it all together
                  • XML Dialplan module review
                    • Extensions
                    • Conditions
                    • Special condition variables
                    • Inline execution
                    • Actions and anti-actions
                    • The regex operator
                    • Nested conditions
                  • Pitfalls to avoid
                  • XML Dialplan applications
                    • mod_dptools
                    • mod_sofia
                    • mod_commands
                  • Utilizing variables
                    • Testing variables with regular expressions
                    • Caller profile fields
                    • Channel variables
                      • Channel variables and call setup
                  • Global variables
                  • Dialplan functions
                    • Real-time condition evaluation
                    • String conditioning
                    • Database queries
                    • SIP contact parameters
                  • Set, export, and legs
                    • Set versus export
                  • Passing variables via call headers
                  • XML Dialplan cookbook
                    • Match by IP address and call a number
                    • Match an IP address and Caller ID
                    • Match a number and strip digits
                    • Match a number, strip digits, and add a prefix
                    • Call a registered device
                    • Try party A, then party B
                    • Route DIDs to extensions
                    • Alternate outbound gateways
                    • Multiple endpoints with enterprise originate
                  • Summary
                  • Chapter 9: Moving Beyond the Static XML Configuration
                    • The mod_xml_curl basics
                    • The mod_xml_curl Dialplan
                    • The mod_xml_curl folder
                    • The mod_xml_curl configuration
                    • The mod_xml_curl summary
                    • Generating configurations dynamically with language bindings
                    • Making calls from the command line interface
                    • Using ESL to execute commands
                    • Summary
                    • Chapter 10: Controlling FreeSWITCH Externally
                      • General overview
                      • Event system architecture
                      • Event-based modules
                        • mod_event_socket
                          • Configuring event socket settings
                          • Reading events
                          • Minimum event information
                      • Sending events
                      • Events from the Dialplan
                        • mod_event_multicast
                      • FreeSWITCH event system commands
                        • auth <password>
                        • api
                        • bgapi
                        • event
                        • noevents
                        • divert_events
                        • filter
                        • filter delete
                        • nixevents
                        • sendevent
                        • sendmsg <uuid>
                        • execute
                        • hangup
                        • nomedia
                        • log <level>
                        • nolog
                        • linger
                        • nolinger
                      • FreeSWITCH Console application
                      • Event Socket Library
                        • Supported libraries
                        • ESLObject
                          • eslSetLogLevel($loglevel)
                        • ESLevent object
                          • serialize([$format])
                          • setPriority([$number])
                          • getHeader($header_name)
                          • getBody()
                          • getType()
                          • addBody($value)
                          • addHeader($header_name, $value)
                          • delHeader($header_name)
                          • firstHeader()
                          • nextHeader()
                        • ESLconnection object
                          • new($host, $port, $password)
                          • new($fd)
                          • socketDescriptor()
                          • connected()
                          • getInfo()
                          • send($command)
                          • sendRecv($command)
                          • api($command[, $arguments])
                          • bgapi($command[, $arguments])
                          • sendEvent($send_me)
                          • recvEvent()
                          • recvEventTimed($milliseconds)
                          • filter($header, $value)
                          • events($event_type,$value)
                          • execute($app[, $arg][, $uuid])
                          • executeAsync($app[, $arg][, $uuid])
                          • setAsyncExecute($value)
                          • setEventLock($value)
                          • disconnect()
                      • Events in practice
                        • Event Socket Library example – running a command
                        • Examples of sending events to FreeSWITCH
                          • Setting phone lights
                          • Rebooting a phone
                          • Requesting phone reconfiguration
                          • Custom notify messages
                      • Summary
                      • Chapter 11: Web-based Call Control with mod_httapi
                        • HTTAPI syntax
                          • Work actions
                            • playback
                            • vmname
                            • record
                            • pause
                            • speak
                            • say
                            • execute
                            • sms
                            • dial
                            • recordCall
                            • conference
                            • hangup
                            • break
                            • log
                            • continue
                            • getVar
                            • voicemail
                        • mod_httapi configuration file
                          • Permissions
                          • Exiting
                          • Storing data across successive requests
                          • Some parameters are missing from some requests
                          • Making it easier
                        • The demo IVR – in HTTAPI
                        • Summary
                        • Chapter 12: Handling NAT
                          • A brief introduction to NAT
                            • Understanding the evolution of NAT
                          • The four pitfalls of NAT
                          • Demystifying NAT settings in FreeSWITCH
                          • Making media flow
                          • Advanced options and settings
                          • FreeSWITCH on the client side
                          • Other creative uses of FreeSWITCH in a NAT situation
                          • Conclusion
                          • Summary
                          • Chapter 13: VoIP Security
                            • Network level protection
                              • Separating interfaces and restricting traffic
                                • Sample setup – simple
                                • Sample setup – complex
                              • VLANs
                              • Intrusion detection
                              • Registration monitoring
                                • Fail2Ban
                              • Encryption
                            • Protecting SIP signalling
                              • Choosing between encryption options
                                • Encryption with SSL
                                • Encryption with TLS
                            • Protecting audio
                              • Encryption with SRTP
                              • Encryption with ZRTP
                          • Protecting passwords
                            • Registration passwords
                            • Voicemail passwords
                          • Summary
                            • Chapter 14: Advanced Features and Further Reading
                              • Multi-user conferencing
                                • Configuration
                                  • Conference profiles
                                  • Caller controls
                                • Advertise
                                • Sending and receiving XMPP events
                                • Connecting callers to the conference
                                • Controlling active conferences
                              • Nibblebill
                                • Use cases
                                  • Billing (pre-pay)
                                  • Billing (post-pay)
                                  • Pay-per-call service billing
                                  • Maximum credit and/or fraud prevention
                                • Design goals
                                • Installation and configuration
                                • Database tables
                                • Creating the database table for PostgreSQL
                                • Creating the database table for MySQL
                                • Billing a call
                                  • The nibble method (default)
                                  • An alternative to nibble billings
                                • Examples
                                  • Different rates per user
                                  • Single rate for all users
                                  • Different rates per area code
                                  • Different rates per service delivery
                                  • Hang up the call when the balance is depleted
                                  • Application/CLI/API commands
                                  • Adding and deducting funds
                                  • Enabling session heartbeat
                                  • Bill based on B Leg only
                              • Alternative endpoints
                                • Skype and GSM endpoints
                                  • Skype with mod_skypopen
                                • GSM with mod_gsmopen
                                • TDM with FreeTDM
                              • Configuration tools and related projects
                              • Web GUIs
                                • FusionPBX
                                • FreePyBX
                                • Kazoo
                              • Supporting libraries
                                • Liverpie (Ruby)
                                • FreeSWITCHeR (Ruby)
                                • Librevox (Ruby)
                                • EventSocket (Python/Twisted)
                                • FSSocket (Perl)
                              • Vestec Automatic Speech Recognition
                              • Summary
                              • Appendix A: The FreeSWITCH Online Community
                                • The FreeSWITCH mailing lists
                                • Talking in real time via IRC
                                • The FreeSWITCH main website and wiki
                                  • The main FreeSWITCH page –
                                  • The FreeSWITCH wiki page –
                                • The annual ClueCon open source developer conference
                                • Appendix B: Migrating from Asterisk to FreeSWITCH
                                  • Getting started
                                    • Starting and stopping Asterisk or FreeSWITCH
                                    • Basic debugging
                                      • Asterisk
                                      • FreeSWITCH
                                  • Configuration files
                                  • Two SIP phones
                                    • Asterisk configuration
                                    • FreeSWITCH configuration
                                    • Analysis
                                  • Voicemail
                                    • Asterisk
                                    • FreeSWITCH
                                    • Accessing voicemail
                                      • Asterisk
                                      • FreeSWITCH
                                  • Summary

                                    Anthony Minessale

                                    Anthony Minessale has been working with computers for nearly 30 years. He is the primary author of FreeSWITCH and Director of Engineering for CudaTEL at Barracuda Networks. He created and continues to run the ClueCon Telephony Developers Conference, held every August in Chicago. He has extensive experience in the Internet industry and VoIP. Before creating FreeSWITCH, he contributed heavily to the Asterisk open source project, producing many features that are still in use today. At Barracuda Networks, Anthony oversees the production and development of the CudaTEL PBX appliance that uses FreeSWITCH as its core telephony engine.

                                    Michael S Collins

                                    Michael S Collins is a telephony and open source software enthusiast. He is a PBX veteran, having worked as a PBX technician for five years and as the head of IT for a call center for more than nine years. He is an active member of the FreeSWITCH community and has co-authored FreeSWITCH Cookbook, Packt Publishing. He resides in Central California with his wife and two children and currently works for Barracuda Networks, Inc.

                                    Darren Schreiber

                                    Darren Schreiber is the CEO and Co-founder of 2600 Hz. He began working heavily in open source voice with the FreeSWITCH project, where he engaged with Brian, Mike, and Anthony. His projects have since evolved into two enterprise VoIP platforms that allow a multitude of development of voice, SMS, and video applications to be delivered to customers.

                                    He has 15 years of voice and IT experience including developing multiple enterprise SaaS infrastructures for hosting and remotely managing IT, voice, and e-commerce services. He is a guest lecturer at major universities on VoIP technology and leads paid international VoIP trainings. As a serious telephony enthusiast since a young age, he has worked extensively with VoIP technologies. He graduated from Rensselaer Polytechnic Institute with a degree in Computer Science and Business Management.

                                    He is also a co-author of FreeSWITCH Cookbook, Packt Publishing.

                                    Raymond Chandler

                                    Raymond Chandler(@intralanman) has been working with, and contributing to, open source projects for over a decade. Raymond's VoIP experience started with a small CLEC/ITSP using SER for call routing, and Asterisk for voicemail and advanced services. After encountering limits in Asterisk and looking for features not easily found in SER, he moved to using OpenSER and CallWeaver (then known as While that combination was better, he still had not found his perfect solution. In 2006, he was introduced to FreeSWITCH. Since then, he's been using FreeSWITCH and regularly contributing to the community. He is the author of mod_lcr and several utility PHP/Perl scripts. He now works with Anthony Minessale as a CudaTel Software Engineer at Barracuda Networks (@CudaTel and @Barracuda). In the spring of 2011, he was among the founding members of the Open Source Telephony Advancement Group (@OSTAG), whose mission is to advance open source telephony to new heights by funding open source projects through funds received by generous contributions and grants from those who share the OSTAG vision.
                                    Sorry, we don't have any reviews for this title yet.

                                    Code Downloads

                                    Download the code and support files for this book.

                                    Submit Errata

                                    Please let us know if you have found any errors not listed on this list by completing our errata submission form. Our editors will check them and add them to this list. Thank you.


                                    - 2 submitted: last submission 06 May 2014

                                    Page No.: 376 | Errata type: Layout The code line number 5 should be highlighted. <extension name="vmain"></extension> <condition field="destination_number" expression="^vma</p> <p> in$|^4000$|^\*98$"></condition> <action application="answer"></action> <action application="sleep" data="1000"></action> <action application="voicemail" data="check default ${domain_ name}"></action>    

                                    Page No: 83 | Errata type: Code related |

                                    It is: <condition field="destination_number" 


                                    It should be: <condition field="destination_number" expression="^(MY_IPTEL_USERNAME)$">


                                    Page No: 104 | Errata type: Technical |

                                    It is: Save the file. Launch fs_cli and issue the reload_xml command, or press F6.

                                    It should be: Save the file. Launch fs_cli and issue the reloadxml command, or press F6.

                                    Page No: 142 | Errata type: Code related


                                    It is: thankyou = "ivr" .. pathsep .. "ivr-Thank_you.wav"


                                    It should be: thankyou = "ivr" .. pathsep .. "ivr-thank_you.wav"

                                    Sample chapters

                                    You can view our sample chapters and prefaces of this title on PacktLib or download sample chapters in PDF format.

                                    Frequently bought together

                                    FreeSWITCH 1.2 +    Machine Learning with R =
                                    50% Off
                                    the second eBook
                                    Price for both: £26.35

                                    Buy both these recommended eBooks together and get 50% off the cheapest eBook.

                                    What you will learn from this book

                                    Set up a basic system to make and receive phone calls, make calls between extensions, and utilize basic PBX functionality Deploy different features of this telephony system with best practices and expert tips Understand the inner workings and architecture of FreeSWITCH Use advanced features to create powerful dialplans Overcome frustrating NAT issues Control FreeSWITCH remotely with the powerful event socket Create web-controlled telephony apps with the new HTTAPI system Secure your VoIP communications

                                    In Detail

                                    FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice and chat-driven products, scaling from a soft-phone to a PBX and even up to an enterprise-class soft-switch. It is always exciting to design and build your own telephony system to suit your needs, but the task is time-consuming and involves a lot of technical skill."FreeSWITCH 1.2" comes to your rescue to help you set up a telephony system quickly and securely using FreeSWITCH. It is rich with practical examples and will give you all of the information and skills needed to implement your own PBX system.You will start with a detailed description of the FreeSWITCH system architecture. Thereafter you will receive step-by-step instructions on how to set up basic and advanced features for your telephony platform.The book begins by introducing the architecture and workings of FreeSWITCH before detailing how to plan a telephone system and then moves on to the installation, configuration, and management of a feature-packed PBX. You will learn about maintaining a user directory, XML dial plan, and advanced dial plan concepts, call routing, and the extremely powerful Event Socket. You will finally learn about the online community and history of FreeSWITCH."FreeSWITCH 1.2" is an indispensable tool for novice and expert alike.


                                    This book is full of practical code examples aimed at a beginner to ease his or her learning curve.

                                    Who this book is for

                                    This book is written for IT professionals and enthusiasts who are interested in quickly getting a powerful telephony system up and running using the free and open source application, FreeSWITCH. Telephony experience will be helpful, but not required.

                                    Code Download and Errata
                                    Packt Anytime, Anywhere
                                    Register Books
                                    Print Upgrades
                                    eBook Downloads
                                    Video Support
                                    Contact Us
                                    Awards Voting Nominations Previous Winners
                                    Judges Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software
                                    Open Source CMS Hall Of Fame CMS Most Promising Open Source Project Open Source E-Commerce Applications Open Source JavaScript Library Open Source Graphics Software