mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-12 15:45:18 +00:00
Version 0.1.10 from FTP
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@384 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
6
config.c
6
config.c
@@ -162,7 +162,7 @@ struct ast_config *ast_load(char *configfile)
|
||||
int lineno=0;
|
||||
|
||||
if (configfile[0] == '/') {
|
||||
strncpy(fn, configfile, sizeof(fn));
|
||||
strncpy(fn, configfile, sizeof(fn)-1);
|
||||
} else {
|
||||
snprintf(fn, sizeof(fn), "%s/%s", AST_CONFIG_DIR, configfile);
|
||||
}
|
||||
@@ -221,7 +221,7 @@ struct ast_config *ast_load(char *configfile)
|
||||
fclose(f);
|
||||
return NULL;
|
||||
}
|
||||
strncpy(tmpc->name, cur+1, sizeof(tmpc->name));
|
||||
strncpy(tmpc->name, cur+1, sizeof(tmpc->name)-1);
|
||||
tmpc->root = NULL;
|
||||
tmpc->next = tmp->root;
|
||||
tmp->root = tmpc;
|
||||
@@ -261,7 +261,7 @@ struct ast_config *ast_load(char *configfile)
|
||||
return NULL;
|
||||
}
|
||||
} else {
|
||||
ast_log(LOG_WARNING, "No '=' (equal sign) in line %d\n", lineno);
|
||||
ast_log(LOG_WARNING, "No '=' (equal sign) in line %d of %s\n", lineno, configfile);
|
||||
}
|
||||
|
||||
}
|
||||
|
47
include/asterisk/parking.h
Executable file
47
include/asterisk/parking.h
Executable file
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* Asterisk -- A telephony toolkit for Linux.
|
||||
*
|
||||
* Call Parking API
|
||||
*
|
||||
* Copyright (C) 1999, Mark Spencer
|
||||
*
|
||||
* Mark Spencer <markster@linux-support.net>
|
||||
*
|
||||
* This program is free software, distributed under the terms of
|
||||
* the GNU General Public License.
|
||||
*
|
||||
* Includes code and algorithms from the Zapata library.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _PARKING_H
|
||||
#define _PARKING_H
|
||||
|
||||
//! Park a call and read back parked location
|
||||
/*! \param chan the channel to actually be parked
|
||||
\param host the channel which will have the parked location read to
|
||||
Park the channel chan, and read back the parked location to the
|
||||
host. If the call is not picked up within a specified period of
|
||||
time, then the call will return to the last step that it was in
|
||||
(in terms of exten, priority and context)
|
||||
*/
|
||||
extern int ast_park_call(struct ast_channel *chan, struct ast_channel *host);
|
||||
//! Park a call via a masqueraded channel
|
||||
/*! \param rchan the real channel to be parked
|
||||
\param host the channel to have the parking read to
|
||||
Masquerade the channel rchan into a new, empty channel which is then
|
||||
parked with ast_park_call
|
||||
*/
|
||||
extern int ast_masq_park_call(struct ast_channel *rchan, struct ast_channel *host);
|
||||
|
||||
//! Determine system parking extension
|
||||
/*! Returns the call parking extension for drivers that provide special
|
||||
call parking help */
|
||||
extern char *ast_parking_ext(void);
|
||||
|
||||
//! Bridge a call, optionally allowing redirection
|
||||
|
||||
extern int ast_bridge_call(struct ast_channel *chan, struct ast_channel *peer, int allowredirect);
|
||||
|
||||
|
||||
#endif /* _PARKING_H */
|
108
loader.c
108
loader.c
@@ -161,14 +161,19 @@ int ast_load_resource(char *resource_name)
|
||||
struct ast_config *cfg;
|
||||
/* Keep the module file parsing silent */
|
||||
o = option_verbose;
|
||||
option_verbose = 0;
|
||||
cfg = ast_load(AST_MODULE_CONFIG);
|
||||
option_verbose = o;
|
||||
if (cfg) {
|
||||
if ((val = ast_variable_retrieve(cfg, "global", resource_name))
|
||||
&& ast_true(val))
|
||||
flags |= RTLD_GLOBAL;
|
||||
ast_destroy(cfg);
|
||||
if (strncasecmp(resource_name, "res_", 4)) {
|
||||
option_verbose = 0;
|
||||
cfg = ast_load(AST_MODULE_CONFIG);
|
||||
option_verbose = o;
|
||||
if (cfg) {
|
||||
if ((val = ast_variable_retrieve(cfg, "global", resource_name))
|
||||
&& ast_true(val))
|
||||
flags |= RTLD_GLOBAL;
|
||||
ast_destroy(cfg);
|
||||
}
|
||||
} else {
|
||||
/* Resource modules are always loaded global */
|
||||
flags |= RTLD_GLOBAL;
|
||||
}
|
||||
|
||||
if (ast_pthread_mutex_lock(&modlock))
|
||||
@@ -188,9 +193,9 @@ int ast_load_resource(char *resource_name)
|
||||
ast_pthread_mutex_unlock(&modlock);
|
||||
return -1;
|
||||
}
|
||||
strncpy(m->resource, resource_name, sizeof(m->resource));
|
||||
strncpy(m->resource, resource_name, sizeof(m->resource)-1);
|
||||
if (resource_name[0] == '/') {
|
||||
strncpy(fn, resource_name, sizeof(fn));
|
||||
strncpy(fn, resource_name, sizeof(fn)-1);
|
||||
} else {
|
||||
snprintf(fn, sizeof(fn), "%s/%s", AST_MODULE_DIR, resource_name);
|
||||
}
|
||||
@@ -315,49 +320,54 @@ int load_modules()
|
||||
/* Load all modules */
|
||||
DIR *mods;
|
||||
struct dirent *d;
|
||||
mods = opendir(AST_MODULE_DIR);
|
||||
if (mods) {
|
||||
while((d = readdir(mods))) {
|
||||
/* Must end in .so to load it. */
|
||||
if ((strlen(d->d_name) > 3) &&
|
||||
!strcasecmp(d->d_name + strlen(d->d_name) - 3, ".so") &&
|
||||
!ast_resource_exists(d->d_name)) {
|
||||
/* It's a shared library -- Just be sure we're allowed to load it -- kinda
|
||||
an inefficient way to do it, but oh well. */
|
||||
if (cfg) {
|
||||
v = ast_variable_browse(cfg, "modules");
|
||||
while(v) {
|
||||
if (!strcasecmp(v->name, "noload") &&
|
||||
!strcasecmp(v->value, d->d_name))
|
||||
break;
|
||||
v = v->next;
|
||||
}
|
||||
if (v) {
|
||||
if (option_verbose) {
|
||||
ast_verbose( VERBOSE_PREFIX_1 "[skipping %s]\n", d->d_name);
|
||||
fflush(stdout);
|
||||
int x;
|
||||
/* Make two passes. First, load any resource modules, then load the others. */
|
||||
for (x=0;x<2;x++) {
|
||||
mods = opendir(AST_MODULE_DIR);
|
||||
if (mods) {
|
||||
while((d = readdir(mods))) {
|
||||
/* Must end in .so to load it. */
|
||||
if ((strlen(d->d_name) > 3) && (x || !strncasecmp(d->d_name, "res_", 4)) &&
|
||||
!strcasecmp(d->d_name + strlen(d->d_name) - 3, ".so") &&
|
||||
!ast_resource_exists(d->d_name)) {
|
||||
/* It's a shared library -- Just be sure we're allowed to load it -- kinda
|
||||
an inefficient way to do it, but oh well. */
|
||||
if (cfg) {
|
||||
v = ast_variable_browse(cfg, "modules");
|
||||
while(v) {
|
||||
if (!strcasecmp(v->name, "noload") &&
|
||||
!strcasecmp(v->value, d->d_name))
|
||||
break;
|
||||
v = v->next;
|
||||
}
|
||||
if (v) {
|
||||
if (option_verbose) {
|
||||
ast_verbose( VERBOSE_PREFIX_1 "[skipping %s]\n", d->d_name);
|
||||
fflush(stdout);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
if (option_debug && !option_verbose)
|
||||
ast_log(LOG_DEBUG, "Loading module %s\n", d->d_name);
|
||||
if (option_verbose) {
|
||||
ast_verbose( VERBOSE_PREFIX_1 "[%s]", d->d_name);
|
||||
fflush(stdout);
|
||||
}
|
||||
if (ast_load_resource(d->d_name)) {
|
||||
ast_log(LOG_WARNING, "Loading module %s failed!\n", d->d_name);
|
||||
if (cfg)
|
||||
ast_destroy(cfg);
|
||||
return -1;
|
||||
}
|
||||
if (option_debug && !option_verbose)
|
||||
ast_log(LOG_DEBUG, "Loading module %s\n", d->d_name);
|
||||
if (option_verbose) {
|
||||
ast_verbose( VERBOSE_PREFIX_1 "[%s]", d->d_name);
|
||||
fflush(stdout);
|
||||
}
|
||||
if (ast_load_resource(d->d_name)) {
|
||||
ast_log(LOG_WARNING, "Loading module %s failed!\n", d->d_name);
|
||||
if (cfg)
|
||||
ast_destroy(cfg);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
if (!option_quiet)
|
||||
ast_log(LOG_WARNING, "Unable to open modules directory " AST_MODULE_DIR ".\n");
|
||||
closedir(mods);
|
||||
} else {
|
||||
if (!option_quiet)
|
||||
ast_log(LOG_WARNING, "Unable to open modules directory " AST_MODULE_DIR ".\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
ast_destroy(cfg);
|
||||
|
Reference in New Issue
Block a user