O'Reilly logo

FreeSWITCH Cookbook by Raymond Chandler, Darren Schreiber, Michael S Collins, Anthony Minessale

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time of day routing

It is common for routing of calls to be different, depending upon the time of day or day of the week. The FreeSWITCH XML dialplan has a number of parameters to allow this functionality.

Getting ready

Determine the parameters for your routing. In this example, we will define business hours as Monday through Friday, 8AM to 5PM. Additionally, we will add a day_part variable to reflect morning (midnight to noon), afternoon (noon to 5PM), or evening (6PM to midnight).

How to do it...

Create an extension at the beginning of your dialplan by following these steps:

  1. Add this extension to the beginning of your dialplan context:
    <extension name="Time of day, day of week setup" continue="true"> <condition wday="2-6" hour="8-17" break="never"> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required