Time Groups & Time Conditions

FreePBX 2.5 breaks down Time Conditions in to two separate modules: Time Groups and Time Conditions. The reason? To confuse you! Nay, we wouldn’t do that. But in case we did, this should set the record straight.

First, lets have a look at the old way of doing things: For illustrative purposes, we’ll talk about the CEO of a multi billion dollar corporation. Obviously, as the most powerful and best paid person in the company, he does the least amount of work, and when he does, he tires quickly. Fortunately for him, they built his office with tons of amenities – including a power napping station where he takes a daily afternoon nap. There is just one thing they forgot to do: automatically turn off his phone during that period. This is the precise purpose of time conditions.
Until now, a setup like this required a lot of work. First, you would set a time condition for Monday morning from 10:00 am until 12:30pm. You would then set the "Destination if time matches" as your extensions. As the "Destination if time does not match", you would put in the next time condition – 2:00pm to 3:30pm (wish those were your working hours, eh?). But wait – you didn’t create that time condition yet. So you’ll need to save this one, then create the next one. If your still following, you’ll realize that you will run in to this problem again – the ‘condition failed’ destination is not yet created. Or in other words, you need to work backwards, starting from Thursday afternoon, and working up the week from there.

By the time your done, you should have at least 10 different time conditions – just for this one extension. Now imagine if there are 4 other people in the company on the same schedule – were pushing fifty time conditions – for just five extensions! And that not including the usual company widetime conditions – including various work schedule’s, open hours, holidays, etc.

Here to save the day is naftali5’s Abstracted Time Groups and updated Time Conditions, (as implemented by FreePBX project lead – Philippe Lindheimer). In a nut shell, what this upgrade does is it separates the time condition from the destinationallowing for the same ‘set’ of conditions to be ‘reused’ many times. Back to our example. In order to accommodate our tired CEO, we would click on the Time Groups module (assuming that the Time Conditions module is installed) and create a new time group by clicking add a new time group. Enter a description, such as "executive working hours". Now start by creating the first time group (10:00am-12:30 pm, mon-thu) and click Submit. Now pick the "Executive working hours" from the time groups menu, and add the second time group (2:00pm – 3:30pm mon-thu), and click submit. When your done it should look like this:

Time Group


Now, click on the Time Condition module. Add a time condition called "CEO’s working hours" and select "Executive working hours" from the time groups drop-down list. Now, simply select the CEO’s extension as the "Destination if time matches" and his voicemail as the "Destination if time does not match" (or send the call wherever you would like – depending on your needs). Bravo! Can it be simpler? If you need to set the same time conditions for other exec’s, just create a new time condition – and reuse the time group as many times as you’d like! The time condition should look something like this:

Time Condition

One more thing:

This solution beautifully and simply addresses our needs and allows for reusing the time groups while keeping the time condition separate. There is just one hiccup: said CEO does not like to be disturbed while he smokes his cigar’s and sips Chardonnay. He needs a simple way to be able to manually override the time conditions and send all his calls to voice mail. That’s what the "Day/Night Mode Association" option is for (assuming you have the day/night module installed). You can set a Day/Night Control with a "Night" destination of the CEO’s voicemail. When ever he needs to smoke his cigars, he can just dial his Day/Night control code – and all his call will be routed to his voicemail.

A more down-to-earth use of Day/Night mode association: just because you set your businesses time conditions, doesn’t meant that bad weather wont force you to close early. Use a Day/Night Control to set your business to go in to night mode early. Or have your receptionist do it – without needing to touch your delicate FreePBX gui!

The use of Day/Night controls are endless – and can introduce some form of dynamic call-flow control. What is your best/wildest implementation of Time Groups/Conditions? Lets hear about it in the comments!

Moshe Brevda, FreePBX Development Team
lazytt – FreePBX forums
hi365 – IRC

FreePBX 2.5.0 is FINAL!


It’s old news to the hundreds of you who beat me to the punch and already responded to those automated email notices telling you that FreePBX 2.5.0 has gone final! All of us who have contributed to the success of this release are thrilled to see it pass this great milestone and for those of you who will be at Astricon next week, I hope to see you at one of the parties to celebrate this great achievement!

Oh darn – got to buy a plane ticket for that don’t I, hmm, donation box is empty, feel free to help out. They are expecting me to give a talk this year…


