freetdm: ISDN - fix for clearing internal states before receiving acknowledgement from remote side

This commit is contained in:
David Yat Sin 2011-01-07 15:39:25 -05:00
parent 3018400461
commit a743263afb
1 changed files with 13 additions and 13 deletions

View File

@ -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 */ /* set the flag to indicate this hangup is started from the local side */
sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_REL); sngisdn_set_flag(sngisdn_info, FLAG_LOCAL_REL);
/* If we never sent ack to incoming call, we need to send release instead of disconnect */ switch(ftdmchan->last_state) {
if (ftdmchan->last_state == FTDM_CHANNEL_STATE_RING || case FTDM_CHANNEL_STATE_RING:
ftdmchan->last_state == FTDM_CHANNEL_STATE_DIALING) { /* 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_set_flag(sngisdn_info, FLAG_LOCAL_ABORT); sngisdn_snd_release(ftdmchan, 0);
sngisdn_snd_release(ftdmchan, 0); break;
case FTDM_CHANNEL_STATE_DIALING:
if (!ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP)) { /* If we never received a PROCEED/ALERT/PROGRESS/CONNECT on an outgoing call, we need to send release instead of disconnect */
sngisdn_set_span_avail_rate(ftdmchan->span, SNGISDN_AVAIL_DOWN); sngisdn_snd_release(ftdmchan, 0);
} break;
} else { default:
sngisdn_snd_disconnect(ftdmchan); sngisdn_snd_disconnect(ftdmchan);
break;
} }
} }
/* now go to the HANGUP complete state */ /* now go to the HANGUP complete state */
ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE); ftdm_set_state(ftdmchan, FTDM_CHANNEL_STATE_HANGUP_COMPLETE);
} }