Multiple calendar events flow, anything simpler?

I need a different message to be played for each calendar event (holydays) of the year.
I linked a chain of match-nonmatch time conditions checking each a different calendar group event for each holiday :

Is it Christmas ? Yes-Play Christmas msg; No-Check New year’s day time condition.
Is it New Year’s day ? Yes-Play NYD msg; No-Check next holiday time condition.
And so on

So:
A number of Calendar events
Same number of calendar group
Same number of time conditions matching calendar group thus calendar events
Link all these Y/N in a chain to final destination
Quite tricky… :exploding_head:

Am I wrong in doing this ?
Is there any simpler or correct way in doing this ?

1 Like

None ??

If you’re playing different announcements, then you must create a separate Time Condition for each so you can reference the different destinations.

With some custom dialplan I suppose you could have a single time condition that determines if it’s a holiday or not, and have the holiday case go off to a Custom Destination that references your own dialplan that determines what the holiday is, plays the appropriate greeting and then goes to a single holiday destination for all cases, but that might well be as much work as just creating the dozen or so separate cases in the GUI.

I’ve used the custom dialplan to accomplish this, but sure would be nice if it could be accomplished on a calendar that the end users could manipulate. Imagine them saying - Hey - Christmas falls on a Sunday, so we’re going to take Friday half day, and Monday off for Christmas. Right now if using calendaring, we’d have to have a Christmas Calendar. Then a New Year’s Calendar, etc. Would really be nice if there was a Holiday Calendar, and when you add New Years you could label it as such so that when FreePBX checks if today is a holiday, it sees it, but also knows how to route for that holiday (in OP case) - Annoucement New Year.

1 Like

We used to have this with our Mitel, and had all the holidays set up individually. The message didn’t reference the actual holiday but did say “… will re-open Tuesday…” for example.

When we switched over to FreePBX we initially had one “holiday” message and would just re-record the greeting in advance of the next holiday but we now just have a message that says we’re closed for the holiday with no re-open details.

The other option I was considering was something like you suggest but I nixed this in the end as too complicated. Or maybe I listened to my consultant for once and went the simple route, either way we didn’t do it!.

Might be worth looking at Dynamic routes. Lorne has an excellent video on Dynamic Routes on youtube. You could pull the current date with a short AGI script and set that as a variable. Then set your matching dates in the route entries pointing to an announcement. AGI script would look something like this:

#!/usr/bin/php -q

<?php

    //setup agi environment
    include("phpagi.php");
    $agi = new AGI();
    
    // Get the current date
    $current_date = date('m-d');

    //Set agi variable today to today's date
    $agi->set_variable("today",$current_date);
?>

I haven’t tested this but it should work. If you use this script set your agi result variable to today and your matches would be month-day. As an example 12-25 for Christmas.

This is a workable solution. The AGI could determine the date and play the appropriate recording for whatever holiday it is, and then send all the holiday calls to one destination and non-holiday calls to another destination.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.