The simplest dialplan query is the CALENDAR_BUSY query. It takes a single option, the name of the calendar defined, and returns "1" for busy (including tentatively busy) and "0" for not busy.
For more information about a calendar event, a combination of CALENDAR_QUERY and CALENDAR_QUERY_RESULT is used. CALENDAR_QUERY takes the calendar name and optionally a start and end time in "unix time" (seconds from unix epoch). It returns an id that can be passed to CALENDAR_QUERY_RESULT along with a field name to return the data in that field. If multiple events are returned in the query, the number of the event in the list can be specified as well. The available fields to return are:
- summary - A short summary of the event
- description - The full description of the event
- organizer - Who organized the event
- location - Where the event is located
- calendar - The name of the calendar from calendar.conf
- uid - The unique identifier associated with the event
- start - The start of the event in seconds since Unix epoch
- end - The end of the event in seconds since Unix epoch
- busystate - The busy state 0=Free, 1=Tentative, 2=Busy
- attendees - A comma separated list of attendees as stored in the event and may include prefixes such as "mailto:".
When an event notification is sent to the dial plan, the CALENDAR_EVENT function may be used to return the information about the event that is causing the notification. The fields that can be returned are the same as those from CALENDAR_QUERY_RESULT.
To write an event to a calendar, the CALENDAR_WRITE function is used. This function takes a calendar name and also uses the same fields as CALENDAR_QUERY_RESULT. As a write function, it takes a set of comma-separated values that are in the same order as the specified fields. For example:
CALENDAR_WRITE(mycalendar,summary,organizer,start,end,busystate)= "My event","mailto:[email protected]",228383580,228383640,1)