]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
make some more changes to the dahdi/zap channel name support stuff to ensure allthe...
authorKevin P. Fleming <kpfleming@digium.com>
Wed, 23 Jul 2008 20:42:30 +0000 (20:42 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Wed, 23 Jul 2008 20:42:30 +0000 (20:42 +0000)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@133226 65c4cc65-6c06-0410-ace0-fbb531ad65f3

apps/app_chanspy.c
apps/app_dahdibarge.c
apps/app_dahdiras.c
channels/chan_dahdi.c
include/asterisk/options.h
main/asterisk.c

index 4a11c3b5af0e5e6c99713222516820a1d66da0aa..80af5b234b291c78170e16645e509778e112f941 100644 (file)
@@ -147,13 +147,6 @@ AST_APP_OPTIONS(spy_opts, {
 });
 
 static int next_unique_id_to_use = 0;
-static int PSEUDO_CHAN_LEN;
-
-static void determine_pseudo_chan_len(void) 
-{
-       PSEUDO_CHAN_LEN = dahdi_chan_name_len + strlen("/pseudo");
-}
-
 
 struct chanspy_translation_helper {
        /* spy data */
@@ -473,6 +466,11 @@ static struct chanspy_ds *next_channel(struct ast_channel *chan,
 {
        struct ast_channel *this;
        char channel_name[AST_CHANNEL_NAME];
+       static size_t PSEUDO_CHAN_LEN = 0;
+
+       if (!PSEUDO_CHAN_LEN) {
+               PSEUDO_CHAN_LEN = *dahdi_chan_name_len + strlen("/pseudo");
+       }
 
 redo:
        if (spec)
@@ -865,7 +863,6 @@ static int load_module(void)
 {
        int res = 0;
 
-       determine_pseudo_chan_len();
        res |= ast_register_application(app_chan, chanspy_exec, tdesc, desc_chan);
        res |= ast_register_application(app_ext, extenspy_exec, tdesc, desc_ext);
 
index 88610cc36d16af3677d7685c233d232192d74deb..a26af7f1d519a83d3636ed5c92f4b986d1d6128d 100644 (file)
@@ -336,7 +336,7 @@ static int unload_module(void)
 {
        int res = 0;
 
-       if (dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
+       if (*dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
                res |= ast_unregister_application(dahdi_app);
        }
 
@@ -351,7 +351,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       if (dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
+       if (*dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
                res |= ast_register_application(dahdi_app, exec_dahdi, dahdi_synopsis, dahdi_descrip);
        }
 
index 1012a5fbeb8dc235b0084f67a9193d2f20caa76b..9c92cda32be2b8a69118eea0be3987b2699fcb4a 100644 (file)
@@ -260,7 +260,7 @@ static int unload_module(void)
 {
        int res = 0;
 
-       if (dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
+       if (*dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
                res |= ast_unregister_application(dahdi_app);
        }
 
@@ -275,7 +275,7 @@ static int load_module(void)
 {
        int res = 0;
 
-       if (dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
+       if (*dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
                res |= ast_register_application(dahdi_app, exec, dahdi_synopsis, dahdi_descrip);
        }
 
index 13d914f64ec5ff03737cf62660d1dc43e28aa4c2..e1acd1bd382ce10cb2b2626c6cabf38e3c799330 100644 (file)
@@ -5234,7 +5234,7 @@ static struct ast_channel *dahdi_new(struct dahdi_pvt *i, int state, int startpb
        int features;
        char *b2 = NULL;
        DAHDI_PARAMS ps;
-       char chanprefix[dahdi_chan_name_len + 4];
+       char chanprefix[*dahdi_chan_name_len + 4];
 
        if (i->subs[index].owner) {
                ast_log(LOG_WARNING, "Channel %d already has a %s call\n", i->channel,subnames[index]);
@@ -10584,7 +10584,7 @@ static int dahdi_action_restart(struct mansession *s, const struct message *m)
 }
 
 #define local_astman_unregister(a) do { \
-                                       if (dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) { \
+                                       if (*dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) { \
                                                ast_manager_unregister("DAHDI" a); \
                                        } \
                                        ast_manager_unregister("Zap" a); \
@@ -11583,7 +11583,7 @@ static int setup_dahdi(int reload)
 }
 
 #define local_astman_register(a, b, c, d) do { \
-                                               if (dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) { \
+                                               if (*dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) { \
                                                        ast_manager_register("DAHDI" a, b, dahdi_ ## c, d); \
                                                } \
                                                ast_manager_register("Zap" a, b, zap_ ## c, d); \
@@ -11611,7 +11611,7 @@ static int load_module(void)
        if ((res = setup_dahdi(0))) {
                return AST_MODULE_LOAD_DECLINE;
        }
-       if (dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
+       if (*dahdi_chan_mode == CHAN_DAHDI_PLUS_ZAP_MODE) {
                chan_tech = &dahdi_tech;
        } else {
                chan_tech = &zap_tech;
index 89f01f58be59666c3c40366607435a4224b3b34e..01eab6e297786c4b7be04c587ed85a9a2a2b0c80 100644 (file)
@@ -123,11 +123,11 @@ extern pid_t ast_mainpid;
 extern char record_cache_dir[AST_CACHE_DIR_LEN];
 extern char debug_filename[AST_FILENAME_MAX];
 extern const char *dahdi_chan_name;
-extern int dahdi_chan_name_len;
-extern enum dahdi_chan_modes {
+extern const size_t *dahdi_chan_name_len;
+extern const enum dahdi_chan_modes {
        CHAN_ZAP_MODE,
        CHAN_DAHDI_PLUS_ZAP_MODE,
-} dahdi_chan_mode;
+} *dahdi_chan_mode;
        
 extern int ast_language_is_prefix;
 
index 5d7c3600d286e1813f58e6eff3f8d66f40a4485f..a581508e53da17b9d92f2f76564adc2dcd6c3876 100644 (file)
@@ -173,16 +173,17 @@ int option_maxcalls;                              /*!< Max number of active calls */
 char record_cache_dir[AST_CACHE_DIR_LEN] = AST_TMP_DIR;
 char debug_filename[AST_FILENAME_MAX] = "";
 #ifdef HAVE_ZAPTEL
-char _dahdi_chan_name[AST_CHANNEL_NAME] = "Zap";
-int _dahdi_chan_name_len = 3;
-enum dahdi_chan_modes dahdi_chan_mode = CHAN_ZAP_MODE;
+static char _dahdi_chan_name[AST_CHANNEL_NAME] = "Zap";
+static size_t _dahdi_chan_name_len = 3;
+static enum dahdi_chan_modes _dahdi_chan_mode = CHAN_ZAP_MODE;
 #else
-char _dahdi_chan_name[AST_CHANNEL_NAME] = "DAHDI";
-int _dahdi_chan_name_len = 5;
-enum dahdi_chan_modes dahdi_chan_mode = CHAN_DAHDI_PLUS_ZAP_MODE;
+static char _dahdi_chan_name[AST_CHANNEL_NAME] = "DAHDI";
+static size_t _dahdi_chan_name_len = 5;
+static enum dahdi_chan_modes _dahdi_chan_mode = CHAN_DAHDI_PLUS_ZAP_MODE;
 #endif
 const char *dahdi_chan_name;
-int dahdi_chan_name_len;
+const size_t *dahdi_chan_name_len;
+const enum dahdi_chan_modes *dahdi_chan_mode;
 
 static int ast_socket = -1;            /*!< UNIX Socket for allowing remote control */
 static int ast_consock = -1;           /*!< UNIX Socket for controlling another asterisk */
@@ -2597,13 +2598,13 @@ static void ast_readconfig(void)
                        if (ast_true(v->value)) {
                                strcpy(_dahdi_chan_name, "DAHDI");
                                _dahdi_chan_name_len = 5;
-                               dahdi_chan_mode = CHAN_DAHDI_PLUS_ZAP_MODE;
+                               _dahdi_chan_mode = CHAN_DAHDI_PLUS_ZAP_MODE;
                        }
 #else
                        if (ast_false(v->value)) {
                                strcpy(_dahdi_chan_name, "Zap");
                                _dahdi_chan_name_len = 3;
-                               dahdi_chan_mode = CHAN_ZAP_MODE;
+                               _dahdi_chan_mode = CHAN_ZAP_MODE;
                        }
 #endif
                }
@@ -2988,7 +2989,8 @@ int main(int argc, char *argv[])
        }
 
        dahdi_chan_name = _dahdi_chan_name;
-       dahdi_chan_name_len = _dahdi_chan_name_len;
+       dahdi_chan_name_len = &_dahdi_chan_name_len;
+       dahdi_chan_mode = &_dahdi_chan_mode;
 
 #ifdef HAVE_ZAPTEL
        {