220 #define CALENDAR_BUCKETS 19 236 .
type =
"EventNotification",
242 .
type =
"CalendarEventList",
262 if (!calendar_config) {
404 int new_calendar = 0;
444 if (!strcasecmp(v->
name,
"autoreminder")) {
446 }
else if (!strcasecmp(v->
name,
"channel")) {
448 }
else if (!strcasecmp(v->
name,
"context")) {
450 }
else if (!strcasecmp(v->
name,
"extension")) {
452 }
else if (!strcasecmp(v->
name,
"waittime")) {
453 int i = atoi(v->
value);
457 }
else if (!strcasecmp(v->
name,
"app")) {
459 }
else if (!strcasecmp(v->
name,
"appdata")) {
461 }
else if (!strcasecmp(v->
name,
"refresh")) {
463 }
else if (!strcasecmp(v->
name,
"fetch_again_at_reload")) {
465 }
else if (!strcasecmp(v->
name,
"timeframe")) {
467 }
else if (!strcasecmp(v->
name,
"setvar")) {
492 "You have set 'autoreminder' but not 'channel' for calendar '%s.' " 493 "Notifications will not occur.\n",
516 const char *cat =
NULL;
519 if (!calendar_config) {
526 if (!strcasecmp(cat,
"general")) {
553 if (!calendar_config) {
560 if(!strcasecmp(tech->
type, iter->
type)) {
580 if (cal->
tech == tech) {
601 ast_verb(2,
"Unregistered calendar type '%s'\n", tech->
type);
614 ast_debug(3,
"Destroying event for calendar '%s'\n",
event->owner->name);
617 if (attendee->
data) {
629 ast_debug(3,
"Notification running, can't delete sched entry\n");
632 ast_debug(3,
"Devicestate update (start) running, can't delete sched entry\n");
635 ast_debug(3,
"Devicestate update (end) running, can't delete sched entry\n");
662 ast_debug(3,
"Clearing all events for calendar %s\n", cal->
name);
680 event->notify_sched = -1;
681 event->bs_start_sched = -1;
682 event->bs_end_sched = -1;
719 unsigned long val[4];
722 for (x = 0; x < 4; x++) {
725 snprintf(buf, size,
"%08lx%08lx%08lx%08lx", val[0], val[1], val[2], val[3]);
737 .description =
"Null channel (should not see this)",
756 if ((dest = strchr(tech,
'/'))) {
777 if (!(chan =
ast_channel_alloc(1,
AST_STATE_DOWN, 0, 0, 0, 0, 0,
NULL,
NULL, 0,
"Calendar/%s-%s",
event->owner->name, buf))) {
790 ast_log(
LOG_ERROR,
"Could not allocate capabilities, notification not being sent!\n");
800 ast_log(
LOG_ERROR,
"Could not allocate datastore, notification not being sent!\n");
817 for (itervar =
event->owner->vars; itervar; itervar = itervar->
next) {
832 ast_verb(3,
"Dialing %s for notification on calendar %s\n",
event->owner->notify_channel,
event->owner->name);
836 ast_verb(3,
"Notification call for %s was not completed\n",
event->owner->name);
880 event->notify_sched = -1;
905 is_end_event =
event->end <= now.tv_sec;
908 event->bs_end_sched = -1;
910 event->bs_start_sched = -1;
958 time_t alarm_notify_sched = 0, devstate_sched_start, devstate_sched_end;
961 event = cmp_event ? cmp_event : old_event;
967 alarm_notify_sched = (
event->start - (60 * cal->
autoreminder) - now.tv_sec) * 1000;
968 }
else if (event->
alarm) {
969 alarm_notify_sched = (
event->alarm - now.tv_sec) * 1000;
973 if (event->
start >= now.tv_sec) {
974 if (alarm_notify_sched <= 0) {
975 alarm_notify_sched = 1;
980 ast_debug(3,
"Calendar alarm event notification scheduled to happen in %ld ms\n", (
long) alarm_notify_sched);
984 if (!cmp_event || old_event->
start != event->
start) {
986 devstate_sched_start = (
event->start - now.tv_sec) * 1000;
988 if (devstate_sched_start < 1) {
989 devstate_sched_start = 1;
995 ast_debug(3,
"Calendar bs_start event notification scheduled to happen in %ld ms\n", (
long) devstate_sched_start);
998 if (!cmp_event || old_event->
end != event->
end) {
1000 devstate_sched_end = (
event->end - now.tv_sec) * 1000;
1004 ast_debug(3,
"Calendar bs_end event notification scheduled to happen in %ld ms\n", (
long) devstate_sched_end);
1022 if (!(new_event =
find_event(new_events, old_event->
uid))) {
1070 if (!(tmpcfg =
ast_config_load2(
"calendar.conf",
"calendar", config_flags)) ||
1081 if (calendar_config) {
1085 calendar_config = tmpcfg;
1097 ast_log(
LOG_WARNING,
"CALENDAR_BUSY requires an argument: CALENDAR_BUSY(<calendar_name>)\n");
1115 .
name =
"CALENDAR_BUSY",
1122 long event_startdiff = labs(start - event->
start);
1123 long event_enddiff = labs(end - event->
end);
1126 if (!(entry =
ast_calloc(1,
sizeof(*entry)))) {
1136 long startdiff = labs(iter->
event->
start - start);
1138 ast_debug(10,
"Comparing %s with startdiff %ld to %s with startdiff %ld\n", event->
summary, event_startdiff, iter->
event->
summary, startdiff);
1140 if (startdiff > event_startdiff) {
1144 if (startdiff == event_startdiff) {
1145 long enddiff = labs(iter->
event->
end - end);
1147 if (enddiff > event_enddiff) {
1151 if (event_startdiff == enddiff) {
1219 time_t start = INT_MIN,
end = INT_MAX;
1251 start = atoi(
args.start);
1255 end = atoi(
args.end);
1260 if (!(start > event->
end || end < event->start)) {
1261 ast_debug(10,
"%s (%ld - %ld) overlapped with (%ld - %ld)\n", event->
summary, (
long) event->
start, (
long) event->
end, (
long) start, (
long) end);
1300 .
name =
"CALENDAR_QUERY",
1355 if (!(events = datastore->
data)) {
1361 row = atoi(
args.row);
1368 if (!strcasecmp(
args.field,
"getnum")) {
1369 snprintf(buf, len,
"%zu", listlen);
1377 if (!strcasecmp(
args.field,
"summary")) {
1379 }
else if (!strcasecmp(
args.field,
"description")) {
1381 }
else if (!strcasecmp(
args.field,
"organizer")) {
1383 }
else if (!strcasecmp(
args.field,
"location")) {
1385 }
else if (!strcasecmp(
args.field,
"categories")) {
1387 }
else if (!strcasecmp(
args.field,
"priority")) {
1389 }
else if (!strcasecmp(
args.field,
"calendar")) {
1391 }
else if (!strcasecmp(
args.field,
"uid")) {
1393 }
else if (!strcasecmp(
args.field,
"start")) {
1394 snprintf(buf, len,
"%ld", (
long) entry->
event->
start);
1395 }
else if (!strcasecmp(
args.field,
"end")) {
1396 snprintf(buf, len,
"%ld", (
long) entry->
event->
end);
1397 }
else if (!strcasecmp(
args.field,
"busystate")) {
1399 }
else if (!strcasecmp(
args.field,
"attendees")) {
1411 .
name =
"CALENDAR_QUERY_RESULT",
1418 char *val_dup =
NULL;
1458 if (fields.argc - 1 !=
values.argc) {
1459 ast_log(
LOG_WARNING,
"CALENDAR_WRITE should have the same number of fields (%u) and values (%u)!\n", fields.argc - 1,
values.argc);
1465 for (i = 1, j = 0; i < fields.argc; i++, j++) {
1466 if (!strcasecmp(fields.field[i],
"summary")) {
1468 }
else if (!strcasecmp(fields.field[i],
"description")) {
1470 }
else if (!strcasecmp(fields.field[i],
"organizer")) {
1472 }
else if (!strcasecmp(fields.field[i],
"location")) {
1474 }
else if (!strcasecmp(fields.field[i],
"categories")) {
1476 }
else if (!strcasecmp(fields.field[i],
"priority")) {
1477 event->priority = atoi(
values.value[j]);
1478 }
else if (!strcasecmp(fields.field[i],
"uid")) {
1480 }
else if (!strcasecmp(fields.field[i],
"start")) {
1481 event->start = atoi(
values.value[j]);
1482 }
else if (!strcasecmp(fields.field[i],
"end")) {
1483 event->end = atoi(
values.value[j]);
1484 }
else if (!strcasecmp(fields.field[i],
"busystate")) {
1485 event->busy_state = atoi(
values.value[j]);
1491 if (!
event->start) {
1492 event->start = tv.tv_sec;
1496 event->end = tv.tv_sec;
1523 .
name =
"CALENDAR_WRITE",
1530 #define FORMAT "%-20.20s %-10.10s %-6.6s\n" 1536 e->
command =
"calendar show calendars";
1538 "Usage: calendar show calendars\n" 1539 " Lists all registered calendars.\n";
1561 #define FORMAT "%-10.10s %-30.30s\n" 1567 e->
command =
"calendar show types";
1569 "Usage: calendar show types\n" 1570 " Lists all registered calendars types.\n";
1590 struct timeval tv = {
1606 #define FORMAT "%-18.18s : %-20.20s\n" 1607 #define FORMAT2 "%-12.12s: %-40.60s\n" 1616 e->
command =
"calendar show calendar";
1618 "Usage: calendar show calendar <calendar name>\n" 1619 " Displays information about a calendar\n";
1628 if (!strncasecmp(a->
word, cal->
name, strlen(a->
word)) && ++which > a->
n) {
1659 ast_cli(a->
fd,
"%-17.17s : None\n",
"Autoreminder");
1694 e->
command =
"calendar dump sched";
1696 "Usage: calendar dump sched\n" 1697 " Dump the calendar sched context";
1739 if (!(event = datastore->
data)) {
1744 if (!strcasecmp(data,
"summary")) {
1746 }
else if (!strcasecmp(data,
"description")) {
1748 }
else if (!strcasecmp(data,
"organizer")) {
1750 }
else if (!strcasecmp(data,
"location")) {
1752 }
else if (!strcasecmp(data,
"categories")) {
1754 }
else if (!strcasecmp(data,
"priority")) {
1755 snprintf(buf, len,
"%d", event->
priority);
1756 }
else if (!strcasecmp(data,
"calendar")) {
1758 }
else if (!strcasecmp(data,
"uid")) {
1760 }
else if (!strcasecmp(data,
"start")) {
1761 snprintf(buf, len,
"%ld", (
long)event->
start);
1762 }
else if (!strcasecmp(data,
"end")) {
1763 snprintf(buf, len,
"%ld", (
long)event->
end);
1764 }
else if (!strcasecmp(data,
"busystate")) {
1766 }
else if (!strcasecmp(data,
"attendees")) {
1775 .
name =
"CALENDAR_EVENT",
1825 struct timespec ts = {0,};
1835 ts.tv_sec = (now.tv_sec + wait / 1000) + 1;
1885 calendar_config =
NULL;
1921 calendar_config =
NULL;
1926 ast_log(
LOG_ERROR,
"Unable to start refresh thread--notifications disabled!\n");
static int calendar_devstate_change(const void *data)
static void * do_notify(void *data)
struct ast_variable * next
static void calendar_join_attendees(struct ast_calendar_event *event, char *buf, size_t len)
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 * generate_random_string(char *buf, size_t size)
Generate 32 byte random string (stolen from chan_sip.c)
enum sip_cc_notify_state state
int fetch_again_at_reload
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.
#define ast_rwlock_rdlock(a)
#define ast_channel_lock(chan)
Main Channel structure associated with a channel.
static struct ast_custom_function calendar_busy_function
#define AST_CLI_DEFINE(fn, txt,...)
ast_device_state
Device States.
int ast_dial_destroy(struct ast_dial *dial)
Destroys a dialing structure.
static ast_cond_t refresh_condition
#define AST_LIST_LOCK(head)
Locks a list.
int ast_dial_option_global_enable(struct ast_dial *dial, enum ast_dial_option option, void *data)
Enables an option globally.
Asterisk main include file. File version handling, generic pbx functions.
const struct ast_calendar_tech * tech
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
static struct ao2_container * calendars
struct ao2_container * ast_calendar_event_container_alloc(void)
Allocate an astobj2 container for ast_calendar_event objects.
#define AST_RWLOCK_DEFINE_STATIC(rwlock)
static int calendar_event_read(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static char * epoch_to_string(char *buf, size_t buflen, time_t epoch)
static int load_module(void)
Load the module.
static int calendar_event_notify(const void *data)
Main dialing structure. Contains global options, channels being dialed, and more! ...
void ast_channel_set_writeformat(struct ast_channel *chan, struct ast_format *format)
void ast_variables_destroy(struct ast_variable *var)
Free variable list.
static void eventlist_destroy(void *data)
static int load_tech_calendars(struct ast_calendar_tech *tech)
int ast_sched_runq(struct ast_sched_context *con)
Runs the queue.
static pthread_t refresh_thread
int ast_cli_unregister_multiple(struct ast_cli_entry *e, int len)
Unregister multiple commands.
void ast_dial_set_global_timeout(struct ast_dial *dial, int timeout)
Set the maximum time (globally) allowed for trying to ring phones.
static int clear_events_cb(void *user_data, void *arg, int flags)
struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category_name)
struct ast_variable * vars
static void * eventlist_duplicate(void *data)
struct ast_channel * ast_channel_release(struct ast_channel *chan)
Unlink and release reference to a channel.
void ast_channel_set_rawwriteformat(struct ast_channel *chan, struct ast_format *format)
#define AST_STANDARD_APP_ARGS(args, parse)
Performs the 'standard' argument separation process for an application.
descriptor for a cli entry.
#define AST_LIST_UNLOCK(head)
Attempts to unlock a list.
char * ast_str_buffer(const struct ast_str *buf)
Returns the string buffer within the ast_str buf.
#define ao2_callback(c, flags, cb_fn, arg)
#define CONFIG_STATUS_FILEINVALID
static int calendar_write_exec(struct ast_channel *chan, const char *cmd, char *data, const char *value)
struct ast_tm * ast_localtime(const struct timeval *timep, struct ast_tm *p_tm, const char *zone)
Timezone-independent version of localtime_r(3).
static struct ast_custom_function calendar_query_result_function
static struct ast_calendar * find_calendar(const char *name)
struct ast_config * ast_config_load2(const char *filename, const char *who_asked, struct ast_flags flags)
Load a config file.
Structure for variables, used for configurations and for channel variables.
#define AST_SCHED_REPLACE(id, sched, when, callback, data)
static int event_hash_fn(const void *obj, const int flags)
void ast_str_substitute_variables(struct ast_str **buf, ssize_t maxlen, struct ast_channel *chan, const char *templ)
int ast_devstate_prov_del(const char *label)
Remove device state provider.
Structure for a data store type.
static const struct adsi_event events[]
int ast_str_append(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Append to a thread local dynamic string.
#define ast_cond_init(cond, attr)
#define ast_cli_register_multiple(e, len)
Register multiple commands.
const ast_string_field notify_app
static int calendar_hash_fn(const void *obj, const int flags)
void ao2_iterator_destroy(struct ao2_iterator *iter)
Destroy a container iterator.
struct ast_module_user * user
int ast_devstate_prov_add(const char *label, ast_devstate_prov_cb_type callback)
Add device state provider.
const ast_string_field uid
enum ast_calendar_busy_state busy_state
struct timeval ast_tvnow(void)
Returns current timeval. Meant to replace calls to gettimeofday().
static struct ast_calendar * build_calendar(struct ast_config *cfg, const char *cat, const struct ast_calendar_tech *tech)
#define ast_mutex_lock(a)
int ast_calendar_register(struct ast_calendar_tech *tech)
Register a new calendar technology.
#define ast_strdup(str)
A wrapper for strdup()
Structure for a data store object.
void ast_calendar_unregister(struct ast_calendar_tech *tech)
Unregister a new calendar technology.
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.
char * ast_category_browse(struct ast_config *config, const char *prev_name)
Browse categories.
static int null_chan_write(struct ast_channel *chan, struct ast_frame *frame)
const ast_string_field notify_context
static void eventlist_destructor(void *obj)
void ast_cli(int fd, const char *fmt,...)
struct evententry::@447 list
#define ast_rwlock_unlock(a)
static void * event_notification_duplicate(void *data)
#define ast_module_user_remove(user)
static struct ast_custom_function calendar_write_function
#define AST_LIST_TRAVERSE_SAFE_END
Closes a safe loop traversal block.
#define ast_cond_signal(cond)
const ast_string_field description
#define ast_verb(level,...)
static struct ast_sched_context * sched
int ast_custom_function_unregister(struct ast_custom_function *acf)
Unregister a custom function.
static int calendar_busy_callback(void *obj, void *arg, int flags)
const ast_string_field organizer
struct ast_calendar_event * ast_calendar_event_alloc(struct ast_calendar *cal)
Allocate an astobj2 ast_calendar_event object.
static int schedule_calendar_event(struct ast_calendar *cal, struct ast_calendar_event *old_event, struct ast_calendar_event *cmp_event)
pthread_cond_t ast_cond_t
#define ast_strlen_zero(foo)
#define ast_pthread_create_background(a, b, c, d)
void ast_channel_tech_set(struct ast_channel *chan, const struct ast_channel_tech *value)
int ast_str_set(struct ast_str **buf, ssize_t max_len, const char *fmt,...)
Set a dynamic string using variable arguments.
static struct ast_calendar_event * destroy_event(struct ast_calendar_event *event)
Configuration File Parser.
#define ast_debug(level,...)
Log a DEBUG message.
const ast_string_field location
void ast_channel_set_rawreadformat(struct ast_channel *chan, struct ast_format *format)
ast_dial_result
List of return codes for dial run API calls.
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.
General Asterisk PBX channel definitions.
void ast_channel_nativeformats_set(struct ast_channel *chan, struct ast_format_cap *value)
#define ast_string_field_init(x, size)
Initialize a field pool and fields.
#define AST_PTHREADT_NULL
void *(* unref_calendar)(void *obj)
const struct ast_config * ast_calendar_config_acquire(void)
Grab and lock pointer to the calendar config (read only)
struct sla_ringing_trunk * last
Data structure associated with a custom dialplan function.
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
Scheduler Routines (derived from cheops)
#define AST_LIST_REMOVE_CURRENT(field)
Removes the current entry from a list during a traversal.
const ast_string_field notify_appdata
#define ao2_ref(o, delta)
static const struct ast_datastore_info eventlist_datastore_info
void ast_channel_set_readformat(struct ast_channel *chan, struct ast_format *format)
void ast_config_destroy(struct ast_config *config)
Destroys a config.
long int ast_random(void)
A general API for managing calendar events with Asterisk.
#define ast_strdupa(s)
duplicate a string in memory from the stack
A set of macros to manage forward-linked lists.
static char * handle_show_calendar(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
static void calendar_destructor(void *obj)
static void copy_event_data(struct ast_calendar_event *dst, struct ast_calendar_event *src)
#define ast_variable_new(name, value, filename)
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
#define ast_module_user_add(chan)
const ast_string_field name
Structure to describe a channel "technology", ie a channel driver See for examples: ...
Core PBX routines and definitions.
enum ast_dial_result ast_dial_run(struct ast_dial *dial, struct ast_channel *chan, int async)
Execute dialing synchronously or asynchronously.
struct ast_calendar_event * event
struct ao2_container * events
#define CONFIG_STATUS_FILEUNCHANGED
#define AST_LIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a list of specified type, statically initialized.
struct ast_sched_context * ast_sched_context_create(void)
Create a scheduler context.
static void calendar_event_destructor(void *obj)
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.
static int calendar_query_result_exec(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
#define ao2_container_alloc_hash(ao2_options, container_options, n_buckets, hash_fn, sort_fn, cmp_fn)
static struct ast_cli_entry calendar_cli[]
int attribute_pure ast_true(const char *val)
Make sure something is true. Determine if a string containing a boolean value is "true". This function checks to see whether a string passed to it is an indication of an "true" value. It checks to see if the string is "yes", "true", "y", "t", "on" or "1".
The descriptor of a dynamic string XXX storage will be optimized later if needed We use the ts field ...
static int add_event_to_list(struct eventlist *events, struct ast_calendar_event *event, time_t start, time_t end)
struct association categories[]
#define ao2_unlink(container, obj)
static int cb_pending_deletion(void *user_data, void *arg, int flags)
static struct ast_calendar * unref_calendar(struct ast_calendar *cal)
static ast_mutex_t refreshlock
static int calendar_is_busy(struct ast_calendar *cal)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
static int merge_events_cb(void *obj, void *arg, int flags)
int ast_unload_resource(const char *resource_name, enum ast_module_unload_mode)
Unload a module.
int ast_dial_append(struct ast_dial *dial, const char *tech, const char *device, const struct ast_assigned_ids *assignedids)
Append a channel.
#define ao2_iterator_next(iter)
#define ao2_alloc(data_size, destructor_fn)
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define ast_channel_unlock(chan)
void *(* load_calendar)(void *data)
static void event_notification_destroy(void *data)
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_pthread_create(a, b, c, d)
struct ast_dial * ast_dial_create(void)
New dialing structure.
struct ast_calendar * owner
void ast_calendar_config_release(void)
Release the calendar config.
static struct ast_calendar_event * find_event(struct ao2_container *events, const char *uid)
static int calendar_cmp_fn(void *obj, void *arg, int flags)
const ast_string_field notify_extension
Prototypes for public functions only of internal interest,.
int ast_sched_del(struct ast_sched_context *con, int id) attribute_warn_unused_result
Deletes a scheduled event.
Module has failed to load, may be in an inconsistent state.
#define DATASTORE_INHERIT_FOREVER
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 ao2_find(container, arg, flags)
static int add_new_event_cb(void *obj, void *arg, int flags)
int(* is_busy)(struct ast_calendar *calendar)
Structure used to handle boolean flags.
const ast_string_field categories
static struct ast_custom_function calendar_event_function
AST_MODULE_INFO(ASTERISK_GPL_KEY, AST_MODFLAG_GLOBAL_SYMBOLS|AST_MODFLAG_LOAD_ORDER, "HTTP Phone Provisioning",.support_level=AST_MODULE_SUPPORT_EXTENDED,.load=load_module,.unload=unload_module,.reload=reload,.load_pri=AST_MODPRI_CHANNEL_DEPEND,.requires="http",)
struct ast_calendar_event::attendees attendees
static int event_cmp_fn(void *obj, void *arg, int flags)
void ast_channel_exten_set(struct ast_channel *chan, const char *value)
struct ast_channel * ast_dial_answered_steal(struct ast_dial *dial)
Steal the channel that answered.
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_rwlock_wrlock(a)
const char * ast_variable_retrieve(struct ast_config *config, const char *category, const char *variable)
unsigned int pending_deletion
static enum ast_device_state calendarstate(const char *data)
#define AST_LIST_HEAD_INIT_NOLOCK(head)
Initializes a list head structure.
char * strsep(char **str, const char *delims)
static int load_config(int reload)
When we need to walk through a container, we use an ao2_iterator to keep track of the current positio...
Standard Command Line Interface.
static const struct ast_channel_tech null_tech
static struct ast_config * calendar_config
void ast_channel_context_set(struct ast_channel *chan, const char *value)
void ast_copy_string(char *dst, const char *src, size_t size)
Size-limited null-terminating string copy.
static int match_caltech_cb(void *user_data, void *arg, int flags)
Individual calendaring technology data.
static ast_mutex_t reloadlock
static int unload_module(void)
const char * ast_channel_name(const struct ast_channel *chan)
void ast_sched_dump(struct ast_sched_context *con)
Dumps the scheduler contents.
enum ast_pbx_result ast_pbx_run(struct ast_channel *c)
Execute the PBX in the current thread.
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.
static const struct ast_datastore_info event_notification_datastore
Data structure associated with a single frame of data.
static char * handle_dump_sched(struct ast_cli_entry *e, int cmd, struct ast_cli_args *a)
#define ast_datastore_alloc(info, uid)
#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field)
Loops safely over (traverses) the entries in a list.
static int notify_channel(void *obj)
#define ast_mutex_init(pmutex)
Asterisk calendar structure.
#define AST_LIST_INSERT_BEFORE_CURRENT(elm, field)
Inserts a list entry before the current entry during a traversal.
static ast_rwlock_t config_lock
int(* write_event)(struct ast_calendar_event *event)
#define ASTERISK_GPL_KEY
The text the key() function should return.
void ast_channel_priority_set(struct ast_channel *chan, int value)
#define ast_channel_alloc(needqueue, state, cid_num, cid_name, acctcode, exten, context, assignedids, requestor, amaflag,...)
Create a channel structure.
struct ast_calendar_event * ast_calendar_unref_event(struct ast_calendar_event *event)
Unreference an ast_calendar_event.
Asterisk module definitions.
const ast_string_field summary
int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *datastore)
Add a datastore to a channel.
void ast_calendar_clear_events(struct ast_calendar *cal)
Remove all events from calendar.
#define AST_DECLARE_APP_ARGS(name, arglist)
Declare a structure to hold an application's arguments.
#define ast_string_field_free_memory(x)
free all memory - to be called before destroying the object
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
struct ao2_iterator ao2_iterator_init(struct ao2_container *c, int flags) attribute_warn_unused_result
Create an iterator for a container.
#define ast_cond_timedwait(cond, mutex, time)
static void * do_refresh(void *data)
void ast_sched_context_destroy(struct ast_sched_context *c)
destroys a schedule context
#define ast_custom_function_register(acf)
Register a custom function.
static int calendar_query_exec(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
Structure for mutex and tracking information.
static force_inline int attribute_pure ast_str_case_hash(const char *str)
Compute a hash value on a case-insensitive string.
static struct ast_custom_function calendar_query_function
const ast_string_field notify_channel
#define ast_str_create(init_len)
Create a malloc'ed dynamic length string.
#define ast_mutex_unlock(a)
static int cb_rm_pending_deletion(void *user_data, void *arg, int flags)
static int module_unloading
#define AST_APP_ARG(name)
Define an application argument.
static force_inline int attribute_pure ast_str_hash(const char *str)
Compute a hash value on a string.
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.
#define ast_string_field_set(x, field, data)
Set a field to a simple string value.
#define ao2_link(container, obj)