]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
doh
authorAnthony Minessale <anthony.minessale@gmail.com>
Fri, 29 Aug 2008 20:41:17 +0000 (20:41 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Fri, 29 Aug 2008 20:41:17 +0000 (20:41 +0000)
git-svn-id: http://svn.openzap.org/svn/openzap/trunk@522 a93c3328-9c30-0410-af19-c9cd2b2d52af

libs/openzap/mod_openzap/mod_openzap.c
libs/openzap/src/include/zap_types.h
libs/openzap/src/ozmod/ozmod_analog/ozmod_analog.c
libs/openzap/src/ozmod/ozmod_ss7_boost/ozmod_ss7_boost.c
libs/openzap/src/testanalog.c
libs/openzap/src/testboost.c
libs/openzap/src/testisdn.c
libs/openzap/src/zap_io.c

index ae9133bf1d9134b3ebeebda5ca4e832c27f2ecf4..b93a5abc55cd9a4289af3599cefa6ea00687d2ef 100644 (file)
@@ -1538,6 +1538,7 @@ static switch_status_t load_config(void)
                                
                        if (!id) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required param 'id'\n");
+                               continue;
                        }
 
                        span_id = atoi(id);
@@ -1562,8 +1563,8 @@ static switch_status_t load_config(void)
                        if (zap_configure_span("analog", span, on_analog_signal, 
                                                                   "tonemap", tonegroup, 
                                                                   "digit_timeout", &to,
-                                                                  "max_dialstr", &max
-                                                                  ) != ZAP_SUCCESS) {
+                                                                  "max_dialstr", &max,
+                                                                  TAG_END) != ZAP_SUCCESS) {
                                zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span %d\n", span_id);
                                continue;
                        }
@@ -1640,8 +1641,8 @@ static switch_status_t load_config(void)
                        
                        if (zap_configure_span("isdn", span, on_clear_channel_signal, 
                                                                   "mode", mode, 
-                                                                  "dialect", dialect
-                                                                  ) != ZAP_SUCCESS) {
+                                                                  "dialect", dialect,
+                                                                  TAG_END) != ZAP_SUCCESS) {
                                zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span %d mode: %d dialect: %d error: %s\n", span_id, mode, dialect, span->last_error);
                                continue;
                        }
@@ -1689,7 +1690,7 @@ static switch_status_t load_config(void)
                                } 
                        }
                                
-                       if (!(id && local_ip && local_port && remote_ip && remote_port) ) {
+                       if (!id) {
                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required param\n");
                                continue;
                        }
@@ -1709,8 +1710,8 @@ static switch_status_t load_config(void)
                                                                   "local_ip", local_ip,
                                                                   "local_port", &local_port,
                                                                   "remote_ip", remote_ip,
-                                                                  "remote_port", &remote_port
-                                                                  ) != ZAP_SUCCESS) {
+                                                                  "remote_port", &remote_port,
+                                                                  TAG_END) != ZAP_SUCCESS) {
                                zap_log(ZAP_LOG_ERROR, "Error starting OpenZAP span %d error: %s\n", span_id, span->last_error);
                                continue;
                        }
index 9c14686f8cf6573a0aef376f92e31faaead6f4e0..3c04b8db8d450e4ea4d0e3f8d598f70e874f2ff8 100644 (file)
@@ -58,6 +58,8 @@ typedef ssize_t zap_ssize_t;
 typedef int zap_filehandle_t;
 #endif
 
+#define TAG_END NULL
+
 typedef size_t zap_size_t;
 struct zap_io_interface;
 
index fe438c2244ada13f4aa09372ec91fc8956fb936f..3d0442588077941862a2b42ce0032afc6d68f525 100644 (file)
@@ -107,7 +107,6 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_analog_configure_span)
        memset(analog_data, 0, sizeof(*analog_data));
        assert(analog_data != NULL);
 
