Version 0.3.0 from FTP

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@593 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Mark Spencer
2003-01-30 15:03:20 +00:00
parent 60c5f7a1fb
commit 63ff352808
17 changed files with 968 additions and 194 deletions

View File

@@ -23,6 +23,7 @@
#include <errno.h>
/* For where to put dynamic tables */
#include "../asterisk.h"
#include "../astconf.h"
static char *dtext = "Text Extension Configuration";
static char *config = "extensions.conf";
@@ -919,7 +920,7 @@ static int handle_save_dialplan(int fd, int argc, char *argv[])
} else
/* no config file, default one */
snprintf(filename, sizeof(filename), "%s/%s",
AST_CONFIG_DIR, config);
(char *)ast_config_AST_CONFIG_DIR, config);
/* try to lock contexts list */
if (ast_lock_contexts()) {
@@ -1463,7 +1464,6 @@ static int pbx_load_module(void)
{
struct ast_config *cfg;
struct ast_variable *v;
char *ptrptr;
char *cxt, *ext, *pri, *appl, *data, *tc, *cidmatch;
struct ast_context *con;
@@ -1485,36 +1485,41 @@ static int pbx_load_module(void)
v = ast_variable_browse(cfg, cxt);
while(v) {
if (!strcasecmp(v->name, "exten")) {
char *stringp=NULL;
tc = strdup(v->value);
ext = strtok_r(tc, ",",&ptrptr);
if (!ext)
ext="";
pri = strtok_r(NULL, ",",&ptrptr);
if (!pri)
pri="";
appl = strtok_r(NULL, ",",&ptrptr);
if (!appl)
appl="";
if (*ptrptr=='"') {
ptrptr++;
data = strtok_r(NULL, "\"",&ptrptr);
ptrptr++;
} else {
data = strtok_r(NULL, ",",&ptrptr);
}
cidmatch = strchr(ext, '/');
if (cidmatch) {
*cidmatch = '\0';
cidmatch++;
}
strtok(ext, "/");
if(tc!=NULL){
stringp=tc;
ext = strsep(&stringp, ",");
if (!ext)
ext="";
pri = strsep(&stringp, ",");
if (!pri)
pri="";
appl = strsep(&stringp, ",");
if (!appl)
appl="";
if (stringp!=NULL && *stringp=='"') {
stringp++;
data = strsep(&stringp, "\"");
stringp++;
} else {
data = strsep(&stringp, ",");
}
cidmatch = strchr(ext, '/');
if (cidmatch) {
*cidmatch = '\0';
cidmatch++;
}
stringp=ext;
strsep(&stringp, "/");
if (!data)
data="";
if (ast_add_extension2(con, 0, ext, atoi(pri), cidmatch, appl, strdup(data), free, registrar)) {
ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
}
free(tc);
if (!data)
data="";
if (ast_add_extension2(con, 0, ext, atoi(pri), cidmatch, appl, strdup(data), free, registrar)) {
ast_log(LOG_WARNING, "Unable to register extension at line %d\n", v->lineno);
}
free(tc);
} else fprintf(stderr,"Error strdup returned NULL in %s\n",__PRETTY_FUNCTION__);
} else if(!strcasecmp(v->name, "include")) {
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);
@@ -1522,9 +1527,11 @@ static int pbx_load_module(void)
if (ast_context_add_ignorepat2(con, v->value, registrar))
ast_log(LOG_WARNING, "Unable to include ignorepat '%s' in context '%s'\n", v->value, cxt);
} else if (!strcasecmp(v->name, "switch")) {
char *stringp=NULL;
tc = strdup(v->value);
appl = strtok(tc, "/");
data = strtok(NULL, "");
stringp=tc;
appl = strsep(&stringp, "/");
data = strsep(&stringp, "");
if (!data)
data = "";
if (ast_context_add_switch2(con, appl, data, registrar))

View File

@@ -39,6 +39,7 @@
#include <glib.h>
/* For where to put dynamic tables */
#include "../asterisk.h"
#include "../astconf.h"
static pthread_mutex_t verb_lock = AST_MUTEX_INITIALIZER;
@@ -228,10 +229,12 @@ static void reload_module()
static void file_ok_sel(GtkWidget *w, GtkFileSelection *fs)
{
char tmp[AST_CONFIG_MAX_PATH];
char *module = gtk_file_selection_get_filename(fs);
char buf[256];
if (!strncmp(module, AST_MODULE_DIR "/", strlen(AST_MODULE_DIR "/")))
module += strlen(AST_MODULE_DIR "/");
snprintf((char *)tmp,sizeof(tmp)-1,"%s/",(char *)ast_config_AST_MODULE_DIR);
if (!strncmp(module, (char *)tmp, strlen(tmp)))
module += strlen(tmp);
gdk_threads_leave();
if (ast_load_resource(module)) {
snprintf(buf, sizeof(buf), "Error loading module '%s'.", module);
@@ -246,13 +249,15 @@ static void file_ok_sel(GtkWidget *w, GtkFileSelection *fs)
static void add_module()
{
char tmp[AST_CONFIG_MAX_PATH];
GtkWidget *filew;
snprintf((char *)tmp,sizeof(tmp)-1,"%s/*.so",(char *)ast_config_AST_MODULE_DIR);
filew = gtk_file_selection_new("Load Module");
gtk_signal_connect(GTK_OBJECT (GTK_FILE_SELECTION(filew)->ok_button),
"clicked", GTK_SIGNAL_FUNC(file_ok_sel), filew);
gtk_signal_connect_object(GTK_OBJECT (GTK_FILE_SELECTION(filew)->cancel_button),
"clicked", GTK_SIGNAL_FUNC(gtk_widget_destroy), GTK_OBJECT(filew));
gtk_file_selection_set_filename(GTK_FILE_SELECTION(filew), AST_MODULE_DIR "/*.so");
gtk_file_selection_set_filename(GTK_FILE_SELECTION(filew), (char *)tmp);
gtk_widget_show(filew);
}

View File

@@ -31,10 +31,11 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include "../astconf.h"
// Globals
const char *dialfile="/var/run/autodial.ctl";
const char dialfile[255];
static char *tdesc = "Wil Cal U (Auto Dialer)";
static pthread_t autodialer_thread;
static char buf[257];
@@ -245,6 +246,7 @@ int unload_module(void)
int load_module(void)
{
int val;
snprintf((char *)dialfile,sizeof(dialfile)-1,"%s/%s",(char *)ast_config_AST_RUN_DIR,"autodial.ctl");
if((val=mkfifo(dialfile, 0700))){
if(errno!=EEXIST){
printf("Error:%d Creating Autodial FIFO\n",errno);