git-svn-id: http://svn.openzap.org/svn/openzap/trunk@522 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale 2008-08-29 20:41:17 +00:00
parent c18c881bd4
commit 2070e9d05b
8 changed files with 38 additions and 35 deletions

View 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;
}

View 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;

View 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 *))) {

View 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,

View 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;

View 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");

View 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;

View 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);
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);
zap_mutex_unlock(globals.mutex);
x++;
}
zap_mutex_unlock(globals.mutex);
}
}
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);
}
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);