[asterisk-commits] murf: branch murf/bug_7638 r59139 - in
/team/murf/bug_7638: ./ include/asteri...
asterisk-commits at lists.digium.com
asterisk-commits at lists.digium.com
Wed Mar 21 18:16:49 MST 2007
Author: murf
Date: Wed Mar 21 20:16:48 2007
New Revision: 59139
URL: http://svn.digium.com/view/asterisk?view=rev&rev=59139
Log:
Checking in all the changes that it took to get aelparse up and running again!
Modified:
team/murf/bug_7638/Makefile.rules
team/murf/bug_7638/include/asterisk/extconf.h
team/murf/bug_7638/main/pbx.c
team/murf/bug_7638/main/pval.c
team/murf/bug_7638/utils/ael_main.c
team/murf/bug_7638/utils/conf2ael.c
team/murf/bug_7638/utils/extconf.c
Modified: team/murf/bug_7638/Makefile.rules
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/Makefile.rules?view=diff&rev=59139&r1=59138&r2=59139
==============================================================================
--- team/murf/bug_7638/Makefile.rules (original)
+++ team/murf/bug_7638/Makefile.rules Wed Mar 21 20:16:48 2007
@@ -32,7 +32,7 @@
# ppro's, etc, as well as the AMD K6 and K7.
#K6OPT=-DK6OPT
-OPTIMIZE?=-O6
+OPTIMIZE?=-O2
ASTCFLAGS+=$(OPTIMIZE)
endif
Modified: team/murf/bug_7638/include/asterisk/extconf.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/include/asterisk/extconf.h?view=diff&rev=59139&r1=59138&r2=59139
==============================================================================
--- team/murf/bug_7638/include/asterisk/extconf.h (original)
+++ team/murf/bug_7638/include/asterisk/extconf.h Wed Mar 21 20:16:48 2007
@@ -15,6 +15,13 @@
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
+
+#ifndef _ASTERISK_EXTCONF_H
+#define _ASTERISK_EXTCONF_H
+
+#if defined(__cplusplus) || defined(c_plusplus)
+extern "C" {
+#endif
#ifdef NOTYET
/* I'm going to define all the structs mentioned below, to avoid
@@ -175,6 +182,8 @@
const char *registrar);
void localized_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar);
int localized_context_verify_includes(struct ast_context *con);
+
+#ifndef _ASTERISK_PBX_H
/*!
* When looking up extensions, we can have different requests
* identified by the 'action' argument, as follows.
@@ -189,12 +198,6 @@
E_SPAWN = 0x12, /* want to spawn an extension. Requires exact match */
E_FINDLABEL = 0x22 /* returns the priority for a given label. Requires exact match */
};
-
-#define STATUS_NO_CONTEXT 1
-#define STATUS_NO_EXTENSION 2
-#define STATUS_NO_PRIORITY 3
-#define STATUS_NO_LABEL 4
-#define STATUS_SUCCESS 5
#define AST_PBX_MAX_STACK 128
/* request and result for pbx_find_extension */
@@ -212,6 +215,15 @@
const char *data; /* set on return */
const char *foundcontext; /* set on return */
};
+
+#define STATUS_NO_CONTEXT 1
+#define STATUS_NO_EXTENSION 2
+#define STATUS_NO_PRIORITY 3
+#define STATUS_NO_LABEL 4
+#define STATUS_SUCCESS 5
+
+#endif
+
struct ast_exten *localized_find_extension(struct ast_context *bypass,
struct pbx_find_info *q,
const char *context,
@@ -222,3 +234,8 @@
enum ext_match_t action);
+#if defined(__cplusplus) || defined(c_plusplus)
+}
+#endif
+
+#endif /* _ASTERISK_PBX_H */
Modified: team/murf/bug_7638/main/pbx.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/main/pbx.c?view=diff&rev=59139&r1=59138&r2=59139
==============================================================================
--- team/murf/bug_7638/main/pbx.c (original)
+++ team/murf/bug_7638/main/pbx.c Wed Mar 21 20:16:48 2007
@@ -736,20 +736,6 @@
return (ret > 0) ? 1 : -1;
}
-/*!
- * When looking up extensions, we can have different requests
- * identified by the 'action' argument, as follows.
- * Note that the coding is such that the low 4 bits are the
- * third argument to extension_match_core.
- */
-enum ext_match_t {
- E_MATCHMORE = 0x00, /* extension can match but only with more 'digits' */
- E_CANMATCH = 0x01, /* extension can match with or without more 'digits' */
- E_MATCH = 0x02, /* extension is an exact match */
- E_MATCH_MASK = 0x03, /* mask for the argument to extension_match_core() */
- E_SPAWN = 0x12, /* want to spawn an extension. Requires exact match */
- E_FINDLABEL = 0x22 /* returns the priority for a given label. Requires exact match */
-};
/*
* Internal function for ast_extension_{match|close}
@@ -912,26 +898,15 @@
return ast_extension_match(cidpattern, callerid);
}
-/* request and result for pbx_find_extension */
-struct pbx_find_info {
-#if 0
- const char *context;
- const char *exten;
- int priority;
-#endif
-
- char *incstack[AST_PBX_MAX_STACK]; /* filled during the search */
- int stacklen; /* modified during the search */
- int status; /* set on return */
- struct ast_switch *swo; /* set on return */
- const char *data; /* set on return */
- const char *foundcontext; /* set on return */
-};
-
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)
+ 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)
{
int x, res;
struct ast_context *tmp;
Modified: team/murf/bug_7638/main/pval.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/main/pval.c?view=diff&rev=59139&r1=59138&r2=59139
==============================================================================
--- team/murf/bug_7638/main/pval.c (original)
+++ team/murf/bug_7638/main/pval.c Wed Mar 21 20:16:48 2007
@@ -49,6 +49,8 @@
#ifdef AAL_ARGCHECK
#include "asterisk/argdesc.h"
#endif
+
+extern int localized_pbx_load_module(void);
static char expr_output[2096];
#define AST_PBX_MAX_STACK 128
@@ -1337,18 +1339,21 @@
extern int localized_pbx_load_module(void);
/* if this is a standalone, we will need to make sure the
localized load of extensions.conf is done */
- if (!extensions_dot_conf_loaded)
+ if (!extensions_dot_conf_loaded) {
localized_pbx_load_module();
+ extensions_dot_conf_loaded++;
+ }
#endif
- pbx_find_extension(NULL, &pfiq, first->u1.str, second->u1.str, atoi(third->u1.str),
+ pbx_find_extension(NULL, NULL, &pfiq, first->u1.str, second->u1.str, atoi(third->u1.str),
atoi(third->u1.str) ? NULL : third->u1.str, NULL,
atoi(third->u1.str) ? E_MATCH : E_FINDLABEL);
- if (pfiq.status != STATUS_SUCCESS)
+ if (pfiq.status != STATUS_SUCCESS) {
ast_log(LOG_WARNING,"Warning: file %s, line %d-%d: goto: Couldn't find goto target %s|%s|%s, not even in extensions.conf!\n",
item->filename, item->startline, item->endline, first->u1.str, second->u1.str, third->u1.str);
- warns++;
+ warns++;
+ }
}
} else {
struct pval *mac = in_macro(item); /* is this goto inside a macro? */
@@ -2364,11 +2369,54 @@
item->u2.arglist->u1.str == argument
item->u2.arglist->next == next arg
*/
+#ifdef STANDALONE
+ /* if this is a standalone, we will need to make sure the
+ localized load of extensions.conf is done */
+ if (!extensions_dot_conf_loaded) {
+ localized_pbx_load_module();
+ extensions_dot_conf_loaded++;
+ }
+#endif
macro_def = find_macro(item->u1.str);
if (!macro_def) {
- ast_log(LOG_ERROR, "Error: file %s, line %d-%d: macro call to non-existent %s !\n",
- item->filename, item->startline, item->endline, item->u1.str);
- errs++;
+ struct pbx_find_info pfiq;
+
+ /* look for the macro in the extensions.conf world */
+ pbx_find_extension(NULL, NULL, &pfiq, item->u1.str, "s", 1, NULL, NULL, E_MATCH);
+
+ if (pfiq.status != STATUS_SUCCESS) {
+ char namebuf2[256];
+ snprintf(namebuf2, 256, "macro-%s", item->u1.str);
+
+ /* look for the macro in the extensions.conf world */
+ pbx_find_extension(NULL, NULL, &pfiq, namebuf2, "s", 1, NULL, NULL, E_MATCH);
+
+ if (pfiq.status == STATUS_SUCCESS) {
+ ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: macro call to non-existent %s! (macro-%s was found in the extensions.conf stuff, but we are using gosubs!)\n",
+ item->filename, item->startline, item->endline, item->u1.str, item->u1.str);
+ warns++;
+ } else {
+ ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: macro call to non-existent %s! (Not even in the extensions.conf stuff!)\n",
+ item->filename, item->startline, item->endline, item->u1.str);
+ warns++;
+ }
+ }
+
+#ifdef THIS_IS_1DOT4
+ char namebuf2[256];
+ snprintf(namebuf2, 256, "macro-%s", item->u1.str);
+
+ /* look for the macro in the extensions.conf world */
+ pbx_find_extension(NULL, NULL, &pfiq, namebuf2, "s", 1, NULL, NULL, E_MATCH);
+
+ if (pfiq.status != STATUS_SUCCESS) {
+ ast_log(LOG_WARNING, "Warning: file %s, line %d-%d: macro call to non-existent %s!\n",
+ item->filename, item->startline, item->endline, item->u1.str);
+ warns++;
+ }
+
+#endif
+
} else if (macro_def->type != PV_MACRO) {
ast_log(LOG_ERROR,"Error: file %s, line %d-%d: macro call to %s references a context, not a macro!\n",
item->filename, item->startline, item->endline, item->u1.str);
@@ -4313,8 +4361,8 @@
pval *pvalCreateNode( pvaltype type )
{
- pval *p = ast_calloc(1,sizeof(pval));
- p->type = type;
+ pval *p = calloc(1,sizeof(pval)); /* why, oh why, don't I use ast_calloc? Way, way, way too messy if I do! */
+ p->type = type; /* remember, this can be used externally or internally to asterisk */
return p;
}
Modified: team/murf/bug_7638/utils/ael_main.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/ael_main.c?view=diff&rev=59139&r1=59138&r2=59139
==============================================================================
--- team/murf/bug_7638/utils/ael_main.c (original)
+++ team/murf/bug_7638/utils/ael_main.c Wed Mar 21 20:16:48 2007
@@ -118,7 +118,8 @@
va_end(vars);
}
-struct ast_exten *pbx_find_extension(struct ast_context *bypass,
+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,
@@ -127,7 +128,8 @@
const char *callerid,
enum ext_match_t action);
-struct ast_exten *pbx_find_extension(struct ast_context *bypass,
+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,
@@ -138,7 +140,6 @@
{
return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
}
-
struct ast_app *pbx_findapp(const char *app)
{
Modified: team/murf/bug_7638/utils/conf2ael.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/conf2ael.c?view=diff&rev=59139&r1=59138&r2=59139
==============================================================================
--- team/murf/bug_7638/utils/conf2ael.c (original)
+++ team/murf/bug_7638/utils/conf2ael.c Wed Mar 21 20:16:48 2007
@@ -293,44 +293,44 @@
static int bit_at(unsigned int *word, int bitsperword, int bitnum)
{
- return word[bitnum/bitsperword] & (1 << (bitnum % bitsperword));
+ return word[bitnum/bitsperword] & (1 << (bitnum % bitsperword));
}
void get_start_stop(unsigned int *word, int bitsperword, int totalbits, int *start, int *end)
{
- int i;
- int thisbit, thatbit = bit_at(word, bitsperword, totalbits-1);
-
- for (i=0; i<totalbits; i++) {
- thisbit = bit_at(word, bitsperword, i);
-
- if (thisbit != thatbit ) {
- if (thisbit) {
- *start = i;
- } else {
- *end = i;
- }
- }
- thatbit = thisbit;
- }
+ int i;
+ int thisbit, thatbit = bit_at(word, bitsperword, totalbits-1);
+
+ for (i=0; i<totalbits; i++) {
+ thisbit = bit_at(word, bitsperword, i);
+
+ if (thisbit != thatbit ) {
+ if (thisbit) {
+ *start = i;
+ } else {
+ *end = i;
+ }
+ }
+ thatbit = thisbit;
+ }
}
int all_bits_set(unsigned int *word, int bitsperword, int totalbits )
{
-
- int i, total=totalbits/bitsperword,bitmask = 0;
-
- for (i=0; i<bitsperword; i++)
- {
- bitmask |= (1 << i);
- }
-
- for (i=0; i<total; i++)
- {
- if (word[i] != bitmask)
- return 0;
- }
- return 1;
+
+ int i, total=totalbits/bitsperword,bitmask = 0;
+
+ for (i=0; i<bitsperword; i++)
+ {
+ bitmask |= (1 << i);
+ }
+
+ for (i=0; i<total; i++)
+ {
+ if (word[i] != bitmask)
+ return 0;
+ }
+ return 1;
}
@@ -569,6 +569,8 @@
struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
{
+ printf("Creating context %s, registrar=%s\n", name, registrar);
+
return localized_context_create(extcontexts, name, registrar);
}
@@ -619,7 +621,8 @@
localized_merge_contexts_and_delete(extcontexts, registrar);
}
-struct ast_exten *pbx_find_extension(struct ast_context *bypass,
+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,
@@ -628,7 +631,8 @@
const char *callerid,
enum ext_match_t action);
-struct ast_exten *pbx_find_extension(struct ast_context *bypass,
+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,
Modified: team/murf/bug_7638/utils/extconf.c
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/extconf.c?view=diff&rev=59139&r1=59138&r2=59139
==============================================================================
--- team/murf/bug_7638/utils/extconf.c (original)
+++ team/murf/bug_7638/utils/extconf.c Wed Mar 21 20:16:48 2007
@@ -57,7 +57,7 @@
# include <glob.h>
#endif
-static char ast_config_AST_CONFIG_DIR[PATH_MAX];
+static char ast_config_AST_CONFIG_DIR[PATH_MAX] = {"/etc/asterisk"};
#include "asterisk/inline_api.h"
#include "asterisk/compat.h"
@@ -1539,8 +1539,6 @@
int ast_atomic_fetchadd_int_slow(volatile int *p, int v);
-#include "asterisk/inline_api.h"
-
#if defined(HAVE_OSX_ATOMICS)
#include "libkern/OSAtomic.h"
#endif
@@ -2419,7 +2417,7 @@
};
-static char *config = "extensions.ael";
+static char *config = "extensions.conf";
static char *registrar = "conf2ael";
static char userscontext[AST_MAX_EXTENSION] = "default";
static int static_config = 0;
@@ -2847,7 +2845,7 @@
static int ast_func_write(struct ast_channel *chan, const char *function, const char *value)
{
- ast_log(LOG_ERROR, "Function %s not registered\n", function);
+ /* ast_log(LOG_ERROR, "Function %s not registered\n", function); we are not interested in the details here */
return -1;
}
@@ -3260,7 +3258,9 @@
}
cfg->include_level++;
- ast_log(LOG_WARNING, "internal loading file %s level=%d\n", filename, cfg->include_level);
+ /* silence is golden!
+ ast_log(LOG_WARNING, "internal loading file %s level=%d\n", filename, cfg->include_level);
+ */
if (strcmp(filename, extconfig_conf) && strcmp(filename, "asterisk.conf") && config_engine_list) {
struct ast_config_engine *eng;
@@ -3278,7 +3278,9 @@
}
result = loader->load_func(db, table, filename, cfg, withcomments);
- ast_log(LOG_WARNING, "finished internal loading file %s level=%d\n", filename, cfg->include_level);
+ /* silence is golden
+ ast_log(LOG_WARNING, "finished internal loading file %s level=%d\n", filename, cfg->include_level);
+ */
if (result)
result->include_level--;
@@ -3407,14 +3409,14 @@
} else
exec_file[0] = '\0';
/* A #include */
- ast_log(LOG_WARNING, "Reading in included file %s withcomments=%d\n", cur, withcomments);
+ /* ast_log(LOG_WARNING, "Reading in included file %s withcomments=%d\n", cur, withcomments); */
do_include = ast_config_internal_load(cur, cfg, withcomments) ? 1 : 0;
if(!ast_strlen_zero(exec_file))
unlink(exec_file);
if(!do_include)
return 0;
- ast_log(LOG_WARNING, "Done reading in included file %s withcomments=%d\n", cur, withcomments);
+ /* ast_log(LOG_WARNING, "Done reading in included file %s withcomments=%d\n", cur, withcomments); */
} else {
ast_log(LOG_WARNING, "Directive '#%s' needs an argument (%s) at line %d of %s\n",
@@ -3463,7 +3465,7 @@
return -1;
}
} else {
- ast_log(LOG_WARNING, "No '=' (equal sign) in line %d of %s\n", lineno, configfile);
+ ast_log(LOG_WARNING, "EXTENSIONS.CONF: No '=' (equal sign) in line %d of %s\n", lineno, configfile);
}
}
return 0;
@@ -3490,8 +3492,6 @@
snprintf(fn, sizeof(fn), "%s/%s", (char *)ast_config_AST_CONFIG_DIR, filename);
}
- ast_log(LOG_WARNING, "textfile load %s \n", fn);
-
if (withcomments && cfg && cfg->include_level < 2 ) {
CB_INIT();
}
@@ -3500,7 +3500,6 @@
{
int glob_ret;
glob_t globbuf;
- ast_log(LOG_WARNING, "textfile load %s glob\n", fn);
globbuf.gl_offs = 0; /* initialize it to silence gcc */
#ifdef SOLARIS
@@ -3637,10 +3636,8 @@
}
}
#endif
- ast_log(LOG_WARNING, "textfile load %s almost done\n", fn);
if (cfg && cfg->include_level == 1 && withcomments && comment_buffer) {
if (comment_buffer) {
- ast_log(LOG_WARNING, "textfile load %s almost almost done\n", fn);
free(comment_buffer);
free(lline_buffer);
comment_buffer=0;
@@ -3652,7 +3649,6 @@
if (count == 0)
return NULL;
- ast_log(LOG_WARNING, "textfile load %s done\n", fn);
return cfg;
}
@@ -4561,24 +4557,26 @@
-static struct ast_exten *pbx_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);
-
-
-static struct ast_exten *pbx_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)
+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 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)
{
int x;
struct ast_context *tmp;
@@ -4586,12 +4584,12 @@
struct ast_include *i;
/* Initialize status if appropriate */
- if (q->stacklen == 0) {
- q->status = STATUS_NO_CONTEXT;
- q->swo = NULL;
- q->data = NULL;
- q->foundcontext = NULL;
- }
+ q->stacklen = 0;
+ q->status = STATUS_NO_CONTEXT;
+ q->swo = NULL;
+ q->data = NULL;
+ q->foundcontext = NULL;
+
/* Check for stack overflow */
if (q->stacklen >= AST_PBX_MAX_STACK) {
ast_log(LOG_WARNING, "Maximum PBX stack exceeded\n");
@@ -4686,7 +4684,7 @@
/* Now try any includes we have in this context */
for (i = tmp->includes; i; i = i->next) {
if (include_valid(i)) {
- if ((e = pbx_find_extension(bypass, q, i->rname, exten, priority, label, callerid, action)))
+ if ((e = pbx_find_extension(NULL, bypass, q, i->rname, exten, priority, label, callerid, action)))
return e;
if (q->swo)
return NULL;
@@ -4713,7 +4711,7 @@
const char *callerid,
enum ext_match_t action)
{
- return pbx_find_extension(bypass, q, context, exten, priority, label, callerid, action);
+ return pbx_find_extension(NULL, bypass, q, context, exten, priority, label, callerid, action);
}
@@ -5161,7 +5159,7 @@
int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);
- e = pbx_find_extension(con, &q, context, exten, priority, label, callerid, action);
+ e = pbx_find_extension(NULL, con, &q, context, exten, priority, label, callerid, action);
if (e) {
if (matching_action) {
return -1; /* success, we found it */
@@ -5452,7 +5450,7 @@
vare++;
}
if (brackets)
- ast_log(LOG_NOTICE, "Error in extension logic (missing '}')\n");
+ ast_log(LOG_NOTICE, "Error in extension logic (missing '}' in '%s')\n", cp1);
len = vare - vars - 1;
/* Skip totally over variable string */
@@ -5866,8 +5864,9 @@
while ( (inc = ast_walk_context_includes(con, inc)) )
if (!ast_context_find(inc->rname)) {
res = -1;
- ast_log(LOG_WARNING, "Context '%s' tries includes nonexistent context '%s'\n",
- ast_get_context_name(con), inc->rname);
+ if (strcasecmp(inc->rname,"parkedcalls")!=0)
+ ast_log(LOG_WARNING, "Context '%s' tries includes nonexistent context '%s'\n",
+ ast_get_context_name(con), inc->rname);
}
return res;
}
More information about the asterisk-commits
mailing list