mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Version 0.1.8 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@290 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user