Search:
     
3CX Phone System for Windows Download the Free Edition

Asterisk tips openhours

How to include contexts based on time and date

The Asterisk dial plan, extensions.conf lets you include contexts based on time and/or date.

Syntax:

include => context|<times>|<weekdays>|<mdays>|<months>

Syntax for Asterisk 1.6

As of Asterisk 1.6-Beta and Trunk (with an uncertain start date) the delimiter has changed to the comma (',').
Stumbled across this after my dialplan would not work in 1.6 or trunk.

For example, the syntax should be....

include = day,08:00-16:59,mon-fri,*,*

Example:

; First, let's do the holidays
include => holiday|*|*|1|jan
include => holiday|*|*|31|may
include => holiday|*|*|4|jul
include => holiday|*|*|6|sep
include => holiday|17:00-23:59|*|24|nov
include => holiday|*|*|25|nov
include => holiday|17:00-23:59|*|24|dec
include => holiday|*|*|25|dec
include => holiday|17:00-23:59|*|31|dec

; these are the days we're open
include => day|09:00-19:59|mon-fri|*|*
include => day|10:00-14:59|sat|*|*

; if we're not open, we're closed (duh!)
include => night

Example from Troy Settle


I ran into a problem with this. The night context is always included in this scenario, and if the night context contains the same extensions as the day context, Asterisk will continue with the night context if the extensions match:

[day]
exten => s,8,Background(to-hear-meu-again)

will jump to:
[night]
exten => s,9,Background()

To prevent this, specify an explicit night include:
include => night|20:00-8:59|mon-fri|*|*
include => night|15:00-9:59|sat|*|*
include => night|*|sun|*|*


Created by: oej,Last modification on Wed 13 of Aug, 2008 [17:39 UTC] by kue


Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - support@voip-info.org

Page Changes | Comments

 





Search: