FreeSWITCH 1.8 - VoIP and WebRTC with FreeSWITCH: The definitive source

This document was uploaded by one of our users. The uploader already confirmed that they had the permission to publish it. If you are author/publisher or own the copyright of this documents, please report to us by using this DMCA report form.

Simply click on the Download Book button.

Yes, Book downloads on Ebookily are 100% Free.

Sometimes the book is free on Amazon As well, so go ahead and hit "Search on Amazon"

This is the third book in a Trilogy: FreeSWITCH 1.6 Cookbook, Mastering FreeSWITCH, and yours truly, FreeSWITCH 1.8. Each one of them has its own role in FreeSWITCH's Universe. The call of this one you're reading is to be the reference and foundation, the exhaustive source of FreeSWITCH knowledge. We've worked hard, we started from the efforts of our co-writers in FreeSWITCH 1.2 book (they were Michael S. Collins, Darren Schreiber and Raymond Chandler), we've updated, rewritten and written anew and we're now proud to introduce you to all you need to know about latest FreeSWITCH. So much happened in the world of Real Time Communication and VoIP in the last years. And FreeSWITCH was leading innovation, implementation and interoperability in the industry: WebRTC, Video MCU, High Definition Audio, OPUS, VP8/9, JSON, Encryption and Security, you name it, FreeSWITCH was there. We're about to announce FreeSWITCH 1.8: an evolutionary step from 1.6, that enhance performances and changes a lot of under the hood plumbing that will be the nervous system of The Next Big Things (TM) in FreeSWITCH Universe. From an operation, administration and application programming point of view 1.8 is completely compatible with 1.6, and this book cover them both.

Author(s): Anthony Minessale II, Giovanni Maruzzelli
Publisher: Packt Publishing
Year: 2017

Language: English
Pages: 424
City: Birmingham

