git-svn-id: http://svn.openzap.org/svn/openzap/trunk@424 a93c3328-9c30-0410-af19-c9cd2b2d52af
This commit is contained in:
Anthony Minessale 2008-03-19 00:26:27 +00:00
parent b43a995bc0
commit 131b13b236
3 changed files with 30 additions and 24 deletions

View File

@ -342,7 +342,7 @@ zap_status_t zap_span_close_all(void)
for(i = 1; i <= globals.span_index; i++) {
span = &globals.spans[i];
if (zap_test_flag(span, ZAP_SPAN_CONFIGURED)) {
for(j = 0; j < span->chan_count; j++) {
for(j = 0; j <= span->chan_count; j++) {
zap_channel_destroy(&span->channels[j]);
}
}
@ -940,6 +940,18 @@ zap_status_t zap_channel_done(zap_channel_t *zchan)
zap_clear_flag_locked(zchan, ZAP_CHANNEL_INUSE);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_OUTBOUND);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_WINK);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_FLASH);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_STATE_CHANGE);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_HOLD);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_OFFHOOK);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_RINGING);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_PROGRESS_DETECT);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_CALLERID_DETECT);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_3WAY);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_PROGRESS);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_MEDIA);
zap_clear_flag_locked(zchan, ZAP_CHANNEL_ANSWERED);
return ZAP_SUCCESS;
}

View File

@ -77,7 +77,7 @@ static zap_channel_t *find_zchan(zap_span_t *span, ss7bc_event_t *event)
int i;
zap_channel_t *zchan = NULL;
for(i = 0; i < span->chan_count; i++) {
for(i = 0; i <= span->chan_count; i++) {
if (span->channels[i].physical_span_id == event->span+1 && span->channels[i].physical_chan_id == event->chan+1) {
zchan = &span->channels[i];
break;
@ -171,6 +171,7 @@ static void handle_call_start_ack(ss7bc_connection_t *mcon, ss7bc_event_t *event
}
}
zap_log(ZAP_LOG_CRIT, "START ACK CANT FIND A CHAN %d:%d\n", event->span+1,event->chan+1);
ss7bc_exec_command(mcon,
event->span,
event->chan,
@ -201,6 +202,9 @@ static void handle_call_stop(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_e
if ((zchan = find_zchan(span, event))) {
zchan->caller_data.hangup_cause = event->release_cause;
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_TERMINATING);
} else {
zap_log(ZAP_LOG_CRIT, "STOP CANT FIND A CHAN %d:%d\n", event->span+1,event->chan+1);
}
ss7bc_exec_command(mcon,
event->span,
@ -209,14 +213,6 @@ static void handle_call_stop(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_e
SIGBOOST_EVENT_CALL_STOPPED_ACK,
0);
} else {
ss7bc_exec_command(mcon,
event->span,
event->chan,
0,
SIGBOOST_EVENT_CALL_STOPPED,
ZAP_CAUSE_DESTINATION_OUT_OF_ORDER);
}
}
static void handle_call_answer(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_event_t *event)
@ -226,12 +222,7 @@ static void handle_call_answer(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc
if ((zchan = find_zchan(span, event))) {
zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_UP);
} else {
ss7bc_exec_command(mcon,
event->span,
event->chan,
0,
SIGBOOST_EVENT_CALL_STOPPED,
ZAP_CAUSE_DESTINATION_OUT_OF_ORDER);
zap_log(ZAP_LOG_CRIT, "ANSWER CANT FIND A CHAN %d:%d\n", event->span+1,event->chan+1);
}
}
@ -579,7 +570,7 @@ static void *zap_ss7_boost_run(zap_thread_t *me, void *obj)
if (FD_ISSET(pcon->socket, &rfds)) {
if ((event = ss7bc_connection_readp(pcon, i))) {
parse_ss7_event(span, pcon, event);
parse_ss7_event(span, mcon, event);
} else goto top;
}

View File

@ -174,6 +174,9 @@ zap_status_t zap_mutex_destroy(zap_mutex_t **mutex)
{
zap_mutex_t *mp = *mutex;
*mutex = NULL;
if (!mp) {
return ZAP_FAIL;
}
#ifdef WIN32
DeleteCriticalSection(&mp->mutex);
#else