[asterisk-commits] murf: branch murf/bug_7638 r59033 - in /team/murf/bug_7638: include/asterisk/...

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Sat Mar 17 20:26:34 MST 2007


Author: murf
Date: Sat Mar 17 22:26:33 2007
New Revision: 59033

URL: http://svn.digium.com/view/asterisk?view=rev&rev=59033
Log:
Another checkpoint commit. Down to a decision about pbx_find_extension now.

Modified:
    team/murf/bug_7638/include/asterisk/extconf.h
    team/murf/bug_7638/include/asterisk/pbx.h
    team/murf/bug_7638/main/pbx.c
    team/murf/bug_7638/main/pval.c
    team/murf/bug_7638/utils/Makefile
    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/include/asterisk/extconf.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/include/asterisk/extconf.h?view=diff&rev=59033&r1=59032&r2=59033
==============================================================================
--- team/murf/bug_7638/include/asterisk/extconf.h (original)
+++ team/murf/bug_7638/include/asterisk/extconf.h Sat Mar 17 22:26:33 2007
@@ -162,5 +162,63 @@
 void localized_context_destroy(struct ast_context *con, const char *registrar);
 int localized_pbx_load_module(void);
 
-struct ast_context *localize_context_create(struct ast_context **extcontexts, const char *name, const char *registrar);
-
+struct ast_context *localized_context_create(struct ast_context **extcontexts, const char *name, const char *registrar);
+int localized_pbx_builtin_setvar(struct ast_channel *chan, void *data);
+int localized_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar);
+int localized_context_add_switch2(struct ast_context *con, const char *value,
+								 const char *data, int eval, const char *registrar);
+int localized_context_add_include2(struct ast_context *con, const char *value,
+								  const char *registrar);
+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 localized_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar);
+int localized_context_verify_includes(struct ast_context *con);
+/*!
+ * 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 */
+};
+
+#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 */
+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 *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);
+
+

Modified: team/murf/bug_7638/include/asterisk/pbx.h
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/include/asterisk/pbx.h?view=diff&rev=59033&r1=59032&r2=59033
==============================================================================
--- team/murf/bug_7638/include/asterisk/pbx.h (original)
+++ team/murf/bug_7638/include/asterisk/pbx.h Sat Mar 17 22:26:33 2007
@@ -879,6 +879,45 @@
 
 void ast_hint_state_changed(const char *device);
 
+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 */
+};
+
+#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 */
+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);
+	
+
+
 #if defined(__cplusplus) || defined(c_plusplus)
 }
 #endif

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=59033&r1=59032&r2=59033
==============================================================================
--- team/murf/bug_7638/main/pbx.c (original)
+++ team/murf/bug_7638/main/pbx.c Sat Mar 17 22:26:33 2007
@@ -928,7 +928,7 @@
 	const char *foundcontext;       /* set on return */
 };
 
-static struct ast_exten *pbx_find_extension(struct ast_channel *chan,
+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)

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=59033&r1=59032&r2=59033
==============================================================================
--- team/murf/bug_7638/main/pval.c (original)
+++ team/murf/bug_7638/main/pval.c Sat Mar 17 22:26:33 2007
@@ -57,7 +57,9 @@
 
 static int errs, warns;
 static int notes;
+#ifdef STANDALONE
 static int extensions_dot_conf_loaded = 0;
+#endif
 static char *registrar = "pbx_ael";
 
 static pval *current_db;
@@ -101,53 +103,6 @@
 static pval *get_contxt(pval *p);
 static void remove_spaces_before_equals(char *str);
 static void substitute_commas(char *str);
-
-/*!
- * 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 */
-};
-
-#define STATUS_NO_CONTEXT	1
-#define STATUS_NO_EXTENSION	2
-#define STATUS_NO_PRIORITY	3
-#define STATUS_NO_LABEL		4
-#define STATUS_SUCCESS		5
-
-/* 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 *external_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);
-
 
 /* I am adding this code to substitute commas with vertbars in the args to apps */
 static void substitute_commas(char *str)
@@ -1378,12 +1333,15 @@
 				} else {
 					/* here is where code would go to check for target existence in extensions.conf files */
 					struct pbx_find_info pfiq;
+#ifdef STANDALONE
 					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)
 						localized_pbx_load_module();
