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;
|
struct ast_context;
|
||||||
|
|
||||||
/* Register a new 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 */
|
/* Destroy a context (matches the specified context (or ANY context if
|
||||||
void ast_context_destroy(struct ast_context *);
|
NULL) */
|
||||||
|
void ast_context_destroy(struct ast_context *, char *registrar);
|
||||||
|
|
||||||
/* Find a context */
|
/* Find a context */
|
||||||
struct ast_context *ast_context_find(char *name);
|
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 * */
|
/* Add an extension to an extension context, this time with an ast_context * */
|
||||||
int ast_add_extension2(struct ast_context *con,
|
int ast_add_extension2(struct ast_context *con,
|
||||||
int replace, char *extension, int priority,
|
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. */
|
/* 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 *));
|
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 */
|
/* Remove an application */
|
||||||
int ast_unregister_application(char *app);
|
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 */
|
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);
|
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) */
|
/* Launch a new extension (i.e. new stack) */
|
||||||
int ast_spawn_extension(struct ast_channel *c, char *context, char *exten, int priority);
|
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);
|
int ast_pbx_longest_extension(char *context);
|
||||||
|
|
||||||
/* Add an include */
|
/* Add an include */
|
||||||
int ast_context_add_include(char *context, char *include);
|
int ast_context_add_include(char *context, char *include, char *registrar);
|
||||||
int ast_context_add_include2(struct ast_context *con, char *include);
|
int ast_context_add_include2(struct ast_context *con, char *include, char *registrar);
|
||||||
|
|
||||||
/* Remove an include */
|
/* Remove an include */
|
||||||
int ast_context_remove_include(char *context, char *include);
|
int ast_context_remove_include(char *context, char *include, char *registrar);
|
||||||
int ast_context_remove_include2(struct ast_context *con, char *include);
|
int ast_context_remove_include2(struct ast_context *con, char *include, char *registrar);
|
||||||
|
|
||||||
#if defined(__cplusplus) || defined(c_plusplus)
|
#if defined(__cplusplus) || defined(c_plusplus)
|
||||||
}
|
}
|
||||||
|
@@ -23,15 +23,17 @@
|
|||||||
|
|
||||||
static char *dtext = "Text Extension Configuration";
|
static char *dtext = "Text Extension Configuration";
|
||||||
static char *config = "extensions.conf";
|
static char *config = "extensions.conf";
|
||||||
|
static char *registrar = "pbx_config";
|
||||||
|
|
||||||
static int static_config = 0;
|
static int static_config = 0;
|
||||||
|
|
||||||
int unload_module(void)
|
int unload_module(void)
|
||||||
{
|
{
|
||||||
|
ast_context_destroy(NULL, registrar);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int load_module(void)
|
static int pbx_load_module(void)
|
||||||
{
|
{
|
||||||
struct ast_config *cfg;
|
struct ast_config *cfg;
|
||||||
struct ast_variable *v;
|
struct ast_variable *v;
|
||||||
@@ -49,7 +51,7 @@ int load_module(void)
|
|||||||
cxt = ast_category_browse(cfg, cxt);
|
cxt = ast_category_browse(cfg, cxt);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if ((con=ast_context_create(cxt))) {
|
if ((con=ast_context_create(cxt, registrar))) {
|
||||||
v = ast_variable_browse(cfg, cxt);
|
v = ast_variable_browse(cfg, cxt);
|
||||||
while(v) {
|
while(v) {
|
||||||
if (!strcasecmp(v->name, "exten")) {
|
if (!strcasecmp(v->name, "exten")) {
|
||||||
@@ -66,12 +68,12 @@ int load_module(void)
|
|||||||
data = strtok(NULL, ",");
|
data = strtok(NULL, ",");
|
||||||
if (!data)
|
if (!data)
|
||||||
data="";
|
data="";
|
||||||
if (ast_add_extension2(con, 0, ext, atoi(pri), appl, strdup(data), free)) {
|
if (ast_add_extension2(con, 0, ext, atoi(pri), appl, strdup(data), free, registrar)) {
|
||||||
ast_log(LOG_WARNING, "Unable to register extension\n");
|
ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
|
||||||
}
|
}
|
||||||
free(tc);
|
free(tc);
|
||||||
} else if(!strcasecmp(v->name, "include")) {
|
} 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);
|
ast_log(LOG_WARNING, "Unable to include context '%s' in context '%s'\n", v->value, cxt);
|
||||||
}
|
}
|
||||||
v = v->next;
|
v = v->next;
|
||||||
@@ -84,6 +86,18 @@ int load_module(void)
|
|||||||
return 0;
|
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)
|
int usecount(void)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user