{
zap_sangoma_boost_data_t *sangoma_boost_data = span->signal_data;
if (sangoma_boost_data->sigmod) {
- return sangoma_boost_data->sigmod->start_span(span);
+ if (sangoma_boost_data->sigmod->start_span(span) != ZAP_SUCCESS) {
+ return ZAP_FAIL;
+ }
}
sangoma_boost_data->pcon = sangoma_boost_data->mcon;
zap_log(ZAP_LOG_CRIT, "Boost event processing Error!\n");
end:
-
- sangomabc_connection_close(&sangoma_boost_data->mcon);
- sangomabc_connection_close(&sangoma_boost_data->pcon);
+ if (!sangoma_boost_data->sigmod) {
+ sangomabc_connection_close(&sangoma_boost_data->mcon);
+ sangomabc_connection_close(&sangoma_boost_data->pcon);
+ }
zap_clear_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RUNNING);
boost_sigmod_interface_t *sigmod = NULL;
const void *key = NULL;
void *val = NULL;
+ zap_dso_lib_t lib;
for (i = hashtable_first(g_boost_modules_hash); i; i = hashtable_next(i)) {
hashtable_this(i, &key, NULL, &val);
if (key && val) {
sigmod = val;
- if (sigmod->on_unload() != ZAP_SUCCESS) {
- zap_log(ZAP_LOG_ERROR, "Failed to unload boost signaling module object\n");
- /* hope for the best */
- } else {
- zap_dso_destroy(sigmod->pvt);
- }
+ lib = sigmod->pvt;
+ zap_dso_destroy(&lib);
}
}
if (hash_locked) \
zap_mutex_unlock(g_boost_modules_mutex); \
if (lib) \
- zap_dso_destroy(lib); \
+ zap_dso_destroy(&lib); \
return retstatus;
boost_sigmod_interface_t *sigmod_iface = NULL;
FAIL_CONFIG_RETURN(ZAP_FAIL);
}
- if (sigmod_iface->on_load() != ZAP_SUCCESS) {
- zap_log(ZAP_LOG_ERROR, "Failed to load Sangoma boost signaling module interface '%s': on_load method failed\n", path);
- FAIL_CONFIG_RETURN(ZAP_FAIL);
- }
sigmod_iface->pvt = lib;
sigmod_iface->set_write_msg_cb(zap_boost_write_msg);
sigmod_iface->set_sig_status_cb(zap_boost_sig_status_change);
}
}
- zap_mutex_create(&mcon->mutex);
return mcon->socket;
}
int sangomabc_connection_open(sangomabc_connection_t *mcon, char *local_ip, int local_port, char *ip, int port)
{
+ zap_mutex_create(&mcon->mutex);
if (mcon->sigmod) {
- zap_log(ZAP_LOG_WARNING, "I should not be called on a sigmod-managed connection!\n");
+ /*value of mcon->socket will be ignored in sigmod mode */
return 0;
}
create_conn_socket(mcon, local_ip, local_port, ip, port);
int err;
int event_size=sizeof(sangomabc_event_t);
- if (!event || mcon->socket < 0 || !mcon->mutex) {
- zap_log(file, func, line, ZAP_LOG_LEVEL_CRIT, "Critical Error: No Event Device\n");
- return -EINVAL;
- abort();
+ if (!mcon->sigmod) {
+ if (!event || mcon->socket < 0 || !mcon->mutex) {
+ zap_log(file, func, line, ZAP_LOG_LEVEL_CRIT, "Critical Error: No Event Device\n");
+ return -EINVAL;
+ abort();
+ }
}
-
+
if (!boost_full_event(event->event_id)) {
event_size=sizeof(sangomabc_short_event_t);
}
zap_mutex_lock(mcon->mutex);
- event->version = SIGBOOST_VERSION;
+ event->version = SIGBOOST_VERSION;
if (mcon->sigmod) {
mcon->sigmod->write_msg(mcon->span, event, event_size);
- err = event_size;
- return -1;
+ err = event_size;
+
} else {
err = sendto(mcon->socket, event, event_size, 0, (struct sockaddr *) &mcon->remote_addr, sizeof(mcon->remote_addr));
}