Merged revisions 80820 via svnmerge from
[asterisk/asterisk.git] / utils / ael_main.c
index f32e0b5..6a2cb6d 100644 (file)
@@ -9,11 +9,18 @@
 #include <regex.h>
 #include <limits.h>
 
-#include "asterisk/ast_expr.h"
+#include "asterisk/compat.h"
 #include "asterisk/channel.h"
+#include "asterisk/ast_expr.h"
+#include "asterisk/ast_expr.h"
 #include "asterisk/module.h"
 #include "asterisk/app.h"
 #include "asterisk/ael_structs.h"
+#include "asterisk/extconf.h"
+
+/*** MODULEINFO
+       <depend>res_ael_share</depend>
+ ***/
 
 struct namelist
 {
@@ -105,11 +112,55 @@ static int dump_extensions = 0;
 static int FIRST_TIME = 0;
 static FILE *dumpfile;
 
+void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
+{
+               va_list vars;
+                       va_start(vars,fmt);
+                       
+                               printf("LOG: lev:%d file:%s  line:%d func: %s  ",
+                                                                  level, file, line, function);
+                                       vprintf(fmt, vars);
+                                               fflush(stdout);
+                                                       va_end(vars);
+}
+
+struct ast_exten *pbx_find_extension(struct ast_channel *chan,
+                                                                        struct ast_context *bypass,
+                                                                        struct pbx_find_info *q,
+                                                                        const char *context, 
+                                                                        const char *exten, 
+                                                                        int priority,
+                                                                        const char *label, 
+                                                                        const char *callerid, 
+                                                                        enum ext_match_t action);
+
+struct ast_exten *pbx_find_extension(struct ast_channel *chan,
+                                                                        struct ast_context *bypass,
+                                                                        struct pbx_find_info *q,
+                                                                        const char *context, 
+                                                                        const char *exten, 
+                                                                        int priority,
+                                                                        const char *label, 
+                                                                        const char *callerid, 
+                                                                        enum ext_match_t action)
+{
+       return localized_find_extension(bypass, q, context, exten, priority, label, callerid, action);
+}
+
 struct ast_app *pbx_findapp(const char *app)
 {
        return (struct ast_app*)1; /* so as not to trigger an error */
 }
 
+struct ast_custom_function *ast_custom_function_find(const char *name);
+
+
+struct ast_custom_function *ast_custom_function_find(const char *name)
+{
+       return 0; /* in "standalone" mode, functions are just not avail */
+}
+
+
 void ast_add_profile(void)
 {
        if (!no_comp)
@@ -154,6 +205,17 @@ void ast_unregister_file_version(void)
        /* I'm erasing this, because I don't think anyone really ever needs to see it anyway */
 
 }
+void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count);
+void pbx_substitute_variables_helper(struct ast_channel *c,const char *cp1,char *cp2,int count)
+{
+       if (cp1 && *cp1)
+               strncpy(cp2,cp1,AST_MAX_EXTENSION); /* Right now, this routine is ONLY being called for 
+                                                                                          a possible var substitution on extension names,
+                                                                                          so....! */
+       else
+               *cp2 = 0;
+}
+
 int ast_add_extension2(struct ast_context *con,
                        int replace, const char *extension, int priority, const char *label, const char *callerid,
                        const char *application, void *data, void (*datad)(void *),
@@ -369,56 +431,6 @@ void ast_context_destroy(void)
                printf("Executed ast_context_destroy();\n");
 }
 
-void ast_log(int level, const char *file, int line, const char *function, const char *fmt, ...)
-{
-        va_list vars;
-        va_start(vars,fmt);
-       if( !quiet || level > 2 ) {
-           printf("LOG: lev:%d file:%s  line:%d func: %s  ",
-                   level, file, line, function);
-            vprintf(fmt, vars);
-            fflush(stdout);
-            va_end(vars);
-       }
-}
-
-void ast_verbose(const char *fmt, ...)
-{
-        va_list vars;
-        va_start(vars,fmt);
-
-        printf("VERBOSE: ");
-        vprintf(fmt, vars);
-        fflush(stdout);
-        va_end(vars);
-}
-
-char *ast_process_quotes_and_slashes(char *start, char find, char replace_with)
-{
-        char *dataPut = start;
-        int inEscape = 0;
-        int inQuotes = 0;
-
-        for (; *start; start++) {
-                if (inEscape) {
-                        *dataPut++ = *start;       /* Always goes verbatim */
-                        inEscape = 0;
-                } else {
-                        if (*start == '\\') {
-                                inEscape = 1;      /* Do not copy \ into the data */
-                        } else if (*start == '\'') {
-                                inQuotes = 1-inQuotes;   /* Do not copy ' into the data */
-                        } else {
-                                /* Replace , with |, unless in quotes */
-                                *dataPut++ = inQuotes ? *start : ((*start==find) ? replace_with : *start);
-                        }
-                }
-        }
-        if (start != dataPut)
-                *dataPut = 0;
-        return dataPut;
-}
-
 void filter_leading_space_from_exprs(char *str)
 {
        /*  Mainly for aesthetics */
@@ -457,7 +469,8 @@ void filter_newlines(char *str)
 
 
 extern struct module_symbols mod_data;
-extern int ael_external_load_module(void);
+int ael_external_load_module(void);
+
 
 int main(int argc, char **argv)
 {
@@ -490,9 +503,11 @@ int main(int argc, char **argv)
 
        if( use_curr_dir ) {
                strcpy(ast_config_AST_CONFIG_DIR, ".");
+               localized_use_local_dir();
        }
        else {
                strcpy(ast_config_AST_CONFIG_DIR, "/etc/asterisk");
+               localized_use_conf_dir();
        }
        strcpy(ast_config_AST_VAR_DIR, "/var/lib/asterisk");