Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
FreeSWITCH 1.2
Table of Contents
FreeSWITCH 1.2
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Support files, eBooks, discount offers, and more
Why Subscribe?
Free Access for Packt Publishing account holders
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Errata
Piracy
Questions
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
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
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
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
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
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
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
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
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
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
Turn lights on
Turn lights off
Rebooting a phone
Requesting phone reconfiguration
Custom notify messages
Summary
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
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
13. VoIP Security
Network level protection
Separating interfaces and restricting traffic
Sample setup – simple
Sample setup – complex
VLANs
Intrusion detection
Registration monitoring
Fail2Ban
Filter configurations
Jail configurations
Other considerations
Encryption
Protecting SIP signalling
Choosing between encryption options
Encryption with SSL
Setting Up SSLv2/3
Encryption with TLS
Protecting audio
Encryption with SRTP
Enabling SRTP
Encryption with ZRTP
Protecting passwords
Registration passwords
Voicemail passwords
Summary
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
Check
Flush
Pause
Resume
Reset
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
blue.box
Kazoo
Supporting libraries
Liverpie (Ruby)
FreeSWITCHeR (Ruby)
Librevox (Ruby)
EventSocket (Python/Twisted)
FSSocket (Perl)
Vestec Automatic Speech Recognition
Summary
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 – www.freeswitch.org
The FreeSWITCH wiki page – wiki.freeswitch.org
The annual ClueCon open source developer conference
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
C. The History of FreeSWITCH
Taking things to the next level
New ideas and a new project
The first ClueCon
Introducing FreeSWITCH
Index
← Prev
Back
Next →
← Prev
Back
Next →