fix boost span hunting

git-svn-id: http://svn.openzap.org/svn/openzap/branches/sangoma_boost@952 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Moises Silva 2010-01-08 21:53:41 +00:00
parent 80e1a88b32
commit 95df158b78
3 changed files with 20 additions and 19 deletions

View File

@ -1230,22 +1230,22 @@ static __inline__ void check_state(zap_span_t *span)
susp = 0;
}
if (zap_test_flag(span, ZAP_SPAN_STATE_CHANGE) || susp) {
uint32_t j;
zap_clear_flag_locked(span, ZAP_SPAN_STATE_CHANGE);
for(j = 1; j <= span->chan_count; j++) {
if (zap_test_flag((span->channels[j]), ZAP_CHANNEL_STATE_CHANGE) || susp) {
if (zap_test_flag(span, ZAP_SPAN_STATE_CHANGE) || susp) {
uint32_t j;
zap_clear_flag_locked(span, ZAP_SPAN_STATE_CHANGE);
for(j = 1; j <= span->chan_count; j++) {
if (zap_test_flag((span->channels[j]), ZAP_CHANNEL_STATE_CHANGE) || susp) {
zap_mutex_lock(span->channels[j]->mutex);
zap_clear_flag((span->channels[j]), ZAP_CHANNEL_STATE_CHANGE);
zap_clear_flag((span->channels[j]), ZAP_CHANNEL_STATE_CHANGE);
if (susp && span->channels[j]->state != ZAP_CHANNEL_STATE_DOWN) {
zap_channel_set_state(span->channels[j], ZAP_CHANNEL_STATE_RESTART, 0);
}
state_advance(span->channels[j]);
zap_channel_complete_state(span->channels[j]);
state_advance(span->channels[j]);
zap_channel_complete_state(span->channels[j]);
zap_mutex_unlock(span->channels[j]->mutex);
}
}
}
}
}
}
if (zap_test_flag(sangoma_boost_data, ZAP_SANGOMA_BOOST_RESTARTING)) {
if (zap_check_state_all(span, ZAP_CHANNEL_STATE_DOWN)) {
@ -1953,14 +1953,15 @@ static ZIO_CONFIGURE_SPAN_SIGNALING_FUNCTION(zap_sangoma_boost_configure_span)
span->start = zap_sangoma_boost_start;
span->stop = zap_sangoma_boost_stop;
span->signal_data = sangoma_boost_data;
span->signal_type = ZAP_SIGTYPE_SANGOMABOOST;
span->outgoing_call = sangoma_boost_outgoing_call;
span->signal_type = ZAP_SIGTYPE_SANGOMABOOST;
span->outgoing_call = sangoma_boost_outgoing_call;
span->channel_request = sangoma_boost_channel_request;
span->get_channel_sig_status = sangoma_boost_get_channel_sig_status;
span->set_channel_sig_status = sangoma_boost_set_channel_sig_status;
span->get_span_sig_status = sangoma_boost_get_span_sig_status;
span->set_span_sig_status = sangoma_boost_set_span_sig_status;
span->state_map = &boost_state_map;
span->suggest_chan_id = 1;
zap_set_flag_locked(span, ZAP_SPAN_SUSPENDED);
return ZAP_SUCCESS;
}

View File

@ -76,7 +76,7 @@ static void sangomabc_print_event_call(sangomabc_connection_t *mcon, sangomabc_e
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
return;
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT (%s): %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s] Rdnis=[%s]\n",
zap_log(file, func, line, ZAP_LOG_LEVEL_DEBUG, "%s EVENT (%s): %s:(%X) [w%dg%d] CSid=%i Seq=%i Cn=[%s] Cd=[%s] Ci=[%s] Rdnis=[%s]\n",
dir ? "TX":"RX",
priority ? "P":"N",
sangomabc_event_id_name(event->event_id),
@ -95,7 +95,7 @@ static void sangomabc_print_event_short(sangomabc_connection_t *mcon, sangomabc_
{
if (event->event_id == SIGBOOST_EVENT_HEARTBEAT)
return;
zap_log(file, func, line, ZAP_LOG_LEVEL_WARNING, "%s EVENT (%s): %s:(%X) [s%dc%d] Rc=%i CSid=%i Seq=%i \n",
zap_log(file, func, line, ZAP_LOG_LEVEL_DEBUG, "%s EVENT (%s): %s:(%X) [s%dc%d] Rc=%i CSid=%i Seq=%i \n",
dir ? "TX":"RX",
priority ? "P":"N",
sangomabc_event_id_name(event->event_id),
@ -305,9 +305,9 @@ sangomabc_event_t *__sangomabc_connection_read(sangomabc_connection_t *mcon, int
return NULL;
}
if (mcon->event.version != SIGBOOST_VERSION) {
if (mcon->event.version != SIGBOOST_VERSION) {
zap_log(ZAP_LOG_CRIT, "Invalid Boost Version %i Expecting %i\n",mcon->event.version, SIGBOOST_VERSION);
}
}
/* Must check for < 0 cannot rely on bytes > MIN_SIZE_... compiler issue */
if (bytes < 0) {

View File

@ -1149,7 +1149,7 @@ OZ_DECLARE(zap_status_t) zap_channel_open_by_group(uint32_t group_id, zap_direct
zap_span_t* span = NULL;
zap_span_find(check->span_id, &span);
if (span && span->channel_request) {
status = span->channel_request(span, check->physical_chan_id, direction, caller_data, zchan);
status = span->channel_request(span, check->chan_id, direction, caller_data, zchan);
break;
}
@ -1209,7 +1209,7 @@ OZ_DECLARE(zap_status_t) zap_channel_open_by_span(uint32_t span_id, zap_directio
if (!span || !zap_test_flag(span, ZAP_SPAN_CONFIGURED)) {
zap_log(ZAP_LOG_CRIT, "SPAN NOT DEFINED!\n");
*zchan = NULL;
return ZAP_FAIL;
return ZAP_FAIL;
}
zap_span_channel_use_count(span, &count);