Time groups negate an entry

hello,

how can I negate an entry in a time group.

For example I have a time group with open hours like:

  • from 9 to 14 from monday to friday

and I would like to add the holiday days in this time group:

  • not 1 january
  • not 26 december

is this possilbe?

another question if is this entry valid?

  • from 14 to 9 from monday to friday

or I have to split it in two entries?

  • from 0 to 9 from monday to friday
  • from 14 to 0 from monday to friday

Thanks a lot

yes, it’s true. I was only thinking with time conditions.

I will try to make some tests with entries like 14-9 monday-friday to see what happens and post the answer.

Thanks for all.

where can I post this feature request? Or where can I send a patch to change this module? when I have time I will try to do it

I thing it’s easy. It’s only to add a checkbox in the web and if is checked send this condition to the falsestate label instead of truestate label.

thanks for the answer

casix,

the tracker is where you post feature requests.

Unfortunately it is not quite that simple wrt to ‘a checkbox’

the timegroups represent and abstract set of times. Each module that uses them it responsible for taking those times and applying the logic. The timeconditions module and outbound routes uses the time groups. So does the third party customcontext module. There may be others I am not thinking of at this time.

So that means that each module that uses them would have to apply the appropriate logic. Furthermore, there may be some fairly “unsolvable” logic challenges in places like the outbound routes and customcontext. These modules use a construct provided by Asterisk that look like:

include => outrt-12|08:30-21:00|sat|*|* ; prefix6
include => outrt-12|06:45-21:15|mon-fri|*|* ; prefix6
include => outrt-12|09:00-20:30|sun|*|* ; prefix6

In that example, there was a time group with 3 entries. So this could likely be a ‘show stopper’ or limiter as to the reasonable ability to have ‘negative’ time group entries. There is no construct in Asterisk that I am aware of that allows you to specify to use the negative and ‘deriving’ the negative can be a fairly complex task.

yes, I know this.

I would like to use one time conditions with a time group where some entries are negated instead of using two time conditions, one with the not negated entries and another with the negated entries, after the other.

It is only for make the administration easiest and more clear.

i don’t see why you need two time conditions to do that. one time condition gives two options, the positive and the negative.

yes, but i’m talking about time groups.

I want to make a time group with this entries:

  • not 1st january
  • not 26 december
  • from 9am to 14pm from monday to friday

all this in the same time group to use it in on time condition

casix,

timegroups are a direct translation down to the basic Asterisk time construct (which you can pull up details with Asterisk documentation.

it is not setup to negate as a result, though you are welcome to make a feature request to do such and we can explore how we might address that in a future release as it’s a valid request.

as far as times like 14 - 9, I don’t know what that would do. It might work, it might result in the equivalent of 14-midnight, or it may result in an error. And if it did work, assuming m-f, what would the implications be for sat 0-9, would that imply a true condition or false? (As you can see, the ambiguity created in such a definition leads me to believe it would be a bad idea to count on that…)

Anyhow - if you experiment with it and come up with some answers, post them here, it’s an interesting question.

time conditions are basic if () else () conditions… to do a negative test, simply put the desired action in the else () section. for example, if you want to “do something” on “not january 1”, set up your condition

if “january 1” (do nothing) else (do something)…

you can do similar things for all your other conditions.