From 56aa60cb2041a609cf56a9b11e5a6ba588a4b06f Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Tue, 1 Apr 2008 18:53:25 +0000 Subject: [PATCH] update git-svn-id: http://svn.openzap.org/svn/openzap/trunk@433 a93c3328-9c30-0410-af19-c9cd2b2d52af --- libs/openzap/src/include/zap_types.h | 3 ++- libs/openzap/src/zap_isdn.c | 2 +- libs/openzap/src/zap_ss7_boost.c | 35 ++++++++++++++++++++++------ 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/libs/openzap/src/include/zap_types.h b/libs/openzap/src/include/zap_types.h index 999b84effb..40fd649ad2 100644 --- a/libs/openzap/src/include/zap_types.h +++ b/libs/openzap/src/include/zap_types.h @@ -304,13 +304,14 @@ typedef enum { ZAP_CHANNEL_STATE_UP, ZAP_CHANNEL_STATE_IDLE, ZAP_CHANNEL_STATE_TERMINATING, + ZAP_CHANNEL_STATE_CANCEL, ZAP_CHANNEL_STATE_HANGUP, ZAP_CHANNEL_STATE_HANGUP_COMPLETE, ZAP_CHANNEL_STATE_INVALID } zap_channel_state_t; #define CHANNEL_STATE_STRINGS "DOWN", "HOLD", "SUSPENDED", "DIALTONE", "COLLECT", \ "RING", "BUSY", "ATTN", "GENRING", "DIALING", "GET_CALLERID", "CALLWAITING", \ - "RESTART", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "HANGUP", "HANGUP_COMPLETE", "INVALID" + "RESTART", "PROGRESS", "PROGRESS_MEDIA", "UP", "IDLE", "TERMINATING", "CANCEL", "HANGUP", "HANGUP_COMPLETE", "INVALID" ZAP_STR2ENUM_P(zap_str2zap_channel_state, zap_channel_state2str, zap_channel_state_t) typedef enum { diff --git a/libs/openzap/src/zap_isdn.c b/libs/openzap/src/zap_isdn.c index e2fe1c241f..e190960321 100644 --- a/libs/openzap/src/zap_isdn.c +++ b/libs/openzap/src/zap_isdn.c @@ -174,7 +174,7 @@ static L3INT zap_isdn_931_34(void *pvt, L2UCHAR *msg, L2INT mlen) zchan->caller_data.hangup_cause = cause->Value; zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_TERMINATING); } else { - zap_log(ZAP_LOG_CRIT, "Received Diconnect with no matching channel %d\n", chan_id); + zap_log(ZAP_LOG_CRIT, "Received Disconnect with no matching channel %d\n", chan_id); } } break; diff --git a/libs/openzap/src/zap_ss7_boost.c b/libs/openzap/src/zap_ss7_boost.c index fac6cf9840..5d586e6d56 100644 --- a/libs/openzap/src/zap_ss7_boost.c +++ b/libs/openzap/src/zap_ss7_boost.c @@ -264,7 +264,7 @@ static void handle_call_start_nack(zap_span_t *span, ss7bc_connection_t *mcon, s if ((zchan = find_zchan(span, event, 1))) { assert(!zap_test_flag(zchan, ZAP_CHANNEL_OUTBOUND)); zchan->caller_data.hangup_cause = event->release_cause; - zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_TERMINATING); + zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_CANCEL); } } @@ -279,14 +279,15 @@ static void handle_call_stop(zap_span_t *span, ss7bc_connection_t *mcon, ss7bc_e 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, + event->chan, + 0, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + 0); } + - ss7bc_exec_command(mcon, - event->span, - event->chan, - 0, - SIGBOOST_EVENT_CALL_STOPPED_ACK, - 0); } @@ -573,12 +574,32 @@ static __inline__ void state_advance(zap_channel_t *zchan) } } break; + case ZAP_CHANNEL_STATE_CANCEL: + { + sig.event_id = ZAP_SIGEVENT_STOP; + status = ss7_boost_data->signal_cb(&sig); + zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN); + ss7bc_exec_command(mcon, + zchan->physical_span_id-1, + zchan->physical_chan_id-1, + 0, + SIGBOOST_EVENT_CALL_START_NACK_ACK, + 0); + } + break; case ZAP_CHANNEL_STATE_TERMINATING: { sig.event_id = ZAP_SIGEVENT_STOP; status = ss7_boost_data->signal_cb(&sig); zap_set_state_locked(zchan, ZAP_CHANNEL_STATE_DOWN); + ss7bc_exec_command(mcon, + zchan->physical_span_id-1, + zchan->physical_chan_id-1, + 0, + SIGBOOST_EVENT_CALL_STOPPED_ACK, + 0); } + break; default: break; }