Cover
Copyright
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Table of Contents
Preface
Chapter 1: Architecture of FreeSWITCH
Real-time communication without mysteries
The FreeSWITCH design - modular, scalable, and stable
Important modules - Endpoint and Dialplan
Complex applications made simple
Voicemail
Multi-party audio/video conferencing
FreeSWITCH API commands (FSAPI)
The XML registry
Scripting language modules
The demo configuration
Summary
Chapter 2: Building and Installation
Where to Install FreeSWITCH
Choice of Operating System
Linux
Windows
OS X (Mac)
*BSD
Packages or Source?
Installing FreeSWITCH
Debian 8 Jessie
From Packages
From Source
Windows
Summary
Chapter 3: Test Driving the Example Configuration
Important concepts to understand
XML Configuration
Regular Expressions
Call Legs
IVRs, Interactive Voice Response (Systems)
Extensions, Contexts and Profiles
Variables
Caller profile Variables
FS_CLI and Console, Controlling FreeSWITCH
Exiting from Console kills FreeSWITCH
Some useful CLI commands
Configure SIP and make the first calls in demo dialplan
Change demo example password
Configure Linphone on a Desktop
Configure a SNOM SIP
Configure Linphone on Android
And now... Fun, fun, fun with the Demo Dialplan
9386, Funny Prompts
1000...1019, Phone to Phone Local Call
5000, Calling the Demo Example IVR
3000, Conference Call
Example Dialplan quick reference
Summary
Chapter 4: User Directory, SIP, and Verto
User Directory concepts
AAA: Authentication, Authorization, Accounting
Exploring and Using the Demo Example User Directory
Domains and groups
Users
Adding a user to the demo example directory and dialplan
Adding a new user to the directory
Modifying the dialplan for the new user
Call to a Group
Voicemail
Communicate with the World via SIP Gateways and DIDs
SIP Gateway from Us to the ITSP to the World
SIP DID from World to the ITSP to Us
SIP and Verto Profiles, Dialplan Contexts, ITSPs
SIP Profiles
Dialplan Contexts
Verto Profiles and Dialplan Contexts
ITSPs
Summary
Chapter 5: WebRTC, SIP, and Verto
WebRTC concepts
Encryption Everywhere
WebRTC in FreeSWITCH
WebRTC Signaling in FS: SIP and Verto
Why SIP and why Verto?
WebRTC Media Streaming in FS: SRTP
Installing and Configuring WebRTC in FS
Certificates
Installing and Configuring Apache or NginX for HTTPS serving
Apache
NginX
Configuring VERTO
Configuring SIP on WebRTC (WSS)
Writing WebRTC Clients
SIP and JavaScript
Verto and JavaScript
Verto Communicator, an Advanced WebRTC Client
WebRTC Rooms, both SIP and Verto Clients
Conference chat in WebRTC Rooms
FreeSWITCH Conferences
mod_sms and chatplan
Dialplan
HTML
JavaScript
TODO
Summary
Chapter 6: XML Dialplan
Forget all you know
Contexts
Default context
Public context
Features
Extensions
Conditions (and
Call legs (channels)
Channel Variables
Regular Expressions
Actions and anti-actions
How dialplan processing works
Important dialplan applications
answer
bridge
hangup
ivr
play_and_get_digits
playback
set
sleep
transfer
Dialstring formats
SIP (sofia)
VERTO
Other dialstring formats
Originate Command
Summary
Chapter 7: Phrase Macros and XML IVRs
Phrase Macros and Voice Prompts
Voice Prompts history
Sound files in FreeSWITCH
Sound files locations, sampling rate and fallbacks
Phrase Macros: Concatenating Sound files
macro name (pause)
input pattern
match - nomatch
action
Phrase Macros: Invocation, Patterns and Registers
Phrase Macro Invocation
Input Pattern and Registers
XML IVRs
IVR in demo config
XML voice menu fields
name
greet-long
greet-short
invalid-sound
exit-sound
timeout
inter-digit-timeout
max-failures
max-timeouts
digit-len
tts-engine
tts-voice
confirm-key
XML voice menu entries and actions
menu-exec-app
menu-play-sound
menu-sub
menu-back
menu-top
menu-exit
Nesting XML IVRs
Summary
Chapter 8: Lua FreeSWITCH Scripting
Many scripting languages
Why Lua?
Basic Lua syntax
Lua and FreeSWITCH
freeswitch
freeswitch.Session and session
freeswitch.API
freeswitch.Dbh
freeswitch.Event
freeswitch.EventConsumer
freeswitch.IVRMenu
Lua scripting IVR Applications
playAndGetDigits
Syntax
Arguments
Behavior
XML demo IVR in Lua
Always checking session:ready()
Summary
Chapter 9: Dialplan in Deep
Where are the previous Dialplan seasons?
XML Dialplan Recap
More about conditions
regex operator (multiple variables and/or expressions)
nested conditions
Pitfalls to avoid
Variables
Global variables
Time of Day, Day of Week, Holidays
Channel Variables
Channel Variables and Field shortcuts
Channel Variables and Caller Profile fields
Channel Variables and call setup
setting channel variables in dialstrings
setting channel variables on B-legs: export and nolocal
exporting variables to SIP custom (X-) Headers
API commands from Dialplan
FreeSWITCH string interpreter functions
cond, C-like
variables' substrings
db and hash: simple key/value stores
bind_meta_*, DTMFs to actions outside menus
eavesdrop (call barge)
eavesdrop DTMF commands
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 10: Dialplan, Directory, and ALL via XML_CURL and Scripts
mod_xml_curl rationale
mod_xml_curl configuration
mod_xml_curl: Caveats and Pitfalls
php/mysql setup for mod_xml_curl
Create and populate the Database
Setup NGINX and xmlhandler.php
mod_xml_curl configuration
Testing php/mysql setup for mod_xml_curl
Lua XML handler
lua xmlhandler script
lua.conf.xml
Lua xml_handler.lua testing
Summary
Chapter 11: ESL - FreeSWITCH Controlled by Events
Event System Fundamentals
Event format - Headers and Body
Event Handling modules
mod_event_socket
mod_event_socket configuration
Reading and sending events via telnet
fs_cli
Event System Commands
api
bgapi
event
filter
filter delete
sendevent
exit
auth
log
nolog
nixevent
noevents
sendmsg
call-command
execute
hangup
Outbound Socket - call connects to you
ESL - Event Socket Library
ESL supported languages
ESL Reference
eslSetLogLevel
ESLevent Object
new
serialize
setPriority
getHeader
getBody
getType
addBody
addHeader
delHeader
firstHeader
nextHeader
ESLconnection Object
new
socketDescriptor
connected
getInfo
send
sendRecv
api
bgapi
sendEvent
recvEvent
recvEventTimed
filter
events
execute
executeAsync
setAsyncExecute
setEventLock
disconnect
ESL installation
ESL: Examples in Perl
Display Filtered Events
Use
Use
Summary
Chapter 12: HTTAPI - FreeSWITCH Asks Webserver Next Action
HTTAPI Rationale
HTTAPI dialplan
data
httapi_profile
url
method
HTTAPI document syntax
Work actions
playback
record
pause
speak
say
execute
sms
dial
recordCall
conference
hangup
break
log
continue
getVar
voicemail
vmname
exiting (param)
storing data across successive requests
mod_httapi configuration file
params
gateway-url
method
permissions
set-params
set-vars
get-vars
extended-data
extended-data longer than max CGI length
execute-apps
expand-vars
dial
dial-set-dialplan
dial-set-context
dial-set-cid-name
dial-set-cid-number
dial-full-originate
conference
conference-set-profile
HTTPAPI libraries for PHP and Python
The demo-ivr in PHP-HTTAPI
Summary
Chapter 13: Conferencing and WebRTC Video-Conferencing
Conferencing Concepts
Conferencing Support in FreeSWITCH
Audio conferencing
Video conferencing
Audio Conferencing setup in FreeSWITCH
profiles
rate
caller-controls
auto-record
interval
energy-level
member-flags
conference-flags
tts-engine
tts-voice
pin
max-members
caller-id-name
caller-id-number
comfort-noise
announce-count
suppress-events
sound-prefix
sounds
caller-controls
advertise
Video-WebRTC conferencing setup in FreeSWITCH
profiles additional video parameters
video-mode
video-layout-name
video-canvas-size
video-no-video-avatar
video-mute-banner
caller-controls additional video actions
member-flags additional video options
conference-flags additional video options
screen estate layouts
layout groups
FreeSWITCH conferencing operation
Conference Application (dialplan)
Controlling active conferences
Calling outbound into the conference
Verto Communicator and Video-WebRTC Conferencing
settings
participants list
participant GUI commands and chat
moderator GUI commands
screen sharing
Summary
Chapter 14: 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 behind NAT
FreeSWITCH speaks to the router
FreeSWITCH behind NAT, leaving the router alone
Additional ways to set the external addresses
Other creative uses of FreeSWITCH in a NAT situation
NAT and WebRTC (SOLVED)
Conclusion
Summary
Chapter 15: VoIP Security
Network level protection
Separating interfaces and restricting traffic
Sample setup - simple
Sample setup - complex
VLANs
Intrusion detection
Registration and call attempts monitoring
Fail2Ban
Filter configurations
Jail configurations
Do not lock the good guys out!
Encryption in non-WebRTC SIP: Signaling and Media
Choosing between encryption options
Disabling SSLv3 and SSLv2
Certificates
Protecting signaling
Encryption with TLS
Protecting media
Encryption with SRTP
Enabling SRTP
Debugging SRTP
Encryption with ZRTP
Enabling ZRTP
Testing media SIP encryption
Protecting WebRTC SIP and VERTO Signaling and Media
Protecting passwords
Registration passwords as hashes
Voicemail passwords
Summary
Chapter 16: Troubleshooting, Asking for Help, and Reporting Bugs
Troubleshooting FreeSWITCH
firewall rules and network issues
checking FreeSWITCH configuration and operation
fsctl loglevel 7
sofia global siptrace on
verto debug=
sngrep: SIP dialogs visualization
tcpdump for saving net traffic in pcap files
Asking for Help
Read the documentation first!
confluence
books
mailing list archives
google
How to ask for Community Help
IRC
HipChat
mailing lists
Official Commercial Support and Consulting
Reporting Problems
don't report a bug on mailing list !
how to file a bug on Jira
ClueCon
Summary
Index