Book Image

FreeSWITCH Cookbook

Book Image

FreeSWITCH Cookbook

Overview of this book

FreeSWITCH is an open source telephony platform designed to facilitate the creation of voice, chat, and video applications. It can scale from a soft-phone to a PBX and even up to an enterprise-class softswitch.In the FreeSWITCH Cookbook, members of the FreeSWITCH development team share some of their hard-earned knowledge with you in the book's recipes. Use this knowledge to improve and expand your FreeSWITCH installations.The FreeSWITCH Cookbook is an essential addition to any VoIP administrator's library.The book starts with recipes on how to handle call routing and then discusses connecting your FreeSWITCH server to the outside world.It then teaches you more advanced topics like CDR handling, practical examples of controlling FreeSWITCH with the event socket, and configuring many features commonly associated with a PBX installation.
Table of Contents (12 chapters)
FreeSWITCH Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Launching a call with an inbound event socket connection


Using an inbound event socket connection to launch a call is a common requirement for some applications, such as outbound IVRs. In a case like this it is advantageous to handle the generating of the calls in a non-blocking manner using the ESL connection object's bgapi() method. This recipe discusses how to use the bgapi() method with the corresponding "Background-Job UUID".

Getting ready

Be sure that you have configured ESL for your system and that you have followed the steps in Establishing an inbound event socket connection earlier in this chapter. The examples here are written in Perl but the principles apply to any ESL-enabled language. Of course, you will need a text editor and a SIP phone registered to your FreeSWITCH server in order to test this example.

How to do it...

Start by creating the new script:

  1. Create the file scripts/ib_bgapi.pl in a text editor and add these lines:

    #!/usr/bin/perl 
    use strict; 
    use warnings; 
    require...