freetdm: ss7 - bug fix in pause/resume handling

This commit is contained in:
Konrad Hammel 2010-09-17 13:37:20 -04:00
parent 6235f74355
commit 1c76ca4d72
2 changed files with 44 additions and 13 deletions

View File

@ -953,6 +953,42 @@ static void ftdm_sangoma_ss7_process_state_change (ftdm_channel_t * ftdmchan)
SS7_DEBUG_CHAN(ftdmchan,"Current flags: 0x%X\n", sngss7_info->flags);
/**********************************************************************/
if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) {
/* clear the RESUME flag */
sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME);
/* if there are any resets present */
if ((sngss7_test_flag (sngss7_info, FLAG_RESET_TX)) ||
(sngss7_test_flag (sngss7_info, FLAG_RESET_RX)) ||
(sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_TX)) ||
(sngss7_test_flag (sngss7_info, FLAG_GRP_RESET_RX))) {
/* go back to the reset state */
goto suspend_goto_restart;
} else {
/* bring the sig status back up */
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
sigev.sigstatus = FTDM_SIG_STATE_UP;
ftdm_span_send_signal(ftdmchan->span, &sigev);
}
/* go back to the last state */
goto suspend_goto_last;
} /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) */
if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) {
/* bring the sig status down */
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
sigev.sigstatus = FTDM_SIG_STATE_DOWN;
ftdm_span_send_signal(ftdmchan->span, &sigev);
/* go back to the last state */
goto suspend_goto_last;
} /* if (sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) { */
/**********************************************************************/
if (sngss7_test_flag (sngss7_info, FLAG_CKT_MN_BLOCK_RX)) {
SS7_DEBUG_CHAN(ftdmchan, "Processing CKT_MN_BLOCK_RX flag %s\n", "");

View File

@ -561,24 +561,19 @@ ftdm_status_t check_for_res_sus_flag(ftdm_span_t *ftdmspan)
sigev.span_id = ftdmchan->span_id;
sigev.channel = ftdmchan;
/* if we have the PAUSED flag and the sig status is still UP */
if ((sngss7_test_flag(sngss7_info, FLAG_INFID_PAUSED)) &&
(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) {
/* bring the sig status down */
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
sigev.sigstatus = FTDM_SIG_STATE_DOWN;
ftdm_span_send_signal(ftdmchan->span, &sigev);
/* throw the channel into SUSPENDED to process the flag */
/* after doing this once the sig status will be down */
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
}
if ((sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) &&
!(ftdm_test_flag(ftdmchan, FTDM_CHANNEL_SIG_UP))) {
/* bring the sig status back up */
sigev.event_id = FTDM_SIGEVENT_SIGSTATUS_CHANGED;
sigev.sigstatus = FTDM_SIG_STATE_UP;
ftdm_span_send_signal(ftdmchan->span, &sigev);
sngss7_clear_flag(sngss7_info, FLAG_INFID_RESUME);
/* if the RESUME flag is up go to SUSPENDED to process the flag */
/* after doing this the flag will be cleared */
if (sngss7_test_flag(sngss7_info, FLAG_INFID_RESUME)) {
ftdm_set_state_locked (ftdmchan, FTDM_CHANNEL_STATE_SUSPENDED);
}
/* unlock the channel */