aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2001-04-17 16:49:37 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2001-04-17 16:49:37 +0000
commit90d033de5d4143db41bf62fd6af7e3c593b0121a (patch)
tree22858a326f415fa2d890d69ae3c4df1c9229b137
parentf7102843df416c1875367054596cc120a7a77aab (diff)
Version 0.1.8 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@290 f38db490-d61c-443f-a65b-d21fe96a405b
-rwxr-xr-xinclude/asterisk/pbx.h29
-rwxr-xr-xpbx/pbx_config.c24
2 files changed, 38 insertions, 15 deletions
diff --git a/include/asterisk/pbx.h b/include/asterisk/pbx.h
index 45758a042..ee28e2ec6 100755
--- a/include/asterisk/pbx.h
+++ b/include/asterisk/pbx.h
@@ -32,10 +32,11 @@ extern "C" {
struct ast_context;
/* Register a new context */
-struct ast_context *ast_context_create(char *name);
+struct ast_context *ast_context_create(char *name, char *registrar);
-/* Destroy a context */
-void ast_context_destroy(struct ast_context *);
+/* Destroy a context (matches the specified context (or ANY context if
+ NULL) */
+void ast_context_destroy(struct ast_context *, char *registrar);
/* Find a context */
struct ast_context *ast_context_find(char *name);
@@ -49,10 +50,15 @@ int ast_pbx_run(struct ast_channel *c);
/* Add an extension to an extension context, this time with an ast_context * */
int ast_add_extension2(struct ast_context *con,
int replace, char *extension, int priority,
- char *application, void *data, void (*datad)(void *));
+ char *application, void *data, void (*datad)(void *),
+ char *registrar);
-/* Add an application. The function 'execute' should return non-zero if the line needs to be hung up. */
-int ast_register_application(char *app, int (*execute)(struct ast_channel *, void *));
+/* Add an application. The function 'execute' should return non-zero if the line needs to be hung up.
+ Include a one-line synopsis (e.g. 'hangs up a channel') and a more lengthy, multiline
+ description with more detail, including under what conditions the application
+ will return 0 or -1. */
+int ast_register_application(char *app, int (*execute)(struct ast_channel *, void *),
+ char *synopsis, char *description);
/* Remove an application */
int ast_unregister_application(char *app);
@@ -65,6 +71,9 @@ int ast_exists_extension(struct ast_channel *c, char *context, char *exten, int
what you add to exten, it's not going to be a valid extension anymore */
int ast_canmatch_extension(struct ast_channel *c, char *context, char *exten, int priority);
+/* Determine if a given extension matches a given pattern (in NXX format) */
+int ast_extension_match(char *pattern, char *extension);
+
/* Launch a new extension (i.e. new stack) */
int ast_spawn_extension(struct ast_channel *c, char *context, char *exten, int priority);
@@ -76,12 +85,12 @@ int ast_exec_extension(struct ast_channel *c, char *context, char *exten, int pr
int ast_pbx_longest_extension(char *context);
/* Add an include */
-int ast_context_add_include(char *context, char *include);
-int ast_context_add_include2(struct ast_context *con, char *include);
+int ast_context_add_include(char *context, char *include, char *registrar);
+int ast_context_add_include2(struct ast_context *con, char *include, char *registrar);
/* Remove an include */
-int ast_context_remove_include(char *context, char *include);
-int ast_context_remove_include2(struct ast_context *con, char *include);
+int ast_context_remove_include(char *context, char *include, char *registrar);
+int ast_context_remove_include2(struct ast_context *con, char *include, char *registrar);
#if defined(__cplusplus) || defined(c_plusplus)
}
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c
index 9bf224a66..24b0bbed2 100755
--- a/pbx/pbx_config.c
+++ b/pbx/pbx_config.c
@@ -23,15 +23,17 @@
static char *dtext = "Text Extension Configuration";
static char *config = "extensions.conf";
+static char *registrar = "pbx_config";
static int static_config = 0;
int unload_module(void)
{
+ ast_context_destroy(NULL, registrar);
return 0;
}
-int load_module(void)
+static int pbx_load_module(void)
{
struct ast_config *cfg;
struct ast_variable *v;
@@ -49,7 +51,7 @@ int load_module(void)
cxt = ast_category_browse(cfg, cxt);
continue;
}
- if ((con=ast_context_create(cxt))) {
+ if ((con=ast_context_create(cxt, registrar))) {
v = ast_variable_browse(cfg, cxt);
while(v) {
if (!strcasecmp(v->name, "exten")) {
@@ -66,12 +68,12 @@ int load_module(void)
data = strtok(NULL, ",");
if (!data)
data="";
- if (ast_add_extension2(con, 0, ext, atoi(pri), appl, strdup(data), free)) {
- ast_log(LOG_WARNING, "Unable to register extension\n");
+ if (ast_add_extension2(con, 0, ext, atoi(pri), appl, strdup(data), free, registrar)) {
+ ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
}
free(tc);
} else if(!strcasecmp(v->name, "include")) {
- if (ast_context_add_include2(con, v->value))
+ if (ast_context_add_include2(con, v->value, registrar))
ast_log(LOG_WARNING, "Unable to include context '%s' in context '%s'\n", v->value, cxt);
}
v = v->next;
@@ -84,6 +86,18 @@ int load_module(void)
return 0;
}
+int load_module(void)
+{
+ return pbx_load_module();
+}
+
+int reload(void)
+{
+ ast_context_destroy(NULL, registrar);
+ load_module();
+ return 0;
+}
+
int usecount(void)
{
return 0;