222#define CALENDAR_BUCKETS 19
238 .
type =
"EventNotification",
244 .
type =
"CalendarEventList",
406 int new_calendar = 0;
446 if (!strcasecmp(v->
name,
"autoreminder")) {
448 }
else if (!strcasecmp(v->
name,
"channel")) {
450 }
else if (!strcasecmp(v->
name,
"context")) {
452 }
else if (!strcasecmp(v->
name,
"extension")) {
454 }
else if (!strcasecmp(v->
name,
"waittime")) {
455 int i = atoi(v->
value);
459 }
else if (!strcasecmp(v->
name,
"app")) {
461 }
else if (!strcasecmp(v->
name,
"appdata")) {
463 }
else if (!strcasecmp(v->
name,
"refresh")) {
465 }
else if (!strcasecmp(v->
name,
"fetch_again_at_reload")) {
467 }
else if (!strcasecmp(v->
name,
"timeframe")) {
469 }
else if (!strcasecmp(v->
name,
"setvar")) {
494 "You have set 'autoreminder' but not 'channel' for calendar '%s.' "
495 "Notifications will not occur.\n",
518 const char *cat =
NULL;
528 if (!strcasecmp(cat,
"general")) {
562 if(!strcasecmp(tech->
type, iter->
type)) {
582 if (cal->
tech == tech) {
603 ast_verb(2,
"Unregistered calendar type '%s'\n", tech->
type);
616 ast_debug(3,
"Destroying event for calendar '%s'\n",
event->owner->name);
619 if (attendee->
data) {
631 ast_debug(3,
"Notification running, can't delete sched entry\n");
634 ast_debug(3,
"Devicestate update (start) running, can't delete sched entry\n");
637 ast_debug(3,
"Devicestate update (end) running, can't delete sched entry\n");
642 if (
event->bs_start_sched < 0 &&
event->bs_end_sched >= 0) {
664 ast_debug(3,
"Clearing all events for calendar %s\n", cal->
name);
682 event->notify_sched = -1;
683 event->bs_start_sched = -1;
684 event->bs_end_sched = -1;
721 unsigned long val[4];
724 for (x = 0; x < 4; x++) {
727 snprintf(
buf, size,
"%08lx%08lx%08lx%08lx",
val[0],
val[1],
val[2],
val[3]);
739 .description =
"Null channel (should not see this)",
758 if ((dest = strchr(tech,
'/'))) {
779 if (!(chan =
ast_channel_alloc(1,
AST_STATE_DOWN, 0, 0, 0, 0, 0,
NULL,
NULL, 0,
"Calendar/%s-%s",
event->owner->name,
buf))) {
792 ast_log(
LOG_ERROR,
"Could not allocate capabilities, notification not being sent!\n");
802 ast_log(
LOG_ERROR,
"Could not allocate datastore, notification not being sent!\n");
819 for (itervar =
event->owner->vars; itervar; itervar = itervar->
next) {
834 ast_verb(3,
"Dialing %s for notification on calendar %s\n",
event->owner->notify_channel,
event->owner->name);
838 ast_verb(3,
"Notification call for %s was not completed\n",
event->owner->name);
882 event->notify_sched = -1;
907 is_end_event =
event->end <= now.tv_sec;
910 event->bs_end_sched = -1;
912 event->bs_start_sched = -1;
960 time_t alarm_notify_sched = 0, devstate_sched_start, devstate_sched_end;
963 event = cmp_event ? cmp_event : old_event;
969 alarm_notify_sched = (
event->start - (60 * cal->
autoreminder) - now.tv_sec) * 1000;
970 }
else if (
event->alarm) {
971 alarm_notify_sched = (
event->alarm - now.tv_sec) * 1000;
975 if (
event->start >= now.tv_sec) {
976 if (alarm_notify_sched <= 0) {
977 alarm_notify_sched = 1;
982 ast_debug(3,
"Calendar alarm event notification scheduled to happen in %ld ms\n", (
long) alarm_notify_sched);
986 if (!cmp_event || old_event->
start !=
event->start) {
988 devstate_sched_start = (
event->start - now.tv_sec) * 1000;
990 if (devstate_sched_start < 1) {
991 devstate_sched_start = 1;
997 ast_debug(3,
"Calendar bs_start event notification scheduled to happen in %ld ms\n", (
long) devstate_sched_start);
1000 if (!cmp_event || old_event->
end !=
event->end) {
1002 devstate_sched_end = (
event->end - now.tv_sec) * 1000;
1004 if (devstate_sched_end <= 0) {
1005 ast_log(
LOG_WARNING,
"Whoops! Event end notification scheduled in the past: %ld ms\n", (
long) devstate_sched_end);
1010 ast_debug(3,
"Calendar bs_end event notification scheduled to happen in %ld ms\n", (
long) devstate_sched_end);
1029 if (!(new_event =
find_event(new_events, old_event->
uid))) {
1077 if (!(tmpcfg =
ast_config_load2(
"calendar.conf",
"calendar", config_flags)) ||
1104 ast_log(
LOG_WARNING,
"CALENDAR_BUSY requires an argument: CALENDAR_BUSY(<calendar_name>)\n");
1122 .
name =
"CALENDAR_BUSY",
1129 long event_startdiff = labs(start -
event->start);
1130 long event_enddiff = labs(
end -
event->end);
1143 long startdiff = labs(iter->
event->
start - start);
1145 ast_debug(10,
"Comparing %s with startdiff %ld to %s with startdiff %ld\n",
event->summary, event_startdiff, iter->
event->
summary, startdiff);
1147 if (startdiff > event_startdiff) {
1151 if (startdiff == event_startdiff) {
1154 if (enddiff > event_enddiff) {
1158 if (event_startdiff == enddiff) {
1226 time_t start = INT_MIN,
end = INT_MAX;
1258 start = atoi(
args.start);
1267 if (!(start >
event->end || end < event->start)) {
1268 ast_debug(10,
"%s (%ld - %ld) overlapped with (%ld - %ld)\n",
event->summary, (
long)
event->start, (
long)
event->end, (
long) start, (
long)
end);
1307 .
name =
"CALENDAR_QUERY",
1368 row = atoi(
args.row);
1375 if (!strcasecmp(
args.field,
"getnum")) {
1376 snprintf(
buf,
len,
"%zu", listlen);
1384 if (!strcasecmp(
args.field,
"summary")) {
1386 }
else if (!strcasecmp(
args.field,
"description")) {
1388 }
else if (!strcasecmp(
args.field,
"organizer")) {
1390 }
else if (!strcasecmp(
args.field,
"location")) {
1392 }
else if (!strcasecmp(
args.field,
"categories")) {
1394 }
else if (!strcasecmp(
args.field,
"priority")) {
1396 }
else if (!strcasecmp(
args.field,
"calendar")) {
1398 }
else if (!strcasecmp(
args.field,
"uid")) {
1400 }
else if (!strcasecmp(
args.field,
"start")) {
1401 snprintf(
buf,
len,
"%ld", (
long)
entry->event->start);
1402 }
else if (!strcasecmp(
args.field,
"end")) {
1403 snprintf(
buf,
len,
"%ld", (
long)
entry->event->end);
1404 }
else if (!strcasecmp(
args.field,
"busystate")) {
1405 snprintf(
buf,
len,
"%u",
entry->event->busy_state);
1406 }
else if (!strcasecmp(
args.field,
"attendees")) {
1418 .
name =
"CALENDAR_QUERY_RESULT",
1425 char *val_dup =
NULL;
1465 if (fields.argc - 1 !=
values.argc) {
1466 ast_log(
LOG_WARNING,
"CALENDAR_WRITE should have the same number of fields (%u) and values (%u)!\n", fields.argc - 1,
values.argc);
1472 for (i = 1, j = 0; i < fields.argc; i++, j++) {
1473 if (!strcasecmp(fields.field[i],
"summary")) {
1475 }
else if (!strcasecmp(fields.field[i],
"description")) {
1477 }
else if (!strcasecmp(fields.field[i],
"organizer")) {
1479 }
else if (!strcasecmp(fields.field[i],
"location")) {
1481 }
else if (!strcasecmp(fields.field[i],
"categories")) {
1483 }
else if (!strcasecmp(fields.field[i],
"priority")) {
1484 event->priority = atoi(
values.value[j]);
1485 }
else if (!strcasecmp(fields.field[i],
"uid")) {
1487 }
else if (!strcasecmp(fields.field[i],
"start")) {
1488 event->start = atoi(
values.value[j]);
1489 }
else if (!strcasecmp(fields.field[i],
"end")) {
1490 event->end = atoi(
values.value[j]);
1491 }
else if (!strcasecmp(fields.field[i],
"busystate")) {
1492 event->busy_state = atoi(
values.value[j]);
1498 if (!
event->start) {
1499 event->start = tv.tv_sec;
1503 event->end = tv.tv_sec;
1530 .
name =
"CALENDAR_WRITE",
1537#define FORMAT "%-20.20s %-10.10s %-6.6s\n"
1543 e->
command =
"calendar show calendars";
1545 "Usage: calendar show calendars\n"
1546 " Lists all registered calendars.\n";
1568#define FORMAT "%-10.10s %-30.30s\n"
1574 e->
command =
"calendar show types";
1576 "Usage: calendar show types\n"
1577 " Lists all registered calendars types.\n";
1597 struct timeval tv = {
1613 switch (busy_state) {
1617 return "Busy (Tentative)";
1621 return "Unknown (Busy)";
1628#define FORMAT "%-18.18s : %-20.20s\n"
1629#define FORMAT2 "%-12.12s: %-40.60s\n"
1638 e->
command =
"calendar show calendar";
1640 "Usage: calendar show calendar <calendar name>\n"
1641 " Displays information about a calendar\n";
1650 if (!strncasecmp(
a->word, cal->
name, strlen(
a->word)) && ++which >
a->n) {
1681 ast_cli(
a->fd,
"%-17.17s : None\n",
"Autoreminder");
1696 ast_cli(
a->fd,
"%-12.12s: %d\n",
"Priority",
event->priority);
1717 e->
command =
"calendar dump sched";
1719 "Usage: calendar dump sched\n"
1720 " Dump the calendar sched context";
1767 if (!strcasecmp(data,
"summary")) {
1769 }
else if (!strcasecmp(data,
"description")) {
1771 }
else if (!strcasecmp(data,
"organizer")) {
1773 }
else if (!strcasecmp(data,
"location")) {
1775 }
else if (!strcasecmp(data,
"categories")) {
1777 }
else if (!strcasecmp(data,
"priority")) {
1779 }
else if (!strcasecmp(data,
"calendar")) {
1781 }
else if (!strcasecmp(data,
"uid")) {
1783 }
else if (!strcasecmp(data,
"start")) {
1785 }
else if (!strcasecmp(data,
"end")) {
1787 }
else if (!strcasecmp(data,
"busystate")) {
1789 }
else if (!strcasecmp(data,
"attendees")) {
1798 .
name =
"CALENDAR_EVENT",
1848 struct timespec ts = {0,};
1858 ts.tv_sec = (now.tv_sec + wait / 1000) + 1;
1949 ast_log(
LOG_ERROR,
"Unable to start refresh thread--notifications disabled!\n");
Prototypes for public functions only of internal interest,.
static const struct adsi_event events[]
struct sla_ringing_trunk * last
Asterisk main include file. File version handling, generic pbx functions.
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
#define ast_calloc(num, len)
A wrapper for calloc()
#define ao2_iterator_next(iter)
#define ao2_link(container, obj)
Add an object to a container.
@ AO2_ALLOC_OPT_LOCK_MUTEX
#define ao2_callback(c, flags, cb_fn, arg)
ao2_callback() is a generic function that applies cb_fn() to all objects in a container,...
#define ao2_unlink(container, obj)
Remove an object from a container.
#define ao2_find(container, arg, flags)
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ao2_ref(o, delta)
Reference/unreference an object and return the old refcount.
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
#define ao2_alloc(data_size, destructor_fn)
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
Allocate and initialize a hash container with the desired number of buckets.
A general API for managing calendar events with Asterisk.
@ AST_CALENDAR_BS_BUSY_TENTATIVE
General Asterisk PBX channel definitions.
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
const char * ast_channel_name(const struct ast_channel *chan)
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
#define DATASTORE_INHERIT_FOREVER
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
#define ast_channel_lock(chan)
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
struct ast_channel * ast_channel_release(struct ast_channel *chan)
Unlink and release reference to a channel.
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
void ast_channel_context_set(struct ast_channel *chan, const char *value)
void ast_channel_priority_set(struct ast_channel *chan, int value)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
#define ast_channel_unlock(chan)
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
struct ast_datastore * ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Find a datastore on a channel.
Standard Command Line Interface.
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
#define AST_CLI_DEFINE(fn, txt,...)
void ast_cli(int fd, const char *fmt,...)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
#define ast_datastore_alloc(info, uid)
int ast_devstate_prov_del(const char *label)
Remove device state provider.
int ast_devstate_changed(enum ast_device_state state, enum ast_devstate_cache cachable, const char *fmt,...)
Tells Asterisk the State for Device is changed.
int ast_devstate_prov_add(const char *label, ast_devstate_prov_cb_type callback)
Add device state provider.
ast_device_state
Device States.
ast_dial_result
List of return codes for dial run API calls.
@ AST_DIAL_RESULT_ANSWERED
int ast_dial_append(struct ast_dial *dial, const char *tech, const char *device, const struct ast_assigned_ids *assignedids)
Append a channel.
struct ast_dial * ast_dial_create(void)
New dialing structure.
void ast_dial_set_global_timeout(struct ast_dial *dial, int timeout)
Set the maximum time (globally) allowed for trying to ring phones.
enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async)
Execute dialing synchronously or asynchronously.
struct ast_channel * ast_dial_answered_steal(struct ast_dial *dial)
Steal the channel that answered.
@ AST_DIAL_OPTION_ANSWER_EXEC
int ast_dial_destroy(struct ast_dial *dial)
Destroys a dialing structure.
int ast_dial_option_global_enable(struct ast_dial *dial, enum ast_dial_option option, void *data)
Enables an option globally.
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
Application convenience functions, designed to give consistent look and feel to Asterisk apps.
#define AST_APP_ARG(name)
Define an application argument.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
char * strsep(char **str, const char *delims)
Configuration File Parser.
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
#define ast_variable_new(name, value, filename)
#define CONFIG_STATUS_FILEUNCHANGED
#define CONFIG_STATUS_FILEINVALID
void ast_config_destroy(struct ast_config *cfg)
Destroys a config.
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
@ CONFIG_FLAG_FILEUNCHANGED
#define ast_debug(level,...)
Log a DEBUG message.
#define ast_verb(level,...)
A set of macros to manage forward-linked lists.
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define AST_LIST_INSERT_BEFORE_CURRENT(elm, field)
Inserts a list entry before the current entry during a traversal.
#define AST_LIST_LOCK(head)
Locks a list.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
int ast_strftime(char *buf, size_t len, const char *format, const struct ast_tm *tm)
Special version of strftime(3) that handles fractions of a second. Takes the same arguments as strfti...
#define ast_rwlock_wrlock(a)
#define AST_PTHREADT_NULL
#define ast_cond_init(cond, attr)
#define ast_cond_timedwait(cond, mutex, time)
#define ast_rwlock_rdlock(a)
#define AST_RWLOCK_DEFINE_STATIC(rwlock)
#define ast_mutex_init(pmutex)
#define ast_mutex_unlock(a)
pthread_cond_t ast_cond_t
#define ast_rwlock_unlock(a)
#define ast_mutex_lock(a)
#define ast_cond_signal(cond)
Asterisk module definitions.
@ AST_MODFLAG_GLOBAL_SYMBOLS
int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode)
Unload a module.
#define AST_MODULE_INFO(keystr, flags_to_set, desc, fields...)
@ AST_MODPRI_DEVSTATE_PROVIDER
#define ast_module_user_remove(user)
@ AST_MODULE_SUPPORT_EXTENDED
#define ast_module_user_add(chan)
#define ASTERISK_GPL_KEY
The text the key() function should return.
@ AST_MODULE_LOAD_SUCCESS
@ AST_MODULE_LOAD_DECLINE
Module has failed to load, may be in an inconsistent state.
Core PBX routines and definitions.
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
int pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
Add a variable to the channel variable stack, removing the most recently set value for the same name.
#define ast_custom_function_register(acf)
Register a custom function.
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static int calendar_write_exec(struct ast_channel *chan, const char *cmd, char *data, const char *value)
static char * epoch_to_string(char *buf, size_t buflen, time_t epoch)
static int calendar_query_exec(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static void calendar_join_attendees(struct ast_calendar_event *event, char *buf, size_t len)
static void * event_notification_duplicate(void *data)
void ast_calendar_unregister(struct ast_calendar_tech *tech)
Unregister a new calendar technology.
static const char * ast_calendar_busy_state_to_str(enum ast_calendar_busy_state busy_state)
static char * handle_show_calendars(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI command to list available calendars.
static char * handle_dump_sched(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static struct ast_custom_function calendar_query_function
void ast_calendar_merge_events(struct ast_calendar *cal, struct ao2_container *new_events)
Add an event to the list of events for a calendar.
static int calendar_query_result_exec(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static struct ast_custom_function calendar_write_function
static struct ast_calendar * unref_calendar(struct ast_calendar *cal)
static void * eventlist_duplicate(void *data)
static ast_mutex_t refreshlock
static int add_new_event_cb(void *obj, void *arg, int flags)
static void * do_refresh(void *data)
static struct ast_sched_context * sched
static struct ast_custom_function calendar_query_result_function
static int clear_events_cb(void *user_data, void *arg, int flags)
static ast_mutex_t reloadlock
static const struct ast_datastore_info event_notification_datastore
static enum ast_device_state calendarstate(const char *data)
static void calendar_destructor(void *obj)
void ast_calendar_config_release(void)
Release the calendar config.
static struct ast_custom_function calendar_event_function
static int cb_pending_deletion(void *user_data, void *arg, int flags)
static struct ast_cli_entry calendar_cli[]
static struct ast_config * calendar_config
static struct ast_custom_function calendar_busy_function
static int match_caltech_cb(void *user_data, void *arg, int flags)
static void eventlist_destructor(void *obj)
static int calendar_event_notify(const void *data)
static const struct ast_channel_tech null_tech
static struct ast_calendar * build_calendar(struct ast_config *cfg, const char *cat, const struct ast_calendar_tech *tech)
static int schedule_calendar_event(struct ast_calendar *cal, struct ast_calendar_event *old_event, struct ast_calendar_event *cmp_event)
static ast_rwlock_t config_lock
struct ao2_container * ast_calendar_event_container_alloc(void)
Allocate an astobj2 container for ast_calendar_event objects.
static int load_tech_calendars(struct ast_calendar_tech *tech)
static int null_chan_write(struct ast_channel *chan, struct ast_frame *frame)
static int event_hash_fn(const void *obj, const int flags)
void ast_calendar_clear_events(struct ast_calendar *cal)
Remove all events from calendar.
static int calendar_hash_fn(const void *obj, const int flags)
static void copy_event_data(struct ast_calendar_event *dst, struct ast_calendar_event *src)
static int calendar_devstate_change(const void *data)
static int calendar_is_busy(struct ast_calendar *cal)
int ast_calendar_register(struct ast_calendar_tech *tech)
Register a new calendar technology.
static int cb_rm_pending_deletion(void *user_data, void *arg, int flags)
static struct ast_calendar_event * find_event(struct ao2_container *events, const char *uid)
static pthread_t refresh_thread
static struct ast_calendar_event * destroy_event(struct ast_calendar_event *event)
static int calendar_event_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static char * handle_show_calendar(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static char * generate_random_string(char *buf, size_t size)
Generate 32 byte random string (stolen from chan_sip.c)
static const struct ast_datastore_info eventlist_datastore_info
static ast_cond_t refresh_condition
static struct ao2_container * calendars
static int merge_events_cb(void *obj, void *arg, int flags)
static int calendar_cmp_fn(void *obj, void *arg, int flags)
static int add_event_to_list(struct eventlist *events, struct ast_calendar_event *event, time_t start, time_t end)
static int load_module(void)
Load the module.
static int unload_module(void)
static int load_config(int reload)
static void event_notification_destroy(void *data)
static int event_cmp_fn(void *obj, void *arg, int flags)
static int module_unloading
static struct ast_calendar * find_calendar(const char *name)
struct ast_calendar_event * ast_calendar_event_alloc(struct ast_calendar *cal)
Allocate an astobj2 ast_calendar_event object.
static int calendar_busy_callback(void *obj, void *arg, int flags)
static int calendar_busy_exec(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
A dialplan function that can be used to determine the busy status of a calendar.
struct ast_calendar_event * ast_calendar_unref_event(struct ast_calendar_event *event)
Unreference an ast_calendar_event.
static void calendar_event_destructor(void *obj)
static char * handle_show_calendars_types(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
CLI command to list of all calendars types currently loaded on the backend.
const struct ast_config * ast_calendar_config_acquire(void)
Grab and lock pointer to the calendar config (read only)
static void eventlist_destroy(void *data)
static void * do_notify(void *data)
static int notify_channel(void *obj)
Scheduler Routines (derived from cheops)
#define AST_SCHED_REPLACE(id, sched, when, callback, data)
int ast_sched_del(struct ast_sched_context *con, int id) attribute_warn_unused_result
Deletes a scheduled event.
void ast_sched_dump(struct ast_sched_context *con)
Dumps the scheduler contents.
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
int ast_sched_runq(struct ast_sched_context *con)
Runs the queue.
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
int ast_sched_wait(struct ast_sched_context *con) attribute_warn_unused_result
Determines number of seconds until the next outstanding event to take place.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true"....
static force_inline int attribute_pure ast_strlen_zero(const char *s)
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
static force_inline int attribute_pure ast_str_case_hash(const char *str)
Compute a hash value on a case-insensitive string.
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
struct ast_calendar_attendee * next
const ast_string_field uid
enum ast_calendar_busy_state busy_state
struct ast_calendar * owner
const ast_string_field location
const ast_string_field description
const ast_string_field categories
const ast_string_field organizer
struct ast_calendar_event::attendees attendees
const ast_string_field summary
Individual calendaring technology data.
struct ast_calendar_tech::@201 list
struct ast_module_user * user
int(* is_busy)(struct ast_calendar *calendar)
int(* write_event)(struct ast_calendar_event *event)
void *(* unref_calendar)(void *obj)
void *(* load_calendar)(void *data)
Asterisk calendar structure.
struct ast_variable * vars
const struct ast_calendar_tech * tech
struct ao2_container * events
int fetch_again_at_reload
const ast_string_field notify_context
const ast_string_field notify_app
unsigned int pending_deletion
const ast_string_field notify_channel
const ast_string_field name
const ast_string_field notify_extension
const ast_string_field notify_appdata
Structure to describe a channel "technology", ie a channel driver See for examples:
Main Channel structure associated with a channel.
descriptor for a cli entry.
Data structure associated with a custom dialplan function.
Structure for a data store type.
Structure for a data store object.
Main dialing structure. Contains global options, channels being dialed, and more!
Structure used to handle boolean flags.
Data structure associated with a single frame of data.
Structure for mutex and tracking information.
Support for dynamic strings.
Structure for variables, used for configurations and for channel variables.
struct ast_variable * next
struct ast_calendar_event * event
struct evententry::@423 list
struct sla_ringing_trunk * next
struct association categories[]
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
#define ast_pthread_create(a, b, c, d)
#define ast_pthread_create_background(a, b, c, d)
long int ast_random(void)