From b43a995bc0208f6abae1258cb616a146bc90dea6 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 18 Mar 2008 20:19:59 +0000 Subject: [PATCH] sync git-svn-id: http://svn.openzap.org/svn/openzap/trunk@423 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/freetdm/src/ss7_boost_client.c | 2 +- libs/freetdm/src/zap_ss7_boost.c | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/libs/freetdm/src/ss7_boost_client.c b/libs/freetdm/src/ss7_boost_client.c index d2ec25d597..53a8c8e726 100644 --- a/libs/freetdm/src/ss7_boost_client.c +++ b/libs/freetdm/src/ss7_boost_client.c @@ -247,7 +247,7 @@ int ss7bc_connection_write(ss7bc_connection_t *mcon, ss7bc_event_t *event) { int err; - if (!event) { + if (!event || mcon->socket < 0 || !mcon->mutex) { zap_log(ZAP_LOG_DEBUG, "Critical Error: No Event Device\n"); return -EINVAL; } diff --git a/libs/freetdm/src/zap_ss7_boost.c b/libs/freetdm/src/zap_ss7_boost.c index bd1507c9bd..09b3c4d7a2 100644 --- a/libs/freetdm/src/zap_ss7_boost.c +++ b/libs/freetdm/src/zap_ss7_boost.c @@ -132,9 +132,12 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(ss7_boost_channel_request) } } - if (OUTBOUND_REQUESTS[r].status == BST_READY) { + if (OUTBOUND_REQUESTS[r].status == BST_READY && OUTBOUND_REQUESTS[r].zchan) { *zchan = OUTBOUND_REQUESTS[r].zchan; status = ZAP_SUCCESS; + } else { + status = ZAP_FAIL; + *zchan = NULL; } done: @@ -162,6 +165,7 @@ static void handle_call_start_ack(ss7bc_connection_t *mcon, ss7bc_event_t *event zap_log(ZAP_LOG_ERROR, "OPEN ERROR [%s]\n", zchan->last_error); } else { zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_PROGRESS_MEDIA); + zap_set_flag(zchan, ZAP_CHANNEL_OUTBOUND); OUTBOUND_REQUESTS[event->call_setup_id].zchan = zchan; return; } @@ -477,6 +481,7 @@ static __inline__ void state_advance(zap_channel_t *zchan) { sig.event_id = ZAP_SIGEVENT_STOP; status = ss7_boost_data->signal_cb(&sig); + zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN); } default: break;