Book Image

Freeswitch 1.6 Cookbook

Book Image

Freeswitch 1.6 Cookbook

Overview of this book

Table of Contents (14 chapters)
FreeSWITCH 1.6 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Filtering events


Events are the lifeblood of the FreeSWITCH eventing system. FreeSWITCH throws events for virtually everything that happens. This can overwhelm a program (and indeed, the programmer) with a flood of information. The solution is to use the FreeSWITCH event filter feature.

Getting ready

Learning about filters is very simple. Initially, we will just use an fs_cli connected to a FreeSWITCH server. Later, we will look at some simple programming examples using ESL. You will need a phone connected to your FreeSWITCH server and two terminal windows open so that you can look at your program in one session and fs_cli in another.

How to do it...

Consider a simple example. Here, we will compare the event socket output before and after using a filter:

  1. Launch fs_cli and connect to a running FreeSWITCH server. Issue these two commands at fs_cli:

    /log 0
    /event plain all
  2. Wait a few seconds. No doubt, you'll see some events, and possibly a lot of events.

  3. From your phone, dial *98 and wait for the...