Time condition at an extension level

Hi :slight_smile:

I don’t believe this is possible and haven’t found anything to what I want to implement exactly, but here goes.

At the moment I have a pretty basic setup where each extension (1000-1400) have their own DDIs XXXXXXX1000-XXXXXXX1400

I would like each DDI to go to a extension, but for it first to match a time condition.

so… XXXXXXX1000 --> Check if it’s between 9am-5pm --> If yes, continue to extension 1000 !–>but if no, then play a closed announcement

Would it be possible to do this without having seperate time conditions for every extension?

I am happy to use a custom context to match the last 4 digits, but this will not always be the case therefore I have decided to have 400 inbound routes and 400 extensions, but I need for it to do a time check before forwarding onto the extension, without having to have 400 time conditions.

Basically, one time condition for all extensions. If it matches then forward onto the original destination, if not, then play a generic announcement.

Thanks for any help in advance :smiley:

1 Like

Given the above (there will not be a pattern to easily follow), have you considered using bulk handler for the routes? It is still 400 routes, but it makes it much easier to manage.

https://wiki.freepbx.org/display/FPG/Bulk+Handler+User+Guide

I can use the bulk handler to create the 400 routes, happy to do this, but then at what point will the time condition be checked? If I create 400 inbound routes, won’t I have to also create 400 time conditions (if open go to extension, if closed play generic announcement). Each time condition will have to have it’s own extension in this scenario/

Apologies, I slipped up here. You could make one time condition that routes to a custom destination.

Options for the custom destination:

  • If you could make the extension match the DNID, then route to extension ${CALLERID(DNID)}

  • If you want to leave extensions as is, make the custom destination route to extension ${CALLERID(DNID):8:4}

1 Like

It can be done, but will require some custom work

-Create an after hours announcement [1]
-Create a custom destination, set the target to:

from-pstn,${EXTEN},1

Set the description to whatever you want.

-Create a Time Group that has 9AM-PM
-Create a Time Condition, tie it to that Time Group.

  • Destination Matches > Custom Destinations > The CD that you created.
  • Destination non-matches > Announcement > The announcement you created.

After creating the time condition, click on the that record, look at the URL and take note of the time condition ID
(It should look like this: http://pbx.ip.address/admin/config.php?display=timeconditions&view=form&itemid=3 So in this case, the ID is 3)

-Paste the below in /etc/asterisk/extensions_custom.conf (you can also use config edit module)

[from-a0429-pbx-trunk]
exten => _X.,1,Goto(timeconditions,3,1)

Replace the number 3 with your time condition ID. Save and apply config.

-Finally, edit your Trunk incoming settings and set the context to from-a0429-pbx-trunk

Save & Apply config.

What will happen is as follows:

  1. Call will come in through the Trunk.
  2. Go to the custom context which will send the call to the time condition.
  3. If it’s between 9-5 the call will try to find an inbound route. If it’s not 9-5 it will go to the announcement.

[1] I’m not sure what you want to happen to the calls once the announcement is completed?
If you want to send to the regular inbound route, then set the announcement failover destination to the same custom destination as the TC matching state.
If you want to send it to everyone’s individual voicemail, then you can setup another custom destination, and do similar to what @comtech suggested.
Set the target to:

from-internal,vmu${CALLERID(DNID)}:-4},1

I did not test this. But feel free to post any trouble you encounter.

Original sources: Here , here and here Thank you @billsimon and @lgaetz

1 Like

in 14+ you can use calendar and followme

How you would do it with Calendar and Follow Me?

https://wiki.freepbx.org/display/FPG/Calendar+Module

Look at the FMFM sections.

1 Like

Assuming by: Enabling Calendar on FollowMe, then clear the FMFM list and set the no answer destination to the announcement.

Edit: however, with this method, I can’t think of a way how to accomplish if OP does want the call to ring the extension after playing the announcement.

1 Like

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