-
        while(var = va_arg(ap, char *)) {
                if (!strcasecmp(var, "tonemap")) {
                        if (!(val = va_arg(ap, char *))) {
index 64cad3c02d2aad856255fa7db13222708aa2fa60..14086a51545ae52a4164ffb883141f19d452ff6c 100644 (file)
@@ -1122,6 +1122,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_ss7_boost_configure_span)
 
 
        if (!local_ip && local_port && remote_ip && remote_port && sig_cb) {
+               zap_set_string(span->last_error, "missing params");
                return ZAP_FAIL;
        }
 
@@ -1147,7 +1148,7 @@ static ZIO_SIG_CONFIGURE_FUNCTION(zap_ss7_boost_configure_span)
 
 
 zap_module_t zap_module = { 
-       "analog",
+       "ss7_boost",
        NULL,
        NULL,
        zap_ss7_boost_init,
index 813605decc1bbbb47d422f09cf427f9616c4c3f0..dd91c639d95dfabb20b91efaf399c957296fa4f8 100644 (file)
@@ -98,7 +98,8 @@ int main(int argc, char *argv[])
        if (zap_configure_span("analog", span, on_signal, 
                                                   "tonemap", "te", 
                                                   "digit_timeout", &digit_timeout,
-                                                  "max_dialstr", &max_dialstr
+                                                  "max_dialstr", &max_dialstr,
+                                                  TAG_END
                                                   ) == ZAP_SUCCESS) {
                zap_log(ZAP_LOG_ERROR, "Error configuring OpenZAP span\n");
                goto done;
index c27636efabc7af26733e2e35a5c2e9d17e99022e..e585fcbb1df9ad80817b9980d10a6bceda4ac721 100644 (file)
@@ -43,8 +43,8 @@ int main(int argc, char *argv[])
                                                   "local_ip", "127.0.0.65",
                                                   "local_port", &local_port,
                                                   "remote_ip", "127.0.0.66",
-                                                  "remote_port", &remote_port
-                                                  ) == ZAP_SUCCESS) {
+                                                  "remote_port", &remote_port,
+                                                  TAG_END) == ZAP_SUCCESS) {
                zap_span_start(span);
        } else {
                fprintf(stderr, "Error starting SS7_BOOST\n");
index 29bf4c952bf5f6326320d825e501b00810cbb4d2..7606d4bb74f93f2e3b9d3ccfbd0ea20444438b5c 100644 (file)
@@ -38,27 +38,15 @@ int main(int argc, char *argv[])
                goto done;
        }
        
-       
-#if 1
-
        if (zap_configure_span("isdn", span, on_signal, 
                                                   "mode", "te", 
-                                                  "dialect", "national"
-                                                  ) == ZAP_SUCCESS) {
+                                                  "dialect", "national",
+                                                  TAG_END) == ZAP_SUCCESS) {
                zap_span_start(span);
        } else {
                fprintf(stderr, "Error starting ISDN D-Channel\n");
                goto done;
        }
-#else 
-       if (zap_isdn_configure_span(span, Q931_TE, Q931_Dialect_National, 0, on_signal) == ZAP_SUCCESS) {
-               zap_isdn_start(span);
-       } else {
-               fprintf(stderr, "Error starting ISDN D-Channel\n");
-               goto done;
-       }
-
-#endif
 
        signal(SIGINT, handle_SIGINT);
        R = 1;
index 7eb6bda296fa74e9753fed1e37aaff17e4fdede1..161949329492b0fff91dd4d04ff848b985705f53 100644 (file)
@@ -2135,13 +2135,13 @@ int zap_load_modules(void)
                                
                                if (!(lib = zap_dso_open(path, &err))) {
                                        zap_log(ZAP_LOG_ERROR, "Error loading %s [%s]\n", path, err);
-                                       free(err);
+                                       zap_safe_free(err);
                                        continue;
                                }
                                
                                if (!(mod = (zap_module_t *) zap_dso_func_sym(lib, "zap_module", &err))) {
                                        zap_log(ZAP_LOG_ERROR, "Error loading %s [%s]\n", path, err);
-                                       free(err);
+                                       zap_safe_free(err);
                                        continue;
                                }
 
@@ -2149,20 +2149,24 @@ int zap_load_modules(void)
                                        zap_io_interface_t *interface;
 
                                        if (mod->io_load(&interface) != ZAP_SUCCESS || !interface) {
-                                               zap_log(ZAP_LOG_ERROR, "Error loading %s [%s]\n", path, err);
+                                               zap_log(ZAP_LOG_ERROR, "Error loading %s\n", path);
                                        } else {
                                                zap_log(ZAP_LOG_INFO, "Loading IO from %s\n", path);
                                                zap_mutex_lock(globals.mutex);
-                                               hashtable_insert(globals.interface_hash, (void *)interface->name, interface);
-                                               process_module_config(interface);
+                                               if (hashtable_search(globals.interface_hash, (void *)interface->name)) {
+                                                       zap_log(ZAP_LOG_ERROR, "Interface %s already loaded!\n", interface->name);
+                                               } else {
+                                                       hashtable_insert(globals.interface_hash, (void *)interface->name, interface);
+                                                       process_module_config(interface);
+                                                       x++;
+                                               }
                                                zap_mutex_unlock(globals.mutex);
-                                               x++;
                                        }
                                }
 
                                if (mod->sig_load) {
                                        if (mod->sig_load() != ZAP_SUCCESS) {
-                                               zap_log(ZAP_LOG_ERROR, "Error loading %s [%s]\n", path, err);
+                                               zap_log(ZAP_LOG_ERROR, "Error loading %s\n", path);
                                        } else {
                                                zap_log(ZAP_LOG_INFO, "Loading SIG from %s\n", path);
                                                x++;
@@ -2180,8 +2184,15 @@ int zap_load_modules(void)
                                                zap_set_string(mod->name, p);
                                        }
 
-                                       hashtable_insert(globals.module_hash, (void *)mod->name, mod);
-                                       count++;
+                                       zap_mutex_lock(globals.mutex);
+                                       if (hashtable_search(globals.module_hash, (void *)mod->name)) {
+                                               zap_log(ZAP_LOG_ERROR, "Module %s already loaded!\n", mod->name);
+                                               zap_dso_destroy(&lib);
+                                       } else {
+                                               hashtable_insert(globals.module_hash, (void *)mod->name, mod);
+                                               count++;
+                                       }
+                                       zap_mutex_unlock(globals.mutex);
                                } else {
                                        zap_log(ZAP_LOG_ERROR, "Unloading %s\n", path);
                                        zap_dso_destroy(&lib);