30 #define ASTMM_LIBC ASTMM_IGNORE 36 #if !defined(SOLARIS) && !defined(__CYGWIN__) 84 void ast_log(
int level,
const char *
file,
int line,
const char *
function,
const char *fmt, ...) __attribute__((
format(printf,5,6)));
86 void ast_log(
int level,
const char *
file,
int line,
const char *
function,
const char *fmt, ...)
91 printf(
"LOG: lev:%d file:%s line:%d func: %s ",
92 level, file, line,
function);
102 #define EXT_DATA_SIZE 256 104 #define EXT_DATA_SIZE 8192 107 #define SWITCH_DATA_LENGTH 256 109 #define VAR_BUF_SIZE 4096 112 #define VAR_SOFTTRAN 2 113 #define VAR_HARDTRAN 3 115 #define BACKGROUND_SKIP (1 << 0) 116 #define BACKGROUND_NOANSWER (1 << 1) 117 #define BACKGROUND_MATCHEXTEN (1 << 2) 118 #define BACKGROUND_PLAYBACK (1 << 3) 136 void (*
datad)(
void *);
193 struct module *module;
229 #define STATUS_NO_CONTEXT 1 230 #define STATUS_NO_EXTENSION 2 231 #define STATUS_NO_PRIORITY 3 232 #define STATUS_NO_LABEL 4 233 #define STATUS_SUCCESS 5 262 static int bit_at(
unsigned int *
word,
int bitsperword,
int bitnum)
264 return word[bitnum/bitsperword] & (1 << (bitnum % bitsperword));
270 int thisbit, thatbit =
bit_at(word, bitsperword, totalbits-1);
272 for (i=0; i<totalbits; i++) {
273 thisbit =
bit_at(word, bitsperword, i);
275 if (thisbit != thatbit ) {
289 int i,
total=totalbits/bitsperword,bitmask = 0;
291 for (i=0; i<bitsperword; i++)
296 for (i=0; i<
total; i++)
298 if (word[i] != bitmask)
305 int main(
int argc,
char **argv)
309 pval *tree, *tmptree, *sws;
320 for (i=1; i<argc; i++)
322 if (strcmp(argv[i],
"-d")==0)
331 printf(
"WARNING: This is an EXTREMELY preliminary version of a program\n");
332 printf(
" that will someday hopefully do a thoughful and intelligent\n");
333 printf(
" job of transforming your extensions.conf file into an\n");
334 printf(
" extensions.ael file.\n");
335 printf(
" This version has absolutely no intelligence, and pretty\n");
336 printf(
" much just does a direct conversion\n");
337 printf(
" The result will most likely need careful attention to\n");
338 printf(
" finish the job!!!!!\n");
341 printf(
" (You could use -d the use the extensions.conf in the current directory!)\n");
349 printf(
"... Done!\n");
353 printf(
"Context: %s\n", tmp->
name);
355 printf(
"=========\n");
370 for (tmpi = tmp->
includes; tmpi; ) {
371 if (strchr(tmpi->
name,
'|')==0) {
378 int startbit=0, endbit=0;
381 strcpy(timerange,
"*");
387 min = (startbit % 30) * 2;
388 sprintf(tbuf,
"%02d:%02d", hr, min);
389 strcpy(timerange, tbuf);
391 min = (endbit % 30) * 2;
392 sprintf(tbuf,
"%02d:%02d", hr, min);
393 strcat(timerange,
"-");
394 strcat(timerange,tbuf);
398 strcpy(dowrange,
"*");
401 strcpy(dowrange,
days[startbit]);
402 strcat(dowrange,
"-");
403 strcat(dowrange,
days[endbit]);
407 strcpy(monrange,
"*");
410 strcpy(monrange,
months[startbit]);
411 strcat(monrange,
"-");
412 strcat(monrange,
months[endbit]);
416 strcpy(domrange,
"*");
420 sprintf(tbuf,
"%d", startbit);
421 strcpy(domrange, tbuf);
422 strcat(domrange,
"-");
423 sprintf(tbuf,
"%d", endbit);
424 strcat(domrange, tbuf);
435 char *hr = strchr(all,
'|');
438 dow = strchr(hr,
'|');
441 dom = strchr(dow,
'|');
444 mon = strchr(dom,
'|');
535 printf(
"Generating aelout.ael file...\n");
539 printf(
"...Done!\n");
564 const char *application,
void *
data,
void (*
datad)(
void *),
577 const char *data,
int eval,
const char *
registrar)
592 printf(
"find/Creating context %s, registrar=%s\n", name, registrar);
669 const char *callerid,
679 const char *callerid,
708 int line_num,
const char *func,
const char *lock_name,
void *lock_addr,
struct ast_bt *bt)
ast_include: include= support in extensions.conf
void pvalTopLevAddObject(pval *p, pval *contextOrObj)
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, const char *registrar_file, int registrar_line)
Add an extension to an extension context, this time with an ast_context *.
Main Channel structure associated with a channel.
struct ast_ignorepats ignorepats
struct ast_exten * localized_walk_extension_priorities(struct ast_exten *exten, struct ast_exten *priority)
void pvalAppCallAddArg(pval *p, pval *arg)
Asterisk locking-related definitions:
Asterisk main include file. File version handling, generic pbx functions.
ast_exten: An extension The dialplan is saved as a linked list with each context having it's own link...
#define AST_LIST_FIRST(head)
Returns the first entry contained in a list.
struct ast_context * localized_context_find_or_create(struct ast_context **extcontexts, void *tab, const char *name, const char *registrar)
#define AST_LIST_HEAD(name, type)
Defines a structure to be used to hold a list of specified type.
static SQLHSTMT execute(struct odbc_obj *obj, void *data, int silent)
Common execution function for SQL queries.
struct ast_context * localized_walk_contexts(struct ast_context *con)
struct ast_include * includes
void pvalExtenSetName(pval *p, char *name)
CallerID (and other GR30) management and generation Includes code and algorithms from the Zapata libr...
int __ast_bt_get_addresses(struct ast_bt *bt)
int ast_context_verify_includes(struct ast_context *con)
Verifies includes in an ast_contect structure.
void ast_log(int level, const char *file, int line, const char *function, const char *fmt,...)
Used for sending a log message This is the standard logger function. Probably the only way you will i...
void ast_module_unregister(const struct ast_module_info *x)
void pvalContextSetName(pval *p, char *name)
int all_bits_set(unsigned int *word, int bitsperword, int totalbits)
struct ast_ignorepat * ignorepats
struct ast_app * cached_app
ast_state_cb: An extension state notify register item
Generic (perhaps overly so) hashtable implementation Hash Table support in Asterisk.
void pvalWordSetString(pval *p, char *str)
int localized_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar)
struct ast_ignorepat * next
static const struct adsi_event events[]
void ast_remove_lock_info(void *lock_addr, struct ast_bt *bt)
remove lock info for the current thread
void pvalIgnorePatSetPattern(pval *p, char *pat)
unsigned int ast_hashtab_hash_contexts(const void *obj)
void pvalAppCallSetAppName(pval *p, char *name)
struct ast_exten * localized_walk_context_extensions(struct ast_context *con, struct ast_exten *exten)
#define ast_strdup(str)
A wrapper for strdup()
struct ast_include * next
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_cli_register_multiple(void)
struct ast_context * local_contexts
pval * pvalCreateNode(pvaltype type)
struct ast_exten * ast_walk_context_extensions(struct ast_context *con, struct ast_exten *exten)
struct ast_vector_string * __ast_bt_get_symbols(void **addresses, size_t num_frames)
ast_state_cb_type callback
Configuration File Parser.
const char * registrar_file
void ast_suspend_lock_info(void *lock_addr)
ast_sw: Switch statement in extensions.conf
void get_start_stop(unsigned int *word, int bitsperword, int totalbits, int *start, int *end)
General Asterisk PBX channel definitions.
Asterisk file paths, configured in asterisk.conf.
static int bit_at(unsigned int *word, int bitsperword, int bitnum)
void localized_merge_contexts_and_delete(struct ast_context **extcontexts, void *tab, const char *registrar)
Data structure associated with a custom dialplan function.
struct ast_sw * localized_walk_context_switches(struct ast_context *con, struct ast_sw *sw)
#define AST_MAX_EXTENSION
struct ast_context * ast_context_find_or_create(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *name, const char *registrar)
Register a new context or find an existing one.
structure to hold extensions
void ael2_print(char *fname, pval *tree)
int localized_context_add_include2(struct ast_context *con, const char *value, const char *registrar)
struct ast_includes includes
AST_LIST_HEAD_NOLOCK(contactliststruct, contact)
void ast_mark_lock_acquired(void *lock_addr)
Mark the last lock as acquired.
const struct ast_include * ast_walk_context_includes(const struct ast_context *con, const struct ast_include *inc)
Core PBX routines and definitions.
External configuration handlers (realtime and static configuration)
void pvalSwitchesAddSwitch(pval *p, char *name)
struct ast_context * ast_walk_contexts(struct ast_context *con)
ast_ignorepat: Ignore patterns in dial plan
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)
Structure for dial plan hints.
int ast_context_add_include2(struct ast_context *con, const char *value, const char *registrar)
Add a context include.
int localized_context_add_switch2(struct ast_context *con, const char *value, const char *data, int eval, const char *registrar)
int ast_add_profile(const char *x, uint64_t scale)
support for event profiling
void pvalExtenSetStatement(pval *p, pval *statement)
struct ast_context * contexts
struct ast_custom_function * ast_custom_function_find(const char *name)
int ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar)
#define AST_LIST_ENTRY(type)
Declare a forward link structure inside a list entry.
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)
void pvalIncludesAddIncludeWithTimeConstraints(pval *p, const char *include, char *hour_range, char *dom_range, char *dow_range, char *month_range)
Structures for AEL - the Asterisk extension language.
void localized_context_destroy(struct ast_context *con, const char *registrar)
const char * ast_get_context_name(struct ast_context *con)
int localized_pbx_load_module(void)
int main(int argc, char **argv)
int ast_context_add_switch2(struct ast_context *con, const char *value, const char *data, int eval, const char *registrar)
Adds a switch (first param is a ast_context)
static int replace(struct ast_channel *chan, const char *cmd, char *data, struct ast_str **buf, ssize_t len)
void pvalStatementBlockAddStatement(pval *p, pval *statement)
Structure for rwlock and tracking information.
void pvalIncludesAddInclude(pval *p, const char *include)
ast_app: A registered application
int localized_context_verify_includes(struct ast_context *con)
void ast_context_destroy(struct ast_context *con, const char *registrar)
Destroy a context (matches the specified context or ANY context if NULL)
Options provided by main asterisk program.
void ast_cli_unregister_multiple(void)
void pvalExtenSetHints(pval *p, char *hints)
struct ast_context * parent
int(* ast_state_cb_type)(const char *context, const char *exten, struct ast_state_cb_info *info, void *data)
Typedef for devicestate and hint callbacks.
static char context[AST_MAX_CONTEXT]
const char * ast_config_AST_CONFIG_DIR
struct ast_state_cb * callbacks
void ast_store_lock_info(enum ast_lock_type type, const char *filename, int line_num, const char *func, const char *lock_name, void *lock_addr, struct ast_bt *bt)
Store lock info for the current thread.
struct ast_state_cb * callbacks
Asterisk module definitions.
static snd_pcm_format_t format
void ast_merge_contexts_and_delete(struct ast_context **extcontexts, struct ast_hashtab *exttable, const char *registrar)
Merge the temporary contexts into a global contexts list and delete from the global list the ones tha...
int ast_hashtab_compare_contexts(const void *ah_a, const void *ah_b)
hashtable functions for contexts
Application convenience functions, designed to give consistent look and feel to Asterisk apps...
ast_context: An extension context - must remain in sync with fake_context
int pbx_builtin_setvar(struct ast_channel *chan, const char *data)
Parse and set a single channel variable, where the name and value are separated with an '=' character...
void ast_restore_lock_info(void *lock_addr)
Structure for mutex and tracking information.
void pbx_substitute_variables_helper(struct ast_channel *c, const char *cp1, char *cp2, int count)
int localized_pbx_builtin_setvar(struct ast_channel *chan, const void *data)
void ast_module_register(const struct ast_module_info *x)
void pvalContextAddStatement(pval *p, pval *statement)
void localized_use_conf_dir(void)