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

Ringing multiple endpoints simultaneously


FreeSWITCH makes it easy to ring multiple endpoints simultaneously within a single command.

Getting ready

Open conf/dialplan/default.xml in a text editor or create or edit a new XML file in the conf/dialplan/default/ subdirectory.

How to do it...

Add a comma-separated list of endpoints to your bridge (or originate) application. For example, to ring [email protected] and [email protected] simultaneously, use an extension like this:

<extension name="ring_simultaneously">
  <condition field="destination_number" expression="^(2000)$">
    <action application="bridge" data="{ignore_early_media=true}sofia/internal/[email protected],sofia/sip/[email protected]"/> 
  </condition>
</extension>

How it works...

Putting comma-separated endpoints in the argument to bridge causes all of the endpoints in that list to be dialed simultaneously. It sounds simple, however, there are several factors to consider when ringing multiple devices simultaneously in a real environment. The bridge application will connect the call to whoever sends media first. This includes early media (ringing). To put this another way, if you bridge a call to two parties and one party starts sending a ringing signal back to you, that may be considered media and the call will be connected to that party only. Ringing of the other phones will cease.

If you find that calls always go to a specific number on your list of endpoints versus ringing all numbers, or that all phones ring for a moment before ringing only a single number, your call may be getting bridged prematurely because of early media. Notice that we added ignore_early_media=true at the beginning of the dial string. As its name implies, ignore_early_media tells the bridge application not to connect the calling party to the called party when receiving early media (such as a ringing or busy signal). Instead, bridge will only connect the calling party to the called party who actually answers the call. In most cases, it is useful to ignore early media when ringing multiple endpoints simultaneously.

There's more...

In some scenarios, you may also wish to ring specific devices for a limited amount of time. You can apply the leg_timeout parameter to each leg of the bridge to specify how long to ring each endpoint, like this:

<action application="bridge" data="[leg_timeout=20]sofia/internal/[email protected],[leg_timeout=30]sofia/sip/[email protected]"/>

In this example, userA's phone would ring for a maximum of 20 seconds while userB's phone would ring for a maximum of 30 seconds.

Tip

Call legs and the leg_timeout variable

The leg_timeout variable is unique in that it implies the ignoring of early media. When using the leg_timeout variable on each call leg in a bridge attempt, there is no need to explicitly use {ignore_early_media=true} in the bridge argument. For a more complete discussion of using { and } (curly braces) versus [ and ] (square brackets), see http://wiki.freeswitch.org/wiki/Channel_Variables#Channel_Variables_in_Dial_strings.

This method of calling multiple parties works well for small numbers of endpoints. However, it does not scale to dozens or more users. Consider using a FIFO queue in such an environment (FreeSWITCH's mod_fifo is discussed at length online at http://wiki.freeswitch.org/wiki/Mod_fifo). See also Ringing multiple endpoints sequentially (simple failover) for an example of ringing a group of endpoints one at a time, which includes an expanded discussion of using call timeouts.

See also

  • The Ringing multiple endpoints sequentially (simple failover) section that follows