-
-					external_find_extension(NULL, &pfiq, first->u1.str, second->u1.str, atoi(third->u1.str),
+#endif
+
+					pbx_find_extension(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);
 					

Modified: team/murf/bug_7638/utils/Makefile
URL: http://svn.digium.com/view/asterisk/team/murf/bug_7638/utils/Makefile?view=diff&rev=59033&r1=59032&r2=59033
==============================================================================
--- team/murf/bug_7638/utils/Makefile (original)
+++ team/murf/bug_7638/utils/Makefile Sat Mar 17 22:26:33 2007
@@ -90,6 +90,8 @@
 
 ast_expr2f.o: ASTCFLAGS+=-DSTANDALONE_AEL -I../main
 
+pval.o : ASTCFLAGS+=-DSTANDALONE
+
 check_expr: check_expr.o ast_expr2.o ast_expr2f.o
 
 aelbison.c: ../pbx/ael/ael.tab.c

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=59033&r1=59032&r2=59033
==============================================================================
--- team/murf/bug_7638/utils/ael_main.c (original)
+++ team/murf/bug_7638/utils/ael_main.c Sat Mar 17 22:26:33 2007
@@ -14,6 +14,7 @@
 #include "asterisk/module.h"
 #include "asterisk/app.h"
 #include "asterisk/ael_structs.h"
+#include "asterisk/extconf.h"
 
 struct namelist
 {
@@ -117,6 +118,28 @@
 						        va_end(vars);
 }
 
+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);
+
+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)
+{
+	return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
+}
+
+
 struct ast_app *pbx_findapp(const char *app)
 {
 	return (struct ast_app*)1; /* so as not to trigger an error */

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=59033&r1=59032&r2=59033
==============================================================================
--- team/murf/bug_7638/utils/conf2ael.c (original)
+++ team/murf/bug_7638/utils/conf2ael.c Sat Mar 17 22:26:33 2007
@@ -72,10 +72,11 @@
 
 extern char *days[];
 extern char *months[];
-extern char *config;
 char ast_config_AST_CONFIG_DIR[PATH_MAX];
 
-/* static char *config = "extensions.conf";
+char *config = "extensions.conf";
+
+/* 
 static char *registrar = "conf2ael";
 static char userscontext[AST_MAX_EXTENSION] = "default";
 static int static_config = 0;
@@ -128,21 +129,6 @@
 #else
 #define EXT_DATA_SIZE 8192
 #endif
-/*!
- * 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 */
-};
-
 
 #define SWITCH_DATA_LENGTH 256
 
@@ -548,3 +534,109 @@
 
 /* ==================================== for linking internal stuff to external stuff */
 
+int pbx_builtin_setvar(struct ast_channel *chan, void *data)
+{
+	return localized_pbx_builtin_setvar(chan, data);
+}
+
+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)
+{
+	return localized_add_extension2(con, replace, extension, priority, label, callerid, application, data, datad, registrar);
+}
+
+int ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar)
+{
+	
+	return localized_context_add_ignorepat2(con, value, registrar);
+}
+
+int ast_context_add_switch2(struct ast_context *con, const char *value,
+								 const char *data, int eval, const char *registrar)
+{
+	
+	return localized_context_add_switch2(con, value, data, eval, registrar);
+}
+
+int ast_context_add_include2(struct ast_context *con, const char *value,
+								  const char *registrar)
+{
+	
+	return localized_context_add_include2(con, value,registrar);
+}
+
+struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
+{
+	return localized_context_create(extcontexts, name, registrar);
+}
+
+void ast_cli_register_multiple(void);
+
+void ast_cli_register_multiple(void)
+{
+}
+
+void ast_module_register(const struct ast_module_info *x)
+{
+}
+
+void ast_module_unregister(const struct ast_module_info *x)
+{
+}
+
+void ast_cli_unregister_multiple(void);
+
+void ast_cli_unregister_multiple(void)
+{
+}
+
+struct ast_context *ast_walk_contexts(struct ast_context *con);
+struct ast_context *ast_walk_contexts(struct ast_context *con)
+{
+	return localized_walk_contexts(con);
+}
+
+void ast_context_destroy(struct ast_context *con, const char *registrar);
+
+void ast_context_destroy(struct ast_context *con, const char *registrar)
+{
+	return localized_context_destroy(con, registrar);
+}
+
+int ast_context_verify_includes(struct ast_context *con);
+
+int ast_context_verify_includes(struct ast_context *con)
+{
+	return  localized_context_verify_includes(con);
+}
+
+void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar);
+
+void ast_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar)
+{
+	localized_merge_contexts_and_delete(extcontexts, registrar);
+}
+
+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);
+
+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)
+{
+	return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
+}
+

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=59033&r1=59032&r2=59033
==============================================================================
--- team/murf/bug_7638/utils/extconf.c (original)
+++ team/murf/bug_7638/utils/extconf.c Sat Mar 17 22:26:33 2007
@@ -2969,6 +2969,8 @@
 
 	return(0);
 }