With new features that span the spectrum of needs you are sure to find capabilities in 2.5 that you could not do or was much less convenient in previous releases. The list of features is too long to mention which is going to keep me really busy between now and October 7th preparing a new section for the upcoming Open Telephony Training Seminar covering this great milestone. (And don’t forget that special deal we mentioned last week which I think is about to expire!

Whether you want to do more with Queues (did you see Moshe’s great article yesterday?), take advantage of BLF, change your IVR messages on the fly with a feature code, simplify your current unmanageable chain of Time Conditions (and incorporate a manual override directly into the Time Condition), or a list of hundreds of other capabilities then you should be having a look at 2.5.

Want to write an article on something new with 2.5 that really peaks your interest? Contact me and we can make arrangements for you to publish something in the Technical Corner column, we would love to see more contributors there!

And as far as stability is concerned this release is panning out to over achieve our high standards once again! We’ve seen the normal pattern of other beta programs. People look for issues, and they find them, the majority of which are usually current bugs in the existing and often previous releases that have never been reported. More often then not, such bugs were only corrected in 2.5 and often will never be back ported to 2.4. So 2.5 is well worth looking at for the enhanced stability as well as all the great features it has to offer. With over 3000 systems in use at the time 2.5.0 went final, you can be confident that many other users have helped pave the way for you to feel comfortable upgrading and staring to explore the new capabilities of 2.5.

Now, with Astricon preparation in order for next week(if I can get there) and the next Open Telephony Training Seminar just around the corner, time to sign off with a thanks to all of you who helped develop, report bugs, provided great feature code ideas and patches and tested the early version prior to it going final!

– on behalf of the FeePBX team!

Queue weights vs. Queue priorities

FreePBX version 2.5 seems to be coming along real nicely and hopefully will be out of beta any day minute now, with way over 500(!) bug fixes and closed tickets, and an elephant load of cool new features. A big tip of the hat to Philippe Lindheimer, the FreePBX projects leader, under who’s leadership (and hard work) this great milestone has been achieved. The Chinese are fond of saying "An army of a thousand is easy to find, but, ah, how difficult to find a general." How true! Without Philippe’s guidance and unique vision of the project, it would probably long be covered in moldy green with every release bumping the bug to feature ratio by 3:.001. Thank you Philippe for making FreePBX what it is!

Lets have a look at two new cool features in FreePBX 2.5: Queue weights and Queue priorities. We’ll start with the Queue priorities module. Queue priorities essentially allows you to give a call a greater priority in a queue. Think of it as the First Class check-in counter – only your standing in the same line as the ‘commoners’. Once you mark a caller with higher priority, their position in the queue is automatically promoted – so that their call gets answered quicker than the others. To illustrate: if Jack is waiting in a queue with priority 1 and Jill comes along at priority 10 – who do you think is going to be answered first? Being that Jill is the holder of a First Class ticket – she will be answered first even if Jack is holding for a longer time! Neat, eh? Now add Jake, holding ‘only’ a business class ticket – say with priority 5, where will he go? Being that he is the second highest priority he will be second in our example – after Jill (10) but before Jack (0).

Queue weights does something similar only in reverse. It gives the queue a priority (called a weight) versus the other queues. If that sounds confusing, then try this: imagine, back to our airport, that instead of all the people standing at one check-in counter there are three counters – one for first class, one for business class, and one for the rest of us. Unfortunately, all the people that usually man the counters ran off to the OTTS, and only Sally stayed on to check in the passengers. So now we have people waiting in three different lines and Sally needs to decide whom to check in first. As I’m sure you guessed, Sally will first check-in those waiting at the first class counter as they have the highest weight, or importance to Sally and her self centered, money hungry, step-on-the-little-guys enterprise).

Another application of call weights (and I bet this one will hit a bit closer to home): the small business. I’m talking about the (more or less) one man business where the sales guy is also the janitor, the CEO is also the secretary, and the technician is also the delivery man. And all three are one and the same guy. But in order to give the big company appearance, you set up a PBX with fancyshmancy stuff like ivr’s and queues and music on hold. (Yes you! C’mon, don’t look at me like that – you know that’s what got the geek in you attracted to asterisk in the first place…). Anyway so your sales/management/technical/maintenance/logistic team (aka you) have all your phone(s) logged in to the different queues. Obviously its business (sales) before pleasure (nothing like pulling an allnighter trying to fiddle with that new linux app that you got off some guy on IRC, trying to impress an old client), and you want to receive the calls in the sales queue before those in the technical assistance queue. This is where call weights comes in to the picture: you can set the weight of the sales queue to be higher than that of the technical support queue, and, like the magic that asterisk is, callers in the sales queue will always come out ahead of the callers in the technical queue (you should of never logged in to that one to begin with anyway – its usually full of annoying clients who need help after trying to "fix" their system).

Truth is, in that last example, you could do exactly the same thing with queue priorities – give the people calling for sales a higher priority (vs. giving the queue a higher weight). But being the geek that you are, you want to impress your family and friends’ clients by announcing their estimated hold time – and position in the queue. Now what happens if you have a caller that was already told that they are next in line and someone with a higher priority call comes in? You guessed it – grandma gets pushed to the back of line in favor of your basket-ball buddy! Granny will be kinda pissed when she hears that she is now number two in the queue. So you need to know you environment before deciding which strategies to take.

That’s not to say that Queue Priorities doesn’t have merits of its own. When that little mom and pop, garage based business grows up and becomes Google or HP (hey – you can do it!) and you have a large call center with different departments, there will often be a situation where after talking to someone in department X the caller will be transferred over to someone in department Y. But being that they already waited in the queue for dept. X its only fair that they shouldn’t have to wait again. This is a very practical application of Queue Priorities: the guy in dept. X transfers the caller to a destination that sets their priority higher in the Y queue, so that they get answered right away, and don’t have to wait again.

Two more points: you might be wondering what happens when two or more callers enter a queue at a higher priority? All the people at a given priority get treated just like people usually get treated in a queue, first come first server (fifo), so that all the people at, say, priority 10 will have their calls answered (again fifo), and then people at priority 5, and so on. Last but not least, we previously mentioned the lines at the airport. In the UK people call those a queue (as in "I’m standing in the queue"). But you already knew that.

Moshe Brevda, FreePBX Development Team
lazytt – FreePBX forums
hi365 – IRC