diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-01-30 15:03:20 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-01-30 15:03:20 +0000 |
commit | a8282b50e1826df08d77e3989b637814415b5865 (patch) | |
tree | 03c27ab3cc019e3323dea0a3464f071a18fa1d18 /pbx | |
parent | 3e152dc0f17e3948a6d3945f203f62060f987c17 (diff) |
Version 0.3.0 from FTP
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@593 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'pbx')
-rwxr-xr-x | pbx/pbx_config.c | 71 | ||||
-rwxr-xr-x | pbx/pbx_gtkconsole.c | 11 | ||||
-rwxr-xr-x | pbx/pbx_wilcalu.c | 4 |
3 files changed, 50 insertions, 36 deletions
diff --git a/pbx/pbx_config.c b/pbx/pbx_config.c index fbcb04a2e..b37a98f62 100755 --- a/pbx/pbx_config.c +++ b/pbx/pbx_config.c @@ -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)) diff --git a/pbx/pbx_gtkconsole.c b/pbx/pbx_gtkconsole.c index d93ef6fa9..727fe38f3 100755 --- a/pbx/pbx_gtkconsole.c +++ b/pbx/pbx_gtkconsole.c @@ -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); } diff --git a/pbx/pbx_wilcalu.c b/pbx/pbx_wilcalu.c index a125bd102..56270733b 100755 --- a/pbx/pbx_wilcalu.c +++ b/pbx/pbx_wilcalu.c @@ -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); |