From a743263afbcbf30e6345e4cceded760579680760 Mon Sep 17 00:00:00 2001 From: David Yat Sin Date: Fri, 7 Jan 2011 15:39:25 -0500 Subject: [PATCH] freetdm: ISDN - fix for clearing internal states before receiving acknowledgement from remote side --- .../ftmod_sangoma_isdn/ftmod_sangoma_isdn.c | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c index c13f584df8..01b2890bf1 100644 --- a/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c +++ b/libs/freetdm/src/ftmod/ftmod_sangoma_isdn/ftmod_sangoma_isdn.c @@ -788,21 +788,21 @@ static ftdm_status_t ftdm_sangoma_isdn_process_state_change(ftdm_channel_t *ftdm /* set the flag to indicate this hangup is started from the local side */ sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_REL); - /* If we never sent ack to incoming call, we need to send release instead of disconnect */ - if (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING || - ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALING) { - - sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); - sngisdn_snd_release(ftdmchan, 0); - - if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { - sngisdn_set_span_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); - } - } else { - sngisdn_snd_disconnect(ftdmchan); + switch(ftdmchan->last_state) { + case FTDM_CHANNEL_STATE_RING: + /* If we never sent PROCEED/ALERT/PROGRESS/CONNECT on an incoming call, we need to send release instead of disconnect */ + sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); + sngisdn_snd_release(ftdmchan, 0); + break; + case FTDM_CHANNEL_STATE_DIALING: + /* If we never received a PROCEED/ALERT/PROGRESS/CONNECT on an outgoing call, we need to send release instead of disconnect */ + sngisdn_snd_release(ftdmchan, 0); + break; + default: + sngisdn_snd_disconnect(ftdmchan); + break; } } - /* now go to the HANGUP complete state */ ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); }