+
+int localized_pbx_builtin_setvar(struct ast_channel *chan, void *data);
 
 int localized_pbx_builtin_setvar(struct ast_channel *chan, void *data)
 {
@@ -4559,7 +4561,7 @@
 
 
 
-struct ast_exten *external_find_extension(struct ast_context *bypass, 
+static struct ast_exten *pbx_find_extension(struct ast_context *bypass, 
 										  struct pbx_find_info *q,
 										  const char *context, 
 										  const char *exten, 
@@ -4569,7 +4571,7 @@
 										  enum ext_match_t action);
 
 
-struct ast_exten *external_find_extension(struct ast_context *bypass, 
+static struct ast_exten *pbx_find_extension(struct ast_context *bypass, 
 										  struct pbx_find_info *q,
 										  const char *context, 
 										  const char *exten, 
@@ -4684,13 +4686,34 @@
 	/* Now try any includes we have in this context */
 	for (i = tmp->includes; i; i = i->next) {
 		if (include_valid(i)) {
-			if ((e = external_find_extension(bypass, q, i->rname, exten, priority, label, callerid, action)))
+			if ((e = pbx_find_extension(bypass, q, i->rname, exten, priority, label, callerid, action)))
 				return e;
 			if (q->swo)
 				return NULL;
 		}
 	}
 	return NULL;
+}
+
+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);
+
+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)
+{
+	return pbx_find_extension(bypass, q, context, exten, priority, label, callerid, action);
 }
 
 
@@ -4767,6 +4790,16 @@
 
 	return 0;
 }
+
+int localized_context_add_include2(struct ast_context *con, const char *value,
+							 const char *registrar);
+int localized_context_add_include2(struct ast_context *con, const char *value,
+								   const char *registrar)
+{
+	return  ast_context_add_include2(con, value, registrar);
+}
+
+
 
 static int ast_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar);
 
@@ -4800,6 +4833,14 @@
 
 }
 
+int localized_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar);
+
+int localized_context_add_ignorepat2(struct ast_context *con, const char *value, const char *registrar)
+{
+	return ast_context_add_ignorepat2(con, value, registrar);
+}
+
+
 /*
  * Lock context list functions ...
  */
@@ -4890,6 +4931,15 @@
 		ast_verbose(VERBOSE_PREFIX_3 "Including switch '%s/%s' in context '%s'\n", new_sw->name, new_sw->data, ast_get_context_name(con));
 
 	return 0;
+}
+
+int localized_context_add_switch2(struct ast_context *con, const char *value,
+										 const char *data, int eval, const char *registrar);
+
+int localized_context_add_switch2(struct ast_context *con, const char *value,
+										 const char *data, int eval, const char *registrar)
+{
+	return ast_context_add_switch2(con, value, data, eval, registrar);
 }
 
 static struct ast_context *__ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar, int existsokay)
@@ -5077,6 +5127,21 @@
 	return 0;
 }
 
+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);
+
+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)
+{
+	return ast_add_extension2(con, replace, extension, priority, label, callerid, application, data, datad, registrar);
+}
+
+
+
 /*! \brief The return value depends on the action:
  *
  * E_MATCH, E_CANMATCH, E_MATCHMORE require a real match,
@@ -5096,7 +5161,7 @@
 
 	int matching_action = (action == E_MATCH || action == E_CANMATCH || action == E_MATCHMORE);
 
-	e = external_find_extension(con, &q, context, exten, priority, label, callerid, action);
+	e = pbx_find_extension(con, &q, context, exten, priority, label, callerid, action);
 	if (e) {
 		if (matching_action) {
 			return -1;	/* success, we found it */
@@ -5157,12 +5222,9 @@
 	return __ast_context_create(extcontexts, name, registrar, 1);
 }
 
-static struct ast_context *ast_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
-{
-	return __ast_context_create(extcontexts, name, registrar, 0);
-}
-
-struct ast_context *localize_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
+struct ast_context *localized_context_create(struct ast_context **extcontexts, const char *name, const char *registrar);
+
+struct ast_context *localized_context_create(struct ast_context **extcontexts, const char *name, const char *registrar)
 {
 	return __ast_context_create(extcontexts, name, registrar, 0);
 }
@@ -5789,6 +5851,13 @@
 	return;
 }
 
+void localized_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar);
+
+void localized_merge_contexts_and_delete(struct ast_context **extcontexts, const char *registrar)
+{
+	ast_merge_contexts_and_delete(extcontexts, registrar);
+}
+
 static int ast_context_verify_includes(struct ast_context *con)
 {
 	struct ast_include *inc = NULL;
@@ -5803,6 +5872,13 @@
 	return res;
 }
 
+int localized_context_verify_includes(struct ast_context *con);
+
+int localized_context_verify_includes(struct ast_context *con)
+{
+	return ast_context_verify_includes(con);
+}
+
 int localized_pbx_load_module(void);
 
 int localized_pbx_load_module(void)



More information about the asterisk-commits mailing list