if (!id) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "span missing required param 'id'\n");
+ continue;
}
span_id = atoi(id);
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;
}
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;
}
}
}
- 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;
}
"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;
}
typedef int zap_filehandle_t;
#endif
+#define TAG_END NULL
+
typedef size_t zap_size_t;
struct zap_io_interface;
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 *))) {
if (!local_ip && local_port && remote_ip && remote_port && sig_cb) {
+ zap_set_string(span->last_error, "missing params");
return ZAP_FAIL;
}
zap_module_t zap_module = {
- "analog",
+ "ss7_boost",
NULL,
NULL,
zap_ss7_boost_init,
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;
"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");
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;
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;
}
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++;
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);