You are previewing Mastering FreeSWITCH.
O'Reilly logo
Mastering FreeSWITCH

Book Description

Master the art of advanced VoIP and WebRTC communication with the most dynamic application server, FreeSWITCH

About This Book

  • Forget the hassle - make FreeSWITCH work for you

  • Discover how FreeSWITCH integrates with a range of tools and APIs

  • From high availability to IVR development use this book to become more confident with this useful communication software

  • Who This Book Is For

    SysAdmins, VoIP engineers – whoever you are, whatever you’re trying to do, this book will help you get more from FreeSWITCH.

    What You Will Learn

  • Get to grips with the core concepts of FreeSWITCH

  • Learn FreeSWITCH high availability

  • Work with SIP profiles, gateways, ITSPs, and Codecs optimization

  • Implement effective security on your projects

  • Master audio manipulation and recording

  • Discover how FreeSWITCH works alongside WebRTC

  • Build your own complex IVR and PBX applications

  • Connect directly to PSTN/TDM

  • Create your own FreeSWITCH module

  • Trace SIP packets with the help of best open source tools

  • Implement Homer Sipcapture to troubleshoot and debug all your platform traffic

  • In Detail

    FreeSWITCH is one of the best tools around if you’re looking for a modern method of managing communication protocols through a range of different media. From real-time browser communication with the WebRTC API to implementing VoIP (voice over internet protocol), with FreeSWITCH you’re in full control of your projects. This book shows you how to unlock its full potential – more than just a tutorial, it’s packed with plenty of tips and tricks to make it work for you.

    Written by members of the team who actually helped build FreeSWITCH, it will guide you through some of the newest features of version 1.6 including video transcoding and conferencing. Find out how FreeSWITCH interacts with other tools and APIs, learn how to tackle common (and not so common) challenges ranging from high availability to IVR development and programming advanced PBXs.

    Great communication functionality begins with FreeSWITCH – find out how and get your project up and running today.

    Style and approach

    Find out how it works, then put your knowledge into practice - that's how this advanced FreeSWITCH guide has been designed to help you learn. You'll soon master FreeSWITCH and be confident using it in your projects.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. Mastering FreeSWITCH
      1. Table of Contents
      2. Mastering FreeSWITCH
      3. Credits
      4. About the Authors
      5. About the Reviewers
      6. Contributors
      7. www.PacktPub.com
        1. eBooks, discount offers, and more
          1. Why subscribe?
      8. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Conventions
        5. Reader feedback
        6. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      9. 1. Typical Voice Uses for FreeSWITCH
        1. Understanding routing calls in FreeSWITCH
          1. Wholesale (provider to providers)
          2. Residential uses of FreeSWITCH
          3. Routing with federated VoIP
          4. Dialers/telemarketing
        2. FreeSWITCH Products and Services
          1. Business PBX services (hosted and on-premises)
          2. Call centers
          3. Value added services and games, prizes, and polls
          4. "Class 4" vs "Class 5" operations (and SBCs)
          5. WebRTC / web services / Internet-only services
          6. Mobile "over-the-top" SIP
        3. Development
          1. Strict on output, broad on input
          2. Very structured, very reusable techniques
          3. Polyglot by vocation and destiny
          4. Extreme scalability, from embedded to big irons
          5. Born internationalist
          6. Telcos internal integration ("FreeSWITCH is the Perl of VoIP")
          7. Rapid new services prototyping
        4. Accounting and billing
          1. Call Detail Records (CDRs)
          2. Mod_nibblebill / CGrateS
          3. Other billing options (open source - commercial)
        5. Summary
      10. 2. Deploying FreeSWITCH
        1. Network requirements
          1. Understanding QoS
          2. LANs, WANs, and peering
        2. Testing with SIPp
          1. Running scenarios
          2. Load testing
        3. Logging with FreeSWITCH
        4. Call Detail Records
        5. Monitoring
          1. SNMP
            1. SNMP and FreeSWITCH
            2. Installation and configuration (on Linux)
            3. Getting more information
          2. Monitoring tools
          3. Monitoring with Nagios
            1. Monitoring with Cacti
        6. HA deployment
          1. Storage, network, switches, power supply
          2. Virtualization
          3. Load balancing and integration with Kamailio and OpenSIPS
            1. In the Web world
            2. In the FreeSWITCH world
          4. DNS SRV records for geographical distribution and HA
        7. Summary
      11. 3. ITSP and Voice Codecs Optimization
        1. ITSPs – what they do
        2. Routes (to numbers)
        3. DIDs (aka DDIs) – numbers
        4. Quality of routes
          1. White, black, and grey
          2. Codecs and bandwidth
          3. Infrastructure capability
        5. Various important features
        6. Support, redundancy, high availability, and number portability
        7. Summary
      12. 4. VoIP Security
        1. Latest versions of it all
        2. Default configuration is a demo
        3. Change passwords
        4. Lock all that's not trusted
        5. Dropping root privileges (file permissions)
        6. Fail2ban on all services
          1. FreeSWITCH jail
          2. SIP(S) and (S|Z)RTP
        7. Encrypting SIP with TLS (SIPS)
        8. Encrypting (S)RTP via SDES (key exchange in SDP)
        9. Encrypting (S)RTP via ZRTP (key exchange in RTP)
        10. New frontiers of VoIP encryption (WebRTC, WebSockets, DTLS)
        11. Summary
      13. 5. Audio File and Streaming Formats, Music on Hold, Recording Calls
        1. Traditional telephony codecs constrain audio
        2. HD audio frontiers are pushed by cellphones, right now
        3. FreeSWITCH audio, file, and stream formats
          1. Audio file formats
          2. MP3 and streaming
          3. Music on Hold
          4. Playing and recording audio files and streams
          5. Recording and modifying prompts and audio files
        4. Recording calls
        5. Tapping audio
        6. Summary
      14. 6. PSTN and TDM
        1. OpenZap
        2. FreeTDM
        3. I/O modules
        4. Signaling modules
          1. ISDN signaling modules
          2. Analog modules
          3. MFC-R2
          4. SS7
          5. Cellular GSM / CDMA (ftmod_gsm)
        5. FreeTDM installation
          1. Wanpipe drivers
          2. DAHDI drivers
          3. LibPRI
          4. Sangoma ISDN stack
          5. OpenR2
          6. LibWAT
          7. Analog modules
        6. Configuring FreeTDM
          1. Wanpipe
          2. DAHDI
          3. FreeTDM library configuration
          4. FreeSWITCH configuration
          5. Operation
          6. Outbound calls
          7. Inbound calls
        7. Debugging
          1. Checking the physical layer
          2. Enabling ISDN tracing
          3. Audio tracing
        8. Summary
      15. 7. WebRTC and Mod_Verto
        1. WebRTC
          1. Browsers are already out there, waitin'
          2. Web Real-Time Communication is coming
          3. Under the hood
          4. Encryption – security
          5. Beyond peer to peer – WebRTC to communication networks and services
          6. WebRTC gateways and application servers
          7. Which architecture? Legacy on the Web, or Web on the Telco?
          8. FreeSWITCH accommodates them ALL
            1. What is Verto (module and jslib)?
            2. Configure mod_verto
            3. Test with Communicator
            4. Build Your Own Verto App
        2. Summary
      16. 8. Audio and Video Conferencing
        1. Conference basics
          1. Conference.conf.xml (profiles, DTMF interaction, and so on)
            1. Configuration sections logic
            2. Profile
            3. Caller-Controls group
            4. Conference invocation, dialplan, channel variables
            5. Outbound conference
          2. Moderating and managing conferences – API
        2. Video conference
          1. Video conference configuration
            1. Mux profile settings
          2. Video conference screen layouts
          3. Screen sharing
            1. Screen sharing dialplan extension
          4. Managing video conferences
        3. Conference performances
        4. Summary
      17. 9. Faxing and T38
        1. What is Fax on PSTN?
          1. How it works
        2. What is Fax over IP?
          1. Enter T38
          2. T38 terminals and gateways
        3. Fax and FreeSWITCH
          1. The mod_spandsp configuration
          2. mod_spandsp usage
            1. Debugging faxes
          3. How to maximize reliability of fax traffic
          4. PDF to fax and fax to PDF
          5. Fax to mail
          6. HylaFax and FreeSWITCH
        4. ITSPs and Real World Fax Support
        5. Summary
      18. 10. Advanced IVR with Lua
        1. Installing IVR
        2. Structure of welcome.lua
        3. Incoming call processing
          1. Before answering
          2. First voice menu
          3. Second and third voice menus
          4. Fourth menu – asynch! Nonblocking! Fun with threads!
        4. After hangup
        5. Utility functions
        6. Summary
      19. 11. Write Your FreeSWITCH Module in C
        1. What is a FreeSWITCH module?
        2. Developing a module
        3. Mod_Example outline
        4. Mandatory functions
          1. Load function
          2. Runtime function
          3. Shutdown function
        5. Configuration using XML
        6. Reacting to channel state changes
        7. Receiving and firing events
        8. Dialplan application
        9. API command
        10. Summary
      20. 12. Tracing and Debugging VoIP
        1. What can go wrong?
          1. What else can go wrong? (NAT problems)
          2. Other things can go wrong too
        2. SIP, RTP, SDP, RTCP, OH MY!
        3. Tools
          1. Firewall
          2. FreeSWITCH as SIP self tracer
          3. Tcpdum – the mother of all packet captures
          4. ngrep – network grep
            1. tshark – pure packet power
          5. pcapsipdump
          6. sngrep – the holy grail
            1. Sipgrep, Ngrep on steroids for VoIP
          7. Wireshark – "the" packet overlord
          8. Audacity – audio Swiss army knife
          9. SoX – audio format converter
        4. Summary
      21. 13. Homer, Monitoring and Troubleshooting Your Communication Platform
        1. What is Homer?
        2. Installing Homer and the Capture Server
        3. Feeding SIP signaling from FreeSWITCH to Homer
        4. Searching signaling with Homer
        5. Feeding SIP signaling, QoS, MOS and RTP/RTCP stats from CaptAgent to Homer
        6. Correlating A-leg and B-leg
        7. Feeding logs and events to Homer
          1. Logs to Homer
          2. FreeSWITCH events to Homer
        8. Summary
      22. Index