Time condition at an extension level

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