46#define ASTMM_LIBC ASTMM_IGNORE
59#include <sys/resource.h>
65#if !defined(SOLARIS) && !defined(__CYGWIN__)
75static void ast_log(
int level,
const char *
file,
int line,
const char *function,
const char *fmt, ...) __attribute__((format(printf, 5, 6)));
76void ast_verbose(const
char *fmt, ...) __attribute__((format(printf, 1, 2)));
78#define AST_API_MODULE 1
93#define EVENTLOG "event_log"
94#define QUEUELOG "queue_log"
100#define VERBOSE_PREFIX_1 " "
101#define VERBOSE_PREFIX_2 " == "
102#define VERBOSE_PREFIX_3 " -- "
103#define VERBOSE_PREFIX_4 " > "
107void ast_queue_log(
const char *queuename,
const char *callid,
const char *agent,
const char *
event,
const char *fmt, ...)
108 __attribute__((format(printf, 5, 6)));
115#define _A_ __FILE__, __LINE__, __PRETTY_FUNCTION__
121#define LOG_DEBUG __LOG_DEBUG, _A_
127#define LOG_EVENT __LOG_EVENT, _A_
132#define __LOG_NOTICE 2
133#define LOG_NOTICE __LOG_NOTICE, _A_
138#define __LOG_WARNING 3
139#define LOG_WARNING __LOG_WARNING, _A_
145#define LOG_ERROR __LOG_ERROR, _A_
150#define __LOG_VERBOSE 5
151#define LOG_VERBOSE __LOG_VERBOSE, _A_
157#define LOG_DTMF __LOG_DTMF, _A_
160#define _ASTERISK_LOCK_H
162#ifndef HAVE_MTX_PROFILE
163#define __MTX_PROF(a) return pthread_mutex_lock((a))
167#define __MTX_PROF(a) do { \
170 ast_mark(mtx_prof, 1); \
171 i = pthread_mutex_trylock((a)); \
172 ast_mark(mtx_prof, 0); \
176 return pthread_mutex_lock((a)); \
180#define AST_PTHREADT_NULL (pthread_t) -1
181#define AST_PTHREADT_STOP (pthread_t) -2
183#if defined(SOLARIS) || defined(BSD)
184#define AST_MUTEX_INIT_W_CONSTRUCTORS
189#if defined(PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP) && defined(PTHREAD_MUTEX_RECURSIVE_NP)
190#define PTHREAD_MUTEX_INIT_VALUE PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
191#define AST_MUTEX_KIND PTHREAD_MUTEX_RECURSIVE_NP
193#define PTHREAD_MUTEX_INIT_VALUE PTHREAD_MUTEX_INITIALIZER
194#define AST_MUTEX_KIND PTHREAD_MUTEX_RECURSIVE
199#define log_mutex_error(canlog, ...) do { if (canlog) ast_log(LOG_ERROR, __VA_ARGS__); else fprintf(stderr, __VA_ARGS__); } while (0)
202#define DO_THREAD_CRASH do { *((int *)(0)) = 1; } while(0)
204#define DO_THREAD_CRASH do { } while (0)
207#define AST_MUTEX_INIT_VALUE { PTHREAD_MUTEX_INIT_VALUE, { NULL }, { 0 }, 0, { NULL }, { 0 } }
209#define AST_MAX_REENTRANCY 10
214 unsigned int track:1;
228static void __attribute__((constructor)) init_empty_mutex(
void)
230 memset(&empty_mutex, 0,
sizeof(empty_mutex));
233static inline int __ast_pthread_mutex_init_attr(
const char *filename,
int lineno,
const char *func,
235 pthread_mutexattr_t *attr)
237#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
238 int canlog = strcmp(filename,
"logger.c");
241 if ((t->
mutex) != (empty_mutex)) {
242 log_mutex_error(canlog,
"%s line %d (%s): Error: mutex '%s' is already initialized.\n",
243 filename, lineno, func, mutex_name);
244 log_mutex_error(canlog,
"%s line %d (%s): Error: previously initialization of mutex '%s'.\n",
245 t->file[0], t->lineno[0], t->func[0], mutex_name);
252 t->file[0] = filename;
253 t->lineno[0] = lineno;
264 static pthread_mutexattr_t attr;
266 pthread_mutexattr_init(&attr);
269 return __ast_pthread_mutex_init_attr(filename, lineno, func, mutex_name, t, &attr);
271#define ast_mutex_init(pmutex) __ast_pthread_mutex_init(__FILE__, __LINE__, __PRETTY_FUNCTION__, #pmutex, pmutex)
277 int canlog = strcmp(filename,
"logger.c");
279#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
281 log_mutex_error(canlog,
"%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
282 filename, lineno, func, mutex_name);
292 log_mutex_error(canlog,
"%s line %d (%s): Error: attempt to destroy invalid mutex '%s'.\n",
293 filename, lineno, func, mutex_name);
296 log_mutex_error(canlog,
"%s line %d (%s): Error: attempt to destroy locked mutex '%s'.\n",
297 filename, lineno, func, mutex_name);
298 log_mutex_error(canlog,
"%s line %d (%s): Error: '%s' was locked here.\n",
299 t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);
304 log_mutex_error(canlog,
"%s line %d (%s): Error destroying mutex: %s\n",
305 filename, lineno, func, strerror(res));
306#ifndef PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP
310 t->file[0] = filename;
311 t->lineno[0] = lineno;
321 int canlog = strcmp(filename,
"logger.c");
323#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
325 log_mutex_error(canlog,
"%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
326 filename, lineno, func, mutex_name);
331#ifdef DETECT_DEADLOCKS
333 time_t seconds = time(
NULL);
336#ifdef HAVE_MTX_PROFILE
340#ifdef HAVE_MTX_PROFILE
346 log_mutex_error(canlog,
"%s line %d (%s): Deadlock? waited %d sec for mutex '%s'?\n",
347 filename, lineno, func, (
int)(
current - seconds), mutex_name);
348 log_mutex_error(canlog,
"%s line %d (%s): '%s' was locked here.\n",
349 t->file[t->reentrancy-1], t->lineno[t->reentrancy-1],
350 t->func[t->reentrancy-1], mutex_name);
354 }
while (res == EBUSY);
357#ifdef HAVE_MTX_PROFILE
368 t->file[t->reentrancy] = filename;
369 t->lineno[t->reentrancy] = lineno;
370 t->func[t->reentrancy] = func;
371 t->thread[t->reentrancy] = pthread_self();
374 log_mutex_error(canlog,
"%s line %d (%s): '%s' really deep reentrancy!\n",
375 filename, lineno, func, mutex_name);
378 log_mutex_error(canlog,
"%s line %d (%s): Error obtaining mutex: %s\n",
379 filename, lineno, func, strerror(
errno));
390 int canlog = strcmp(filename,
"logger.c");
392#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
394 log_mutex_error(canlog,
"%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
395 filename, lineno, func, mutex_name);
402 t->file[t->reentrancy] = filename;
403 t->lineno[t->reentrancy] = lineno;
404 t->func[t->reentrancy] = func;
405 t->thread[t->reentrancy] = pthread_self();
408 log_mutex_error(canlog,
"%s line %d (%s): '%s' really deep reentrancy!\n",
409 filename, lineno, func, mutex_name);
412 log_mutex_error(canlog,
"%s line %d (%s): Warning: '%s' was locked here.\n",
413 t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);
423 int canlog = strcmp(filename,
"logger.c");
425#ifdef AST_MUTEX_INIT_W_CONSTRUCTORS
427 log_mutex_error(canlog,
"%s line %d (%s): Error: mutex '%s' is uninitialized.\n",
428 filename, lineno, func, mutex_name);
432 if (t->reentrancy && (t->thread[t->reentrancy-1] != pthread_self())) {
433 log_mutex_error(canlog,
"%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
434 filename, lineno, func, mutex_name);
435 log_mutex_error(canlog,
"%s line %d (%s): '%s' was locked here.\n",
436 t->file[t->reentrancy-1], t->lineno[t->reentrancy-1], t->func[t->reentrancy-1], mutex_name);
440 if (--t->reentrancy < 0) {
441 log_mutex_error(canlog,
"%s line %d (%s): mutex '%s' freed more times than we've locked!\n",
442 filename, lineno, func, mutex_name);
447 t->file[t->reentrancy] =
NULL;
448 t->lineno[t->reentrancy] = 0;
449 t->func[t->reentrancy] =
NULL;
450 t->thread[t->reentrancy] = 0;
454 log_mutex_error(canlog,
"%s line %d (%s): Error releasing mutex: %s\n",
455 filename, lineno, func, strerror(res));
467#define AST_MUTEX_INIT_VALUE ((ast_mutex_t) PTHREAD_MUTEX_INIT_VALUE)
471 pthread_mutexattr_t attr;
473 pthread_mutexattr_init(&attr);
479#define ast_pthread_mutex_init(pmutex,a) pthread_mutex_init(pmutex,a)
485#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
488#define __AST_MUTEX_DEFINE(scope, mutex) \
489 scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE; \
490static void __attribute__((constructor)) init_##mutex(void) \
492 ast_mutex_init(&mutex); \
496#define __AST_MUTEX_DEFINE(scope, mutex) \
497 scope ast_mutex_t mutex = AST_MUTEX_INIT_VALUE
500#define pthread_mutex_t use_ast_mutex_t_instead_of_pthread_mutex_t
501#define pthread_mutex_init use_ast_mutex_init_instead_of_pthread_mutex_init
502#define pthread_cond_t use_ast_cond_t_instead_of_pthread_cond_t
504#define AST_MUTEX_DEFINE_STATIC(mutex) __AST_MUTEX_DEFINE(static, mutex)
506#define AST_MUTEX_INITIALIZER __use_AST_MUTEX_DEFINE_STATIC_rather_than_AST_MUTEX_INITIALIZER__
508#define gethostbyname __gethostbyname__is__not__reentrant__use__ast_gethostbyname__instead__
511#define pthread_create __use_ast_pthread_create_instead__
518 pthread_rwlockattr_t attr;
520 pthread_rwlockattr_init(&attr);
522#ifdef HAVE_PTHREAD_RWLOCK_PREFER_WRITER_NP
523 pthread_rwlockattr_setkind_np(&attr, PTHREAD_RWLOCK_PREFER_WRITER_NP);
526 return pthread_rwlock_init(prwlock, &attr);
531 return pthread_rwlock_destroy(prwlock);
536 return pthread_rwlock_unlock(prwlock);
541 return pthread_rwlock_rdlock(prwlock);
546 return pthread_rwlock_wrlock(prwlock);
551#ifndef HAVE_PTHREAD_RWLOCK_INITIALIZER
552#define __AST_RWLOCK_DEFINE(scope, rwlock) \
553 scope ast_rwlock_t rwlock; \
554static void __attribute__((constructor)) init_##rwlock(void) \
556 ast_rwlock_init(&rwlock); \
558static void __attribute__((destructor)) fini_##rwlock(void) \
560 ast_rwlock_destroy(&rwlock); \
563#define AST_RWLOCK_INIT_VALUE PTHREAD_RWLOCK_INITIALIZER
564#define __AST_RWLOCK_DEFINE(scope, rwlock) \
565 scope ast_rwlock_t rwlock = AST_RWLOCK_INIT_VALUE
568#define AST_RWLOCK_DEFINE_STATIC(rwlock) __AST_RWLOCK_DEFINE(static, rwlock)
580#if defined(HAVE_OSX_ATOMICS)
581#include "libkern/OSAtomic.h"
589#if defined(HAVE_GCC_ATOMICS)
592 return __sync_fetch_and_add(p, v);
594#elif defined(HAVE_OSX_ATOMICS) && (
SIZEOF_INT == 4)
597 return OSAtomicAdd32(v, (int32_t *) p);
599#elif defined(HAVE_OSX_ATOMICS) && (
SIZEOF_INT == 8)
602 return OSAtomicAdd64(v, (int64_t *) p);
603#elif defined (__i386__) || defined(__x86_64__)
607 " lock xaddl %0, %1 ; "
614static int ast_atomic_fetchadd_int_slow(
volatile int *p,
int v)
623 return ast_atomic_fetchadd_int_slow(p, v);
633 return __sync_sub_and_fetch(p, 1) == 0;
635#elif defined(HAVE_OSX_ATOMICS) && (
SIZEOF_INT == 4)
638 return OSAtomicAdd32( -1, (int32_t *) p) == 0;
640#elif defined(HAVE_OSX_ATOMICS) && (
SIZEOF_INT == 8)
643 return OSAtomicAdd64( -1, (int64_t *) p) == 0;
652#ifdef DEBUG_CHANNEL_LOCKS
677#if __BYTE_ORDER == __BIG_ENDIAN
678#define SWAP64_32(flags) (((uint64_t)flags << 32) | ((uint64_t)flags >> 32))
680#define SWAP64_32(flags) (flags)
685#define ast_test_flag64(p,flag) ({ \
686 typeof ((p)->flags) __p = (p)->flags; \
687 typeof (__unsigned_int_flags_dummy64) __x = 0; \
688 (void) (&__p == &__x); \
689 ((p)->flags & SWAP64_32(flag)); \
694#define MAX_NESTED_COMMENTS 128
695#define COMMENT_START ";--"
696#define COMMENT_END "--;"
697#define COMMENT_META ';'
698#define COMMENT_TAG '-'
738 int siz = strlen(
str);
765 int siz = strlen(
str);
794 .sa_flags = SA_RESTART,
830#ifdef HAVE_WORKING_FORK
836#if defined(HAVE_WORKING_FORK) || defined(HAVE_WORKING_VFORK)
839#ifdef HAVE_WORKING_FORK
846#ifdef HAVE_WORKING_FORK
848 for (x = STDERR_FILENO + 1; x < 4096; x++)
851 execl(
"/bin/sh",
"/bin/sh",
"-c", s, (
char *)
NULL);
853 }
else if (pid > 0) {
855 res = waitpid(pid, &
status, 0);
859 }
else if (
errno != EINTR)
878 strcpy(x->
cmt, buffer);
893#define MAX_INCLUDE_LEVEL 10
934typedef int realtime_update(
const char *database,
const char *
table,
const char *keyfield,
const char *entity, va_list ap);
952 return (!s || (*s ==
'\0'));
955#define S_OR(a, b) (!ast_strlen_zero(a) ? (a) : (b))
960 while (*src && size) {
964 if (__builtin_expect(!size, 0))
990 work += strlen(work) - 1;
997 while ((work >=
str) && *work < 33)
1056 int name_len = strlen(
name) + 1;
1057 size_t value_len = strlen(
value) + 1;
1058 size_t filename_len = strlen(filename) + 1;
1060 if ((variable =
ast_calloc(1, name_len + value_len + filename_len +
sizeof(*variable)))) {
1062 variable->
value = variable->
stuff + name_len;
1063 variable->
file = variable->
value + value_len;
1085 ast_log(
LOG_WARNING,
"'%s', line %d: Same File included more than once! This data will be saved in %s if saved back to disk.\n", from_file, from_lineno, real_included_file_name);
1087 *real_included_file_name = 0;
1097 inc->
exec = is_exec;
1103 conf->includes = inc;
1114 int from_len = strlen(from_file);
1115 int to_len = strlen(to_file);
1117 if (strcmp(from_file, to_file) == 0)
1129 for (incl =
conf->includes; incl; incl=incl->
next) {
1131 if (from_len >= to_len)
1139 for (cat =
conf->root; cat; cat = cat->
next) {
1140 if (strcmp(cat->
file,from_file) == 0) {
1141 if (from_len >= to_len)
1142 strcpy(cat->
file, to_file);
1148 for (v = cat->
root; v; v = v->
next) {
1149 if (strcmp(v->
file,from_file) == 0) {
1150 if (from_len >= to_len)
1151 strcpy(v->
file, to_file);
1182 category->
root = variable;
1183 category->
last = variable;
1195 for (cat =
config->root; cat; cat = cat->
next) {
1200 for (cat =
config->root; cat; cat = cat->
next) {
1217 if (category &&
config->last_browse && (
config->last_browse->name == category))
1218 cat =
config->last_browse;
1231 if (!strcasecmp(variable, v->
name))
1237 for (cat =
config->root; cat; cat = cat->
next)
1238 for (v = cat->
root; v; v = v->
next)
1239 if (!strcasecmp(variable, v->
name))
1251 new->lineno = old->
lineno;
1252 new->object = old->
object;
1275 for (incl=incls; incl; incl = inclnext) {
1276 inclnext = incl->
next;
1356#define AST_CACHE_DIR_LEN 512
1357#define AST_FILENAME_MAX 80
1360#define AST_DEFAULT_OPTIONS AST_OPT_FLAG_TRANSCODE_VIA_SLIN
1364#define ast_opt_exec_includes ast_test_flag64(&ast_options, AST_OPT_FLAG_EXEC_INCLUDES)
1365#define ast_opt_no_fork ast_test_flag64(&ast_options, AST_OPT_FLAG_NO_FORK)
1366#define ast_opt_quiet ast_test_flag64(&ast_options, AST_OPT_FLAG_QUIET)
1367#define ast_opt_console ast_test_flag64(&ast_options, AST_OPT_FLAG_CONSOLE)
1368#define ast_opt_high_priority ast_test_flag64(&ast_options, AST_OPT_FLAG_HIGH_PRIORITY)
1369#define ast_opt_init_keys ast_test_flag64(&ast_options, AST_OPT_FLAG_INIT_KEYS)
1370#define ast_opt_remote ast_test_flag64(&ast_options, AST_OPT_FLAG_REMOTE)
1371#define ast_opt_exec ast_test_flag64(&ast_options, AST_OPT_FLAG_EXEC)
1372#define ast_opt_no_color ast_test_flag64(&ast_options, AST_OPT_FLAG_NO_COLOR)
1373#define ast_fully_booted ast_test_flag64(&ast_options, AST_OPT_FLAG_FULLY_BOOTED)
1374#define ast_opt_transcode_via_slin ast_test_flag64(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN)
1375#define ast_opt_priority_jumping ast_test_flag64(&ast_options, AST_OPT_FLAG_PRIORITY_JUMPING)
1376#define ast_opt_dump_core ast_test_flag64(&ast_options, AST_OPT_FLAG_DUMP_CORE)
1377#define ast_opt_cache_record_files ast_test_flag64(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES)
1378#define ast_opt_timestamp ast_test_flag64(&ast_options, AST_OPT_FLAG_TIMESTAMP)
1379#define ast_opt_override_config ast_test_flag64(&ast_options, AST_OPT_FLAG_OVERRIDE_CONFIG)
1380#define ast_opt_reconnect ast_test_flag64(&ast_options, AST_OPT_FLAG_RECONNECT)
1381#define ast_opt_transmit_silence ast_test_flag64(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE)
1382#define ast_opt_dont_warn ast_test_flag64(&ast_options, AST_OPT_FLAG_DONT_WARN)
1383#define ast_opt_always_fork ast_test_flag64(&ast_options, AST_OPT_FLAG_ALWAYS_FORK)
1384#define ast_opt_mute ast_test_flag64(&ast_options, AST_OPT_FLAG_MUTE)
1411#define AST_RWLIST_WRLOCK(head) \
1412 ast_rwlock_wrlock(&(head)->lock)
1422#define AST_RWLIST_RDLOCK(head) \
1423 ast_rwlock_rdlock(&(head)->lock)
1433#define AST_RWLIST_UNLOCK(head) \
1434 ast_rwlock_unlock(&(head)->lock)
1455#define AST_LIST_HEAD(name, type) \
1457 struct type *first; \
1458 struct type *last; \
1481#define AST_RWLIST_HEAD(name, type) \
1483 struct type *first; \
1484 struct type *last; \
1485 ast_rwlock_t lock; \
1507#define AST_LIST_HEAD_NOLOCK(name, type) \
1509 struct type *first; \
1510 struct type *last; \
1516#define AST_LIST_HEAD_INIT_VALUE { \
1519 .lock = AST_MUTEX_INIT_VALUE, \
1525#define AST_RWLIST_HEAD_INIT_VALUE { \
1528 .lock = AST_RWLOCK_INIT_VALUE, \
1534#define AST_LIST_HEAD_NOLOCK_INIT_VALUE { \
1556#if defined(AST_MUTEX_INIT_W_CONSTRUCTORS)
1557#define AST_LIST_HEAD_STATIC(name, type) \
1559 struct type *first; \
1560 struct type *last; \
1563static void __attribute__((constructor)) init_##name(void) \
1565 AST_LIST_HEAD_INIT(&name); \
1567static void __attribute__((destructor)) fini_##name(void) \
1569 AST_LIST_HEAD_DESTROY(&name); \
1571struct __dummy_##name
1573#define AST_LIST_HEAD_STATIC(name, type) \
1575 struct type *first; \
1576 struct type *last; \
1578} name = AST_LIST_HEAD_INIT_VALUE
1598#ifndef AST_RWLOCK_INIT_VALUE
1599#define AST_RWLIST_HEAD_STATIC(name, type) \
1601 struct type *first; \
1602 struct type *last; \
1603 ast_rwlock_t lock; \
1605static void __attribute__((constructor)) init_##name(void) \
1607 AST_RWLIST_HEAD_INIT(&name); \
1609static void __attribute__((destructor)) fini_##name(void) \
1611 AST_RWLIST_HEAD_DESTROY(&name); \
1613struct __dummy_##name
1615#define AST_RWLIST_HEAD_STATIC(name, type) \
1617 struct type *first; \
1618 struct type *last; \
1619 ast_rwlock_t lock; \
1620} name = AST_RWLIST_HEAD_INIT_VALUE
1628#define AST_LIST_HEAD_NOLOCK_STATIC(name, type) \
1630 struct type *first; \
1631 struct type *last; \
1632} name = AST_LIST_HEAD_NOLOCK_INIT_VALUE
1642#define AST_LIST_HEAD_SET(head, entry) do { \
1643 (head)->first = (entry); \
1644 (head)->last = (entry); \
1645 ast_mutex_init(&(head)->lock); \
1656#define AST_RWLIST_HEAD_SET(head, entry) do { \
1657 (head)->first = (entry); \
1658 (head)->last = (entry); \
1659 ast_rwlock_init(&(head)->lock); \
1670#define AST_LIST_HEAD_SET_NOLOCK(head, entry) do { \
1671 (head)->first = (entry); \
1672 (head)->last = (entry); \
1692#define AST_LIST_ENTRY(type) \
1694 struct type *next; \
1697#define AST_RWLIST_ENTRY AST_LIST_ENTRY
1703#define AST_LIST_FIRST(head) ((head)->first)
1705#define AST_RWLIST_FIRST AST_LIST_FIRST
1711#define AST_LIST_LAST(head) ((head)->last)
1713#define AST_RWLIST_LAST AST_LIST_LAST
1721#define AST_LIST_NEXT(elm, field) ((elm)->field.next)
1723#define AST_RWLIST_NEXT AST_LIST_NEXT
1731#define AST_LIST_EMPTY(head) (AST_LIST_FIRST(head) == NULL)
1733#define AST_RWLIST_EMPTY AST_LIST_EMPTY
1771#define AST_LIST_TRAVERSE(head,var,field) \
1772 for((var) = (head)->first; (var); (var) = (var)->field.next)
1774#define AST_RWLIST_TRAVERSE AST_LIST_TRAVERSE
1809#define AST_LIST_TRAVERSE_SAFE_BEGIN(head, var, field) { \
1810 typeof((head)->first) __list_next; \
1811 typeof((head)->first) __list_prev = NULL; \
1812 typeof((head)->first) __new_prev = NULL; \
1813 for ((var) = (head)->first, __new_prev = (var), \
1814 __list_next = (var) ? (var)->field.next : NULL; \
1816 __list_prev = __new_prev, (var) = __list_next, \
1817 __new_prev = (var), \
1818 __list_next = (var) ? (var)->field.next : NULL \
1821#define AST_RWLIST_TRAVERSE_SAFE_BEGIN AST_LIST_TRAVERSE_SAFE_BEGIN
1834#define AST_LIST_REMOVE_CURRENT(head, field) \
1835 __new_prev->field.next = NULL; \
1836 __new_prev = __list_prev; \
1838 __list_prev->field.next = __list_next; \
1840 (head)->first = __list_next; \
1842 (head)->last = __list_prev;
1844#define AST_RWLIST_REMOVE_CURRENT AST_LIST_REMOVE_CURRENT
1856#define AST_LIST_INSERT_BEFORE_CURRENT(head, elm, field) do { \
1857 if (__list_prev) { \
1858 (elm)->field.next = __list_prev->field.next; \
1859 __list_prev->field.next = elm; \
1861 (elm)->field.next = (head)->first; \
1862 (head)->first = (elm); \
1864 __new_prev = (elm); \
1867#define AST_RWLIST_INSERT_BEFORE_CURRENT AST_LIST_INSERT_BEFORE_CURRENT
1872#define AST_LIST_TRAVERSE_SAFE_END }
1874#define AST_RWLIST_TRAVERSE_SAFE_END AST_LIST_TRAVERSE_SAFE_END
1883#define AST_LIST_HEAD_INIT(head) { \
1884 (head)->first = NULL; \
1885 (head)->last = NULL; \
1886 ast_mutex_init(&(head)->lock); \
1896#define AST_RWLIST_HEAD_INIT(head) { \
1897 (head)->first = NULL; \
1898 (head)->last = NULL; \
1899 ast_rwlock_init(&(head)->lock); \
1910#define AST_RWLIST_HEAD_DESTROY(head) { \
1911 (head)->first = NULL; \
1912 (head)->last = NULL; \
1913 ast_rwlock_destroy(&(head)->lock); \
1924#define AST_LIST_HEAD_INIT_NOLOCK(head) { \
1925 (head)->first = NULL; \
1926 (head)->last = NULL; \
1938#define AST_LIST_INSERT_AFTER(head, listelm, elm, field) do { \
1939 (elm)->field.next = (listelm)->field.next; \
1940 (listelm)->field.next = (elm); \
1941 if ((head)->last == (listelm)) \
1942 (head)->last = (elm); \
1945#define AST_RWLIST_INSERT_AFTER AST_LIST_INSERT_AFTER
1954#define AST_LIST_INSERT_HEAD(head, elm, field) do { \
1955 (elm)->field.next = (head)->first; \
1956 (head)->first = (elm); \
1957 if (!(head)->last) \
1958 (head)->last = (elm); \
1961#define AST_RWLIST_INSERT_HEAD AST_LIST_INSERT_HEAD
1974#define AST_LIST_INSERT_TAIL(head, elm, field) do { \
1975 if (!(head)->first) { \
1976 (head)->first = (elm); \
1977 (head)->last = (elm); \
1979 (head)->last->field.next = (elm); \
1980 (head)->last = (elm); \
1984#define AST_RWLIST_INSERT_TAIL AST_LIST_INSERT_TAIL
1993#define AST_LIST_APPEND_LIST(head, list, field) do { \
1994 if (!(head)->first) { \
1995 (head)->first = (list)->first; \
1996 (head)->last = (list)->last; \
1998 (head)->last->field.next = (list)->first; \
1999 (head)->last = (list)->last; \
2003#define AST_RWLIST_APPEND_LIST AST_LIST_APPEND_LIST
2014#define AST_LIST_REMOVE_HEAD(head, field) ({ \
2015 typeof((head)->first) cur = (head)->first; \
2017 (head)->first = cur->field.next; \
2018 cur->field.next = NULL; \
2019 if ((head)->last == cur) \
2020 (head)->last = NULL; \
2025#define AST_RWLIST_REMOVE_HEAD AST_LIST_REMOVE_HEAD
2035#define AST_LIST_REMOVE(head, elm, field) do { \
2036 if ((head)->first == (elm)) { \
2037 (head)->first = (elm)->field.next; \
2038 if ((head)->last == (elm)) \
2039 (head)->last = NULL; \
2041 typeof(elm) curelm = (head)->first; \
2042 while (curelm && (curelm->field.next != (elm))) \
2043 curelm = curelm->field.next; \
2045 curelm->field.next = (elm)->field.next; \
2046 if ((head)->last == (elm)) \
2047 (head)->last = curelm; \
2050 (elm)->field.next = NULL; \
2053#define AST_RWLIST_REMOVE AST_LIST_REMOVE
2076#define AST_MAX_EXTENSION 80
2080#define PRIORITY_HINT -1
2139 for (x=0; n[x]; x++) {
2158 if (!strchr(
"()", n[x]))
2175 if (
name[0] ==
'_') {
2192static void ast_log(
int level,
const char *
file,
int line,
const char *function,
const char *fmt, ...)
2197 printf(
"LOG: lev:%d file:%s line:%d func: %s ",
2198 level,
file, line, function);
2204void __attribute__((format(printf, 1, 2)))
ast_verbose(const
char *fmt, ...)
2209 printf(
"VERBOSE: ");
2218 char *dataPut = start;
2222 for (; *start; start++) {
2224 *dataPut++ = *start;
2227 if (*start ==
'\\') {
2229 }
else if (*start ==
'\'') {
2230 inQuotes = 1 - inQuotes;
2233 *dataPut++ = inQuotes ? *start : ((*start == find) ? replace_with : *start);
2237 if (start != dataPut)
2248 if (!strcasecmp(s,
"yes") ||
2249 !strcasecmp(s,
"true") ||
2250 !strcasecmp(s,
"y") ||
2251 !strcasecmp(s,
"t") ||
2252 !strcasecmp(s,
"1") ||
2253 !strcasecmp(s,
"on"))
2259#define ONE_MILLION 1000000
2268 (
long)
a.tv_sec, (
long int)
a.tv_usec);
2271 }
else if (
a.tv_usec < 0) {
2273 (
long)
a.tv_sec, (
long int)
a.tv_usec);
2279struct timeval
ast_tvadd(struct timeval
a, struct timeval
b);
2285 a.tv_sec +=
b.tv_sec;
2286 a.tv_usec +=
b.tv_usec;
2294struct timeval
ast_tvsub(struct timeval
a, struct timeval
b);
2300 a.tv_sec -=
b.tv_sec;
2301 a.tv_usec -=
b.tv_usec;
2302 if (
a.tv_usec < 0) {
2317#define VAR_BUF_SIZE 4096
2320#define VAR_SOFTTRAN 2
2321#define VAR_HARDTRAN 3
2323#define BACKGROUND_SKIP (1 << 0)
2324#define BACKGROUND_NOANSWER (1 << 1)
2325#define BACKGROUND_MATCHEXTEN (1 << 2)
2326#define BACKGROUND_PLAYBACK (1 << 3)
2344 void (*
datad)(
void *);
2446#define STATUS_NO_CONTEXT 1
2447#define STATUS_NO_EXTENSION 2
2448#define STATUS_NO_PRIORITY 3
2449#define STATUS_NO_LABEL 4
2450#define STATUS_SUCCESS 5
2455 int name_len = strlen(
name) + 1;
2456 int value_len = strlen(
value) + 1;
2458 if (!(
var =
ast_calloc(
sizeof(*
var) + name_len + value_len,
sizeof(
char)))) {
2463 var->value =
var->name + name_len;
2497 for (argc = 0; *scan && (argc < arraylen - 1); argc++) {
2499 for (; *scan; scan++) {
2502 else if (*scan ==
')') {
2505 }
else if (*scan ==
'"' && delim !=
'"') {
2508 memmove(scan, scan + 1, strlen(scan));
2510 }
else if (*scan ==
'\\') {
2512 memmove(scan, scan + 1, strlen(scan));
2513 }
else if ((*scan == delim) && !
paren && !
quote) {
2521 array[argc++] = scan;
2530 const char *nametail =
name;
2543 if (*nametail ==
'_') {
2545 if (*nametail ==
'_')
2550 if (strcasecmp(
ast_var_name(newvariable), nametail) == 0) {
2583 if ((argc > 1) && !strchr(argv[argc-1],
'=')) {
2585 if (strchr(argv[argc],
'g'))
2589 for (x = 0; x < argc; x++) {
2617 if (names && *s >
'9') {
2618 for (i = 0; names[i]; i++) {
2619 if (!strcasecmp(s, names[i])) {
2626 if (sscanf(s,
"%2d", &i) == 1 && i >= 1 && i <=
max) {
2636static unsigned get_range(
char *src,
int max,
char *
const names[],
const char *msg)
2639 unsigned int mask = 0;
2644 return (1 <<
max) - 1;
2647 while ((part =
strsep(&src,
"&"))) {
2649 char *endpart = strchr(part,
'-');
2668 while (start !=
end) {
2672 mask |= (1 << start);
2682 char *endpart, *part;
2686 int minute_start, minute_end;
2695 for (x = 0; x < 48; x++) {
2701 while ((part =
strsep(×,
"&"))) {
2702 if (!(endpart = strchr(part,
'-'))) {
2703 if (sscanf(part,
"%2d:%2d", &st_h, &st_m) != 2 || st_h < 0 || st_h > 23 || st_m < 0 || st_m > 59) {
2707 i->
minmask[st_h * 2 + (st_m >= 30 ? 1 : 0)] |= (1 << (st_m % 30));
2712 while (*endpart && !isdigit(*endpart)) {
2719 if (sscanf(part,
"%2d:%2d", &st_h, &st_m) != 2 || st_h < 0 || st_h > 23 || st_m < 0 || st_m > 59) {
2723 if (sscanf(endpart,
"%2d:%2d", &endh, &endm) != 2 || endh < 0 || endh > 23 || endm < 0 || endm > 59) {
2727 minute_start = st_h * 60 + st_m;
2728 minute_end = endh * 60 + endm;
2730 for (x = minute_start; x != minute_end; x = (x + 1) % (24 * 60)) {
2731 i->
minmask[x / 30] |= (1 << (x % 30));
2734 i->
minmask[x / 30] |= (1 << (x % 30));
2752 if (!strcasecmp(family, map->
name)) {
2764 if (!strcasecmp(eng->name, map->
driver))
2790 if ((category =
ast_calloc(1,
sizeof(*category))))
2834 config->last->next = category;
2838 config->current = category;
2863 char table[256] =
"";
2909 char exec_file[512];
2910 int object, do_exec, do_include;
2913 if (cur[0] ==
'[') {
2918 c = strchr(cur,
']');
2945 if (!(cur = strchr(
c,
')'))) {
2950 while ((cur =
strsep(&
c,
","))) {
2951 if (!strcasecmp(cur,
"!")) {
2952 (*cat)->ignored = 1;
2953 }
else if (!strcasecmp(cur,
"+")) {
2959 ast_log(
LOG_WARNING,
"Category addition requested, but category '%s' does not exist, line %d of %s\n", catname,
lineno, configfile);
2972 ast_log(
LOG_WARNING,
"Inheritance requested, but category '%s' does not exist, line %d of %s\n", cur,
lineno, configfile);
2981 }
else if (cur[0] ==
'#') {
2985 while(*
c && (*
c > 32))
c++;
2994 do_include = !strcasecmp(cur,
"include");
2996 do_exec = !strcasecmp(cur,
"exec");
3000 ast_log(
LOG_WARNING,
"Cannot perform #exec unless execincludes option is enabled in asterisk.conf (options section)!\n");
3003 if (do_include || do_exec) {
3006 char real_inclusion_name[525];
3009 while((*
c ==
'<') || (*
c ==
'>') || (*
c ==
'\"'))
c++;
3014 c = cur + strlen(cur) - 1;
3015 if ((*
c ==
'>') || (*
c ==
'<') || (*
c ==
'\"'))
3025 snprintf(exec_file,
sizeof(exec_file),
"/var/tmp/exec.%d.%ld", (
int)time(
NULL), (
long)pthread_self());
3026 if (snprintf(cmd,
sizeof(cmd),
"%s > %s 2>&1", cur, exec_file) >=
sizeof(cmd)) {
3027 ast_log(
LOG_ERROR,
"Failed to construct command string to execute %s.\n", cur);
3034 exec_file[0] =
'\0';
3039 ast_include_new(cfg, configfile, cur, do_exec, cur2,
lineno, real_inclusion_name,
sizeof(real_inclusion_name));
3050 do_exec ?
"exec" :
"include",
3051 do_exec ?
"/path/to/executable" :
"filename",
3062 "parse error: No category context for line %d of %s\n",
lineno, configfile);
3065 c = strchr(cur,
'=');
3121 char *new_buf, *comment_p, *process_buf;
3127 struct stat statbuf;
3131 if (filename[0] ==
'/') {
3135 snprintf(fn,
sizeof(fn),
"./%s", filename);
3145 if (stat(fn, &statbuf))
3148 if (!S_ISREG(statbuf.st_mode)) {
3156 if (!(f = fopen(fn,
"r"))) {
3170 if (fgets(
buf,
sizeof(
buf), f)) {
3171 if ( withcomments ) {
3183 if ((comment_p > new_buf) && (*(comment_p-1) ==
'\\')) {
3185 memmove(comment_p - 1, comment_p, strlen(comment_p) + 1);
3186 new_buf = comment_p;
3191 new_buf = comment_p + 3;
3197 }
else if ((comment_p >= new_buf + 2) &&
3202 new_buf = comment_p + 1;
3208 oldptr = process_buf + strlen(process_buf);
3209 if ( withcomments ) {
3214 memmove(oldptr, new_buf, strlen(new_buf) + 1);
3217 process_buf = new_buf;
3223 if ( withcomments ) {
3227 new_buf = comment_p;
3229 new_buf = comment_p + 1;
3232 if( withcomments &&
comment && !process_buf )
3238 char *stripped_process_buf =
ast_strip(process_buf);
3240 if (
process_text_line(cfg, &cat, stripped_process_buf, lineno, filename, withcomments, suggested_include_file)) {
3329 cat =
config->last_browse->next;
3333 for (cat =
config->root; cat; cat = cat->
next) {
3340 for (cat =
config->root; cat; cat = cat->
next) {
3341 if (!strcasecmp(cat->
name,
prev)) {
3352 config->last_browse = cat;
3386static void gen_header(FILE *f1,
const char *configfile,
const char *fn,
const char *generator)
3393 fprintf(f1,
";!\n");
3394 fprintf(f1,
";! Automatically generated configuration file\n");
3395 if (strcmp(configfile, fn))
3396 fprintf(f1,
";! Filename: %s (%s)\n", configfile, fn);
3398 fprintf(f1,
";! Filename: %s\n", configfile);
3399 fprintf(f1,
";! Generator: %s\n", generator);
3400 fprintf(f1,
";! Creation Date: %s", date);
3401 fprintf(f1,
";!\n");
3404static void set_fn(
char *fn,
int fn_size,
const char *
file,
const char *configfile)
3407 if (configfile[0] ==
'/')
3411 }
else if (
file[0] ==
'/')
3453 set_fn(fn,
sizeof(fn), 0, configfile);
3455 if ((f = fopen(fn,
"w+"))) {
3457 if ((f = fopen(fn,
"w"))) {
3471 set_fn(fn,
sizeof(fn), cat->
file, configfile);
3484 fprintf(f,
"#exec \"%s\"\n", incl->
exec_file);
3494 if (cmt->
cmt[0] !=
';' || cmt->
cmt[1] !=
'!')
3495 fprintf(f,
"%s", cmt->
cmt);
3499 fprintf(f,
"[%s]", cat->
name);
3501 fprintf(f,
"%s", cmt->
cmt);
3509 set_fn(fn,
sizeof(fn),
var->file, configfile);
3522 fprintf(f,
"#exec \"%s\"\n", incl->
exec_file);
3530 for (cmt =
var->precomments; cmt; cmt=cmt->
next) {
3531 if (cmt->
cmt[0] !=
';' || cmt->
cmt[1] !=
'!')
3532 fprintf(f,
"%s", cmt->
cmt);
3535 fprintf(f,
"%s %s %s %s",
var->name, (
var->object ?
"=>" :
"="),
var->value,
var->sameline->cmt);
3537 fprintf(f,
"%s %s %s\n",
var->name, (
var->object ?
"=>" :
"="),
var->value);
3538 if (
var->blanklines) {
3539 blanklines =
var->blanklines;
3540 while (blanklines--)
3577 fprintf(f,
"#exec \"%s\"\n", incl->
exec_file);
3599#define EXT_DATA_SIZE 256
3601#define EXT_DATA_SIZE 8192
3608#define SWITCH_DATA_LENGTH 256
3629 if (hint->
exten == oe) {
3650 if (hint->
exten == e) {
3660 if (!(hint =
ast_calloc(1,
sizeof(*hint)))) {
3678 for (ep =
NULL; e ; ep = e, e = e->
peer) {
3742 if (hint->
exten == e) {
3748 cblist = cblist->
next;
3807 int j, num_fields, last_sep = -1;
3820 for (j = 0, num_fields = 1;
info[j] !=
'\0'; j++) {
3821 if (
info[j] ==
'|' ||
info[j] ==
',') {
3828 if (num_fields == 5) {
3873 int c, cmin = 0xff, count = 0;
3879 while ( (
c = *(*p)++) && (
c ==
' ' ||
c ==
'-') )
3885 return 0x0000 | (
c & 0xff);
3888 return 0x0700 |
'2' ;
3891 return 0x0900 |
'0';
3894 return 0x0800 |
'1';
3910 end = strchr(*p,
']');
3917 memset(chars,
'\0',
sizeof(chars));
3918 for (; *p <
end ; (*p)++) {
3919 unsigned char c1, c2;
3920 c1 = (
unsigned char)((*p)[0]);
3921 if (*p + 2 <
end && (*p)[1] ==
'-') {
3922 c2 = (
unsigned char)((*p)[2]);
3928 for (; c1 <= c2; c1++) {
3929 uint32_t mask = 1 << (c1 % 32);
3930 if ( (chars[ c1 / 32 ] & mask) == 0)
3932 chars[ c1 / 32 ] |= mask;
3936 return count == 0 ? 0x30000 : (count | cmin);
3951 return (
b[0] ==
'_') ? -1 : strcmp(
a,
b);
3957 return strcmp(
a,
b);
3960 while (!ret &&
a &&
b)
3965 return (ret > 0) ? 1 : -1;
3973 while (*src && (count <
len - 1)) {
4011 if (!strcasecmp(asw->
name, sw))
4193 if ( (mode ==
E_MATCH) && (pattern[0] ==
'_') && (strcasecmp(pattern,
data)==0) )
4196 if (pattern[0] !=
'_') {
4197 int ld = strlen(
data), lp = strlen(pattern);
4203 return !strcmp(pattern,
data);
4204 if (ld == 0 || !strncasecmp(pattern,
data, ld))
4214 while (*
data && *pattern && *pattern !=
'/') {
4221 switch (toupper(*pattern)) {
4223 end = strchr(pattern+1,
']');
4228 for (pattern++; pattern !=
end; pattern++) {
4229 if (pattern+2 <
end && pattern[1] ==
'-') {
4230 if (*
data >= pattern[0] && *
data <= pattern[2])
4236 }
else if (*
data == pattern[0])
4244 if (*data < '2' || *data >
'9')
4248 if (*data < '0' || *data >
'9')
4252 if (*data < '1' || *data >
'9')
4264 if (*
data != *pattern)
4276 if (*pattern ==
'\0' || *pattern ==
'/')
4278 else if (*pattern ==
'!')
4281 return (mode ==
E_MATCH) ? 0 : 1;
4298static int matchcid(
const char *cidpattern,
const char *callerid)
4326 const char *callerid,
4337 const char *callerid,
4360 for (x = 0; x < q->
stacklen; x++) {
4401 if (label && e->
label && !strcmp(label, e->
label))
4433 datap = sw->eval ? sw->tmpdata : sw->data;
4434 res = !aswf ? 0 : aswf(chan,
context, exten,
priority, callerid, datap);
4463 const char *callerid,
4472 const char *callerid,
4509 length += 2 * (strlen(
value) + 1);
4517 p = new_include->
stuff;
4518 new_include->
name = p;
4520 p += strlen(
value) + 1;
4521 new_include->
rname = p;
4524 if ( (
c = strchr(p,
'|')) || (
c = strchr(p,
',')) ) {
4534 if (!strcasecmp(i->
name, new_include->
name)) {
4544 il->
next = new_include;
4570 length += strlen(
value) + 1;
4579 for (ignorepatc = con->
ignorepats; ignorepatc; ignorepatc = ignorepatc->
next) {
4580 ignorepatl = ignorepatc;
4588 ignorepatl->
next = ignorepat;
4635 const char *data,
int eval,
const char *
registrar);
4638 const char *data,
int eval,
const char *
registrar)
4645 length =
sizeof(
struct ast_sw);
4646 length += strlen(
value) + 1;
4648 length += strlen(
data);
4663 p += strlen(
value) + 1;
4667 p += strlen(
data) + 1;
4669 strcpy(new_sw->
data,
"");
4679 if (!strcasecmp(i->
name, new_sw->
name) && !strcasecmp(i->
data, new_sw->
data)) {
4713 loc_contexts = extcontexts;
4715 for (tmp = *loc_contexts; tmp; tmp = tmp->
next) {
4716 if (!strcasecmp(tmp->
name,
name)) {
4731 tmp->
next = *loc_contexts;
4734 *loc_contexts = tmp;
4773 const char *application,
void *
data,
void (*datad)(
void *),
4793 length += strlen(application) + 1;
4795 length += strlen(
label) + 1;
4797 length += strlen(callerid) + 1;
4812 p += strlen(
label) + 1;
4819 p +=
ext_strncpy(p, callerid, strlen(callerid) + 1) + 1;
4826 strcpy(p, application);
4833 for (e = con->
root; e;
el = e, e = e->
next) {
4848 if (e && res == 0) {
4869 ast_log(
LOG_DEBUG,
"Added extension '%s' priority %d (CID match '%s') to %s\n",
4890 const char *application,
void *
data,
void (*
datad)(
void *),
4895 const char *application,
void *
data,
void (*
datad)(
void *),
4924 if (matching_action) {
4935 if (matching_action)
4947 if (!matching_action)
4951 if (!matching_action)
4955 if (!matching_action)
4967 return (matching_action) ? 0 : -1;
5012 }
else if (*
var ==
')') {
5014 }
else if (*
var ==
':' && parens == 0) {
5016 sscanf(
var,
"%30d:%30d", offset, length);
5036static char *
substring(
const char *
value,
int offset,
int length,
char *workspace,
size_t workspace_len)
5038 char *ret = workspace;
5046 if (offset == 0 && length >= lr)
5050 offset = lr + offset;
5060 if (length >= 0 && length < lr - offset)
5062 else if (length < 0) {
5063 if (lr > offset - length)
5064 ret[lr + length - offset] =
'\0';
5079 const char not_found =
'\0';
5083 int i, need_substring;
5110 if (s == ¬_found) {
5111 if (!strcmp(
var,
"EPOCH")) {
5112 snprintf(workspace, workspacelen,
"%u",(
int)time(
NULL));
5118 for (i = 0; s == ¬_found && i < (
sizeof(places) /
sizeof(places[0])); i++) {
5133 if (s == ¬_found || s ==
NULL)
5140 *ret =
substring(*ret, offset, length, workspace, workspacelen);
5149 const char *tmp, *whereweare;
5150 int length, offset, offset2, isfunction;
5151 char *workspace =
NULL;
5153 char *nextvar, *nextexp, *nextthing;
5155 int pos, brackets, needsub,
len;
5161 pos = strlen(whereweare);
5164 nextthing = strchr(whereweare,
'$');
5166 switch (nextthing[1]) {
5168 nextvar = nextthing;
5169 pos = nextvar - whereweare;
5172 nextexp = nextthing;
5173 pos = nextexp - whereweare;
5184 memcpy(cp2, whereweare, pos);
5196 vars = vare = nextvar + 2;
5201 while (brackets && *vare) {
5202 if ((vare[0] ==
'$') && (vare[1] ==
'{')) {
5204 }
else if (vare[0] ==
'{') {
5206 }
else if (vare[0] ==
'}') {
5208 }
else if ((vare[0] ==
'$') && (vare[1] ==
'['))
5214 len = vare - vars - 1;
5217 whereweare += (
len + 3);
5240 workspace[0] =
'\0';
5255 length = strlen(cp4);
5258 memcpy(cp2, cp4, length);
5263 }
else if (nextexp) {
5267 vars = vare = nextexp + 2;
5272 while (brackets && *vare) {
5273 if ((vare[0] ==
'$') && (vare[1] ==
'[')) {
5277 }
else if (vare[0] ==
'[') {
5279 }
else if (vare[0] ==
']') {
5281 }
else if ((vare[0] ==
'$') && (vare[1] ==
'{')) {
5289 len = vare - vars - 1;
5292 whereweare += (
len + 3);
5339 char realvalue[256];
5363 memset(realvalue, 0,
sizeof(realvalue));
5369 if (!strcasecmp(cxt,
"general") || !strcasecmp(cxt,
"globals"))
5376 if (!strcasecmp(v->
name,
"exten")) {
5380 char realext[256]=
"";
5381 char *plus, *firstp, *firstc;
5382 char *pri, *appl, *data, *cidmatch;
5388 cidmatch = strchr(realext,
'/');
5393 pri =
strsep(&stringp,
",");
5396 label = strchr(pri,
'(');
5399 end = strchr(label,
')');
5405 plus = strchr(pri,
'+');
5408 if (!strcmp(pri,
"hint"))
5410 else if (!strcmp(pri,
"next") || !strcmp(pri,
"n")) {
5415 }
else if (!strcmp(pri,
"same") || !strcmp(pri,
"s")) {
5420 }
else if (sscanf(pri,
"%30d", &ipri) != 1 &&
5425 appl =
S_OR(stringp,
"");
5427 firstc = strchr(appl,
',');
5428 firstp = strchr(appl,
'(');
5429 if (firstc && (!firstp || firstc < firstp)) {
5432 appl =
strsep(&stringp,
",");
5434 }
else if (!firstc && !firstp) {
5439 appl =
strsep(&stringp,
"(");
5441 end = strrchr(data,
')');
5442 if ((
end = strrchr(data,
')'))) {
5458 ast_log(
LOG_WARNING,
"The use of '_.' for an extension is strongly discouraged and can have unexpected behavior. Please use '_X.' instead at line %d\n", v->
lineno);
5465 }
else if (!strcasecmp(v->
name,
"include")) {
5466 memset(realvalue, 0,
sizeof(realvalue));
5470 }
else if (!strcasecmp(v->
name,
"ignorepat")) {
5471 memset(realvalue, 0,
sizeof(realvalue));
5475 }
else if (!strcasecmp(v->
name,
"switch") || !strcasecmp(v->
name,
"lswitch") || !strcasecmp(v->
name,
"eswitch")) {
5476 char *stringp= realvalue;
5479 memset(realvalue, 0,
sizeof(realvalue));
5480 if (!strcasecmp(v->
name,
"switch"))
5484 appl =
strsep(&stringp,
"/");
5485 data =
strsep(&stringp,
"");
5509 for (; tmp; tmpl = tmp, tmp = tmp->
next) {
5513 (!con || !strcasecmp(tmp->name, con->
name)) )
5529 for (tmpi = tmp->includes; tmpi; ) {
5534 for (ipi = tmp->ignorepats; ipi; ) {
5541 for (e = tmp->root; e;) {
5542 for (en = e->
peer; en;) {
5604 *extcontexts =
NULL;
5626 if (strcasecmp(inc->
rname,
"parkedcalls")!=0)
5656 printf(
"=== Loading extensions.conf ===\n");
5659 printf(
"Context: %s\n", con->
name);
5661 printf(
"=========\n");
5672 gettimeofday(&t,
NULL);
Structures for AEL - the Asterisk extension language.
int ast_expr(char *expr, char *buf, int length, struct ast_channel *chan)
Evaluate the given expression.
General Definitions for Asterisk top level program Included by asterisk.h to handle platform-specific...
char * strsep(char **str, const char *delims)
Asterisk main include file. File version handling, generic pbx functions.
int64_t ast_mark(int, int start1_stop0)
#define ast_realloc(p, len)
A wrapper for realloc()
#define ast_strdup(str)
A wrapper for strdup()
#define ast_strdupa(s)
duplicate a string in memory from the stack
void ast_free_ptr(void *ptr)
free() wrapper
#define ast_calloc(num, len)
A wrapper for calloc()
#define ast_malloc(len)
A wrapper for malloc()
static const char config_file[]
static int match(struct ast_sockaddr *addr, unsigned short callno, unsigned short dcallno, const struct chan_iax2_pvt *cur, int check_dcallno)
static const char config[]
#define ast_channel_lock(chan)
#define ast_channel_trylock(chan)
#define ast_channel_unlock(chan)
Asterisk architecture endianess compatibility definitions.
#define AST_RWLIST_REMOVE_CURRENT
static int ast_func_read(struct ast_channel *chan, const char *function, char *workspace, size_t len)
int ast_build_timing(struct ast_timing *i, const char *info_in)
Construct a timing bitmap, for use in time-based conditionals.
static int lookup_name(const char *s, char *const names[], int max)
Helper for get_range. return the index of the matching entry, starting from 1. If names is not suppli...
struct ast_config * realtime_multi_get(const char *database, const char *table, va_list ap)
static int ast_true(const char *s)
int localized_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar)
char record_cache_dir[AST_CACHE_DIR_LEN]
static void CB_RESET(void)
static char * lline_buffer
static struct ast_sw * ast_walk_context_switches(struct ast_context *con, struct ast_sw *sw)
int realtime_update(const char *database, const char *table, const char *keyfield, const char *entity, va_list ap)
void ast_mark_lock_failed(void *lock_addr)
#define MAX_NESTED_COMMENTS
#define AST_LIST_HEAD_NOLOCK(name, type)
Defines a structure to be used to hold a list of specified type (with no lock).
int localized_context_add_include2(struct ast_context *con, const char *value, const char *registrar)
static int ext_cmp(const char *a, const char *b)
the full routine to compare extensions in rules.
static int ast_context_add_switch2(struct ast_context *con, const char *value, const char *data, int eval, const char *registrar)
static struct ast_context * ast_walk_contexts(struct ast_context *con)
static void ast_includes_destroy(struct ast_config_include *incls)
int ast_check_timing(const struct ast_timing *i)
Evaluate a pre-constructed bitmap as to whether the current time falls within the range specified.
struct ast_sw * localized_walk_context_switches(struct ast_context *con, struct ast_sw *sw)
static int process_text_line(struct ast_config *cfg, struct ast_category **cat, char *buf, int lineno, const char *configfile, int withcomments, const char *suggested_include_file)
int localized_pbx_builtin_setvar(struct ast_channel *chan, const void *data)
struct ast_context * localized_walk_contexts(struct ast_context *con)
#define AST_RWLIST_TRAVERSE_SAFE_BEGIN
static int ast_rwlock_unlock(ast_rwlock_t *prwlock)
int ast_language_is_prefix
The following variable controls the layout of localized sound files. If 0, use the historical layout ...
static char * substring(const char *value, int offset, int length, char *workspace, size_t workspace_len)
takes a substring. It is ok to call with value == workspace.
static int ast_wrlock_context(struct ast_context *con)
struct ast_include * localized_walk_context_includes(struct ast_context *con, struct ast_include *inc)
struct ast_exten * localized_walk_context_extensions(struct ast_context *con, struct ast_exten *exten)
pthread_mutex_t ast_mutex_t
static struct ast_context * ast_context_find(const char *name)
static int autofallthrough_config
#define AST_LIST_TRAVERSE(head, var, field)
Loops over (traverses) the entries in a list.
static struct ast_variable * ast_variable_new(const char *name, const char *value, const char *filename)
static unsigned int safe_system_level
Keep track of how many threads are currently trying to wait*() on a child process.
static struct ast_config * config_text_file_load(const char *database, const char *table, const char *filename, struct ast_config *cfg, int withcomments, const char *suggested_include_file)
static const char * ast_variable_retrieve(const struct ast_config *config, const char *category, const char *variable)
#define AST_RWLIST_HEAD_STATIC(name, type)
Defines a structure to be used to hold a read/write list of specified type, statically initialized.
static struct ast_config * ast_config_new(void)
static ast_rwlock_t globalslock
struct ast_exten * localized_walk_extension_priorities(struct ast_exten *exten, struct ast_exten *priority)
static int ast_add_extension2(struct ast_context *con, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
Main interface to add extensions to the list for out context.
static struct ast_ignorepat * ast_walk_context_ignorepats(struct ast_context *con, struct ast_ignorepat *ip)
static int ast_context_add_include2(struct ast_context *con, const char *value, const char *registrar)
static struct ast_context * __ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar, int existsokay)
static void inherit_category(struct ast_category *new, const struct ast_category *base)
static int ast_wrlock_contexts(void)
int(* ast_state_cb_type)(char *context, char *id, enum ast_extension_states state, void *data)
static const char * ast_get_extension_app(struct ast_exten *e)
#define AST_LIST_INSERT_TAIL(head, elm, field)
Appends a list entry to the tail of a list.
struct ast_config * config_load_func(const char *database, const char *table, const char *configfile, struct ast_config *config, int withcomments, const char *suggested_include_file)
static struct ast_config * ast_config_internal_load(const char *filename, struct ast_config *cfg, int withcomments, const char *suggested_incl_file)
static void ast_category_append(struct ast_config *config, struct ast_category *category)
#define ast_opt_dont_warn
#define STATUS_NO_EXTENSION
static int ext_strncpy(char *dst, const char *src, int len)
copy a string skipping whitespace
static void ast_variable_append(struct ast_category *category, struct ast_variable *variable)
static int pbx_extension_helper(struct ast_channel *c, struct ast_context *con, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action)
The return value depends on the action:
#define AST_LIST_HEAD_NOLOCK_INIT_VALUE
Defines initial values for a declaration of AST_LIST_HEAD_NOLOCK.
static struct sigaction safe_system_prev_handler
static int ext_cmp1(const char **p)
helper functions to sort extensions and patterns in the desired way, so that more specific patterns a...
static struct ast_exten * ast_walk_context_extensions(struct ast_context *con, struct ast_exten *exten)
static void __ast_context_destroy(struct ast_context *con, const char *registrar)
static int ast_mutex_init(ast_mutex_t *pmutex)
static char * ast_process_quotes_and_slashes(char *start, char find, char replace_with)
static struct ast_variable * ast_variable_browse(const struct ast_config *config, const char *category)
static struct ast_category * category_get(const struct ast_config *config, const char *category_name, int ignored)
int localized_context_add_switch2(struct ast_context *con, const char *value, const char *data, int eval, const char *registrar)
static struct ast_config_include * ast_include_new(struct ast_config *conf, const char *from_file, const char *included_file, int is_exec, const char *exec_file, int from_lineno, char *real_included_file_name, int real_included_file_name_size)
#define AST_CACHE_DIR_LEN
static struct ast_category * ast_category_new(const char *name, const char *in_file, int lineno)
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
int ast_context_switches_count(struct ast_context *con)
static int include_valid(struct ast_include *i)
static char * ast_category_browse(struct ast_config *config, const char *prev)
static void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar)
char debug_filename[AST_FILENAME_MAX]
#define AST_RWLIST_TRAVERSE_SAFE_END
static int pbx_builtin_setvar(struct ast_channel *chan, const void *data)
void ast_replace_sigchld(void)
Replace the SIGCHLD handler.
static struct ast_config_engine * config_engine_list
static struct ast_var_t * ast_var_assign(const char *name, const char *value)
static struct ast_context * local_contexts
static struct ast_category * next_available_category(struct ast_category *cat)
static int ast_context_verify_includes(struct ast_context *con)
static const char * ast_var_name(const struct ast_var_t *var)
#define AST_RWLOCK_DEFINE_STATIC(rwlock)
static void get_timerange(struct ast_timing *i, char *times)
store a bitmask of valid times, one bit each 2 minute
static int lline_buffer_size
uint64_t __unsigned_int_flags_dummy64
static void _null_sig_handler(int sig)
NULL handler so we can collect the child exit status.
static unsigned get_range(char *src, int max, char *const names[], const char *msg)
helper function to return a range up to max (7, 12, 31 respectively). names, if supplied,...
void ast_config_set_current_category(struct ast_config *cfg, const struct ast_category *cat)
Set the category within the configuration as being current.
static void pbx_builtin_setvar_helper(struct ast_channel *chan, const char *name, const char *value)
static void CB_INIT(void)
@ AST_EXTENSION_NOT_INUSE
@ AST_EXTENSION_UNAVAILABLE
@ AST_EXTENSION_DEACTIVATED
void ast_console_puts(const char *string)
write the string to the root console, and all attached network console clients
static int ast_extension_match(const char *pattern, const char *data)
int localized_context_verify_includes(struct ast_context *con)
void ast_verbose(const char *fmt,...)
struct ast_config * localized_config_load_with_comments(const char *filename)
struct ast_category * ast_config_get_current_category(const struct ast_config *cfg)
Retrieve the current category name being built.
static void move_variables(struct ast_category *old, struct ast_category *new)
static struct ast_exten * ast_walk_extension_priorities(struct ast_exten *exten, struct ast_exten *priority)
static const char * ast_var_value(const struct ast_var_t *var)
void localized_merge_contexts_and_delete(struct ast_context **extcontexts, void *tab, const char *registrar)
static void CB_ADD(char *str)
static void gen_header(FILE *f1, const char *configfile, const char *fn, const char *generator)
static int clearglobalvars_config
int ast_atomic_fetchadd_int(volatile int *p, int v)
Atomically add v to *p and return * the previous value of *p. This can be used to handle reference co...
static const char * ast_get_context_name(struct ast_context *con)
void localized_context_destroy(struct ast_context *con, const char *registrar)
static int add_pri(struct ast_context *con, struct ast_exten *tmp, struct ast_exten *el, struct ast_exten *e, int replace)
add the extension in the priority chain. returns 0 on success, -1 on failure
void localized_ast_include_rename(struct ast_config *conf, const char *from_file, const char *to_file)
static int ast_remove_hint(struct ast_exten *e)
ast_remove_hint: Remove hint from extension
static char * comment_buffer
#define AST_RWLIST_TRAVERSE
static void ast_category_destroy(struct ast_category *cat)
static int ast_rwlock_wrlock(ast_rwlock_t *prwlock)
static void pbx_retrieve_variable(struct ast_channel *c, const char *var, char **ret, char *workspace, int workspacelen, struct varshead *headp)
Support for Asterisk built-in variables in the dialplan.
struct timeval ast_tvadd(struct timeval a, struct timeval b)
Returns the sum of two timevals a + b.
int localized_add_extension2(struct ast_context *con, int replace, const char *extension, int priority, const char *label, const char *callerid, const char *application, void *data, void(*datad)(void *), const char *registrar)
static void pbx_substitute_variables_helper_full(struct ast_channel *c, struct varshead *headp, const char *cp1, char *cp2, int count)
static void ast_config_destroy(struct ast_config *cfg)
#define PTHREAD_MUTEX_INIT_VALUE
static const char * ast_get_extension_name(struct ast_exten *exten)
struct ast_exten * localized_find_extension(struct ast_context *bypass, struct pbx_find_info *q, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action)
void ast_queue_log(const char *queuename, const char *callid, const char *agent, const char *event, const char *fmt,...)
int ast_safe_system(const char *s)
Safely spawn an OS shell command while closing file descriptors.
static struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar)
static unsigned int ast_app_separate_args(char *buf, char delim, char **array, int arraylen)
static ast_rwlock_t conlock
int ast_context_ignorepats_count(struct ast_context *con)
struct timeval ast_tvsub(struct timeval a, struct timeval b)
Returns the difference of two timevals a - b.
static struct ast_comment * ALLOC_COMMENT(const char *buffer)
int() ast_switch_f(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data)
static struct ast_config_engine * find_engine(const char *family, char *database, int dbsiz, char *table, int tabsiz)
Find realtime engine for realtime family.
static int ast_rwlock_destroy(ast_rwlock_t *prwlock)
#define STATUS_NO_CONTEXT
#define AST_LIST_INSERT_HEAD(head, elm, field)
Inserts a list entry at the head of a list.
#define AST_LIST_REMOVE(head, elm, field)
Removes a specific entry from a list.
static int matchcid(const char *cidpattern, const char *callerid)
static struct ast_variable * variable_clone(const struct ast_variable *old)
static struct ast_category * ast_category_get(const struct ast_config *config, const char *category_name)
static struct ast_context * contexts
static struct ast_config_map * config_maps
#define AST_RWLIST_INSERT_HEAD
static int _extension_match_core(const char *pattern, const char *data, enum ext_match_t mode)
static char userscontext[AST_MAX_EXTENSION]
#define AST_LIST_REMOVE_HEAD(head, field)
Removes and returns the head entry from a list.
int localized_config_text_file_save(const char *configfile, const struct ast_config *cfg, const char *generator)
void localized_use_conf_dir(void)
static struct ast_config_include * ast_include_find(struct ast_config *conf, const char *included_file)
#define MAX_INCLUDE_LEVEL
static int ast_unlock_contexts(void)
pthread_cond_t ast_cond_t
struct ast_variable * realtime_var_get(const char *database, const char *table, va_list ap)
static void set_fn(char *fn, int fn_size, const char *file, const char *configfile)
int localized_pbx_load_module(void)
int ast_context_includes_count(struct ast_context *con)
#define STATUS_NO_PRIORITY
static int pbx_load_config(const char *config_file)
static int ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar)
char * ast_trim_blanks(char *str)
Trims trailing whitespace characters from a string.
static int ast_unlock_context(struct ast_context *con)
struct ast_config * localized_config_load(const char *filename)
static int parse_variable_name(char *var, int *offset, int *length, int *isfunc)
extract offset:length from variable name. Returns 1 if there is a offset:length part,...
static char * global_registrar
void ast_copy_string(char *dst, const char *src, size_t size)
void localized_use_local_dir(void)
static int comment_buffer_size
static void ast_variables_destroy(struct ast_variable *v)
static void ast_shrink_phone_number(char *n)
Clean up phone string remove '(', ' ', ')', non-trailing '.', and '-' not in square brackets....
static struct ast_include * ast_walk_context_includes(struct ast_context *con, struct ast_include *inc)
#define AST_DEFAULT_OPTIONS
char * ast_strip(char *s)
Strip leading/trailing whitespace from a string.
static int ast_findlabel_extension2(struct ast_channel *c, struct ast_context *con, const char *exten, const char *label, const char *callerid)
static void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
int ast_atomic_dec_and_test(volatile int *p)
decrement *p by 1 and return true if the variable has reached 0. Useful e.g. to check if a refcount h...
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
static void CB_ADD_LEN(char *str, int len)
static void null_datad(void *foo)
struct timeval ast_tvnow(void)
#define pthread_mutex_init
void ast_unreplace_sigchld(void)
Restore the SIGCHLD handler.
static char * extconfig_conf
static int ast_func_write(struct ast_channel *chan, const char *function, const char *value)
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
static int ast_change_hint(struct ast_exten *oe, struct ast_exten *ne)
ast_change_hint: Change hint for an extension
static struct timeval tvfix(struct timeval a)
static struct ast_exten * pbx_find_extension(struct ast_channel *chan, struct ast_context *bypass, struct pbx_find_info *q, const char *context, const char *exten, int priority, const char *label, const char *callerid, enum ext_match_t action)
static void ast_var_delete(struct ast_var_t *var)
#define AST_LIST_NEXT(elm, field)
Returns the next entry in the list after the given entry.
static void destroy_exten(struct ast_exten *e)
static int ast_add_hint(struct ast_exten *e)
ast_add_hint: Add hint to hint list, check initial extension state
struct ast_context * localized_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar)
static char * config_filename
struct ast_category * localized_category_get(const struct ast_config *config, const char *category_name)
static int ast_rwlock_rdlock(ast_rwlock_t *prwlock)
static force_inline int ast_strlen_zero(const char *s)
static int ast_rwlock_init(ast_rwlock_t *prwlock)
static struct varshead globals
static int extension_match_core(const char *pattern, const char *data, enum ext_match_t mode)
#define AST_MAX_EXTENSION
char * ast_skip_blanks(const char *str)
static void LLB_ADD(char *str)
static struct sigaction null_sig_handler
static void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
void ast_log_backtrace(void)
Log a backtrace of the current thread's execution stack to the Asterisk log.
pthread_rwlock_t ast_rwlock_t
static int write_protect_config
#define ast_opt_exec_includes
static struct ast_config_engine text_file_engine
#define SWITCH_DATA_LENGTH
char ast_defaultlanguage[]
External configuration handlers (realtime and static configuration)
#define AST_PBX_MAX_STACK
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
static int array(struct ast_channel *chan, const char *cmd, char *var, const char *value)
static int quote(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t len)
static int len(struct ast_channel *chan, const char *cmd, char *data, char *buf, size_t buflen)
struct ast_flags ast_options
double ast_option_maxload
@ AST_OPT_FLAG_HIGH_PRIORITY
@ AST_OPT_FLAG_TRANSCODE_VIA_SLIN
@ AST_OPT_FLAG_EXEC_INCLUDES
@ AST_OPT_FLAG_DEBUG_FILE
@ AST_OPT_FLAG_TRANSMIT_SILENCE
@ AST_OPT_FLAG_ALWAYS_FORK
@ AST_OPT_FLAG_OVERRIDE_CONFIG
@ AST_OPT_FLAG_CACHE_RECORD_FILES
@ AST_OPT_FLAG_FULLY_BOOTED
@ AST_OPT_FLAG_FORCE_BLACK_BACKGROUND
@ AST_OPT_FLAG_LIGHT_BACKGROUND
Generic (perhaps overly so) hashtable implementation Hash Table support in Asterisk.
Inlinable API function macro.
#define AST_INLINE_API(hdr, body)
#define AST_MAX_REENTRANCY
#define pthread_mutex_trylock
#define pthread_mutex_lock
int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
int __ast_pthread_mutex_init(int tracking, const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
int __ast_pthread_mutex_trylock(const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
#define pthread_mutex_unlock
#define pthread_mutex_destroy
int __ast_pthread_mutex_destroy(const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
int __ast_pthread_mutex_unlock(const char *filename, int lineno, const char *func, const char *mutex_name, ast_mutex_t *t)
#define WEXITSTATUS(status)
#define WIFEXITED(status)
Asterisk file paths, configured in asterisk.conf.
const char * ast_config_AST_CONFIG_DIR
ast_extension_states
Extension states.
struct ast_switch * pbx_findswitch(const char *sw)
ast_app: A registered application
int(* execute)(struct ast_channel *chan, const char *data)
struct ast_comment * precomments
struct ast_category * next
struct ast_variable * last
struct ast_variable * root
struct ast_comment * sameline
struct ast_category * prev
char * file
The file name from whence this declaration was read.
Main Channel structure associated with a channel.
char exten[AST_MAX_EXTENSION]
Configuration engine structure, used to define realtime drivers.
realtime_var_get * realtime_func
struct ast_config_engine * next
realtime_multi_get * realtime_multi_func
config_load_func * load_func
realtime_update * update_func
char * include_location_file
file name in which the include occurs
char * exec_file
if it's an exec, you'll have both the /var/tmp to read, and the original script
char * included_file
file name included
struct ast_config_include * next
int include_location_lineno
struct ast_config_map * next
struct ast_category * current
struct ast_config_include * includes
struct ast_category * last
struct ast_category * root
struct ast_category * last_browse
ast_context: An extension context
struct ast_context::@517 alts
struct ast_ignorepats ignorepats
struct ast_includes includes
struct ast_context * next
struct ast_include * includes
struct ast_ignorepat * ignorepats
Data structure associated with a custom dialplan function.
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own link...
struct ast_app * cached_app
struct ast_context * parent
Structure used to handle boolean flags.
Structure for dial plan hints.
struct ao2_container * callbacks
struct ast_exten * exten
Hint extension.
struct ast_state_cb * callbacks
ast_ignorepat: Ignore patterns in dial plan
struct ast_ignorepat * next
ast_include: include= support in extensions.conf
struct ast_include * next
Structure for mutex and tracking information.
Structure for rwlock and tracking information.
ast_state_cb: An extension state notify register item
ast_state_cb_type callback
struct ast_state_cb * next
ast_sw: Switch statement in extensions.conf
struct ast_switch::@515 list
struct ast_switch::@246 list
struct ast_var_t::@216 entries
struct ast_var_t::@514 entries
Structure for variables, used for configurations and for channel variables.
char stuff[0]
Contents of file, name, and value in that order stuffed here.
struct ast_comment * precomments
struct ast_comment * sameline
struct ast_variable * next
All configuration options for http media cache.
structure to hold extensions
char * incstack[AST_PBX_MAX_STACK]
const char * foundcontext
struct store_hint::@518 list
struct ast_state_cb * callbacks
static struct aco_type global
Time-related functions and macros.