Calendaring Dialplan Asterisk Calendaring

A common business PBX scenario is would be executing dialplan logic based on when the business is open and the phones staffed. If the business is closed for holidays, it is sometimes desirable to play a message to the caller stating why the business is closed.

The standard way to do this in asterisk has been doing a series of GotoIfTime statements or time-based include statements. Either way can be tedious and requires someone with access to edit asterisk config files.

With calendaring, the adminstrator only needs to set up a calendar that contains the various holidays or even recurring events specifying the office hours. A custom greeting filename could even be contained in the description field for playback

For Example:-

[incoming]
exten => 011123456,1,Answer
 same => n,GotoIf(${CALENDAR_BUSY(officehours)}?closed:attendant,s,1)
 same => n(closed),Set(id=${CALENDAR_QUERY(office,${EPOCH},${EPOCH})})
 same => n,Set(soundfile=${CALENDAR_QUERY_RESULT(${id},description)})
 same => n,Playback($[${ISNULL(soundfile)} ? generic-closed :: ${soundfile}])
 same => n,Hangup

Leave a Reply